On 2021-02-01 10:38, Alexey Semenyuk wrote:
On Mon, 1 Feb 2021 18:24:23 GMT, Erik Joelsson <er...@openjdk.org> wrote:

"common" was perfectly enough until this change. Unfortunately we cant just drop new C 
sources in "common" dir because we don't want them to be compiled with g++. That is why 
need new common directory (applauncherlibcommon) for C sources.

I'll rename applauncherlibcommon in libapplaunchercommon and applauncherlib in 
libapplauncher in the next commit.
"common" was perfectly enough until this change. Unfortunately we cant just drop new C 
sources in "common" dir because we don't want them to be compiled with g++. That is why 
need new common directory (applauncherlibcommon) for C sources.
We pick compiler based on file suffix, not directory, so it shouldn't matter 
where you put a .c file, it should always be compiled with gcc and .cpp files 
with g++. Which compiler is used to launch the linker can however differ. 
That's configured for each SetupNativeCompilation call with the different 
TOOLCHAIN settings.
Erik, thank you for explanation.

The launcher on Linux should not be linked with c++ runtime, that is why 
TOOLCHAIN_DEFAULT is used at a value for TOOLCHAIN property in 
BUILD_JPACKAGE_APPLAUNCHEREXE target on Linux.

Will SetupNativeCompilation work if `TOOLCHAIN=TOOLCHAIN_DEFAULT` and there are 
.cpp sources are in directories passed in `SRC` property of 
SetupNativeCompilation? Will it try to compile these sources? If it will ignore 
them and pick only .c files, that would be perfect.

SetupNativeCompilation will by default include all src files found in any directory given to SRC, recursively. You can use EXCLUDES, EXCLUDE_FILES and EXCLUDE_PATTERN to exclude files or directories from SRC. You can also use EXTRA_FILES to pick specific files outside of any directory in SRC. Sorting files in separate directories or using EXCLUDE*/EXTRA_FILES are both possible and picking the right solution is mostly down to taste.

/Erik

-------------

PR: https://git.openjdk.java.net/jdk/pull/2320

Reply via email to