diff --git a/CMakeLists.txt b/CMakeLists.txt index a4dcf7644827..3036bf5aeae4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,9 +8,6 @@ project(CoreCLR) # Include cmake functions include(functions.cmake) -# Verify that LTCG/LTO is available -include(configure.cmake) - if (WIN32) message(STATUS "VS_PLATFORM_TOOLSET is ${CMAKE_VS_PLATFORM_TOOLSET}") message(STATUS "VS_PLATFORM_NAME is ${CMAKE_VS_PLATFORM_NAME}") diff --git a/build.cmd b/build.cmd index 29af75d6fcd4..0b3efaba5cbb 100644 --- a/build.cmd +++ b/build.cmd @@ -557,8 +557,6 @@ if %__BuildNative% EQU 1 ( echo %__MsgPrefix%Regenerating the Visual Studio solution - echo Cross Arch Defines !___CrossBuildDefine! - pushd "%__IntermediatesDir%" set __ExtraCmakeArgs=!___SDKVersion! !___CrossBuildDefine! "-DCLR_CMAKE_TARGET_OS=%__BuildOS%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs! diff --git a/clrdefinitions.cmake b/clrdefinitions.cmake index 372b0318b6ed..d4da74a70040 100644 --- a/clrdefinitions.cmake +++ b/clrdefinitions.cmake @@ -10,6 +10,12 @@ if (PRERELEASE) # add_definitions(-DFEATURE_XXX) endif (PRERELEASE) +add_compile_definitions($<$>:DACCESS_COMPILE>) +add_compile_definitions($<$>:CROSSGEN_COMPILE>) +add_compile_definitions($<$>:CROSS_COMPILE>) +add_compile_definitions($<$>:FEATURE_NATIVE_IMAGE_GENERATION>) +add_compile_definitions($<$>:SELF_NO_HOST>) + if (CLR_CMAKE_TARGET_ARCH_AMD64) if (CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DDBG_TARGET_AMD64_UNIX) @@ -73,7 +79,8 @@ endif(CLR_CMAKE_PLATFORM_ALPINE_LINUX) add_definitions(-D_BLD_CLR) add_definitions(-DDEBUGGING_SUPPORTED) -add_definitions(-DPROFILING_SUPPORTED) +add_compile_definitions($<$>>:PROFILING_SUPPORTED>) +add_compile_definitions($<$>:PROFILING_SUPPORTED_DATA>) if(WIN32) add_definitions(-DWIN32) @@ -85,9 +92,9 @@ if(WIN32) if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) # Only enable edit and continue on windows x86 and x64 # exclude Linux, arm & arm64 - add_definitions(-DEnC_SUPPORTED) + add_compile_definitions($<$>>:EnC_SUPPORTED>) endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) -endif(WIN32) + endif(WIN32) # Features - please keep them alphabetically sorted if(WIN32) @@ -100,7 +107,7 @@ else(WIN32) add_definitions(-DFEATURE_ARRAYSTUB_AS_IL) add_definitions(-DFEATURE_MULTICASTSTUB_AS_IL) endif(WIN32) -add_definitions(-DFEATURE_CODE_VERSIONING) +add_compile_definitions($<$>>:FEATURE_CODE_VERSIONING>) add_definitions(-DFEATURE_COLLECTIBLE_TYPES) if(WIN32) @@ -121,7 +128,7 @@ if(FEATURE_DBGIPC) endif(FEATURE_DBGIPC) add_definitions(-DFEATURE_DEFAULT_INTERFACES) if(FEATURE_EVENT_TRACE) - add_definitions(-DFEATURE_EVENT_TRACE) + add_compile_definitions($<$>>:FEATURE_EVENT_TRACE>) add_definitions(-DFEATURE_PERFTRACING) endif(FEATURE_EVENT_TRACE) if(FEATURE_GDBJIT) @@ -148,7 +155,7 @@ if (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386 OR CLR_ add_definitions(-DFEATURE_INTEROP_DEBUGGING) endif (WIN32 AND (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM64)) if(FEATURE_INTERPRETER) - add_definitions(-DFEATURE_INTERPRETER) + add_compile_definitions($<$>>:FEATURE_INTERPRETER>) endif(FEATURE_INTERPRETER) add_definitions(-DFEATURE_ISYM_READER) if (CLR_CMAKE_PLATFORM_LINUX OR WIN32) @@ -159,27 +166,36 @@ add_definitions(-DFEATURE_MANAGED_ETW_CHANNELS) if(FEATURE_MERGE_JIT_AND_ENGINE) add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) endif(FEATURE_MERGE_JIT_AND_ENGINE) -add_definitions(-DFEATURE_MULTICOREJIT) +add_compile_definitions($<$>>:FEATURE_MULTICOREJIT>) if(CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DFEATURE_PAL) add_definitions(-DFEATURE_PAL_ANSI) endif(CLR_CMAKE_PLATFORM_UNIX) -if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD) +if(CLR_CMAKE_PLATFORM_LINUX) add_definitions(-DFEATURE_PERFMAP) -endif(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD) +endif(CLR_CMAKE_PLATFORM_LINUX) +if(CLR_CMAKE_PLATFORM_FREEBSD) + add_compile_definitions($<$>>:FEATURE_PERFMAP>) +endif(CLR_CMAKE_PLATFORM_FREEBSD) if(FEATURE_PREJIT) add_definitions(-DFEATURE_PREJIT) +else() + add_compile_definitions($<$>:FEATURE_PREJIT>) endif(FEATURE_PREJIT) if(WIN32 OR CLR_CMAKE_PLATFORM_LINUX) - add_definitions(-DFEATURE_PROFAPI_ATTACH_DETACH) + add_compile_definitions($<$>>,$>>>:FEATURE_PROFAPI_ATTACH_DETACH>) endif(WIN32 OR CLR_CMAKE_PLATFORM_LINUX) +add_compile_definitions($<$>:DATA_PROFAPI_ATTACH_DETACH>) + add_definitions(-DFEATURE_READYTORUN) + +add_compile_definitions($<$>:FEATURE_READYTORUN_COMPILER>) set(FEATURE_READYTORUN 1) if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) - add_definitions(-DFEATURE_REJIT) + add_compile_definitions($<$>>:FEATURE_REJIT>) endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64) @@ -193,7 +209,7 @@ if (FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) endif(FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION) add_definitions(-DFEATURE_SVR_GC) add_definitions(-DFEATURE_SYMDIFF) -add_definitions(-DFEATURE_TIERED_COMPILATION) +add_compile_definitions($<$>>:FEATURE_TIERED_COMPILATION>) if (WIN32) add_definitions(-DFEATURE_TYPEEQUIVALENCE) endif(WIN32) @@ -216,7 +232,7 @@ if((CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64) AND NOT WIN3 endif((CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM64) AND NOT WIN32) if(WIN32) - add_definitions(-DFEATURE_VERSIONING_LOG) + add_compile_definitions($<$>>:FEATURE_VERSIONING_LOG>) endif(WIN32) if(NOT CLR_CMAKE_PLATFORM_UNIX) add_definitions(-DFEATURE_WIN32_REGISTRY) diff --git a/configure.cmake b/configure.cmake deleted file mode 100644 index 3af13f3c15da..000000000000 --- a/configure.cmake +++ /dev/null @@ -1,15 +0,0 @@ -include(CheckCXXSourceCompiles) -include(CheckCXXCompilerFlag) - -# VC++ guarantees support for LTCG (LTO's equivalent) -if(NOT WIN32) - # Function required to give CMAKE_REQUIRED_* local scope - function(check_have_lto) - set(CMAKE_REQUIRED_FLAGS -flto) - set(CMAKE_REQUIRED_LIBRARIES -flto -fuse-ld=gold) - check_cxx_source_compiles("int main() { return 0; }" HAVE_LTO) - endfunction(check_have_lto) - check_have_lto() - - check_cxx_compiler_flag(-faligned-new COMPILER_SUPPORTS_F_ALIGNED_NEW) -endif(NOT WIN32) diff --git a/configurecompiler.cmake b/configurecompiler.cmake index 525849b5391e..82876984f3d4 100644 --- a/configurecompiler.cmake +++ b/configurecompiler.cmake @@ -6,13 +6,20 @@ set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +cmake_policy(SET CMP0083 NEW) + +include(CheckPIESupported) +include(CheckCXXCompilerFlag) + # All code we build should be compiled as position independent +check_pie_supported(OUTPUT_VARIABLE PIE_SUPPORT_OUTPUT LANGUAGES CXX) +if(NOT MSVC AND NOT CMAKE_CXX_LINK_PIE_SUPPORTED) + message(WARNING "PIE is not supported at link time: ${PIE_SUPPORT_OUTPUT}.\n" + "PIE link options will not be passed to linker.") +endif() set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(CLR_DEFINES_DEBUG_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1) -set(CLR_DEFINES_CHECKED_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1) -set(CLR_DEFINES_RELEASE_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) -set(CLR_DEFINES_RELWITHDEBINFO_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) +check_cxx_compiler_flag(-faligned-new COMPILER_SUPPORTS_F_ALIGNED_NEW) #---------------------------------------- # Detect and set platform variable names @@ -184,7 +191,7 @@ endif() # Initialize Cmake compiler flags and other variables #----------------------------------------------------- -if(WIN32) +if(MSVC) add_compile_options(/Zi /FC /Zc:strictStrings) elseif (CLR_CMAKE_PLATFORM_UNIX) add_compile_options(-g) @@ -205,68 +212,66 @@ set(CMAKE_CXX_FLAGS_CHECKED "") set(CMAKE_EXE_LINKER_FLAGS_CHECKED "") set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "") -set(CMAKE_CXX_STANDARD_LIBRARIES "") # do not link against standard win32 libs i.e. kernel32, uuid, user32, etc. +add_compile_definitions("$<$,$>:DEBUG;_DEBUG;_DBG;URTBLDENV_FRIENDLY=Checked;BUILDENV_CHECKED=1>") +add_compile_definitions("$<$,$>:NDEBUG;URTBLDENV_FRIENDLY=Retail>") -if (WIN32) - # For multi-configuration toolset (as Visual Studio) - # set the different configuration defines. - foreach (Config DEBUG CHECKED RELEASE RELWITHDEBINFO) - foreach (Definition IN LISTS CLR_DEFINES_${Config}_INIT) - set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:${Definition}>) - endforeach (Definition) - endforeach (Config) +set(CMAKE_CXX_STANDARD_LIBRARIES "") # do not link against standard win32 libs i.e. kernel32, uuid, user32, etc. - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /GUARD:CF") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /GUARD:CF") +if (MSVC) + add_link_options(/GUARD:CF) # Linker flags # - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO") #Do not create Side-by-Side Assembly Manifest + set (WINDOWS_SUBSYSTEM_VERSION 6.01) if (CLR_CMAKE_PLATFORM_ARCH_ARM) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.02") #windows subsystem - arm minimum is 6.02 + set(WINDOWS_SUBSYSTEM_VERSION 6.02) #windows subsystem - arm minimum is 6.02 elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.03") #windows subsystem - arm64 minimum is 6.03 - else () - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.01") #windows subsystem + set(WINDOWS_SUBSYSTEM_VERSION 6.03) #windows subsystem - arm64 minimum is 6.03 endif () - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE") # can handle addresses larger than 2 gigabytes - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NXCOMPAT") #Compatible with Data Execution Prevention - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE") #Use address space layout randomization - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /PDBCOMPRESS") #shrink pdb size - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4197,4013,4254,4070,4221") + #Do not create Side-by-Side Assembly Manifest + add_link_options($<$,SHARED_LIBRARY>:/MANIFEST:NO>) + # can handle addresses larger than 2 gigabytes + add_link_options($<$,SHARED_LIBRARY>:/LARGEADDRESSAWARE>) + #Compatible with Data Execution Prevention + add_link_options($<$,SHARED_LIBRARY>:/NXCOMPAT>) + #Use address space layout randomization + add_link_options($<$,SHARED_LIBRARY>:/DYNAMICBASE>) + #shrink pdb size + add_link_options($<$,SHARED_LIBRARY>:/PDBCOMPRESS>) + + add_link_options($<$,SHARED_LIBRARY>:/DEBUG>) + add_link_options($<$,SHARED_LIBRARY>:/IGNORE:4197,4013,4254,4070,4221>) + add_link_options($<$,SHARED_LIBRARY>:/SUBSYSTEM:WINDOWS,${WINDOWS_SUBSYSTEM_VERSION}>) set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221") - - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /PDBCOMPRESS") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1572864") + + add_link_options($<$,EXECUTABLE>:/DEBUG>) + add_link_options($<$,EXECUTABLE>:/PDBCOMPRESS>) + add_link_options($<$,EXECUTABLE>:/STACK:1572864>) # Debug build specific flags - set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/NOVCFEATURE ${NO_INCREMENTAL_LINKER_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${NO_INCREMENTAL_LINKER_FLAGS}") + add_link_options($<$,$>,$,SHARED_LIBRARY>>:/NOVCFEATURE>) # Checked build specific flags - set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "${CMAKE_SHARED_LINKER_FLAGS_CHECKED} /OPT:REF /OPT:NOICF /NOVCFEATURE ${NO_INCREMENTAL_LINKER_FLAGS}") - set(CMAKE_STATIC_LINKER_FLAGS_CHECKED "${CMAKE_STATIC_LINKER_FLAGS_CHECKED}") - set(CMAKE_EXE_LINKER_FLAGS_CHECKED "${CMAKE_EXE_LINKER_FLAGS_CHECKED} /OPT:REF /OPT:NOICF ${NO_INCREMENTAL_LINKER_FLAGS}") + add_link_options($<$:/OPT:REF>) + add_link_options($<$:/OPT:NOICF>) # Release build specific flags - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") + add_link_options($<$:/LTCG>) + add_link_options($<$:/OPT:REF>) + add_link_options($<$:/OPT:ICF>) set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") # ReleaseWithDebugInfo build specific flags - set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") + add_link_options($<$:/LTCG>) + add_link_options($<$:/OPT:REF>) + add_link_options($<$:/OPT:ICF>) set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /LTCG") - set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") # Force uCRT to be dynamically linked for Release build - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") + add_link_options("$<$:/NODEFAULTLIB:libucrt.lib;/DEFAULTLIB:ucrt.lib>") elseif (CLR_CMAKE_PLATFORM_UNIX) # Set the values to display when interactively configuring CMAKE_BUILD_TYPE @@ -275,23 +280,8 @@ elseif (CLR_CMAKE_PLATFORM_UNIX) # Use uppercase CMAKE_BUILD_TYPE for the string comparisons below string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_CMAKE_BUILD_TYPE) - # For single-configuration toolset - # set the different configuration defines. - if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG) - # First DEBUG - set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS ${CLR_DEFINES_DEBUG_INIT}) - elseif (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED) - # Then CHECKED - set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS ${CLR_DEFINES_CHECKED_INIT}) - elseif (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE) - # Then RELEASE - set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS ${CLR_DEFINES_RELEASE_INIT}) - elseif (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELWITHDEBINFO) - # And then RELWITHDEBINFO - set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${CLR_DEFINES_RELWITHDEBINFO_INIT}) - else () - message(FATAL_ERROR "Unknown build type! Set CMAKE_BUILD_TYPE to DEBUG, CHECKED, RELEASE, or RELWITHDEBINFO!") - endif () + set(CLR_SANITIZE_CXX_OPTIONS "") + set(CLR_SANITIZE_LINK_OPTIONS "") # set the CLANG sanitizer flags for debug build if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED) @@ -299,9 +289,12 @@ elseif (CLR_CMAKE_PLATFORM_UNIX) string(FIND "$ENV{DEBUG_SANITIZERS}" "asan" __ASAN_POS) string(FIND "$ENV{DEBUG_SANITIZERS}" "ubsan" __UBSAN_POS) if ((${__ASAN_POS} GREATER -1) OR (${__UBSAN_POS} GREATER -1)) - set(CLR_SANITIZE_CXX_FLAGS "${CLR_SANITIZE_CXX_FLAGS} -fsanitize-blacklist=${CMAKE_CURRENT_SOURCE_DIR}/sanitizerblacklist.txt -fsanitize=") - set(CLR_SANITIZE_LINK_FLAGS "${CLR_SANITIZE_LINK_FLAGS} -fsanitize=") + list(APPEND CLR_SANITIZE_CXX_OPTIONS -fsanitize-blacklist=${CMAKE_CURRENT_SOURCE_DIR}/sanitizerblacklist.txt) + set (CLR_CXX_SANITIZERS "") + set (CLR_LINK_SANITIZERS "") if (${__ASAN_POS} GREATER -1) + list(APPEND CLR_CXX_SANITIZERS address) + list(APPEND CLR_LINK_SANITIZERS address) set(CLR_SANITIZE_CXX_FLAGS "${CLR_SANITIZE_CXX_FLAGS}address,") set(CLR_SANITIZE_LINK_FLAGS "${CLR_SANITIZE_LINK_FLAGS}address,") add_definitions(-DHAS_ASAN) @@ -309,30 +302,42 @@ elseif (CLR_CMAKE_PLATFORM_UNIX) endif () if (${__UBSAN_POS} GREATER -1) # all sanitizier flags are enabled except alignment (due to heavy use of __unaligned modifier) - set(CLR_SANITIZE_CXX_FLAGS "${CLR_SANITIZE_CXX_FLAGS}bool,bounds,enum,float-cast-overflow,float-divide-by-zero,function,integer,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift,unreachable,vla-bound,vptr") - set(CLR_SANITIZE_LINK_FLAGS "${CLR_SANITIZE_LINK_FLAGS}undefined") + list(APPEND CLR_CXX_SANITIZERS + "bool" + bounds + enum + float-cast-overflow + float-divide-by-zero + "function" + integer + nonnull-attribute + null + object-size + "return" + returns-nonnull-attribute + shift + unreachable + vla-bound + vptr) + list(APPEND CLR_LINK_SANITIZERS + undefined) message("Undefined Behavior Sanitizer (ubsan) enabled") endif () + list(JOIN CLR_CXX_SANITIZERS "," CLR_CXX_SANITIZERS_OPTIONS) + list(APPEND CLR_SANITIZE_CXX_OPTIONS "-fsanitize=${CLR_CXX_SANITIZERS_OPTIONS}") + list(JOIN CLR_LINK_SANITIZERS "," CLR_LINK_SANITIZERS_OPTIONS) + list(APPEND CLR_SANITIZE_LINK_OPTIONS "-fsanitize=${CLR_LINK_SANITIZERS_OPTIONS}") # -fdata-sections -ffunction-sections: each function has own section instead of one per .o file (needed for --gc-sections) # -O1: optimization level used instead of -O0 to avoid compile error "invalid operand for inline asm constraint" - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CLR_SANITIZE_CXX_FLAGS} -fdata-sections -ffunction-sections -O1") - set(CMAKE_CXX_FLAGS_CHECKED "${CMAKE_CXX_FLAGS_CHECKED} ${CLR_SANITIZE_CXX_FLAGS} -fdata-sections -ffunction-sections -O1") - - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${CLR_SANITIZE_LINK_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS_CHECKED "${CMAKE_EXE_LINKER_FLAGS_CHECKED} ${CLR_SANITIZE_LINK_FLAGS}") + add_compile_definitions("$<$,$>:${CLR_SANITIZE_CXX_OPTIONS};-fdata-sections;--ffunction-sections;-O1>") + add_link_options($<$,$>,$,EXECUTABLE>>:${CLR_SANITIZE_LINK_OPTIONS}>) # -Wl and --gc-sections: drop unused sections\functions (similar to Windows /Gy function-level-linking) - set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${CLR_SANITIZE_LINK_FLAGS} -Wl,--gc-sections") - set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "${CMAKE_SHARED_LINKER_FLAGS_CHECKED} ${CLR_SANITIZE_LINK_FLAGS} -Wl,--gc-sections") + add_link_options("$<$,$>,$,SHARED_LIBRARY>>:${CLR_SANITIZE_LINK_OPTIONS};-Wl,--gc-sections>") endif () endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED) - - # This linker option causes executables we build to be marked as containing position independent code. - # It is necessary to make ASLR work for executables. - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie" ) - -endif(WIN32) +endif(MSVC) # CLR_ADDITIONAL_LINKER_FLAGS - used for passing additional arguments to linker # CLR_ADDITIONAL_COMPILER_OPTIONS - used for passing additional arguments to compiler @@ -341,19 +346,16 @@ endif(WIN32) # ./build-native.sh cmakeargs "-DCLR_ADDITIONAL_COMPILER_OPTIONS=<...>" cmakeargs "-DCLR_ADDITIONAL_LINKER_FLAGS=<...>" # if(CLR_CMAKE_PLATFORM_UNIX) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CLR_ADDITIONAL_LINKER_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CLR_ADDITIONAL_LINKER_FLAGS}" ) + add_link_options(${CLR_ADDITIONAL_LINKER_FLAGS}) endif(CLR_CMAKE_PLATFORM_UNIX) if(CLR_CMAKE_PLATFORM_LINUX) - set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--build-id=sha1") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id=sha1") + add_compile_options($<$:-Wa,--noexecstack>) + add_link_options(-Wl,--build-id=sha1) endif(CLR_CMAKE_PLATFORM_LINUX) if(CLR_CMAKE_PLATFORM_FREEBSD) - set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,--noexecstack") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld -Xlinker --build-id=sha1") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld -Xlinker --build-id=sha1") + add_compile_options($<$:-Wa,--noexecstack>) + add_link_options(-fuse-ld=lld LINKER:--build-id=sha1) endif(CLR_CMAKE_PLATFORM_FREEBSD) #------------------------------------ @@ -520,10 +522,9 @@ if (CLR_CMAKE_PLATFORM_UNIX) # Specify the minimum supported version of macOS if(CLR_CMAKE_PLATFORM_DARWIN) - set(MACOS_VERSION_MIN_FLAGS "-mmacosx-version-min=10.12") - add_compile_options("${MACOS_VERSION_MIN_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MACOS_VERSION_MIN_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MACOS_VERSION_MIN_FLAGS}") + set(MACOS_VERSION_MIN_FLAGS -mmacosx-version-min=10.12) + add_compile_options(${MACOS_VERSION_MIN_FLAGS}) + add_link_options(${MACOS_VERSION_MIN_FLAGS}) endif(CLR_CMAKE_PLATFORM_DARWIN) endif(CLR_CMAKE_PLATFORM_UNIX) @@ -543,7 +544,7 @@ if(CLR_CMAKE_PLATFORM_UNIX) add_compile_options(${CLR_ADDITIONAL_COMPILER_OPTIONS}) endif(CLR_CMAKE_PLATFORM_UNIX) -if (WIN32) +if (MSVC) # Compile options for targeting windows # The following options are set by the razzle build @@ -595,17 +596,18 @@ if (WIN32) # For Release builds, we shall dynamically link into uCRT [ucrtbase.dll] (which is pushed down as a Windows Update on downlevel OS) but # wont do the same for debug/checked builds since ucrtbased.dll is not redistributable and Debug/Checked builds are not # production-time scenarios. - add_compile_options($<$,$>:/MT>) - add_compile_options($<$,$>:/MTd>) - set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /ZH:SHA_256") + add_compile_options($<$,$>,$>>:/MT>) + add_compile_options($<$,$>,$>>>:/MTd>) + + add_compile_options($<$:/ZH:SHA_256>) if (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64) # Contracts work too slow on ARM/ARM64 DEBUG/CHECKED. add_definitions(-DDISABLE_CONTRACTS) endif (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64) -endif (WIN32) +endif (MSVC) if(CLR_CMAKE_ENABLE_CODE_COVERAGE) @@ -617,9 +619,7 @@ if(CLR_CMAKE_ENABLE_CODE_COVERAGE) add_compile_options(-fprofile-arcs) add_compile_options(-ftest-coverage) - set(CLANG_COVERAGE_LINK_FLAGS "--coverage") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CLANG_COVERAGE_LINK_FLAGS}") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CLANG_COVERAGE_LINK_FLAGS}") + add_link_options(--coverage) else() message(FATAL_ERROR "Code coverage builds not supported on current platform") endif(CLR_CMAKE_PLATFORM_UNIX) diff --git a/cross/toolchain.cmake b/cross/toolchain.cmake index 75c2e27cdcd6..0eea7d1df3e4 100644 --- a/cross/toolchain.cmake +++ b/cross/toolchain.cmake @@ -35,15 +35,6 @@ if(DEFINED ENV{TOOLCHAIN}) set(TOOLCHAIN $ENV{TOOLCHAIN}) endif() -# This gets called with CLR_CMAKE_COMPILER set on the first invocation -# but the cmake variable is not getting populated into other calls. -# Use environment variable to keep CLR_CMAKE_COMPILER around. -if (NOT DEFINED CLR_CMAKE_COMPILER) - set(CLR_CMAKE_COMPILER $ENV{CLR_CMAKE_COMPILER}) -else() - set(ENV{CLR_CMAKE_COMPILER} ${CLR_CMAKE_COMPILER}) -endif() - # Specify include paths if(TARGET_ARCH_NAME STREQUAL "armel") if(DEFINED TIZEN_TOOLCHAIN) @@ -52,51 +43,25 @@ if(TARGET_ARCH_NAME STREQUAL "armel") endif() endif() -# add_compile_param - adds only new options without duplicates. -# arg0 - list with result options, arg1 - list with new options. -# arg2 - optional argument, quick summary string for optional using CACHE FORCE mode. -macro(add_compile_param) - if(NOT ${ARGC} MATCHES "^(2|3)$") - message(FATAL_ERROR "Wrong using add_compile_param! Two or three parameters must be given! See add_compile_param description.") - endif() - foreach(OPTION ${ARGV1}) - if(NOT ${ARGV0} MATCHES "${OPTION}($| )") - set(${ARGV0} "${${ARGV0}} ${OPTION}") - if(${ARGC} EQUAL "3") # CACHE FORCE mode - set(${ARGV0} "${${ARGV0}}" CACHE STRING "${ARGV2}" FORCE) - endif() - endif() - endforeach() -endmacro() +set(CMAKE_SYSROOT "${CROSS_ROOTFS}") +set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") +set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") +set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") # Specify link flags -add_compile_param(CROSS_LINK_FLAGS "--sysroot=${CROSS_ROOTFS}") -if (CLR_CMAKE_COMPILER STREQUAL "Clang") - add_compile_param(CROSS_LINK_FLAGS "--gcc-toolchain=${CROSS_ROOTFS}/usr") - add_compile_param(CROSS_LINK_FLAGS "--target=${TOOLCHAIN}") -endif() if(TARGET_ARCH_NAME STREQUAL "armel") if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only - add_compile_param(CROSS_LINK_FLAGS "-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") - add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/lib") - add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib") - add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_link_options("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_link_options("-L${CROSS_ROOTFS}/lib") + add_link_options("-L${CROSS_ROOTFS}/usr/lib") + add_link_options("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") endif() elseif(TARGET_ARCH_NAME STREQUAL "x86") - add_compile_param(CROSS_LINK_FLAGS "-m32") + add_link_options(-m32) endif() -add_compile_param(CMAKE_EXE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS") -add_compile_param(CMAKE_SHARED_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS") -add_compile_param(CMAKE_MODULE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS") - # Specify compile options -add_compile_options("--sysroot=${CROSS_ROOTFS}") -if (CLR_CMAKE_COMPILER STREQUAL "Clang") - add_compile_options("--target=${TOOLCHAIN}") - add_compile_options("--gcc-toolchain=${CROSS_ROOTFS}/usr") -endif() if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$") set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) @@ -119,7 +84,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86") add_compile_options(-Wno-error=unused-command-line-argument) endif() -# Set LLDB include and library paths +# Set LLDB include and library paths for builds that need lldb. if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") if(TARGET_ARCH_NAME STREQUAL "x86") set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}") @@ -147,7 +112,7 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") endif() endif() -set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}") + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/crossgen.cmake b/crossgen.cmake deleted file mode 100644 index 6f416bf6cc16..000000000000 --- a/crossgen.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# Contains the crossgen build specific definitions. Included by the leaf crossgen cmake files. - -add_definitions( - -DFEATURE_PREJIT - -DCROSSGEN_COMPILE - -DCROSS_COMPILE - -DFEATURE_NATIVE_IMAGE_GENERATION - -DSELF_NO_HOST) - -remove_definitions( - -DFEATURE_CODE_VERSIONING - -DEnC_SUPPORTED - -DFEATURE_EVENT_TRACE - -DFEATURE_INTERPRETER - -DFEATURE_MULTICOREJIT - -DFEATURE_PERFMAP - -DFEATURE_REJIT - -DFEATURE_TIERED_COMPILATION - -DFEATURE_VERSIONING_LOG - -DFEATURE_PROFAPI_ATTACH_DETACH -) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -if(CLR_CMAKE_PLATFORM_LINUX) - add_definitions(-DFEATURE_PERFMAP) -endif(CLR_CMAKE_PLATFORM_LINUX) diff --git a/dac.cmake b/dac.cmake deleted file mode 100644 index 82da3d2df759..000000000000 --- a/dac.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# Contains the dac build specific definitions. Included by the leaf dac cmake files. - -add_definitions(-DDACCESS_COMPILE) -if(WIN32) - add_definitions(-MT) -endif(WIN32) - -remove_definitions(-DPROFILING_SUPPORTED) -add_definitions(-DPROFILING_SUPPORTED_DATA) - -remove_definitions(-DFEATURE_PROFAPI_ATTACH_DETACH) -add_definitions(-DDATA_PROFAPI_ATTACH_DETACH) diff --git a/functions.cmake b/functions.cmake index d86844591078..14d376ddb0fb 100644 --- a/functions.cmake +++ b/functions.cmake @@ -13,15 +13,38 @@ function(get_compile_definitions DefinitionName) # Get the current list of definitions get_directory_property(COMPILE_DEFINITIONS_LIST COMPILE_DEFINITIONS) + # The entries that contain generator expressions must have the -D inside of the + # expression. So we transform e.g. $<$:_DEBUG> to $<$:-D_DEBUG> + + # CMake's support for multiple values within a single generator expression is somewhat ad-hoc. + # Since we have a number of complex generator expressions, we use them with multiple values to ensure that + # we don't forget to update all of the generator expressions if one needs to be updated. + # As a result, we need to expand out the multi-valued generator expression to wrap each individual value here. + # Otherwise, CMake will fail to expand it. + set(LastGeneratorExpression "") foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST) - if (${DEFINITION} MATCHES "^\\$<\\$]+)>:([^>]+)>$") - # The entries that contain generator expressions must have the -D inside of the - # expression. So we transform e.g. $<$:_DEBUG> to $<$:-D_DEBUG> - set(DEFINITION "$<$:-D${CMAKE_MATCH_2}>") + # If there is a definition that uses the $ generator expression + # we need to remove it since that generator expression is only valid on binary targets. + # Assume that the value is 0. + string(REGEX REPLACE "\\$]+>" "0" DEFINITION "${DEFINITION}") + + if (${DEFINITION} MATCHES "^\\$<(.+):([^>]+)(>?)$") + if("${CMAKE_MATCH_3}" STREQUAL "") + set(DEFINITION "$<${CMAKE_MATCH_1}:-D${CMAKE_MATCH_2}>") + set(LastGeneratorExpression "${CMAKE_MATCH_1}") else() - set(DEFINITION -D${DEFINITION}) + set(DEFINITION "$<${CMAKE_MATCH_1}:-D${CMAKE_MATCH_2}>") endif() - list(APPEND DEFINITIONS ${DEFINITION}) + elseif(${DEFINITION} MATCHES "([^>]+)>$") + # This entry is the last in a list nested within a generator expression. + set(DEFINITION "$<${LastGeneratorExpression}:-D${CMAKE_MATCH_1}>") + set(LastGeneratorExpression "") + elseif(NOT "${LastGeneratorExpression}" STREQUAL "") + set(DEFINITION "$<${LastGeneratorExpression}:-D${DEFINITION}>") + else() + set(DEFINITION -D${DEFINITION}) + endif() + list(APPEND DEFINITIONS ${DEFINITION}) endforeach() set(${DefinitionName} ${DEFINITIONS} PARENT_SCOPE) endfunction(get_compile_definitions) @@ -71,21 +94,74 @@ function(convert_to_absolute_path RetSources) set(${RetSources} ${AbsolutePathSources} PARENT_SCOPE) endfunction(convert_to_absolute_path) -#Preprocess exports definition file -function(preprocess_def_file inputFilename outputFilename) +#Preprocess file +function(preprocess_file inputFilename outputFilename) get_compile_definitions(PREPROCESS_DEFINITIONS) - get_include_directories(ASM_INCLUDE_DIRECTORIES) - add_custom_command( - OUTPUT ${outputFilename} - COMMAND ${CMAKE_CXX_COMPILER} ${ASM_INCLUDE_DIRECTORIES} /P /EP /TC ${PREPROCESS_DEFINITIONS} /Fi${outputFilename} ${inputFilename} - DEPENDS ${inputFilename} - COMMENT "Preprocessing ${inputFilename} - ${CMAKE_CXX_COMPILER} ${ASM_INCLUDE_DIRECTORIES} /P /EP /TC ${PREPROCESS_DEFINITIONS} /Fi${outputFilename} ${inputFilename}" - ) + get_include_directories(PREPROCESS_INCLUDE_DIRECTORIES) + if (MSVC) + add_custom_command( + OUTPUT ${outputFilename} + COMMAND ${CMAKE_CXX_COMPILER} ${PREPROCESS_INCLUDE_DIRECTORIES} /P /EP /TC ${PREPROCESS_DEFINITIONS} /Fi${outputFilename} ${inputFilename} + DEPENDS ${inputFilename} + COMMENT "Preprocessing ${inputFilename}. Outputting to ${outputFilename}" + ) + else() + add_custom_command( + OUTPUT ${outputFilename} + COMMAND ${CMAKE_CXX_COMPILER} -E -P ${PREPROCESS_DEFINITIONS} ${PREPROCESS_INCLUDE_DIRECTORIES} -o ${outputFilename} -x c ${inputFilename} + DEPENDS ${inputFilename} + COMMENT "Preprocessing ${inputFilename}. Outputting to ${outputFilename}" + ) + endif() set_source_files_properties(${outputFilename} PROPERTIES GENERATED TRUE) endfunction() +# preprocess_compile_asm(ASM_FILES file1 [file2 ...] OUTPUT_OBJECTS [variableName]) +function(preprocess_compile_asm) + set(options "") + set(oneValueArgs OUTPUT_OBJECTS) + set(multiValueArgs ASM_FILES) + cmake_parse_arguments(PARSE_ARGV 0 COMPILE_ASM "${options}" "${oneValueArgs}" "${multiValueArgs}") + + get_include_directories_asm(ASM_INCLUDE_DIRECTORIES) + + set (ASSEMBLED_OBJECTS "") + + foreach(ASM_FILE ${COMPILE_ASM_ASM_FILES}) + # Inserts a custom command in CMake build to preprocess each asm source file + get_filename_component(name ${ASM_FILE} NAME_WE) + file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${name}.asm" ASM_PREPROCESSED_FILE) + preprocess_file(${ASM_FILE} ${ASM_PREPROCESSED_FILE}) + + # We do not pass any defines since we have already done pre-processing above + set (ASM_CMDLINE "-o ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj ${ASM_PREPROCESSED_FILE}") + + # Generate the batch file that will invoke the assembler + file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/runasm_${name}.cmd" ASM_SCRIPT_FILE) + + file(GENERATE OUTPUT "${ASM_SCRIPT_FILE}" + CONTENT "\"${CMAKE_ASM_MASM_COMPILER}\" -g ${ASM_INCLUDE_DIRECTORIES} ${ASM_CMDLINE}") + + message("Generated - ${ASM_SCRIPT_FILE}") + + # Need to compile asm file using custom command as include directories are not provided to asm compiler + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj + COMMAND ${ASM_SCRIPT_FILE} + DEPENDS ${ASM_PREPROCESSED_FILE} + COMMENT "Assembling ${ASM_PREPROCESSED_FILE} - ${ASM_SCRIPT_FILE}") + + # mark obj as source that does not require compile + set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${name}.obj PROPERTIES EXTERNAL_OBJECT TRUE) + + # Add the generated OBJ in the dependency list so that it gets consumed during linkage + list(APPEND ASSEMBLED_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj) + endforeach() + + set(${COMPILE_ASM_OUTPUT_OBJECTS} ${ASSEMBLED_OBJECTS} PARENT_SCOPE) +endfunction() + function(generate_exports_file) set(INPUT_LIST ${ARGN}) list(GET INPUT_LIST -1 outputFilename) @@ -128,33 +204,56 @@ function(generate_exports_file_prefix inputFilename outputFilename prefix) PROPERTIES GENERATED TRUE) endfunction() -function(add_precompiled_header header cppFile targetSources) +# target_precompile_header(TARGET targetName HEADER headerName [ADDITIONAL_INCLUDE_DIRECTORIES includeDirs]) +function(target_precompile_header) + set(options "") + set(oneValueArgs TARGET HEADER) + set(multiValueArgs ADDITIONAL_INCLUDE_DIRECTORIES) + cmake_parse_arguments(PARSE_ARGV 0 PRECOMPILE_HEADERS "${options}" "${oneValueArgs}" "${multiValueArgs}") + + if ("${PRECOMPILE_HEADERS_TARGET}" STREQUAL "") + message(SEND_ERROR "No target supplied to target_precompile_header.") + endif() + if ("${PRECOMPILE_HEADERS_HEADER}" STREQUAL "") + message(SEND_ERROR "No header supplied to target_precompile_header.") + endif() + if(MSVC) - set(precompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/stdafx.pch") - - set_source_files_properties(${cppFile} - PROPERTIES COMPILE_FLAGS "/Yc\"${header}\" /Fp\"${precompiledBinary}\"" - OBJECT_OUTPUTS "${precompiledBinary}") - set_source_files_properties(${${targetSources}} - PROPERTIES COMPILE_FLAGS "/Yu\"${header}\" /Fp\"${precompiledBinary}\"" - OBJECT_DEPENDS "${precompiledBinary}") - # Add cppFile to SourcesVar - set(${targetSources} ${${targetSources}} ${cppFile} PARENT_SCOPE) + get_filename_component(PCH_NAME ${PRECOMPILE_HEADERS_HEADER} NAME_WE) + # We need to use the $ generator here instead of the ${targetName} variable since + # CMake evaluates source file properties once per directory. If we just use ${targetName}, we end up sharing + # the same PCH between targets, which doesn't work. + set(precompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PCH_NAME}.$.pch") + set(pchSourceFile "${CMAKE_CURRENT_BINARY_DIR}/${PCH_NAME}.${PRECOMPILE_HEADERS_TARGET}.cpp") + + file(GENERATE OUTPUT ${pchSourceFile} CONTENT "#include \"${PRECOMPILE_HEADERS_HEADER}\"") + + set(PCH_SOURCE_FILE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} ${PRECOMPILE_HEADERS_ADDITIONAL_INCLUDE_DIRECTORIES}) + + set_source_files_properties(${pchSourceFile} + PROPERTIES COMPILE_FLAGS "/Yc\"${PRECOMPILE_HEADERS_HEADER}\" /Fp\"${precompiledBinary}\"" + OBJECT_OUTPUTS "${precompiledBinary}" + INCLUDE_DIRECTORIES "${PCH_SOURCE_FILE_INCLUDE_DIRECTORIES}") + get_target_property(TARGET_SOURCES ${PRECOMPILE_HEADERS_TARGET} SOURCES) + + foreach (SOURCE ${TARGET_SOURCES}) + get_source_file_property(SOURCE_LANG ${SOURCE} LANGUAGE) + if (("${SOURCE_LANG}" STREQUAL "C") OR ("${SOURCE_LANG}" STREQUAL "CXX")) + set_source_files_properties(${SOURCE} + PROPERTIES COMPILE_FLAGS "/Yu\"${PRECOMPILE_HEADERS_HEADER}\" /Fp\"${precompiledBinary}\"" + OBJECT_DEPENDS "${precompiledBinary}") + endif() + endforeach() + + # Add pchSourceFile to PRECOMPILE_HEADERS_TARGET target + target_sources(${PRECOMPILE_HEADERS_TARGET} PRIVATE ${pchSourceFile}) endif(MSVC) endfunction() function(strip_symbols targetName outputFilename) if (CLR_CMAKE_PLATFORM_UNIX) if (STRIP_SYMBOLS) - - # On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE - # generator expression doesn't work correctly returning the wrong path and on - # the newer cmake versions the LOCATION property isn't supported anymore. - if (CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0) - set(strip_source_file $) - else() - get_property(strip_source_file TARGET ${targetName} PROPERTY LOCATION) - endif() + set(strip_source_file $) if (CMAKE_SYSTEM_NAME STREQUAL Darwin) set(strip_destination_file ${strip_source_file}.dwarf) @@ -190,17 +289,13 @@ function(install_clr targetName) list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX) if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1) strip_symbols(${targetName} strip_destination_file) - # On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE - # generator expression doesn't work correctly returning the wrong path and on - # the newer cmake versions the LOCATION property isn't supported anymore. - if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0) - set(install_source_file $) - else() - get_property(install_source_file TARGET ${targetName} PROPERTY LOCATION) - endif() - install(PROGRAMS ${install_source_file} DESTINATION .) + # We don't need to install the export libraries for our DLLs + # since they won't be directly linked against. + install(PROGRAMS $ DESTINATION .) if(WIN32) + # We can't use the $ generator expression here since + # the generator expression isn't supported on resource DLLs. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb DESTINATION PDB) else() install(FILES ${strip_destination_file} DESTINATION .) diff --git a/pgosupport.cmake b/pgosupport.cmake index dec050033e01..59a03739a74b 100644 --- a/pgosupport.cmake +++ b/pgosupport.cmake @@ -1,3 +1,6 @@ +include(CheckIPOSupported) +check_ipo_supported(RESULT HAVE_LTO) + # Adds Profile Guided Optimization (PGO) flags to the current target function(add_pgo TargetName) if(WIN32) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 94214cf4220e..d4b491c4c15d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,19 +38,17 @@ if(CLR_CMAKE_PLATFORM_UNIX) # variable specified by the TARGET_FILE parameter. function(build_resources SOURCE TARGET_NAME TARGET_FILE) - get_compile_definitions(PREPROCESS_DEFINITIONS) - get_include_directories(INCLUDE_DIRECTORIES) - set(PREPROCESSED_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.rc.i) + + preprocess_file(${SOURCE} ${PREPROCESSED_SOURCE}) + set(RESOURCE_ENTRY_ARRAY_CPP ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.cpp) add_custom_command( OUTPUT ${RESOURCE_ENTRY_ARRAY_CPP} - # Preprocess the windows .rc file - COMMAND ${CMAKE_CXX_COMPILER} -E -P ${PREPROCESS_DEFINITIONS} ${INCLUDE_DIRECTORIES} -o ${PREPROCESSED_SOURCE} -x c ${SOURCE} # Convert the preprocessed .rc file to a C++ file which will be used to make a static lib. COMMAND ${AWK} -v name=${TARGET_NAME} -f ${RC_TO_CPP} -f ${PROCESS_RC} ${PREPROCESSED_SOURCE} >${RESOURCE_ENTRY_ARRAY_CPP} - DEPENDS ${SOURCE} ${RC_TO_CPP} ${PROCESS_RC} + DEPENDS ${PREPROCESSED_SOURCE} ${RC_TO_CPP} ${PROCESS_RC} ) include_directories(${RESOURCE_STRING_HEADER_DIR}) diff --git a/src/ToolBox/SOS/diasdk/CMakeLists.txt b/src/ToolBox/SOS/diasdk/CMakeLists.txt deleted file mode 100644 index 07bbcdc9d98a..000000000000 --- a/src/ToolBox/SOS/diasdk/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -# replace backslashes in path with forward slash -STRING(REGEX REPLACE "\\\\" "/" VSINSTALLDIR $ENV{VSINSTALLDIR} ) - -# Generate managed type lib from dia2.idl -add_custom_target(dialib ALL - # generate tlb file from idl - COMMAND midl.exe /I"${VSINSTALLDIR}DIA SDK/include" /tlb ${CMAKE_CURRENT_BINARY_DIR}/dia2.tlb /Zp8 "${VSINSTALLDIR}DIA SDK/idl/dia2.idl" - # run tlbimp to generate managed type library - COMMAND TlbImp.exe /silent /namespace:Dia /unsafe /strictref:nopia ${CMAKE_CURRENT_BINARY_DIR}/dia2.tlb /out:${CMAKE_CURRENT_BINARY_DIR}/dialib.dll - COMMENT Generating managed type library from dia2.idl -) - -# In order to use dialib.dll as library target it needs to be imported into cmake -# Target is used in ToolBox/SOS/dactablegen/cmakelists.txt -add_library_clr(dialib_dll SHARED IMPORTED GLOBAL) -set_property(TARGET dialib_dll PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/dialib.dll) diff --git a/src/ToolBox/SOS/diasdk/native.rc b/src/ToolBox/SOS/diasdk/native.rc deleted file mode 100644 index 4c1007fd9a96..000000000000 --- a/src/ToolBox/SOS/diasdk/native.rc +++ /dev/null @@ -1,7 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -#define FX_VER_FILEDESCRIPTION_STR "Microsoft\0" - -#include -#include diff --git a/src/ToolBox/superpmi/mcs/CMakeLists.txt b/src/ToolBox/superpmi/mcs/CMakeLists.txt index 9f1bde4f5fd0..5a6a0e3515a9 100644 --- a/src/ToolBox/superpmi/mcs/CMakeLists.txt +++ b/src/ToolBox/superpmi/mcs/CMakeLists.txt @@ -43,15 +43,10 @@ set(MCS_SOURCES ../superpmi-shared/spmidumphelper.cpp ) -add_precompiled_header( - standardpch.h - ../superpmi-shared/standardpch.cpp - MCS_SOURCES -) - _add_executable(mcs ${MCS_SOURCES} ) +target_precompile_header(TARGET mcs HEADER standardpch.h) if(CLR_CMAKE_PLATFORM_UNIX) target_link_libraries(mcs diff --git a/src/ToolBox/superpmi/superpmi-shared/standardpch.cpp b/src/ToolBox/superpmi/superpmi-shared/standardpch.cpp deleted file mode 100644 index b61444351ef6..000000000000 --- a/src/ToolBox/superpmi/superpmi-shared/standardpch.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -// Don't touch this file: it's just here to create a precompiled header... -#include "standardpch.h" diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt b/src/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt index d79d3a583c33..5faf3be4cdb1 100644 --- a/src/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt +++ b/src/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt @@ -35,15 +35,8 @@ set(SUPERPMI_SHIM_COLLECTOR_SOURCES ../superpmi-shared/typeutils.cpp ../superpmi-shared/spmidumphelper.cpp ) - -add_precompiled_header( - standardpch.h - ../superpmi-shared/standardpch.cpp - SUPERPMI_SHIM_COLLECTOR_SOURCES -) - if (WIN32) - preprocess_def_file(${CMAKE_CURRENT_SOURCE_DIR}/superpmi-shim-collector.def ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-collector.def) + preprocess_file(${CMAKE_CURRENT_SOURCE_DIR}/superpmi-shim-collector.def ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-collector.def) list(APPEND SUPERPMI_SHIM_COLLECTOR_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-collector.def) endif (WIN32) @@ -53,6 +46,8 @@ _add_library(superpmi-shim-collector ${SUPERPMI_SHIM_COLLECTOR_SOURCES} ) +target_precompile_header(TARGET superpmi-shim-collector HEADER standardpch.h) + if(CLR_CMAKE_PLATFORM_UNIX) target_link_libraries(superpmi-shim-collector utilcodestaticnohost diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt b/src/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt index 3330c65e30da..2c0a27cc125f 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt +++ b/src/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt @@ -37,14 +37,8 @@ set(SUPERPMI_SHIM_COUNTER_SOURCES ../superpmi-shared/spmidumphelper.cpp ) -add_precompiled_header( - standardpch.h - ../superpmi-shared/standardpch.cpp - SUPERPMI_SHIM_COUNTER_SOURCES -) - if (WIN32) - preprocess_def_file(${CMAKE_CURRENT_SOURCE_DIR}/superpmi-shim-counter.def ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-counter.def) + preprocess_file(${CMAKE_CURRENT_SOURCE_DIR}/superpmi-shim-counter.def ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-counter.def) list(APPEND SUPERPMI_SHIM_COUNTER_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-counter.def) endif (WIN32) @@ -54,6 +48,8 @@ _add_library(superpmi-shim-counter ${SUPERPMI_SHIM_COUNTER_SOURCES} ) +target_precompile_header(TARGET superpmi-shim-counter HEADER standardpch.h) + if(CLR_CMAKE_PLATFORM_UNIX) target_link_libraries(superpmi-shim-counter utilcodestaticnohost diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt b/src/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt index 1b6e8472c61b..f97d57f42e99 100644 --- a/src/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt +++ b/src/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt @@ -36,14 +36,8 @@ set(SUPERPMI_SHIM_SIMPLE_SOURCES ../superpmi-shared/spmidumphelper.cpp ) -add_precompiled_header( - standardpch.h - ../superpmi-shared/standardpch.cpp - SUPERPMI_SHIM_SIMPLE_SOURCES -) - if (WIN32) - preprocess_def_file(${CMAKE_CURRENT_SOURCE_DIR}/superpmi-shim-simple.def ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-simple.def) + preprocess_file(${CMAKE_CURRENT_SOURCE_DIR}/superpmi-shim-simple.def ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-simple.def) list(APPEND SUPERPMI_SHIM_SIMPLE_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-simple.def) endif (WIN32) @@ -53,6 +47,8 @@ _add_library(superpmi-shim-simple ${SUPERPMI_SHIM_SIMPLE_SOURCES} ) +target_precompile_header(TARGET superpmi-shim-simple HEADER standardpch.h) + if(CLR_CMAKE_PLATFORM_UNIX) target_link_libraries(superpmi-shim-simple utilcodestaticnohost diff --git a/src/ToolBox/superpmi/superpmi/CMakeLists.txt b/src/ToolBox/superpmi/superpmi/CMakeLists.txt index 3bb3c6f0e831..a6a70115b319 100644 --- a/src/ToolBox/superpmi/superpmi/CMakeLists.txt +++ b/src/ToolBox/superpmi/superpmi/CMakeLists.txt @@ -43,16 +43,12 @@ set(SUPERPMI_SOURCES ../superpmi-shared/spmidumphelper.cpp ) -add_precompiled_header( - standardpch.h - ../superpmi-shared/standardpch.cpp - SUPERPMI_SOURCES -) - _add_executable(superpmi ${SUPERPMI_SOURCES} ) +target_precompile_header(TARGET superpmi HEADER standardpch.h) + if(CLR_CMAKE_PLATFORM_UNIX) target_link_libraries(superpmi utilcodestaticnohost diff --git a/src/binder/CMakeLists.txt b/src/binder/CMakeLists.txt index 07f6c15bffab..46f46e32397d 100644 --- a/src/binder/CMakeLists.txt +++ b/src/binder/CMakeLists.txt @@ -91,5 +91,16 @@ endif(WIN32) convert_to_absolute_path(BINDER_SOURCES ${BINDER_SOURCES}) convert_to_absolute_path(BINDER_CROSSGEN_SOURCES ${BINDER_CROSSGEN_SOURCES}) -add_subdirectory(v3binder) -add_subdirectory(v3binder_crossgen) +add_library_clr(v3binder + STATIC + ${BINDER_SOURCES} +) +add_dependencies(v3binder eventing_headers) + +add_library_clr(v3binder_crossgen + STATIC + ${BINDER_CROSSGEN_SOURCES} +) +add_dependencies(v3binder_crossgen eventing_headers) +set_target_properties(v3binder_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) + diff --git a/src/binder/v3binder/CMakeLists.txt b/src/binder/v3binder/CMakeLists.txt deleted file mode 100644 index 70a66eb654d7..000000000000 --- a/src/binder/v3binder/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_library_clr(v3binder - STATIC - ${BINDER_SOURCES} -) - -add_dependencies(v3binder eventing_headers) diff --git a/src/binder/v3binder_crossgen/CMakeLists.txt b/src/binder/v3binder_crossgen/CMakeLists.txt deleted file mode 100644 index 06dd0d886a38..000000000000 --- a/src/binder/v3binder_crossgen/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) - -add_library_clr(v3binder_crossgen - STATIC - ${BINDER_CROSSGEN_SOURCES} -) - -add_dependencies(v3binder_crossgen eventing_headers) diff --git a/src/debug/daccess/CMakeLists.txt b/src/debug/daccess/CMakeLists.txt index 241a629948de..bad942e86fae 100644 --- a/src/debug/daccess/CMakeLists.txt +++ b/src/debug/daccess/CMakeLists.txt @@ -1,6 +1,3 @@ - -include(${CLR_DIR}/dac.cmake) - add_definitions(-DFEATURE_NO_HOST) include_directories(BEFORE ${VM_DIR}) @@ -38,9 +35,9 @@ include_directories(${ARCH_SOURCES_DIR}) convert_to_absolute_path(DACCESS_SOURCES ${DACCESS_SOURCES}) -add_precompiled_header(stdafx.h stdafx.cpp DACCESS_SOURCES) - add_library_clr(daccess ${DACCESS_SOURCES}) +set_target_properties(daccess PROPERTIES DAC_COMPONENT TRUE) +target_precompile_header(TARGET daccess HEADER stdafx.h) add_dependencies(daccess eventing_headers) diff --git a/src/debug/daccess/stdafx.cpp b/src/debug/daccess/stdafx.cpp deleted file mode 100644 index f50897377933..000000000000 --- a/src/debug/daccess/stdafx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// File: stdafx.cpp -// - -// -// Host for precompiled headers. -// -//***************************************************************************** -#include "stdafx.h" // Precompiled header key. diff --git a/src/debug/di/CMakeLists.txt b/src/debug/di/CMakeLists.txt index 1c34eac59e69..7f0ca8b042fb 100644 --- a/src/debug/di/CMakeLists.txt +++ b/src/debug/di/CMakeLists.txt @@ -59,34 +59,7 @@ if(WIN32) if ((CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64) AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD) convert_to_absolute_path(CORDBDI_SOURCES_ASM_FILE ${CORDBDI_SOURCES_ASM_FILE}) - - # Inserts a custom command in CMake build to preprocess each asm source file - get_filename_component(name ${CORDBDI_SOURCES_ASM_FILE} NAME_WE) - file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${name}.asm" ASM_PREPROCESSED_FILE) - preprocess_def_file(${CORDBDI_SOURCES_ASM_FILE} ${ASM_PREPROCESSED_FILE}) - - # We do not pass any defines since we have already done pre-processing above - set (ASM_CMDLINE "-o ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj ${ASM_PREPROCESSED_FILE}") - - # Generate the batch file that will invoke the assembler - file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/runasm_${name}.cmd" ASM_SCRIPT_FILE) - - file(GENERATE OUTPUT "${ASM_SCRIPT_FILE}" - CONTENT "\"${CMAKE_ASM_MASM_COMPILER}\" -g ${ASM_CMDLINE}") - - message("Generated - ${ASM_SCRIPT_FILE}") - - # Need to compile asm file using custom command as include directories are not provided to asm compiler - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj - COMMAND ${ASM_SCRIPT_FILE} - DEPENDS ${ASM_PREPROCESSED_FILE} - COMMENT "Assembling ${ASM_PREPROCESSED_FILE} - ${ASM_SCRIPT_FILE}") - - # mark obj as source that does not require compile - set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${name}.obj PROPERTIES EXTERNAL_OBJECT TRUE) - - # Add the generated OBJ in the dependency list so that it gets consumed during linkage - set(CORDBDI_SOURCES_ASM_FILE ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj) + preprocess_compile_asm(ASM_FILES ${CORDBDI_SOURCES_ASM_FILE} OUTPUT_OBJECTS CORDBDI_SOURCES_ASM_FILE) endif() elseif(CLR_CMAKE_PLATFORM_UNIX) @@ -98,8 +71,6 @@ elseif(CLR_CMAKE_PLATFORM_UNIX) endif(WIN32) -add_precompiled_header(stdafx.h stdafx.cpp CORDBDI_SOURCES) - if (WIN32) convert_to_absolute_path(CORDBDI_HEADERS ${CORDBDI_HEADERS}) list(APPEND CORDBDI_SOURCES ${CORDBDI_HEADERS}) @@ -108,4 +79,5 @@ endif (WIN32) list(APPEND CORDBDI_SOURCES ${CORDBDI_SOURCES_ASM_FILE}) add_library_clr(cordbdi STATIC ${CORDBDI_SOURCES}) +target_precompile_header(TARGET cordbdi HEADER stdafx.h) add_dependencies(cordbdi eventing_headers) diff --git a/src/debug/di/stdafx.cpp b/src/debug/di/stdafx.cpp deleted file mode 100644 index 91eba1366654..000000000000 --- a/src/debug/di/stdafx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// stdafx.cpp -// - -// -// Host for precompiled header. -// -//***************************************************************************** -#include "stdafx.h" // Precompiled header key. diff --git a/src/debug/ee/dac/CMakeLists.txt b/src/debug/ee/dac/CMakeLists.txt index ceae5c9faafa..feb69474a9c7 100644 --- a/src/debug/ee/dac/CMakeLists.txt +++ b/src/debug/ee/dac/CMakeLists.txt @@ -1,11 +1,9 @@ -include(${CLR_DIR}/dac.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp CORDBEE_SOURCES_DAC) - if (WIN32) list(APPEND CORDBEE_SOURCES_DAC ${CORDBEE_HEADERS_DAC}) endif (WIN32) add_library_clr(cordbee_dac ${CORDBEE_SOURCES_DAC}) +set_target_properties(cordbee_dac PROPERTIES DAC_COMPONENT TRUE) +target_precompile_header(TARGET cordbee_dac HEADER stdafx.h) add_dependencies(cordbee_dac eventing_headers) diff --git a/src/debug/ee/stdafx.cpp b/src/debug/ee/stdafx.cpp deleted file mode 100644 index f50897377933..000000000000 --- a/src/debug/ee/stdafx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// File: stdafx.cpp -// - -// -// Host for precompiled headers. -// -//***************************************************************************** -#include "stdafx.h" // Precompiled header key. diff --git a/src/debug/ee/wks/CMakeLists.txt b/src/debug/ee/wks/CMakeLists.txt index 6a1a47c7b84c..aa1bc138efa5 100644 --- a/src/debug/ee/wks/CMakeLists.txt +++ b/src/debug/ee/wks/CMakeLists.txt @@ -1,7 +1,5 @@ if (WIN32) - add_precompiled_header(stdafx.h ../stdafx.cpp CORDBEE_SOURCES_WKS) - list(APPEND CORDBEE_SOURCES_WKS ${CORDBEE_HEADERS_WKS}) get_include_directories(ASM_INCLUDE_DIRECTORIES) @@ -11,28 +9,9 @@ if (WIN32) if(CLR_CMAKE_PLATFORM_ARCH_ARM OR CLR_CMAKE_PLATFORM_ARCH_ARM64) - get_filename_component(name ${ASM_FILE} NAME_WE) - file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${name}.asm" ASM_PREPROCESSED_FILE) - preprocess_def_file(${ASM_FILE} ${ASM_PREPROCESSED_FILE}) - - # We do not pass any defines since we have already done pre-processing above - set (ASM_CMDLINE "-o ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj ${ASM_PREPROCESSED_FILE}") - - # Generate the batch file that will invoke the assembler - file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/runasm_${name}.cmd" ASM_SCRIPT_FILE) - - file(GENERATE OUTPUT "${ASM_SCRIPT_FILE}" - CONTENT "\"${CMAKE_ASM_MASM_COMPILER}\" -g ${ASM_CMDLINE}") + preprocess_compile_asm(ASM_FILES ${ASM_FILE} OUTPUT_OBJECTS ASM_OBJECTS) - message("Generated - ${ASM_SCRIPT_FILE}") - - # Need to compile asm file using custom command as include directories are not provided to asm compiler - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj - COMMAND ${ASM_SCRIPT_FILE} - DEPENDS ${ASM_PREPROCESSED_FILE} - COMMENT "Assembling ${ASM_PREPROCESSED_FILE} - ${ASM_SCRIPT_FILE}") - - add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS} ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj) + add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS} ${ASM_OBJECTS}) else () @@ -42,13 +21,9 @@ if (WIN32) list (APPEND ASM_OPTIONS /safeseh) endif (CLR_CMAKE_PLATFORM_ARCH_I386) - # Need to compile asm file using custom command as include directories are not provided to asm compiler - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dbghelpers.obj - COMMAND ${CMAKE_ASM_MASM_COMPILER} ${ASM_INCLUDE_DIRECTORIES} ${ASM_DEFINITIONS} ${ASM_OPTIONS} /Fo${CMAKE_CURRENT_BINARY_DIR}/dbghelpers.obj /Ta${ASM_FILE} - DEPENDS ${ASM_FILE} - COMMENT "Compiling dbghelpers.asm") - - add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS} ${CMAKE_CURRENT_BINARY_DIR}/dbghelpers.obj) + set_source_files_properties(${ASM_FILE} PROPERTIES COMPILE_OPTIONS "${ASM_OPTIONS}") + + add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS} ${ASM_FILE}) endif() @@ -62,4 +37,5 @@ else () endif (WIN32) +target_precompile_header(TARGET cordbee_wks HEADER stdafx.h) add_dependencies(cordbee_wks eventing_headers) diff --git a/src/dlls/dbgshim/CMakeLists.txt b/src/dlls/dbgshim/CMakeLists.txt index ca4556bd0323..7a0275b13847 100644 --- a/src/dlls/dbgshim/CMakeLists.txt +++ b/src/dlls/dbgshim/CMakeLists.txt @@ -16,7 +16,7 @@ if(WIN32) dbgshim.rc ) - preprocess_def_file(${CMAKE_CURRENT_SOURCE_DIR}/dbgshim.ntdef ${CMAKE_CURRENT_BINARY_DIR}/dbgshim.def) + preprocess_file(${CMAKE_CURRENT_SOURCE_DIR}/dbgshim.ntdef ${CMAKE_CURRENT_BINARY_DIR}/dbgshim.def) list(APPEND DBGSHIM_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dbgshim.def) else(WIN32) set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dbgshim_unixexports.src) diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt index df8d615e0a83..715381da6a6f 100644 --- a/src/dlls/mscordac/CMakeLists.txt +++ b/src/dlls/mscordac/CMakeLists.txt @@ -1,4 +1,3 @@ -include(${CLR_DIR}/dac.cmake) add_definitions(-DFEATURE_NO_HOST) set(CLR_DAC_SOURCES @@ -17,7 +16,7 @@ if(WIN32) set(CURRENT_BINARY_DIR_FOR_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}) # Preprocess exports definition file - preprocess_def_file(${CMAKE_CURRENT_SOURCE_DIR}/${DEF_SOURCES} ${CURRENT_BINARY_DIR_FOR_CONFIG}/mscordac.def) + preprocess_file(${CMAKE_CURRENT_SOURCE_DIR}/${DEF_SOURCES} ${CURRENT_BINARY_DIR_FOR_CONFIG}/mscordac.def) # Create target to add file dependency on mscordac.def add_custom_target(mscordaccore_def DEPENDS ${CURRENT_BINARY_DIR_FOR_CONFIG}/mscordac.def) @@ -103,6 +102,8 @@ _add_library(mscordacobj OBJECT mscordac.cpp) add_library_clr(mscordaccore SHARED ${CLR_DAC_SOURCES} $) +set_target_properties(mscordacobj mscordaccore PROPERTIES DAC_COMPONENT TRUE) + if(CLR_CMAKE_PLATFORM_LINUX) add_dependencies(mscordaccore lib_redefines_inc) endif(CLR_CMAKE_PLATFORM_LINUX) diff --git a/src/dlls/mscordbi/CMakeLists.txt b/src/dlls/mscordbi/CMakeLists.txt index 87823a39e21c..78bff40a37cc 100644 --- a/src/dlls/mscordbi/CMakeLists.txt +++ b/src/dlls/mscordbi/CMakeLists.txt @@ -19,9 +19,7 @@ if(CLR_CMAKE_PLATFORM_LINUX) list(APPEND MSCORDBI_SOURCES ${PAL_REDEFINES_FILE}) endif(CLR_CMAKE_PLATFORM_LINUX) -if(WIN32) - add_precompiled_header(stdafx.h stdafx.cpp MSCORDBI_SOURCES) - +if(WIN32) add_definitions(-DFX_VER_INTERNALNAME_STR=mscordbi.dll) list(APPEND MSCORDBI_SOURCES @@ -34,7 +32,7 @@ if(WIN32) convert_to_absolute_path(DEF_SOURCES ${DEF_SOURCES}) - preprocess_def_file(${DEF_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/mscordbi.def) + preprocess_file(${DEF_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/mscordbi.def) list(APPEND MSCORDBI_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/mscordbi.def) else(WIN32) @@ -58,6 +56,7 @@ if(CLR_CMAKE_PLATFORM_DARWIN) endif(CLR_CMAKE_PLATFORM_DARWIN) add_library_clr(mscordbi SHARED ${MSCORDBI_SOURCES}) +target_precompile_header(TARGET mscordbi HEADER stdafx.h) if(CLR_CMAKE_PLATFORM_UNIX) add_custom_target(mscordbi_exports DEPENDS ${EXPORTS_FILE}) diff --git a/src/dlls/mscordbi/stdafx.cpp b/src/dlls/mscordbi/stdafx.cpp deleted file mode 100644 index a23e304c22e7..000000000000 --- a/src/dlls/mscordbi/stdafx.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// stdafx.cpp -// -// Precompiled headers. -// -//***************************************************************************** -#include "stdafx.h" diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt index 7c684a008196..0b89ee0bc30d 100644 --- a/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -1,22 +1,22 @@ if (WIN32) - preprocess_def_file(${DEF_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/coreclr.def) + preprocess_file(${DEF_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/coreclr.def) list(APPEND CLR_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/coreclr.def) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /ENTRY:CoreDllMain") + add_link_options(/ENTRY:CoreDllMain) # Incremental linking results in the linker inserting extra padding and routing function calls via thunks that can break the # invariants (e.g. size of region between Jit_PatchedCodeLast-Jit_PatchCodeStart needs to fit in a page). - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL:NO") + add_link_options(/INCREMENTAL:NO) # Delay load libraries required for WinRT as that is not supported on all platforms - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:api-ms-win-core-winrt-roparameterizediid-l1-1-0.dll") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:api-ms-win-ro-typeresolution-l1-1-0.dll") + add_link_options("/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll") + add_link_options("/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll") + add_link_options("/DELAYLOAD:api-ms-win-core-winrt-roparameterizediid-l1-1-0.dll") + add_link_options("/DELAYLOAD:api-ms-win-ro-typeresolution-l1-1-0.dll") # Delay load version.dll so that we can specify how to search when loading it as it is not part of Windows' known DLLs - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:version.dll") + add_link_options("/DELAYLOAD:version.dll") # No library groups for Win32 set(START_LIBRARY_GROUP) @@ -31,7 +31,7 @@ else() if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD OR CMAKE_SYSTEM_NAME STREQUAL NetBSD) # This option is necessary to ensure that the overloaded delete operator defined inside # of the utilcode will be used instead of the standard library delete operator. - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Xlinker -Bsymbolic-functions") + add_link_options("LINKER:-Bsymbolic,-Bsymbolic-functions") # The following linked options can be inserted into the linker libraries list to # ensure proper resolving of circular references between a subset of the libraries. @@ -181,19 +181,15 @@ if(WIN32) include(${CMAKE_INSTALL_PREFIX}/${CLR_CMAKE_CROSS_HOST_ARCH}/dactabletools/dactabletools.cmake) endif() - set(DACTABLEGEN_EXE $) - set(INJECT_RESOURCE_EXE $) - set(GEN_CLR_DEBUG_RESOURCE_EXE $) - add_custom_command( DEPENDS coreclr mscordaccore mscordbi ${CLR_DIR}/src/debug/daccess/daccess.cpp OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp COMMAND ${CMAKE_CXX_COMPILER} /P /EP /TP ${PREPROCESS_DEFINITIONS} ${INC_DIR} /Fi${CMAKE_CURRENT_BINARY_DIR}/daccess.i ${CLR_DIR}/src/debug/daccess/daccess.cpp - COMMAND ${DACTABLEGEN_EXE} /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$/coreclr.pdb /dll:$ /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin - COMMAND ${INJECT_RESOURCE_EXE} /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$ - COMMAND ${GEN_CLR_DEBUG_RESOURCE_EXE} /dac:$ /dbi:$ /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin - COMMAND ${INJECT_RESOURCE_EXE} /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$ /name:CLRDEBUGINFO - COMMAND ${INJECT_RESOURCE_EXE} /bin:${CMAKE_CURRENT_SOURCE_DIR}/dump_helper_resource.bin /dll:$ /name:MINIDUMP_AUXILIARY_PROVIDER + COMMAND dactablegen /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$/coreclr.pdb /dll:$ /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin + COMMAND InjectResource /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$ + COMMAND GenClrDebugResource /dac:$ /dbi:$ /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin + COMMAND InjectResource /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$ /name:CLRDEBUGINFO + COMMAND InjectResource /bin:${CMAKE_CURRENT_SOURCE_DIR}/dump_helper_resource.bin /dll:$ /name:MINIDUMP_AUXILIARY_PROVIDER COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp COMMENT Add dactable, debug resources, and dump helper resources to coreclr ) diff --git a/src/gcinfo/CMakeLists.txt b/src/gcinfo/CMakeLists.txt index c9c60db89e5f..970b1a91218f 100644 --- a/src/gcinfo/CMakeLists.txt +++ b/src/gcinfo/CMakeLists.txt @@ -16,8 +16,18 @@ endif(CLR_CMAKE_TARGET_ARCH_I386) convert_to_absolute_path(GCINFO_SOURCES ${GCINFO_SOURCES}) -add_subdirectory(lib) -add_subdirectory(crossgen) +add_library_clr(gcinfo + STATIC + ${GCINFO_SOURCES} +) + +add_library_clr(gcinfo_crossgen + STATIC + ${GCINFO_SOURCES} +) + +set_target_properties(gcinfo_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) + if (CLR_CMAKE_PLATFORM_ARCH_I386) # On x86, build RyuJIT/ARM32 cross-compiling altjit. diff --git a/src/gcinfo/crossgen/CMakeLists.txt b/src/gcinfo/crossgen/CMakeLists.txt deleted file mode 100644 index 5e1652147f92..000000000000 --- a/src/gcinfo/crossgen/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) - -add_library_clr(gcinfo_crossgen - STATIC - ${GCINFO_SOURCES} -) diff --git a/src/gcinfo/lib/CMakeLists.txt b/src/gcinfo/lib/CMakeLists.txt deleted file mode 100644 index ec44c2ba5f2d..000000000000 --- a/src/gcinfo/lib/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -add_library_clr(gcinfo - STATIC - ${GCINFO_SOURCES} -) diff --git a/src/jit/CMakeLists.txt b/src/jit/CMakeLists.txt index ea122ad1c889..feda3ad817ee 100644 --- a/src/jit/CMakeLists.txt +++ b/src/jit/CMakeLists.txt @@ -296,10 +296,9 @@ convert_to_absolute_path(JIT_ARM64_SOURCES ${JIT_ARM64_SOURCES}) if(WIN32) - add_precompiled_header(jitpch.h ../jitpch.cpp SOURCES) set(CLRJIT_EXPORTS ${CMAKE_CURRENT_LIST_DIR}/ClrJit.exports) set(JIT_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/ClrJit.exports.def) - preprocess_def_file (${CLRJIT_EXPORTS} ${JIT_EXPORTS_FILE}) + preprocess_file (${CLRJIT_EXPORTS} ${JIT_EXPORTS_FILE}) set(SHARED_LIB_SOURCES ${SOURCES} ${JIT_EXPORTS_FILE}) else() @@ -351,6 +350,8 @@ else() ) endif(CLR_CMAKE_PLATFORM_UNIX) +set(JIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + if (FEATURE_MERGE_JIT_AND_ENGINE) # Despite the directory being named "dll", it creates a static library "clrjit_static" to link into the VM. add_subdirectory(dll) diff --git a/src/jit/armelnonjit/CMakeLists.txt b/src/jit/armelnonjit/CMakeLists.txt index dea437416717..341aff6ef5b3 100644 --- a/src/jit/armelnonjit/CMakeLists.txt +++ b/src/jit/armelnonjit/CMakeLists.txt @@ -50,6 +50,8 @@ add_library_clr(armelnonjit ${JIT_ARCH_ALTJIT_SOURCES} ) +target_precompile_header(TARGET armelnonjit HEADER jitpch.h ADDITIONAL_INCLUDE_DIRECTORIES ${JIT_SOURCE_DIR}) + add_dependencies(armelnonjit jit_exports) set_property(TARGET armelnonjit APPEND_STRING PROPERTY LINK_FLAGS ${JIT_EXPORTS_LINKER_OPTION}) diff --git a/src/jit/crossgen/CMakeLists.txt b/src/jit/crossgen/CMakeLists.txt index e68bf590c7d7..331556febc7d 100644 --- a/src/jit/crossgen/CMakeLists.txt +++ b/src/jit/crossgen/CMakeLists.txt @@ -1,6 +1,6 @@ -include(${CLR_DIR}/crossgen.cmake) - add_library_clr(clrjit_crossgen ${SOURCES} ${JIT_ARCH_SOURCES}) if(FEATURE_MERGE_JIT_AND_ENGINE) target_link_libraries(clrjit_crossgen ${RYUJIT_LINK_LIBRARIES}) endif(FEATURE_MERGE_JIT_AND_ENGINE) +set_target_properties(clrjit_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +target_precompile_header(TARGET clrjit_crossgen HEADER jitpch.h ADDITIONAL_INCLUDE_DIRECTORIES ${JIT_SOURCE_DIR}) diff --git a/src/jit/dll/CMakeLists.txt b/src/jit/dll/CMakeLists.txt index 624e3579894d..2e8a254ca6d7 100644 --- a/src/jit/dll/CMakeLists.txt +++ b/src/jit/dll/CMakeLists.txt @@ -15,3 +15,4 @@ else() ${JIT_ARCH_SOURCES} ) endif(CLR_CMAKE_PLATFORM_UNIX) +target_precompile_header(TARGET clrjit_static HEADER jitpch.h ADDITIONAL_INCLUDE_DIRECTORIES ${JIT_SOURCE_DIR}) diff --git a/src/jit/jitpch.cpp b/src/jit/jitpch.cpp deleted file mode 100644 index 74300aefc3a1..000000000000 --- a/src/jit/jitpch.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -/*****************************************************************************/ - -#include "jitpch.h" diff --git a/src/jit/linuxnonjit/CMakeLists.txt b/src/jit/linuxnonjit/CMakeLists.txt index bcd11cf3f217..aeed8137dec1 100644 --- a/src/jit/linuxnonjit/CMakeLists.txt +++ b/src/jit/linuxnonjit/CMakeLists.txt @@ -34,6 +34,7 @@ add_library_clr(linuxnonjit ${SHARED_LIB_SOURCES} ${JIT_ARCH_ALTJIT_SOURCES} ) +target_precompile_header(TARGET linuxnonjit HEADER jitpch.h ADDITIONAL_INCLUDE_DIRECTORIES ${JIT_SOURCE_DIR}) add_dependencies(linuxnonjit jit_exports) diff --git a/src/jit/protojit/CMakeLists.txt b/src/jit/protojit/CMakeLists.txt index b5d4e08cfced..533d541d4e53 100644 --- a/src/jit/protojit/CMakeLists.txt +++ b/src/jit/protojit/CMakeLists.txt @@ -21,6 +21,8 @@ add_library_clr(protojit ${JIT_ARCH_SOURCES} ) +target_precompile_header(TARGET protojit HEADER jitpch.h ADDITIONAL_INCLUDE_DIRECTORIES ${JIT_SOURCE_DIR}) + add_dependencies(protojit jit_exports) set_property(TARGET protojit APPEND_STRING PROPERTY LINK_FLAGS ${JIT_EXPORTS_LINKER_OPTION}) diff --git a/src/jit/protononjit/CMakeLists.txt b/src/jit/protononjit/CMakeLists.txt index 951733330803..f7466a854938 100644 --- a/src/jit/protononjit/CMakeLists.txt +++ b/src/jit/protononjit/CMakeLists.txt @@ -48,6 +48,8 @@ add_library_clr(protononjit ${JIT_ARCH_ALTJIT_SOURCES} ) +target_precompile_header(TARGET protononjit HEADER jitpch.h ADDITIONAL_INCLUDE_DIRECTORIES ${JIT_SOURCE_DIR}) + add_dependencies(protononjit jit_exports) set_property(TARGET protononjit APPEND_STRING PROPERTY LINK_FLAGS ${JIT_EXPORTS_LINKER_OPTION}) diff --git a/src/jit/standalone/CMakeLists.txt b/src/jit/standalone/CMakeLists.txt index f893ddc667ad..572bfc7682d6 100644 --- a/src/jit/standalone/CMakeLists.txt +++ b/src/jit/standalone/CMakeLists.txt @@ -20,6 +20,8 @@ add_library_clr(clrjit ${JIT_ARCH_SOURCES} ) +target_precompile_header(TARGET clrjit HEADER jitpch.h ADDITIONAL_INCLUDE_DIRECTORIES ${JIT_SOURCE_DIR}) + add_dependencies(clrjit jit_exports) set_property(TARGET clrjit APPEND_STRING PROPERTY LINK_FLAGS ${JIT_EXPORTS_LINKER_OPTION}) diff --git a/src/md/CMakeLists.txt b/src/md/CMakeLists.txt index a640b095763b..7899de11eb7b 100644 --- a/src/md/CMakeLists.txt +++ b/src/md/CMakeLists.txt @@ -1,3 +1,19 @@ + +add_compile_definitions(FEATURE_METADATA_EMIT) +add_compile_definitions(FEATURE_METADATA_INTERNAL_APIS) +add_compile_definitions($<$>,$>>:FEATURE_METADATA_EMIT_IN_DEBUGGER>) +add_compile_definitions($<$>,$>>>:FEATURE_METADATA_IN_VM>) +add_compile_definitions($<$>:FEATURE_METADATA_CUSTOM_DATA_SOURCE>) +add_compile_definitions($<$>:FEATURE_METADATA_DEBUGGEE_DATA_SOURCE>) +add_compile_definitions($<$>:FEATURE_METADATA_LOAD_TRUSTED_IMAGES>) +add_compile_definitions($<$>:FEATURE_METADATA_RELEASE_MEMORY_ON_REOPEN>) + +if (WIN32) + add_compile_options($<$>,$>:-MTd>) + add_compile_options($<$>,$>>:-MT>) + add_compile_definitions($<$>,$>>>:FEATURE_METADATA_VERIFY_LAYOUTS>) +endif() + add_subdirectory(compiler) add_subdirectory(runtime) add_subdirectory(enc) @@ -6,5 +22,5 @@ add_subdirectory(ceefilegen) add_subdirectory(datasource) add_subdirectory(staticmd) if(WIN32) -add_subdirectory(winmd) + add_subdirectory(winmd) endif(WIN32) diff --git a/src/md/ceefilegen/CMakeLists.txt b/src/md/ceefilegen/CMakeLists.txt index 57d4cb6338cb..75faa168cc15 100644 --- a/src/md/ceefilegen/CMakeLists.txt +++ b/src/md/ceefilegen/CMakeLists.txt @@ -21,8 +21,6 @@ set(CEEFILEGEN_HEADERS ../../inc/utilcode.h ) -add_precompiled_header(stdafx.h stdafx.cpp CEEFILEGEN_SOURCES) - if (WIN32) list(APPEND CEEFILEGEN_SOURCES ${CEEFILEGEN_HEADERS}) endif (WIN32) @@ -31,3 +29,4 @@ add_library_clr(ceefgen STATIC ${CEEFILEGEN_SOURCES} ) +target_precompile_header(TARGET ceefgen HEADER stdafx.h) diff --git a/src/md/ceefilegen/stdafx.cpp b/src/md/ceefilegen/stdafx.cpp deleted file mode 100644 index 91eba1366654..000000000000 --- a/src/md/ceefilegen/stdafx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// stdafx.cpp -// - -// -// Host for precompiled header. -// -//***************************************************************************** -#include "stdafx.h" // Precompiled header key. diff --git a/src/md/compiler/CMakeLists.txt b/src/md/compiler/CMakeLists.txt index 260731d4a343..cc9ba348f8d0 100644 --- a/src/md/compiler/CMakeLists.txt +++ b/src/md/compiler/CMakeLists.txt @@ -51,7 +51,22 @@ set(MDCOMPILER_HEADERS convert_to_absolute_path(MDCOMPILER_SOURCES ${MDCOMPILER_SOURCES}) convert_to_absolute_path(MDCOMPILER_HEADERS ${MDCOMPILER_HEADERS}) -add_subdirectory(dac) -add_subdirectory(wks) -add_subdirectory(dbi) -add_subdirectory(crossgen) +if (WIN32) + list(APPEND MDCOMPILER_SOURCES ${MDCOMPILER_HEADERS}) +endif() + +add_library_clr(mdcompiler_dac ${MDCOMPILER_SOURCES}) +set_target_properties(mdcompiler_dac PROPERTIES DAC_COMPONENT TRUE) +target_precompile_header(TARGET mdcompiler_dac HEADER stdafx.h) + +add_library_clr(mdcompiler_wks ${MDCOMPILER_SOURCES}) +target_compile_definitions(mdcompiler_wks PRIVATE FEATURE_METADATA_EMIT_ALL) +target_precompile_header(TARGET mdcompiler_wks HEADER stdafx.h) + +add_library_clr(mdcompiler-dbi ${MDCOMPILER_SOURCES}) +set_target_properties(mdcompiler-dbi PROPERTIES DBI_COMPONENT TRUE) +target_precompile_header(TARGET mdcompiler-dbi HEADER stdafx.h) + +add_library_clr(mdcompiler_crossgen ${MDCOMPILER_SOURCES}) +set_target_properties(mdcompiler_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +target_precompile_header(TARGET mdcompiler_crossgen HEADER stdafx.h) diff --git a/src/md/compiler/crossgen/CMakeLists.txt b/src/md/compiler/crossgen/CMakeLists.txt deleted file mode 100644 index e732ef637cde..000000000000 --- a/src/md/compiler/crossgen/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) -include(../../md_wks.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDCOMPILER_SOURCES) - -if (WIN32) - list(APPEND MDCOMPILER_SOURCES ${MDCOMPILER_HEADERS}) -endif (WIN32) - -add_library_clr(mdcompiler_crossgen ${MDCOMPILER_SOURCES}) diff --git a/src/md/compiler/dac/CMakeLists.txt b/src/md/compiler/dac/CMakeLists.txt deleted file mode 100644 index 80041f3fdb16..000000000000 --- a/src/md/compiler/dac/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ - -include(${CLR_DIR}/dac.cmake) -include(../../md_dac.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDCOMPILER_SOURCES) - -if (WIN32) - list(APPEND MDCOMPILER_SOURCES ${MDCOMPILER_HEADERS}) -endif (WIN32) - -add_library_clr(mdcompiler_dac ${MDCOMPILER_SOURCES}) diff --git a/src/md/compiler/dbi/CMakeLists.txt b/src/md/compiler/dbi/CMakeLists.txt deleted file mode 100644 index ee7a2cbbd7fa..000000000000 --- a/src/md/compiler/dbi/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include(../../md_dbi.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDCOMPILER_SOURCES) - -if (WIN32) - list(APPEND MDCOMPILER_SOURCES ${MDCOMPILER_HEADERS}) -endif (WIN32) - -add_library_clr(mdcompiler-dbi ${MDCOMPILER_SOURCES}) diff --git a/src/md/compiler/stdafx.cpp b/src/md/compiler/stdafx.cpp deleted file mode 100644 index ff341e19a7fb..000000000000 --- a/src/md/compiler/stdafx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// stdafx.cpp -// - -// -// Precompiled headers. -// -//***************************************************************************** -#include "stdafx.h" diff --git a/src/md/compiler/wks/CMakeLists.txt b/src/md/compiler/wks/CMakeLists.txt deleted file mode 100644 index c4cf62e33bb6..000000000000 --- a/src/md/compiler/wks/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -include(../../md_wks.cmake) - -add_definitions(-DFEATURE_METADATA_EMIT_ALL) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDCOMPILER_SOURCES) - -if (WIN32) - list(APPEND MDCOMPILER_SOURCES ${MDCOMPILER_HEADERS}) -endif (WIN32) - -add_library_clr(mdcompiler_wks ${MDCOMPILER_SOURCES}) diff --git a/src/md/datasource/CMakeLists.txt b/src/md/datasource/CMakeLists.txt index 3aaa00afa21b..0a842fca36b7 100644 --- a/src/md/datasource/CMakeLists.txt +++ b/src/md/datasource/CMakeLists.txt @@ -16,4 +16,10 @@ set(MDDATASOURCE_HEADERS convert_to_absolute_path(MDDATASOURCE_SOURCES ${MDDATASOURCE_SOURCES}) convert_to_absolute_path(MDDATASOURCE_HEADERS ${MDDATASOURCE_HEADERS}) -add_subdirectory(dbi) +if (WIN32) + list(APPEND MDDATASOURCE_SOURCES ${MDDATASOURCE_HEADERS}) +endif (WIN32) + +add_library_clr(mddatasource_dbi STATIC ${MDDATASOURCE_SOURCES}) +set_target_properties(mddatasource_dbi PROPERTIES DBI_COMPONENT TRUE) +target_precompile_header(TARGET mddatasource_dbi HEADER stdafx.h) diff --git a/src/md/datasource/dbi/CMakeLists.txt b/src/md/datasource/dbi/CMakeLists.txt deleted file mode 100644 index f392a20599fd..000000000000 --- a/src/md/datasource/dbi/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include(../../md_dbi.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDDATASOURCE_SOURCES) - -if (WIN32) - list(APPEND MDDATASOURCE_SOURCES ${MDDATASOURCE_HEADERS}) -endif (WIN32) - -add_library_clr(mddatasource_dbi STATIC ${MDDATASOURCE_SOURCES}) diff --git a/src/md/datasource/stdafx.cpp b/src/md/datasource/stdafx.cpp deleted file mode 100644 index ff341e19a7fb..000000000000 --- a/src/md/datasource/stdafx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// stdafx.cpp -// - -// -// Precompiled headers. -// -//***************************************************************************** -#include "stdafx.h" diff --git a/src/md/enc/CMakeLists.txt b/src/md/enc/CMakeLists.txt index 2f1398d6f19f..e6773e9cebf4 100644 --- a/src/md/enc/CMakeLists.txt +++ b/src/md/enc/CMakeLists.txt @@ -44,7 +44,18 @@ endif(WIN32) convert_to_absolute_path(MDRUNTIMERW_HEADERS ${MDRUNTIMERW_HEADERS}) convert_to_absolute_path(MDRUNTIMERW_SOURCES ${MDRUNTIMERW_SOURCES}) -add_subdirectory(dac) -add_subdirectory(wks) -add_subdirectory(dbi) -add_subdirectory(crossgen) +add_library_clr(mdruntimerw_dac ${MDRUNTIMERW_SOURCES}) +set_target_properties(mdruntimerw_dac PROPERTIES DAC_COMPONENT TRUE) +target_precompile_header(TARGET mdruntimerw_dac HEADER stdafx.h) + +add_library_clr(mdruntimerw_wks ${MDRUNTIMERW_SOURCES}) +target_compile_definitions(mdruntimerw_wks PRIVATE FEATURE_METADATA_EMIT_ALL) +target_precompile_header(TARGET mdruntimerw_wks HEADER stdafx.h) + +add_library_clr(mdruntimerw-dbi ${MDRUNTIMERW_SOURCES}) +set_target_properties(mdruntimerw-dbi PROPERTIES DBI_COMPONENT TRUE) +target_precompile_header(TARGET mdruntimerw-dbi HEADER stdafx.h) + +add_library_clr(mdruntimerw_crossgen ${MDRUNTIMERW_SOURCES}) +set_target_properties(mdruntimerw_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +target_precompile_header(TARGET mdruntimerw_crossgen HEADER stdafx.h) diff --git a/src/md/enc/crossgen/CMakeLists.txt b/src/md/enc/crossgen/CMakeLists.txt deleted file mode 100644 index 86aa43294541..000000000000 --- a/src/md/enc/crossgen/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) -include(../../md_wks.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIMERW_SOURCES) - -if (WIN32) - list(APPEND MDRUNTIMERW_SOURCES ${MDRUNTIMERW_HEADERS}) -endif (WIN32) - -add_library_clr(mdruntimerw_crossgen ${MDRUNTIMERW_SOURCES}) diff --git a/src/md/enc/dac/CMakeLists.txt b/src/md/enc/dac/CMakeLists.txt deleted file mode 100644 index c4ba31df97b9..000000000000 --- a/src/md/enc/dac/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ - -include(${CLR_DIR}/dac.cmake) -include(../../md_dac.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIMERW_SOURCES) - -if (WIN32) - list(APPEND MDRUNTIMERW_SOURCES ${MDRUNTIMERW_HEADERS}) -endif (WIN32) - -add_library_clr(mdruntimerw_dac ${MDRUNTIMERW_SOURCES}) diff --git a/src/md/enc/dbi/CMakeLists.txt b/src/md/enc/dbi/CMakeLists.txt deleted file mode 100644 index d59193714871..000000000000 --- a/src/md/enc/dbi/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include(../../md_dbi.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIMERW_SOURCES) - -if (WIN32) - list(APPEND MDRUNTIMERW_SOURCES ${MDRUNTIMERW_HEADERS}) -endif (WIN32) - -add_library_clr(mdruntimerw-dbi ${MDRUNTIMERW_SOURCES}) diff --git a/src/md/enc/stdafx.cpp b/src/md/enc/stdafx.cpp deleted file mode 100644 index ff341e19a7fb..000000000000 --- a/src/md/enc/stdafx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// stdafx.cpp -// - -// -// Precompiled headers. -// -//***************************************************************************** -#include "stdafx.h" diff --git a/src/md/enc/wks/CMakeLists.txt b/src/md/enc/wks/CMakeLists.txt deleted file mode 100644 index ff4ec935d0a5..000000000000 --- a/src/md/enc/wks/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -include(../../md_wks.cmake) - -add_definitions(-DFEATURE_METADATA_EMIT_ALL) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIMERW_SOURCES) - -if (WIN32) - list(APPEND MDRUNTIMERW_SOURCES ${MDRUNTIMERW_HEADERS}) -endif (WIN32) - -add_library_clr(mdruntimerw_wks ${MDRUNTIMERW_SOURCES}) diff --git a/src/md/hotdata/CMakeLists.txt b/src/md/hotdata/CMakeLists.txt index 92a16cc9f2ae..37a2545cfa5d 100644 --- a/src/md/hotdata/CMakeLists.txt +++ b/src/md/hotdata/CMakeLists.txt @@ -25,9 +25,22 @@ set(MDHOTDATA_HEADERS convert_to_absolute_path(MDHOTDATA_HEADERS ${MDHOTDATA_HEADERS}) convert_to_absolute_path(MDHOTDATA_SOURCES ${MDHOTDATA_SOURCES}) -add_subdirectory(dac) -add_subdirectory(full) -add_subdirectory(crossgen) +if (WIN32) + list(APPEND MDHOTDATA_SOURCES ${MDHOTDATA_HEADERS}) +endif (WIN32) + +add_library_clr(mdhotdata_dac ${MDHOTDATA_SOURCES}) +set_target_properties(mdhotdata_dac PROPERTIES DAC_COMPONENT TRUE) +target_precompile_header(TARGET mdhotdata_dac HEADER external.h) + +add_library_clr(mdhotdata_full ${MDHOTDATA_SOURCES}) +target_precompile_header(TARGET mdhotdata_full HEADER external.h) + +add_library_clr(mdhotdata_crossgen ${MDHOTDATA_SOURCES}) +set_target_properties(mdhotdata_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +target_precompile_header(TARGET mdhotdata_crossgen HEADER external.h) + if(WIN32) - add_subdirectory(full-staticcrt) + add_library_clr(mdhotdata-staticcrt ${MDHOTDATA_SOURCES}) + target_precompile_header(TARGET mdhotdata-staticcrt HEADER external.h) endif(WIN32) diff --git a/src/md/hotdata/crossgen/CMakeLists.txt b/src/md/hotdata/crossgen/CMakeLists.txt deleted file mode 100644 index 4403c2fd688e..000000000000 --- a/src/md/hotdata/crossgen/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) -include(../../md_wks.cmake) - -add_precompiled_header(external.h ../external.cpp MDHOTDATA_SOURCES) - -if (WIN32) - list(APPEND MDHOTDATA_SOURCES ${MDHOTDATA_HEADERS}) -endif (WIN32) - -add_library_clr(mdhotdata_crossgen ${MDHOTDATA_SOURCES}) diff --git a/src/md/hotdata/dac/CMakeLists.txt b/src/md/hotdata/dac/CMakeLists.txt deleted file mode 100644 index 67b8408cf20e..000000000000 --- a/src/md/hotdata/dac/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ - -include(${CLR_DIR}/dac.cmake) - -add_precompiled_header(external.h ../external.cpp MDHOTDATA_SOURCES) - -if (WIN32) - list(APPEND MDHOTDATA_SOURCES ${MDHOTDATA_HEADERS}) -endif (WIN32) - -add_library_clr(mdhotdata_dac ${MDHOTDATA_SOURCES}) diff --git a/src/md/hotdata/external.cpp b/src/md/hotdata/external.cpp deleted file mode 100644 index 26ec26d9a4d7..000000000000 --- a/src/md/hotdata/external.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// -// File: external.cpp -// - -// -// Precompiled headers. -// -// ====================================================================================== - -#include "external.h" diff --git a/src/md/hotdata/full-staticcrt/CMakeLists.txt b/src/md/hotdata/full-staticcrt/CMakeLists.txt deleted file mode 100644 index d702032e9005..000000000000 --- a/src/md/hotdata/full-staticcrt/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -add_definitions(-D_CRTIMP=) # static link of crt - -add_precompiled_header(external.h ../external.cpp MDHOTDATA_SOURCES) - -if (WIN32) - list(APPEND MDHOTDATA_SOURCES ${MDHOTDATA_HEADERS}) -endif (WIN32) - -add_library_clr(mdhotdata-staticcrt ${MDHOTDATA_SOURCES}) diff --git a/src/md/hotdata/full/CMakeLists.txt b/src/md/hotdata/full/CMakeLists.txt deleted file mode 100644 index 1b97ff3db34a..000000000000 --- a/src/md/hotdata/full/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_precompiled_header(external.h ../external.cpp MDHOTDATA_SOURCES) - -if (WIN32) - list(APPEND MDHOTDATA_SOURCES ${MDHOTDATA_HEADERS}) -endif (WIN32) - -add_library_clr(mdhotdata_full ${MDHOTDATA_SOURCES}) diff --git a/src/md/md_dac.cmake b/src/md/md_dac.cmake deleted file mode 100644 index 1820a555aa73..000000000000 --- a/src/md/md_dac.cmake +++ /dev/null @@ -1,3 +0,0 @@ -add_definitions(-DFEATURE_METADATA_EMIT) -add_definitions(-DFEATURE_METADATA_INTERNAL_APIS) -add_definitions(-DFEATURE_METADATA_EMIT_IN_DEBUGGER) \ No newline at end of file diff --git a/src/md/md_dbi.cmake b/src/md/md_dbi.cmake deleted file mode 100644 index 7622cf04c92d..000000000000 --- a/src/md/md_dbi.cmake +++ /dev/null @@ -1,17 +0,0 @@ -add_definitions(-DFEATURE_METADATA_EMIT) -add_definitions(-DFEATURE_METADATA_EMIT_IN_DEBUGGER) -add_definitions(-DFEATURE_METADATA_INTERNAL_APIS) -add_definitions(-DFEATURE_METADATA_CUSTOM_DATA_SOURCE) -add_definitions(-DFEATURE_METADATA_DEBUGGEE_DATA_SOURCE) -# Enable mscordbi-only (perf) feature --> -add_definitions(-DFEATURE_METADATA_LOAD_TRUSTED_IMAGES -DFEATURE_METADATA_RELEASE_MEMORY_ON_REOPEN) - - -if(WIN32) - # using static crt for dbi - if (CMAKE_BUILD_TYPE STREQUAL DEBUG) - add_definitions(-MTd) - else() - add_definitions(-MT) - endif(CMAKE_BUILD_TYPE STREQUAL DEBUG) -endif(WIN32) diff --git a/src/md/md_wks.cmake b/src/md/md_wks.cmake deleted file mode 100644 index 4d72c55a145d..000000000000 --- a/src/md/md_wks.cmake +++ /dev/null @@ -1,6 +0,0 @@ -add_definitions(-DFEATURE_METADATA_EMIT) -add_definitions(-DFEATURE_METADATA_INTERNAL_APIS) -add_definitions(-DFEATURE_METADATA_IN_VM) -if(WIN32) - add_definitions(-DFEATURE_METADATA_VERIFY_LAYOUTS) -endif(WIN32) diff --git a/src/md/runtime/CMakeLists.txt b/src/md/runtime/CMakeLists.txt index fc817b1f0d71..c5a78fc97278 100644 --- a/src/md/runtime/CMakeLists.txt +++ b/src/md/runtime/CMakeLists.txt @@ -41,7 +41,22 @@ set(MDRUNTIME_HEADERS convert_to_absolute_path(MDRUNTIME_HEADERS ${MDRUNTIME_HEADERS}) convert_to_absolute_path(MDRUNTIME_SOURCES ${MDRUNTIME_SOURCES}) -add_subdirectory(dac) -add_subdirectory(wks) -add_subdirectory(dbi) -add_subdirectory(crossgen) +if (WIN32) + list(APPEND MDRUNTIME_SOURCES ${MDRUNTIME_HEADERS}) +endif (WIN32) + +add_library_clr(mdruntime_dac ${MDRUNTIME_SOURCES}) +set_target_properties(mdruntime_dac PROPERTIES DAC_COMPONENT TRUE) +target_precompile_header(TARGET mdruntime_dac HEADER stdafx.h) + +add_library_clr(mdruntime_wks ${MDRUNTIME_SOURCES}) +target_compile_definitions(mdruntime_wks PRIVATE FEATURE_METADATA_EMIT_ALL) +target_precompile_header(TARGET mdruntime_wks HEADER stdafx.h) + +add_library_clr(mdruntime-dbi ${MDRUNTIME_SOURCES}) +set_target_properties(mdruntime-dbi PROPERTIES DBI_COMPONENT TRUE) +target_precompile_header(TARGET mdruntime-dbi HEADER stdafx.h) + +add_library_clr(mdruntime_crossgen ${MDRUNTIME_SOURCES}) +set_target_properties(mdruntime_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +target_precompile_header(TARGET mdruntime_crossgen HEADER stdafx.h) diff --git a/src/md/runtime/crossgen/CMakeLists.txt b/src/md/runtime/crossgen/CMakeLists.txt deleted file mode 100644 index e778a8601ed2..000000000000 --- a/src/md/runtime/crossgen/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) -include(../../md_wks.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIME_SOURCES) - -if (WIN32) - list(APPEND MDRUNTIME_SOURCES ${MDRUNTIME_HEADERS}) -endif (WIN32) - -add_library_clr(mdruntime_crossgen ${MDRUNTIME_SOURCES}) diff --git a/src/md/runtime/dac/CMakeLists.txt b/src/md/runtime/dac/CMakeLists.txt deleted file mode 100644 index ba6d4f0de886..000000000000 --- a/src/md/runtime/dac/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ - -include(${CLR_DIR}/dac.cmake) -include(../../md_dac.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIME_SOURCES) - -if (WIN32) - list(APPEND MDRUNTIME_SOURCES ${MDRUNTIME_HEADERS}) -endif (WIN32) - -add_library_clr(mdruntime_dac ${MDRUNTIME_SOURCES}) \ No newline at end of file diff --git a/src/md/runtime/dbi/CMakeLists.txt b/src/md/runtime/dbi/CMakeLists.txt deleted file mode 100644 index 4d2ebe48711b..000000000000 --- a/src/md/runtime/dbi/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include(../../md_dbi.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIME_SOURCES) - -if (WIN32) - list(APPEND MDRUNTIME_SOURCES ${MDRUNTIME_HEADERS}) -endif (WIN32) - -add_library_clr(mdruntime-dbi ${MDRUNTIME_SOURCES}) diff --git a/src/md/runtime/stdafx.cpp b/src/md/runtime/stdafx.cpp deleted file mode 100644 index ff341e19a7fb..000000000000 --- a/src/md/runtime/stdafx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// stdafx.cpp -// - -// -// Precompiled headers. -// -//***************************************************************************** -#include "stdafx.h" diff --git a/src/md/runtime/wks/CMakeLists.txt b/src/md/runtime/wks/CMakeLists.txt deleted file mode 100644 index c8c52f59f2d8..000000000000 --- a/src/md/runtime/wks/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -include(../../md_wks.cmake) - -add_definitions(-DFEATURE_METADATA_EMIT_ALL) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIME_SOURCES) - -if (WIN32) - list(APPEND MDRUNTIME_SOURCES ${MDRUNTIME_HEADERS}) -endif (WIN32) - -add_library_clr(mdruntime_wks ${MDRUNTIME_SOURCES}) diff --git a/src/md/winmd/CMakeLists.txt b/src/md/winmd/CMakeLists.txt index 567a9758f136..6cee65a18eab 100644 --- a/src/md/winmd/CMakeLists.txt +++ b/src/md/winmd/CMakeLists.txt @@ -20,9 +20,25 @@ set(MDWINMD_HEADERS convert_to_absolute_path(MDWINMD_HEADERS ${MDWINMD_HEADERS}) convert_to_absolute_path(MDWINMD_SOURCES ${MDWINMD_SOURCES}) -add_subdirectory(dac) -add_subdirectory(wks) +if (WIN32) + list(APPEND MDWINMD_SOURCES ${MDWINMD_HEADERS}) +endif (WIN32) + + +add_library_clr(mdwinmd_dac ${MDWINMD_SOURCES}) +set_target_properties(mdwinmd_dac PROPERTIES DAC_COMPONENT TRUE) +target_precompile_header(TARGET mdwinmd_dac HEADER stdafx.h) + +add_library_clr(mdwinmd_wks ${MDWINMD_SOURCES}) +target_compile_definitions(mdwinmd_wks PRIVATE FEATURE_METADATA_EMIT_ALL) +target_precompile_header(TARGET mdwinmd_wks HEADER stdafx.h) + if(WIN32) - add_subdirectory(dbi) - add_subdirectory(crossgen) + add_library_clr(mdwinmd_dbi ${MDWINMD_SOURCES}) + set_target_properties(mdwinmd_dbi PROPERTIES DBI_COMPONENT TRUE) + target_precompile_header(TARGET mdwinmd_dbi HEADER stdafx.h) + + add_library_clr(mdwinmd_crossgen ${MDWINMD_SOURCES}) + set_target_properties(mdwinmd_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) + target_precompile_header(TARGET mdwinmd_crossgen HEADER stdafx.h) endif(WIN32) diff --git a/src/md/winmd/crossgen/CMakeLists.txt b/src/md/winmd/crossgen/CMakeLists.txt deleted file mode 100644 index 670514a3ab28..000000000000 --- a/src/md/winmd/crossgen/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) -include(../../md_wks.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDWINMD_SOURCES) - -if (WIN32) - list(APPEND MDWINMD_SOURCES ${MDWINMD_HEADERS}) -endif (WIN32) - -add_library_clr(mdwinmd_crossgen ${MDWINMD_SOURCES}) diff --git a/src/md/winmd/dac/CMakeLists.txt b/src/md/winmd/dac/CMakeLists.txt deleted file mode 100644 index 1ed4aec55047..000000000000 --- a/src/md/winmd/dac/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ - -include(${CLR_DIR}/dac.cmake) -include(../../md_dbi.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDWINMD_SOURCES) - -if (WIN32) - list(APPEND MDWINMD_SOURCES ${MDWINMD_HEADERS}) -endif (WIN32) - -add_library_clr(mdwinmd_dac ${MDWINMD_SOURCES}) diff --git a/src/md/winmd/dbi/CMakeLists.txt b/src/md/winmd/dbi/CMakeLists.txt deleted file mode 100644 index 669018e38793..000000000000 --- a/src/md/winmd/dbi/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include(../../md_dbi.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDWINMD_SOURCES) - -if (WIN32) - list(APPEND MDWINMD_SOURCES ${MDWINMD_HEADERS}) -endif (WIN32) - -add_library_clr(mdwinmd_dbi ${MDWINMD_SOURCES}) diff --git a/src/md/winmd/wks/CMakeLists.txt b/src/md/winmd/wks/CMakeLists.txt deleted file mode 100644 index 930dbca9cfb9..000000000000 --- a/src/md/winmd/wks/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -include(../../md_wks.cmake) - -add_definitions(-DFEATURE_METADATA_EMIT_ALL) - -add_precompiled_header(stdafx.h ../stdafx.cpp MDWINMD_SOURCES) - -if (WIN32) - list(APPEND MDWINMD_SOURCES ${MDWINMD_HEADERS}) -endif (WIN32) - -add_library_clr(mdwinmd_wks ${MDWINMD_SOURCES}) diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index 1a5b3b33e4a4..2fabeb11f224 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -58,9 +58,7 @@ if(CORECLR_SET_RPATH) set(MACOSX_RPATH ON) endif(CORECLR_SET_RPATH) -if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0) - cmake_policy(SET CMP0042 NEW) -endif() +cmake_policy(SET CMP0042 NEW) # Include directories diff --git a/src/pal/src/eventprovider/dummyprovider/CMakeLists.txt b/src/pal/src/eventprovider/dummyprovider/CMakeLists.txt index 684aadd175b2..18ada86bdc3e 100644 --- a/src/pal/src/eventprovider/dummyprovider/CMakeLists.txt +++ b/src/pal/src/eventprovider/dummyprovider/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 2.8.12) -include(FindPythonInterp) +include(FindPython) set (GENERATE_SCRIPT ${CLR_DIR}/src/scripts/genDummyProvider.py) -set(GENERATE_COMMAND ${PYTHON_EXECUTABLE} ${GENERATE_SCRIPT} --man ${EVENT_MANIFEST} --intermediate ${CMAKE_CURRENT_BINARY_DIR}) +set(GENERATE_COMMAND ${Python_EXECUTABLE} ${GENERATE_SCRIPT} --man ${EVENT_MANIFEST} --intermediate ${CMAKE_CURRENT_BINARY_DIR}) execute_process( COMMAND ${GENERATE_COMMAND} --dry-run diff --git a/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt index 1f49aef64e0a..1e6c8112b5af 100644 --- a/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt +++ b/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 2.8.12) -include(FindPythonInterp) +include(FindPython) set (GENERATE_SCRIPT ${CLR_DIR}/src/scripts/genLttngProvider.py) -set(GENERATE_COMMAND ${PYTHON_EXECUTABLE} ${GENERATE_SCRIPT} --man ${EVENT_MANIFEST} --intermediate ${CMAKE_CURRENT_BINARY_DIR}) +set(GENERATE_COMMAND ${Python_EXECUTABLE} ${GENERATE_SCRIPT} --man ${EVENT_MANIFEST} --intermediate ${CMAKE_CURRENT_BINARY_DIR}) execute_process( COMMAND ${GENERATE_COMMAND} --dry-run diff --git a/src/pal/tests/palsuite/eventprovider/CMakeLists.txt b/src/pal/tests/palsuite/eventprovider/CMakeLists.txt index 8b43aad633cd..ad3205a9570f 100644 --- a/src/pal/tests/palsuite/eventprovider/CMakeLists.txt +++ b/src/pal/tests/palsuite/eventprovider/CMakeLists.txt @@ -7,10 +7,10 @@ set(SOURCES set(EVENT_MANIFEST ${VM_DIR}/ClrEtwAll.man) set(TEST_GENERATOR ${CLR_DIR}/src/scripts/genEventingTests.py) -include(FindPythonInterp) +include(FindPython) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/clralltestevents.cpp - COMMAND ${PYTHON_EXECUTABLE} ${TEST_GENERATOR} --testdir "${CMAKE_CURRENT_BINARY_DIR}" --man "${EVENT_MANIFEST}" + COMMAND ${Python_EXECUTABLE} ${TEST_GENERATOR} --testdir "${CMAKE_CURRENT_BINARY_DIR}" --man "${EVENT_MANIFEST}" DEPENDS ${EVENT_MANIFEST} ${TEST_GENERATOR} COMMENT "Updating clralltestevents.cpp" ) diff --git a/src/pal/tools/gen-buildsys-clang.sh b/src/pal/tools/gen-buildsys-clang.sh index 125a1580d7fc..ce6bc06a425d 100755 --- a/src/pal/tools/gen-buildsys-clang.sh +++ b/src/pal/tools/gen-buildsys-clang.sh @@ -114,12 +114,6 @@ if [ $OS = "Linux" -o $OS = "FreeBSD" -o $OS = "OpenBSD" -o $OS = "NetBSD" -o $O fi cmake_extra_defines= -if [[ -n "$LLDB_LIB_DIR" ]]; then - cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_LIBS=$LLDB_LIB_DIR" -fi -if [[ -n "$LLDB_INCLUDE_DIR" ]]; then - cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_INCLUDES=$LLDB_INCLUDE_DIR" -fi if [ "$CROSSCOMPILE" == "1" ]; then if ! [[ -n "$ROOTFS_DIR" ]]; then echo "ROOTFS_DIR not set for crosscompile" @@ -168,7 +162,6 @@ $cmake_command \ "-DCMAKE_BUILD_TYPE=$buildtype" \ "-DCLR_CMAKE_ENABLE_CODE_COVERAGE=$code_coverage" \ "-DCMAKE_INSTALL_PREFIX=$__CMakeBinDir" \ - "-DCLR_CMAKE_COMPILER=Clang" \ "-DCMAKE_USER_MAKE_RULES_OVERRIDE=" \ $cmake_extra_defines \ $__UnprocessedCMakeArgs \ diff --git a/src/pal/tools/gen-buildsys-gcc.sh b/src/pal/tools/gen-buildsys-gcc.sh index 911324415ee4..30a8769a4328 100755 --- a/src/pal/tools/gen-buildsys-gcc.sh +++ b/src/pal/tools/gen-buildsys-gcc.sh @@ -124,12 +124,6 @@ if ! gcc_objcopy="$(locate_gcc_exec objcopy)"; then { echo "Unable to locate gcc if ! gcc_ranlib="$(locate_gcc_exec ranlib)"; then { echo "Unable to locate gcc-ranlib"; exit 1; } fi cmake_extra_defines= -if [ -n "$LLDB_LIB_DIR" ]; then - cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_LIBS=$LLDB_LIB_DIR" -fi -if [ -n "$LLDB_INCLUDE_DIR" ]; then - cmake_extra_defines="$cmake_extra_defines -DWITH_LLDB_INCLUDES=$LLDB_INCLUDE_DIR" -fi if [ "$CROSSCOMPILE" = "1" ]; then if [ -z "$ROOTFS_DIR" ]; then echo "ROOTFS_DIR not set for crosscompile" @@ -173,7 +167,6 @@ $cmake_command \ "-DCMAKE_OBJDUMP=$gcc_objdump" \ "-DCMAKE_BUILD_TYPE=$buildtype" \ "-DCLR_CMAKE_ENABLE_CODE_COVERAGE=$code_coverage" \ - "-DCLR_CMAKE_COMPILER=GNU" \ "-DCMAKE_USER_MAKE_RULES_OVERRIDE=" \ "-DCMAKE_INSTALL_PREFIX=$__CMakeBinDir" \ $cmake_extra_defines \ diff --git a/src/strongname/api/CMakeLists.txt b/src/strongname/api/CMakeLists.txt index 1e0ec2097a68..865aaccdde71 100644 --- a/src/strongname/api/CMakeLists.txt +++ b/src/strongname/api/CMakeLists.txt @@ -8,7 +8,7 @@ include_directories(BEFORE ${VM_DIR}) include_directories(${VM_DIR}/${ARCH_SOURCES_DIR}) include_directories(${CLR_DIR}/src/md/compiler) -add_definitions(-DSTRONGNAME_IN_VM -DSNAPI_INTERNAL) +add_definitions(-DSNAPI_INTERNAL) set(STRONGNAME_SOURCES strongname.cpp @@ -17,7 +17,18 @@ set(STRONGNAME_SOURCES convert_to_absolute_path(STRONGNAME_SOURCES ${STRONGNAME_SOURCES}) -add_subdirectory(dac) -add_subdirectory(wks) -add_subdirectory(crossgen) -add_subdirectory(tool) +add_library_clr(strongname_tool ${STRONGNAME_SOURCES}) + +add_library_clr(strongname_dac ${STRONGNAME_SOURCES}) +add_dependencies(strongname_dac eventing_headers) +set_target_properties(strongname_dac PROPERTIES DAC_COMPONENT TRUE) +target_compile_definitions(strongname_dac PRIVATE STRONGNAME_IN_VM) + +add_library_clr(strongname_wks ${STRONGNAME_SOURCES}) +add_dependencies(strongname_wks eventing_headers) +target_compile_definitions(strongname_wks PRIVATE STRONGNAME_IN_VM) + +add_library_clr(strongname_crossgen ${STRONGNAME_SOURCES}) +add_dependencies(strongname_crossgen eventing_headers) +set_target_properties(strongname_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +target_compile_definitions(strongname_crossgen PRIVATE STRONGNAME_IN_VM) diff --git a/src/strongname/api/crossgen/CMakeLists.txt b/src/strongname/api/crossgen/CMakeLists.txt deleted file mode 100644 index 5632c0321b55..000000000000 --- a/src/strongname/api/crossgen/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) - -add_library_clr(strongname_crossgen ${STRONGNAME_SOURCES}) -add_dependencies(strongname_crossgen eventing_headers) diff --git a/src/strongname/api/dac/CMakeLists.txt b/src/strongname/api/dac/CMakeLists.txt deleted file mode 100644 index ee4fc2fb511b..000000000000 --- a/src/strongname/api/dac/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ - -include(${CLR_DIR}/dac.cmake) - -add_library_clr(strongname_dac ${STRONGNAME_SOURCES}) -add_dependencies(strongname_dac eventing_headers) diff --git a/src/strongname/api/tool/CMakeLists.txt b/src/strongname/api/tool/CMakeLists.txt deleted file mode 100644 index c04dc9219ac9..000000000000 --- a/src/strongname/api/tool/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -remove_definitions(-DSTRONGNAME_IN_VM) -add_library_clr(strongname_tool ${STRONGNAME_SOURCES}) \ No newline at end of file diff --git a/src/strongname/api/wks/CMakeLists.txt b/src/strongname/api/wks/CMakeLists.txt deleted file mode 100644 index fcd6f8af07bc..000000000000 --- a/src/strongname/api/wks/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library_clr(strongname_wks ${STRONGNAME_SOURCES}) -add_dependencies(strongname_wks eventing_headers) diff --git a/src/tools/crossgen/CMakeLists.txt b/src/tools/crossgen/CMakeLists.txt index ab5b4eda5397..0f338572c863 100644 --- a/src/tools/crossgen/CMakeLists.txt +++ b/src/tools/crossgen/CMakeLists.txt @@ -1,7 +1,5 @@ project(crossgen) -include(${CLR_DIR}/crossgen.cmake) - set(CMAKE_INCLUDE_CURRENT_DIR ON) include_directories(../util) include_directories(../../pal/prebuilt/corerror) @@ -23,6 +21,7 @@ add_executable_clr(crossgen ${crossgen_SOURCES} ${crossgen_RESOURCES} ) +set_target_properties(crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) if(FEATURE_MERGE_JIT_AND_ENGINE) set(CLRJIT_CROSSGEN clrjit_crossgen) @@ -67,9 +66,8 @@ else() endif(CLR_CMAKE_PLATFORM_UNIX) -add_subdirectory(../../zap/crossgen ../../zap/crossgen) +add_subdirectory(../../zap ../../zap) add_subdirectory(../../vm/crossgen ../../vm/crossgen) -add_subdirectory(../../vm/crossgen_mscorlib ../../vm/crossgen_mscorlib) # add the install targets install_clr(crossgen) diff --git a/src/unwinder/CMakeLists.txt b/src/unwinder/CMakeLists.txt index 9a5d7829c86d..5a264403b8dc 100644 --- a/src/unwinder/CMakeLists.txt +++ b/src/unwinder/CMakeLists.txt @@ -20,7 +20,17 @@ list(APPEND UNWINDER_SOURCES convert_to_absolute_path(UNWINDER_SOURCES ${UNWINDER_SOURCES}) if(CLR_CMAKE_PLATFORM_UNIX) - add_subdirectory(wks) + add_library_clr(unwinder_wks ${UNWINDER_SOURCES}) + add_dependencies(unwinder_wks eventing_headers) endif(CLR_CMAKE_PLATFORM_UNIX) -add_subdirectory(dac) +add_library_clr(unwinder_dac ${UNWINDER_SOURCES}) +add_dependencies(unwinder_dac eventing_headers) +set_target_properties(unwinder_dac PROPERTIES DAC_COMPONENT TRUE) +target_compile_definitions(unwinder_dac PRIVATE FEATURE_NO_HOST) + +add_library_clr(unwinder_dac_amd64 ${UNWINDER_SOURCES}) +add_dependencies(unwinder_dac_amd64 eventing_headers) +set_target_properties(unwinder_dac_amd64 PROPERTIES DAC_COMPONENT TRUE) +target_compile_definitions(unwinder_dac_amd64 PRIVATE FEATURE_NO_HOST) + diff --git a/src/unwinder/dac/CMakeLists.txt b/src/unwinder/dac/CMakeLists.txt deleted file mode 100644 index 7a670e815f40..000000000000 --- a/src/unwinder/dac/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -include(${CLR_DIR}/dac.cmake) - -add_definitions(-DFEATURE_NO_HOST) - -add_library_clr(unwinder_dac ${UNWINDER_SOURCES}) -add_dependencies(unwinder_dac eventing_headers) diff --git a/src/unwinder/dac/hostwinamd64/CMakeLists.txt b/src/unwinder/dac/hostwinamd64/CMakeLists.txt deleted file mode 100644 index 8309c3597b7d..000000000000 --- a/src/unwinder/dac/hostwinamd64/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -include(${CLR_DIR}/dac.cmake) - -add_library_clr(unwinder_dac_amd64 ${UNWINDER_SOURCES}) diff --git a/src/unwinder/wks/CMakeLists.txt b/src/unwinder/wks/CMakeLists.txt deleted file mode 100644 index b23cb796485c..000000000000 --- a/src/unwinder/wks/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library_clr(unwinder_wks ${UNWINDER_SOURCES}) -add_dependencies(unwinder_wks eventing_headers) diff --git a/src/utilcode/CMakeLists.txt b/src/utilcode/CMakeLists.txt index deb5dc827d88..be4bad5d92a0 100644 --- a/src/utilcode/CMakeLists.txt +++ b/src/utilcode/CMakeLists.txt @@ -109,7 +109,34 @@ convert_to_absolute_path(UTILCODE_DAC_SOURCES ${UTILCODE_DAC_SOURCES}) convert_to_absolute_path(UTILCODE_CROSSGEN_SOURCES ${UTILCODE_CROSSGEN_SOURCES}) convert_to_absolute_path(UTILCODE_STATICNOHOST_SOURCES ${UTILCODE_STATICNOHOST_SOURCES}) -add_subdirectory(dac) -add_subdirectory(dyncrt) -add_subdirectory(staticnohost) -add_subdirectory(crossgen) +add_library_clr(utilcode_dac STATIC ${UTILCODE_DAC_SOURCES}) +add_library_clr(utilcode STATIC ${UTILCODE_SOURCES}) +add_library_clr(utilcodestaticnohost STATIC ${UTILCODE_STATICNOHOST_SOURCES}) +add_library_clr(utilcode_crossgen STATIC ${UTILCODE_CROSSGEN_SOURCES}) + +if(CLR_CMAKE_PLATFORM_UNIX) + target_link_libraries(utilcodestaticnohost nativeresourcestring) + target_link_libraries(utilcode_crossgen nativeresourcestring) + target_link_libraries(utilcode_dac nativeresourcestring) + target_link_libraries(utilcode nativeresourcestring) + add_dependencies(utilcode_dac coreclrpal) + add_dependencies(utilcode coreclrpal) +endif(CLR_CMAKE_PLATFORM_UNIX) + + +if(WIN32) + target_compile_definitions(utilcodestaticnohost PRIVATE _CRTIMP=) # use static version of crt +endif(WIN32) + +set_target_properties(utilcode_dac PROPERTIES DAC_COMPONENT TRUE) +set_target_properties(utilcode_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +target_compile_definitions(utilcode_dac PRIVATE SELF_NO_HOST) +target_compile_definitions(utilcodestaticnohost PRIVATE SELF_NO_HOST) +add_dependencies(utilcode_dac ${UTILCODE_DEPENDENCIES}) +add_dependencies(utilcode ${UTILCODE_DEPENDENCIES}) +add_dependencies(utilcode_crossgen ${UTILCODE_DEPENDENCIES}) +add_dependencies(utilcodestaticnohost ${UTILCODE_DEPENDENCIES}) +target_precompile_header(TARGET utilcode_dac HEADER stdafx.h) +target_precompile_header(TARGET utilcode HEADER stdafx.h) +target_precompile_header(TARGET utilcode_crossgen HEADER stdafx.h) +target_precompile_header(TARGET utilcodestaticnohost HEADER stdafx.h) diff --git a/src/utilcode/crossgen/CMakeLists.txt b/src/utilcode/crossgen/CMakeLists.txt deleted file mode 100644 index 41dd6d2306ca..000000000000 --- a/src/utilcode/crossgen/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) - -add_precompiled_header(stdafx.h ../stdafx.cpp UTILCODE_CROSSGEN_SOURCES) -add_library_clr(utilcode_crossgen STATIC ${UTILCODE_CROSSGEN_SOURCES}) -if(CLR_CMAKE_PLATFORM_UNIX) - target_link_libraries(utilcode_crossgen nativeresourcestring) -endif(CLR_CMAKE_PLATFORM_UNIX) - -add_dependencies(utilcode_crossgen ${UTILCODE_DEPENDENCIES}) diff --git a/src/utilcode/dac/CMakeLists.txt b/src/utilcode/dac/CMakeLists.txt deleted file mode 100644 index 07d3e1b4221b..000000000000 --- a/src/utilcode/dac/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -include(${CLR_DIR}/dac.cmake) - -add_definitions(-DSELF_NO_HOST) - -if(CLR_CMAKE_PLATFORM_UNIX) - add_library_clr(utilcode_dac STATIC ${UTILCODE_DAC_SOURCES}) - target_link_libraries(utilcode_dac nativeresourcestring) - add_dependencies(utilcode_dac coreclrpal) -else() - add_precompiled_header(stdafx.h ../stdafx.cpp UTILCODE_DAC_SOURCES) - add_library_clr(utilcode_dac STATIC ${UTILCODE_DAC_SOURCES}) -endif(CLR_CMAKE_PLATFORM_UNIX) - -add_dependencies(utilcode_dac ${UTILCODE_DEPENDENCIES}) diff --git a/src/utilcode/dyncrt/CMakeLists.txt b/src/utilcode/dyncrt/CMakeLists.txt deleted file mode 100644 index 752e32b9e922..000000000000 --- a/src/utilcode/dyncrt/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ - -if(CLR_CMAKE_PLATFORM_UNIX) - add_library_clr(utilcode STATIC ${UTILCODE_SOURCES}) - target_link_libraries(utilcode nativeresourcestring) - add_dependencies(utilcode coreclrpal) -else() - add_precompiled_header(stdafx.h ../stdafx.cpp UTILCODE_SOURCES) - add_library_clr(utilcode STATIC ${UTILCODE_SOURCES}) -endif(CLR_CMAKE_PLATFORM_UNIX) - -add_dependencies(utilcode ${UTILCODE_DEPENDENCIES}) diff --git a/src/utilcode/staticnohost/CMakeLists.txt b/src/utilcode/staticnohost/CMakeLists.txt deleted file mode 100644 index 5947718d898f..000000000000 --- a/src/utilcode/staticnohost/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -add_definitions(-DSELF_NO_HOST) - -if(WIN32) - add_definitions(-D_CRTIMP=) # use static version of crt - add_precompiled_header(stdafx.h ../stdafx.cpp UTILCODE_STATICNOHOST_SOURCES) -endif(WIN32) - -add_library_clr(utilcodestaticnohost STATIC ${UTILCODE_STATICNOHOST_SOURCES}) - -if(CLR_CMAKE_PLATFORM_UNIX) - target_link_libraries(utilcodestaticnohost nativeresourcestring) -endif(CLR_CMAKE_PLATFORM_UNIX) - -add_dependencies(utilcodestaticnohost ${UTILCODE_DEPENDENCIES}) diff --git a/src/utilcode/stdafx.cpp b/src/utilcode/stdafx.cpp deleted file mode 100644 index f31fef92f92a..000000000000 --- a/src/utilcode/stdafx.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// stdafx.cpp -// - -// -// Host for precompiled header. -// -//***************************************************************************** -#include "stdafx.h" // Precompiled header key. diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt index b036efbdf488..ed72c943611f 100644 --- a/src/vm/CMakeLists.txt +++ b/src/vm/CMakeLists.txt @@ -920,7 +920,11 @@ convert_to_absolute_path(VM_SOURCES_WKS ${VM_SOURCES_WKS}) convert_to_absolute_path(VM_SOURCES_WKS_ARCH_ASM ${VM_SOURCES_WKS_ARCH_ASM}) convert_to_absolute_path(VM_SOURCES_DAC ${VM_SOURCES_DAC}) -add_subdirectory(dac) +add_library_clr(cee_dac ${VM_SOURCES_DAC}) +add_dependencies(cee_dac eventing_headers) +set_target_properties(cee_dac PROPERTIES DAC_COMPONENT TRUE) +target_precompile_header(TARGET cee_dac HEADER common.h) + add_subdirectory(wks) if(FEATURE_PERFTRACING) diff --git a/src/vm/common.cpp b/src/vm/common.cpp deleted file mode 100644 index 55a63b37b18a..000000000000 --- a/src/vm/common.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - - -#include "common.h" - diff --git a/src/vm/crossgen/CMakeLists.txt b/src/vm/crossgen/CMakeLists.txt index 9b52d77a2d8c..949e96ec9dce 100644 --- a/src/vm/crossgen/CMakeLists.txt +++ b/src/vm/crossgen/CMakeLists.txt @@ -1,5 +1,3 @@ -include(${CLR_DIR}/crossgen.cmake) - set(VM_CROSSGEN_SOURCES ../appdomain.cpp ../array.cpp @@ -251,9 +249,6 @@ if (WIN32) ../winrttypenameconverter.h ) - add_precompiled_header(common.h ../common.cpp VM_CROSSGEN_SOURCES) - # mscorlib.cpp does not compile with precompiled header file - set_source_files_properties(../mscorlib.cpp PROPERTIES COMPILE_FLAGS "/Y-") list(APPEND VM_CROSSGEN_SOURCES ${VM_CROSSGEN_HEADERS}) endif (WIN32) @@ -266,3 +261,22 @@ endif (CLR_CMAKE_PLATFORM_LINUX) add_library_clr(cee_crossgen ${VM_CROSSGEN_SOURCES}) add_dependencies(cee_crossgen eventing_headers) +set_target_properties(cee_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +target_precompile_header(TARGET cee_crossgen HEADER common.h) +if (MSVC) + # mscorlib.cpp does not compile with precompiled header file + set_source_files_properties(../mscorlib.cpp PROPERTIES COMPILE_FLAGS "/Y-") +endif() + +add_library_clr(mscorlib_crossgen ../mscorlib.cpp) +add_dependencies(mscorlib_crossgen eventing_headers) +target_compile_definitions(mscorlib_crossgen + PRIVATE + EnC_SUPPORTED + FEATURE_EVENT_TRACE + FEATURE_MULTICOREJIT + FEATURE_VERSIONING_LOG + CROSSGEN_MSCORLIB) + +set_target_properties(mscorlib_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) + diff --git a/src/vm/crossgen_mscorlib/CMakeLists.txt b/src/vm/crossgen_mscorlib/CMakeLists.txt deleted file mode 100644 index b79a08ff9ae9..000000000000 --- a/src/vm/crossgen_mscorlib/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) - -# Add back some of the macro removed by crossgen.cmake. -add_definitions( - -DEnC_SUPPORTED - -DFEATURE_EVENT_TRACE - -DFEATURE_MULTICOREJIT - -DFEATURE_VERSIONING_LOG -) - -add_definitions(-DCROSSGEN_MSCORLIB) - -add_library_clr(mscorlib_crossgen ../mscorlib.cpp) -add_dependencies(cee_crossgen eventing_headers) diff --git a/src/vm/dac/CMakeLists.txt b/src/vm/dac/CMakeLists.txt deleted file mode 100644 index f001f2ec5104..000000000000 --- a/src/vm/dac/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ - -include(${CLR_DIR}/dac.cmake) - -add_precompiled_header(common.h ../common.cpp VM_SOURCES_DAC) -add_library_clr(cee_dac ${VM_SOURCES_DAC}) -add_dependencies(cee_dac eventing_headers) diff --git a/src/vm/eventing/CMakeLists.txt b/src/vm/eventing/CMakeLists.txt index 9d3c98802c9d..380a2820dee1 100644 --- a/src/vm/eventing/CMakeLists.txt +++ b/src/vm/eventing/CMakeLists.txt @@ -10,7 +10,7 @@ else() set(NEED_XPLAT_HEADER ON) endif() -include(FindPythonInterp) +include(FindPython) set (EventingHeaders ${GENERATED_INCLUDE_DIR}/etmdummy.h @@ -26,7 +26,7 @@ endif() set(GENEVENTING_SCRIPT ${CLR_DIR}/src/scripts/genEventing.py) add_custom_target(eventing_headers - ${PYTHON_EXECUTABLE} ${GENEVENTING_SCRIPT} --man ${EVENT_MANIFEST} --inc ${GENERATED_INCLUDE_DIR} --dummy ${GENERATED_INCLUDE_DIR}/etmdummy.h ${NONEXTERN_ARG} ${NOXPLATHEADER_ARG} + ${Python_EXECUTABLE} ${GENEVENTING_SCRIPT} --man ${EVENT_MANIFEST} --inc ${GENERATED_INCLUDE_DIR} --dummy ${GENERATED_INCLUDE_DIR}/etmdummy.h ${NONEXTERN_ARG} ${NOXPLATHEADER_ARG} DEPENDS ${EVENT_MANIFEST} ${GENEVENTING_SCRIPT} VERBATIM ) diff --git a/src/vm/eventing/EtwProvider/CMakeLists.txt b/src/vm/eventing/EtwProvider/CMakeLists.txt index fe7808284618..8289309730ea 100644 --- a/src/vm/eventing/EtwProvider/CMakeLists.txt +++ b/src/vm/eventing/EtwProvider/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8.12) -include(FindPythonInterp) +include(FindPython) set(ETW_PROVIDER_SCRIPT ${CLR_DIR}/src/scripts/genEtwProvider.py) @@ -16,5 +16,5 @@ set (ETW_PROVIDER_OUTPUTS set_source_files_properties(${ETW_PROVIDER_OUTPUTS} PROPERTIES GENERATED TRUE) add_custom_target(eventprovider - ${PYTHON_EXECUTABLE} ${ETW_PROVIDER_SCRIPT} --man ${EVENT_MANIFEST} --exc ${EVENT_EXCLUSIONS} --intermediate ${GENERATED_INCLUDE_DIR} + ${Python_EXECUTABLE} ${ETW_PROVIDER_SCRIPT} --man ${EVENT_MANIFEST} --exc ${EVENT_EXCLUSIONS} --intermediate ${GENERATED_INCLUDE_DIR} DEPENDS ${EVENT_MANIFEST} ${EVENT_EXCLUSIONS} ${ETW_PROVIDER_SCRIPT}) diff --git a/src/vm/eventing/eventpipe/CMakeLists.txt b/src/vm/eventing/eventpipe/CMakeLists.txt index 065906e22b87..3ce136226d4e 100644 --- a/src/vm/eventing/eventpipe/CMakeLists.txt +++ b/src/vm/eventing/eventpipe/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 2.8.12.2) -include(FindPythonInterp) +include(FindPython) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(GENERATE_SCRIPT ${CLR_DIR}/src/scripts/genEventPipe.py) -set(GENERATE_COMMAND ${PYTHON_EXECUTABLE} ${GENERATE_SCRIPT} --man ${EVENT_MANIFEST} --exc ${EVENT_EXCLUSIONS} --intermediate ${CMAKE_CURRENT_BINARY_DIR} ${NONEXTERN_ARG}) +set(GENERATE_COMMAND ${Python_EXECUTABLE} ${GENERATE_SCRIPT} --man ${EVENT_MANIFEST} --exc ${EVENT_EXCLUSIONS} --intermediate ${CMAKE_CURRENT_BINARY_DIR} ${NONEXTERN_ARG}) execute_process( COMMAND ${GENERATE_COMMAND} --dry-run diff --git a/src/vm/wks/CMakeLists.txt b/src/vm/wks/CMakeLists.txt index db33f4b49012..2a2593f32eda 100644 --- a/src/vm/wks/CMakeLists.txt +++ b/src/vm/wks/CMakeLists.txt @@ -1,81 +1,23 @@ if (WIN32) - add_precompiled_header(common.h ../common.cpp VM_SOURCES_WKS) - # mscorlib.cpp does not compile with precompiled header file - set_source_files_properties(../mscorlib.cpp PROPERTIES COMPILE_FLAGS "/Y-") - - # asm files require preprocessing using cl.exe on arm32 and arm64 if(CLR_CMAKE_PLATFORM_ARCH_ARM OR CLR_CMAKE_PLATFORM_ARCH_ARM64) - - get_include_directories_asm(ASM_INCLUDE_DIRECTORIES) - - foreach(ASM_FILE ${VM_SOURCES_WKS_ARCH_ASM}) - - # Inserts a custom command in CMake build to preprocess each asm source file - get_filename_component(name ${ASM_FILE} NAME_WE) - file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${name}.asm" ASM_PREPROCESSED_FILE) - preprocess_def_file(${ASM_FILE} ${ASM_PREPROCESSED_FILE}) - - # We do not pass any defines since we have already done pre-processing above - set (ASM_CMDLINE "-o ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj ${ASM_PREPROCESSED_FILE}") - - # Generate the batch file that will invoke the assembler - file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/runasm_${name}.cmd" ASM_SCRIPT_FILE) - - file(GENERATE OUTPUT "${ASM_SCRIPT_FILE}" - CONTENT "\"${CMAKE_ASM_MASM_COMPILER}\" -g ${ASM_INCLUDE_DIRECTORIES} ${ASM_CMDLINE}") - - message("Generated - ${ASM_SCRIPT_FILE}") - - # Need to compile asm file using custom command as include directories are not provided to asm compiler - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj - COMMAND ${ASM_SCRIPT_FILE} - DEPENDS ${ASM_PREPROCESSED_FILE} - COMMENT "Assembling ${ASM_PREPROCESSED_FILE} - ${ASM_SCRIPT_FILE}") - - # mark obj as source that does not require compile - set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${name}.obj PROPERTIES EXTERNAL_OBJECT TRUE) - - # Add the generated OBJ in the dependency list so that it gets consumed during linkage - set(VM_SOURCES_WKS_ARCH_ASM ${VM_SOURCES_WKS_ARCH_ASM} ${CMAKE_CURRENT_BINARY_DIR}/${name}.obj) - - endforeach() - + preprocess_compile_asm(ASM_FILES ${VM_SOURCES_WKS_ARCH_ASM} OUTPUT_OBJECTS VM_WKS_ARCH_ASM_OBJECTS) + list(APPEND VM_SOURCES_WKS_ARCH_ASM ${VM_WKS_ARCH_ASM_OBJECTS}) endif() endif (WIN32) add_library_clr(cee_wks ${VM_SOURCES_WKS} ${VM_SOURCES_WKS_ARCH_ASM}) +target_precompile_header(TARGET cee_wks HEADER common.h) +if (MSVC) + # mscorlib.cpp does not compile with precompiled header file + set_source_files_properties(../mscorlib.cpp PROPERTIES COMPILE_FLAGS "/Y-") +endif() add_dependencies(cee_wks eventing_headers) if (WIN32) if(NOT CLR_CMAKE_PLATFORM_ARCH_ARM AND NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) - # Get the current list of definitions - get_compile_definitions(DEFINITIONS) - - get_directory_property(COMPILE_DEFINITIONS_LIST COMPILE_DEFINITIONS) - - # Extract the definitions for the ASM code. Since there is a bug in the cmake that prevents us from - # using the generator expressions, we split the definitions into lists based on the configuration. - foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST) - if (${DEFINITION} MATCHES "^\\$<\\$]+)>:([^>]+)>$") - # The entry contains generator expression, so insert the definition into a definitions list - # corresponding to the config - string(TOUPPER ${CMAKE_MATCH_1} CONFIG) - set(ASM_DEFINITIONS_${CONFIG} ${ASM_DEFINITIONS_${CONFIG}} ${CMAKE_MATCH_2}) - else() - list(APPEND ASM_DEFINITIONS ${DEFINITION}) - endif() - endforeach() - - # Add defines for the ASM. Unfortunately setting it on the target is ignored for asm by the cmake, so we have - # to set it on the sources. - set_property(SOURCE ${VM_SOURCES_WKS_ARCH_ASM} PROPERTY COMPILE_DEFINITIONS ${ASM_DEFINITIONS}) - foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES) - string(TOUPPER ${CONFIG} CONFIG) - set_property(SOURCE ${VM_SOURCES_WKS_ARCH_ASM} PROPERTY COMPILE_DEFINITIONS_${CONFIG} ${ASM_DEFINITIONS_${CONFIG}}) - endforeach() if (CLR_CMAKE_PLATFORM_ARCH_I386) set_source_files_properties(${VM_SOURCES_WKS_ARCH_ASM} PROPERTIES COMPILE_FLAGS "/Zm /safeseh") @@ -87,6 +29,8 @@ if (WIN32) message(FATAL_ERROR "POWERSHELL not found") endif() + # Get the current list of definitions + get_compile_definitions(DEFINITIONS) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc" DEPENDS ${VM_DIR}/${ARCH_SOURCES_DIR}/asmconstants.h @@ -97,8 +41,8 @@ if (WIN32) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc PROPERTIES GENERATED TRUE) add_custom_target( - asmconstants_inc - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc + asmconstants_inc + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc ) add_dependencies(cee_wks asmconstants_inc) diff --git a/src/zap/CMakeLists.txt b/src/zap/CMakeLists.txt new file mode 100644 index 000000000000..1c23048d128d --- /dev/null +++ b/src/zap/CMakeLists.txt @@ -0,0 +1,56 @@ +set(ZAP_SOURCES + svcworker.cpp + zapper.cpp + zaprelocs.cpp + zapcode.cpp + zapheaders.cpp + zapimage.cpp + zapinfo.cpp + zapimport.cpp + zapinnerptr.cpp + zapmetadata.cpp + zapwriter.cpp + zapwrapper.cpp + zapperstats.cpp + nativeformatwriter.cpp +) + +set(ZAP_HEADERS + zaprelocs.h + zapcode.h + zapheaders.h + zapimage.h + zapinfo.h + zapimport.h + zapinnerptr.h + zaplog.h + zapmetadata.h + zapnodetype.h + zapwriter.h + zapwrapper.h + zapperstats.h + nativeformatwriter.h +) + +if (FEATURE_READYTORUN) + list(APPEND ZAP_SOURCES + zapreadytorun.cpp + nativeformatwriter.cpp + ) + list(APPEND ZAP_HEADERS + zapreadytorun.h + nativeformatwriter.h + ) +endif (FEATURE_READYTORUN) + +if (WIN32) + list(APPEND ZAP_SOURCES ${ZAP_HEADERS}) +endif(WIN32) + +add_library_clr(corzap_crossgen STATIC ${ZAP_SOURCES}) +set_target_properties(corzap_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) +target_precompile_header(TARGET corzap_crossgen HEADER common.h) + +if(FEATURE_MERGE_JIT_AND_ENGINE) + target_link_libraries(corzap_crossgen clrjit_crossgen) +endif(FEATURE_MERGE_JIT_AND_ENGINE) diff --git a/src/zap/common.cpp b/src/zap/common.cpp deleted file mode 100644 index edecbd31bf6a..000000000000 --- a/src/zap/common.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//***************************************************************************** -// common.cpp -// - -// -// Precompiled headers. -// -//***************************************************************************** -#include "common.h" diff --git a/src/zap/crossgen/CMakeLists.txt b/src/zap/crossgen/CMakeLists.txt deleted file mode 100644 index 0d45cd1f7624..000000000000 --- a/src/zap/crossgen/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -include(${CLR_DIR}/crossgen.cmake) - -set(ZAP_SOURCES - ../svcworker.cpp - ../zapper.cpp - ../zaprelocs.cpp - ../zapcode.cpp - ../zapheaders.cpp - ../zapimage.cpp - ../zapinfo.cpp - ../zapimport.cpp - ../zapinnerptr.cpp - ../zapmetadata.cpp - ../zapwriter.cpp - ../zapwrapper.cpp - ../zapperstats.cpp - ../nativeformatwriter.cpp -) - -set(ZAP_HEADERS - ../zaprelocs.h - ../zapcode.h - ../zapheaders.h - ../zapimage.h - ../zapinfo.h - ../zapimport.h - ../zapinnerptr.h - ../zaplog.h - ../zapmetadata.h - ../zapnodetype.h - ../zapwriter.h - ../zapwrapper.h - ../zapperstats.h - ../nativeformatwriter.h -) - -if (FEATURE_READYTORUN) - list(APPEND ZAP_SOURCES - ../zapreadytorun.cpp - ../nativeformatwriter.cpp - ) - list(APPEND ZAP_HEADERS - ../zapreadytorun.h - ../nativeformatwriter.h - ) -endif (FEATURE_READYTORUN) - -add_precompiled_header(common.h ../common.cpp ZAP_SOURCES) - -if (WIN32) - list(APPEND ZAP_SOURCES ${ZAP_HEADERS}) -endif(WIN32) - -add_library_clr(corzap_crossgen STATIC ${ZAP_SOURCES}) - -if(FEATURE_MERGE_JIT_AND_ENGINE) - target_link_libraries(corzap_crossgen clrjit_crossgen) -endif(FEATURE_MERGE_JIT_AND_ENGINE) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0b453ced3e6f..1a4665bff32e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,8 +7,6 @@ if (WIN32) add_definitions(-DWINDOWS) endif() -# Verify that LTCG/LTO is available -include(${CMAKE_CURRENT_SOURCE_DIR}/../configure.cmake) # Include global configure settings include(${CMAKE_CURRENT_SOURCE_DIR}/../configurecompiler.cmake) # Compile options