From b0351370ccd132d95c97b75312fc36adaacc2664 Mon Sep 17 00:00:00 2001 From: Adeel Mujahid Date: Sat, 21 Mar 2020 04:45:42 +0200 Subject: [PATCH] Unify some cmake function definitions (#33716) * Unify some cmake function definitions * Address CR feedback * Make installers /Zc:strictStrings compatible * Make installer /Gz compatible * Remove skip-strip internal implementation * Use CLR_CMAKE_TARGET_DARWIN * Establish iOS to Darwin relationship * Simplify iOS conditions --- eng/native/build-commons.sh | 1 - .../coreclr => eng/native}/configurecompiler.cmake | 65 ++++++- .../native}/configureoptimization.cmake | 0 eng/native/configureplatform.cmake | 2 + eng/native/configuretools.cmake | 4 +- eng/native/functions.cmake | 106 +++++----- {src/coreclr => eng/native}/sanitizerblacklist.txt | 0 src/coreclr/CMakeLists.txt | 93 +-------- src/coreclr/src/debug/createdump/CMakeLists.txt | 2 +- src/coreclr/src/dlls/clretwrc/CMakeLists.txt | 2 +- src/coreclr/src/dlls/dbgshim/CMakeLists.txt | 2 +- src/coreclr/src/dlls/mscordac/CMakeLists.txt | 2 +- src/coreclr/src/dlls/mscordbi/CMakeLists.txt | 2 +- .../src/dlls/mscoree/coreclr/CMakeLists.txt | 2 +- src/coreclr/src/dlls/mscorrc/CMakeLists.txt | 2 +- src/coreclr/src/jit/standalone/CMakeLists.txt | 2 +- .../src/eventprovider/lttngprovider/CMakeLists.txt | 2 +- src/coreclr/src/tools/crossgen/CMakeLists.txt | 2 +- src/coreclr/tests/CMakeLists.txt | 4 +- src/installer/corehost/CMakeLists.txt | 9 +- .../corehost/cli/apphost/apphost.windows.cpp | 2 +- src/installer/corehost/cli/hostmisc/pal.h | 4 +- src/installer/corehost/cli/hostmisc/pal.unix.cpp | 20 +- .../corehost/cli/hostmisc/pal.windows.cpp | 18 +- src/installer/corehost/cli/hostmisc/trace.h | 2 +- src/installer/corehost/cli/hostmisc/utils.cpp | 8 +- src/installer/corehost/cli/hostmisc/utils.h | 4 +- .../corehost/cli/hostpolicy/hostpolicy.cpp | 12 +- src/installer/corehost/cli/ijwhost/CMakeLists.txt | 6 +- .../cli/ijwhost/{AMD64 => amd64}/asmhelpers.asm | 0 .../cli/ijwhost/{AMD64 => amd64}/asmmacros.inc | 0 .../ijwhost/{AMD64 => amd64}/bootstrap_thunk.cpp | 0 .../cli/ijwhost/{AMD64 => amd64}/bootstrap_thunk.h | 4 +- .../corehost/cli/ijwhost/arm/bootstrap_thunk.h | 4 +- .../corehost/cli/ijwhost/arm64/bootstrap_thunk.h | 4 +- .../corehost/cli/ijwhost/i386/bootstrap_thunk.h | 4 +- src/installer/corehost/cli/ijwhost/ijwthunk.cpp | 4 +- src/installer/corehost/cli/nethost/nethost.cpp | 2 +- .../corehost/cli/redirected_error_writer.cpp | 2 +- .../corehost/cli/redirected_error_writer.h | 4 +- src/installer/functions.cmake | 154 --------------- src/installer/settings.cmake | 214 --------------------- src/libraries/Native/Unix/CMakeLists.txt | 46 +---- 43 files changed, 205 insertions(+), 617 deletions(-) rename {src/coreclr => eng/native}/configurecompiler.cmake (90%) rename {src/coreclr => eng/native}/configureoptimization.cmake (100%) rename {src/coreclr => eng/native}/sanitizerblacklist.txt (100%) rename src/installer/corehost/cli/ijwhost/{AMD64 => amd64}/asmhelpers.asm (100%) rename src/installer/corehost/cli/ijwhost/{AMD64 => amd64}/asmmacros.inc (100%) rename src/installer/corehost/cli/ijwhost/{AMD64 => amd64}/bootstrap_thunk.cpp (100%) rename src/installer/corehost/cli/ijwhost/{AMD64 => amd64}/bootstrap_thunk.h (98%) delete mode 100644 src/installer/functions.cmake delete mode 100644 src/installer/settings.cmake diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index c65f99a..6cc187e 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -337,7 +337,6 @@ while :; do ;; stripsymbols|-stripsymbols) - __CMakeArgs="-DSTRIP_SYMBOLS=true $__CMakeArgs" ;; verbose|-verbose) diff --git a/src/coreclr/configurecompiler.cmake b/eng/native/configurecompiler.cmake similarity index 90% rename from src/coreclr/configurecompiler.cmake rename to eng/native/configurecompiler.cmake index c460aad..6ce429b 100644 --- a/src/coreclr/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -1,3 +1,5 @@ +include(${CMAKE_CURRENT_LIST_DIR}/configuretools.cmake) + # Set initial flags for each configuration set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -41,8 +43,6 @@ set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "") add_compile_definitions("$<$,$>:DEBUG;_DEBUG;_DBG;URTBLDENV_FRIENDLY=Checked;BUILDENV_CHECKED=1>") add_compile_definitions("$<$,$>:NDEBUG;URTBLDENV_FRIENDLY=Retail>") -set(CMAKE_CXX_STANDARD_LIBRARIES "") # do not link against standard win32 libs i.e. kernel32, uuid, user32, etc. - if (MSVC) add_link_options(/GUARD:CF) @@ -373,6 +373,9 @@ if(CLR_CMAKE_TARGET_UNIX) if(CLR_CMAKE_TARGET_NETBSD) add_definitions(-DTARGET_NETBSD) endif(CLR_CMAKE_TARGET_NETBSD) + if(CLR_CMAKE_TARGET_ANDROID) + add_definitions(-DTARGET_ANDROID) + endif() else(CLR_CMAKE_TARGET_UNIX) add_definitions(-DTARGET_WINDOWS) endif(CLR_CMAKE_TARGET_UNIX) @@ -523,3 +526,61 @@ endif(CLR_CMAKE_ENABLE_CODE_COVERAGE) if (CMAKE_BUILD_TOOL STREQUAL nmake) set(CMAKE_RC_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") endif(CMAKE_BUILD_TOOL STREQUAL nmake) + +# Ensure other tools are present +if (CLR_CMAKE_HOST_WIN32) + if(CLR_CMAKE_HOST_ARCH_ARM) + + # Confirm that Windows SDK is present + if(NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION OR CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION STREQUAL "" ) + message(FATAL_ERROR "Windows SDK is required for the Arm32 build.") + else() + message("Using Windows SDK version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + endif() + + # Explicitly specify the assembler to be used for Arm32 compile + file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm\\armasm.exe" CMAKE_ASM_COMPILER) + + set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER}) + message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}") + + # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly + # use ml[64].exe as the assembler. + enable_language(ASM) + elseif(CLR_CMAKE_HOST_ARCH_ARM64) + + # Confirm that Windows SDK is present + if(NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION OR CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION STREQUAL "" ) + message(FATAL_ERROR "Windows SDK is required for the ARM64 build.") + else() + message("Using Windows SDK version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + endif() + + # Explicitly specify the assembler to be used for Arm64 compile + file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm64\\armasm64.exe" CMAKE_ASM_COMPILER) + + set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER}) + message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}") + + # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly + # use ml[64].exe as the assembler. + enable_language(ASM) + else() + enable_language(ASM_MASM) + endif() + + # Ensure that MC is present + find_program(MC mc) + if (MC STREQUAL "MC-NOTFOUND") + message(FATAL_ERROR "MC not found") + endif() + +else (CLR_CMAKE_HOST_WIN32) + enable_language(ASM) + + # Ensure that awk is present + find_program(AWK awk) + if (AWK STREQUAL "AWK-NOTFOUND") + message(FATAL_ERROR "AWK not found") + endif() +endif(CLR_CMAKE_HOST_WIN32) diff --git a/src/coreclr/configureoptimization.cmake b/eng/native/configureoptimization.cmake similarity index 100% rename from src/coreclr/configureoptimization.cmake rename to eng/native/configureoptimization.cmake diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 4fccb81..5c5accd 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -91,6 +91,7 @@ endif(CLR_CMAKE_HOST_OS STREQUAL Darwin) if(CLR_CMAKE_HOST_OS STREQUAL iOS) set(CLR_CMAKE_HOST_UNIX 1) set(CLR_CMAKE_HOST_IOS 1) + set(CLR_CMAKE_HOST_DARWIN 1) if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64") set(CLR_CMAKE_HOST_UNIX_AMD64 1) elseif(CMAKE_OSX_ARCHITECTURES MATCHES "armv7") @@ -255,6 +256,7 @@ endif(CLR_CMAKE_TARGET_OS STREQUAL Darwin) if(CLR_CMAKE_TARGET_OS STREQUAL iOS) set(CLR_CMAKE_TARGET_UNIX 1) set(CLR_CMAKE_TARGET_IOS 1) + set(CLR_CMAKE_TARGET_DARWIN 1) endif(CLR_CMAKE_TARGET_OS STREQUAL iOS) if(CLR_CMAKE_TARGET_OS STREQUAL FreeBSD) diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake index b91237d..4c0f969 100644 --- a/eng/native/configuretools.cmake +++ b/eng/native/configuretools.cmake @@ -47,7 +47,7 @@ if(NOT WIN32) locate_toolchain_exec(ranlib CMAKE_RANLIB) endif() - if(NOT CLR_CMAKE_TARGET_DARWIN AND NOT CLR_CMAKE_TARGET_IOS) + if(NOT CLR_CMAKE_TARGET_DARWIN) locate_toolchain_exec(objdump CMAKE_OBJDUMP) if(CMAKE_SYSTEM_NAME STREQUAL Android) @@ -60,5 +60,5 @@ if(NOT WIN32) endif() locate_toolchain_exec(objcopy CMAKE_OBJCOPY) - endif() + endif(NOT CLR_CMAKE_TARGET_DARWIN) endif() diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index cc806fe..c376620 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -124,7 +124,7 @@ function(preprocess_compile_asm) 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 "") @@ -250,48 +250,62 @@ function(target_precompile_header) endif(MSVC) endfunction() -function(strip_symbols targetName outputFilename skipStrip) +function(strip_symbols targetName outputFilename) if (CLR_CMAKE_HOST_UNIX) - if (STRIP_SYMBOLS) - set(strip_source_file $) - - if (CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(strip_destination_file ${strip_source_file}.dwarf) - - if(NOT ${skipStrip}) - add_custom_command( - TARGET ${targetName} - POST_BUILD - VERBATIM - COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file} - COMMAND ${STRIP} -S ${strip_source_file} - COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file} - ) - endif() - else (CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(strip_destination_file ${strip_source_file}.dbg) - - if(NOT ${skipStrip}) - add_custom_command( - TARGET ${targetName} - POST_BUILD - VERBATIM - COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file} - COMMAND ${CMAKE_OBJCOPY} --strip-debug ${strip_source_file} - COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file} - COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file} - ) - endif() - endif (CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(strip_source_file $) - set(${outputFilename} ${strip_destination_file} PARENT_SCOPE) - endif (STRIP_SYMBOLS) + if (CLR_CMAKE_TARGET_DARWIN) + set(strip_destination_file ${strip_source_file}.dwarf) + + # Ensure that dsymutil and strip are present + find_program(DSYMUTIL dsymutil) + if (DSYMUTIL STREQUAL "DSYMUTIL-NOTFOUND") + message(FATAL_ERROR "dsymutil not found") + endif() + + find_program(STRIP strip) + if (STRIP STREQUAL "STRIP-NOTFOUND") + message(FATAL_ERROR "strip not found") + endif() + + add_custom_command( + TARGET ${targetName} + POST_BUILD + VERBATIM + COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file} + COMMAND ${STRIP} -S ${strip_source_file} + COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file} + ) + else (CLR_CMAKE_TARGET_DARWIN) + set(strip_destination_file ${strip_source_file}.dbg) + + add_custom_command( + TARGET ${targetName} + POST_BUILD + VERBATIM + COMMAND ${CMAKE_OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file} + COMMAND ${CMAKE_OBJCOPY} --strip-debug ${strip_source_file} + COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file} + COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file} + ) + endif (CLR_CMAKE_TARGET_DARWIN) + + set(${outputFilename} ${strip_destination_file} PARENT_SCOPE) endif(CLR_CMAKE_HOST_UNIX) endfunction() -# install_clr(TARGETS TARGETS targetName [targetName2 ...] [DESTINATION destination] [SKIP_STRIP]) +function(install_symbols targetName destination_path) + strip_symbols(${targetName} strip_destination_file) + + if(CLR_CMAKE_TARGET_WIN32) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb DESTINATION ${destination_path}/PDB) + else() + install(FILES ${strip_destination_file} DESTINATION ${destination_path}) + endif() +endfunction() + +# install_clr(TARGETS TARGETS targetName [targetName2 ...] [DESTINATION destination]) function(install_clr) - set(options SKIP_STRIP) set(oneValueArgs DESTINATION) set(multiValueArgs TARGETS) cmake_parse_arguments(PARSE_ARGV 0 INSTALL_CLR "${options}" "${oneValueArgs}" "${multiValueArgs}") @@ -307,21 +321,12 @@ function(install_clr) foreach(targetName ${INSTALL_CLR_TARGETS}) list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX) if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1) - if("${INSTALL_CLR_SKIP_STRIP}" STREQUAL "") - set(INSTALL_CLR_SKIP_STRIP FALSE) - endif() - strip_symbols(${targetName} strip_destination_file ${INSTALL_CLR_SKIP_STRIP}) + install_symbols(${targetName} ${INSTALL_CLR_DESTINATION}) # We don't need to install the export libraries for our DLLs # since they won't be directly linked against. install(PROGRAMS $ DESTINATION ${INSTALL_CLR_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 ${INSTALL_CLR_DESTINATION}/PDB) - else() - install(FILES ${strip_destination_file} DESTINATION ${INSTALL_CLR_DESTINATION}) - endif() + if(CLR_CMAKE_PGO_INSTRUMENT) if(WIN32) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pgd DESTINATION ${INSTALL_CLR_DESTINATION}/PGD OPTIONAL) @@ -339,6 +344,11 @@ endfunction() # - creating executable pages from anonymous memory, # - making read-only-after-relocations (RELRO) data pages writable again. function(disable_pax_mprotect targetName) + # Try to locate the paxctl tool. Failure to find it is not fatal, + # but the generated executables won't work on a system where PAX is set + # to prevent applications to create executable memory mappings. + find_program(PAXCTL paxctl) + if (NOT PAXCTL STREQUAL "PAXCTL-NOTFOUND") add_custom_command( TARGET ${targetName} diff --git a/src/coreclr/sanitizerblacklist.txt b/eng/native/sanitizerblacklist.txt similarity index 100% rename from src/coreclr/sanitizerblacklist.txt rename to eng/native/sanitizerblacklist.txt diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 0e75f44..d154553 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -5,13 +5,17 @@ cmake_policy(SET CMP0042 NEW) # Set the project name project(CoreCLR) -include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake) +include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake) if (CLR_CMAKE_HOST_WIN32) message(STATUS "VS_PLATFORM_TOOLSET is ${CMAKE_VS_PLATFORM_TOOLSET}") message(STATUS "VS_PLATFORM_NAME is ${CMAKE_VS_PLATFORM_NAME}") endif (CLR_CMAKE_HOST_WIN32) +if(MSVC) + set(CMAKE_CXX_STANDARD_LIBRARIES "") # do not link against standard win32 libs i.e. kernel32, uuid, user32, etc. +endif (MSVC) + # Set commonly used directory names set(CLR_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(VM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/vm) @@ -31,93 +35,6 @@ endif(CORECLR_SET_RPATH) OPTION(CLR_CMAKE_ENABLE_CODE_COVERAGE "Enable code coverage" OFF) -# Ensure other tools are present -if (CLR_CMAKE_HOST_WIN32) - if(CLR_CMAKE_HOST_ARCH_ARM) - - # Confirm that Windows SDK is present - if(NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION OR CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION STREQUAL "" ) - message(FATAL_ERROR "Windows SDK is required for the Arm32 build.") - else() - message("Using Windows SDK version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") - endif() - - # Explicitly specify the assembler to be used for Arm32 compile - file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm\\armasm.exe" CMAKE_ASM_COMPILER) - - set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER}) - message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}") - - # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly - # use ml[64].exe as the assembler. - enable_language(ASM) - elseif(CLR_CMAKE_HOST_ARCH_ARM64) - - # Confirm that Windows SDK is present - if(NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION OR CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION STREQUAL "" ) - message(FATAL_ERROR "Windows SDK is required for the ARM64 build.") - else() - message("Using Windows SDK version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") - endif() - - # Explicitly specify the assembler to be used for Arm64 compile - file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm64\\armasm64.exe" CMAKE_ASM_COMPILER) - - set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER}) - message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}") - - # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly - # use ml[64].exe as the assembler. - enable_language(ASM) - else() - enable_language(ASM_MASM) - endif() - - # Ensure that MC is present - find_program(MC mc) - if (MC STREQUAL "MC-NOTFOUND") - message(FATAL_ERROR "MC not found") - endif() - -else (CLR_CMAKE_HOST_WIN32) - enable_language(ASM) - - # Ensure that awk is present - find_program(AWK awk) - if (AWK STREQUAL "AWK-NOTFOUND") - message(FATAL_ERROR "AWK not found") - endif() - - # Try to locate the paxctl tool. Failure to find it is not fatal, - # but the generated executables won't work on a system where PAX is set - # to prevent applications to create executable memory mappings. - find_program(PAXCTL paxctl) - - if (CLR_CMAKE_HOST_DARWIN) - - # Ensure that dsymutil and strip are present - find_program(DSYMUTIL dsymutil) - if (DSYMUTIL STREQUAL "DSYMUTIL-NOTFOUND") - message(FATAL_ERROR "dsymutil not found") - endif() - - find_program(STRIP strip) - if (STRIP STREQUAL "STRIP-NOTFOUND") - message(FATAL_ERROR "strip not found") - endif() - - endif() -endif(CLR_CMAKE_HOST_WIN32) - -if(CLR_CMAKE_TARGET_ANDROID) - add_definitions(-DTARGET_ANDROID) -endif() - -#---------------------------------------------------- -# Configure compiler settings for environment -#---------------------------------------------------- -include(configurecompiler.cmake) - #---------------------------------------------------- # Cross target Component build specific configuration #---------------------------------------------------- diff --git a/src/coreclr/src/debug/createdump/CMakeLists.txt b/src/coreclr/src/debug/createdump/CMakeLists.txt index e110566..d29eda5 100644 --- a/src/coreclr/src/debug/createdump/CMakeLists.txt +++ b/src/coreclr/src/debug/createdump/CMakeLists.txt @@ -52,4 +52,4 @@ target_link_libraries(createdump add_dependencies(createdump mscordaccore) install_clr(TARGETS createdump) -install_clr(TARGETS createdump DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS createdump DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/clretwrc/CMakeLists.txt b/src/coreclr/src/dlls/clretwrc/CMakeLists.txt index 771dc49..7ef540f 100644 --- a/src/coreclr/src/dlls/clretwrc/CMakeLists.txt +++ b/src/coreclr/src/dlls/clretwrc/CMakeLists.txt @@ -21,6 +21,6 @@ add_library_clr(clretwrc SHARED # add the install targets install_clr(TARGETS clretwrc) -install_clr(TARGETS clretwrc DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS clretwrc DESTINATION sharedFramework) add_dependencies(clretwrc eventing_headers) diff --git a/src/coreclr/src/dlls/dbgshim/CMakeLists.txt b/src/coreclr/src/dlls/dbgshim/CMakeLists.txt index 5367d77..52c1f76 100644 --- a/src/coreclr/src/dlls/dbgshim/CMakeLists.txt +++ b/src/coreclr/src/dlls/dbgshim/CMakeLists.txt @@ -84,4 +84,4 @@ target_link_libraries(dbgshim ${DBGSHIM_LIBRARIES}) # add the install targets install_clr(TARGETS dbgshim) -install_clr(TARGETS dbgshim DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS dbgshim DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/mscordac/CMakeLists.txt b/src/coreclr/src/dlls/mscordac/CMakeLists.txt index f1fe14c..aa3c6e8 100644 --- a/src/coreclr/src/dlls/mscordac/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscordac/CMakeLists.txt @@ -189,7 +189,7 @@ target_link_libraries(mscordaccore PRIVATE ${COREDAC_LIBRARIES}) # add the install targets install_clr(TARGETS mscordaccore) -install_clr(TARGETS mscordaccore DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS mscordaccore DESTINATION sharedFramework) if(CLR_CMAKE_HOST_WIN32) set(LONG_NAME_HOST_ARCH ${CLR_CMAKE_HOST_ARCH}) diff --git a/src/coreclr/src/dlls/mscordbi/CMakeLists.txt b/src/coreclr/src/dlls/mscordbi/CMakeLists.txt index 304d776..073ea9d 100644 --- a/src/coreclr/src/dlls/mscordbi/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscordbi/CMakeLists.txt @@ -119,4 +119,4 @@ endif(CLR_CMAKE_HOST_WIN32) # add the install targets install_clr(TARGETS mscordbi) -install_clr(TARGETS mscordbi DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS mscordbi DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt index 0517bb5..8b5365f 100644 --- a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -214,7 +214,7 @@ endif(CLR_CMAKE_TARGET_WIN32) # add the install targets install_clr(TARGETS coreclr) -install_clr(TARGETS coreclr DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS coreclr DESTINATION sharedFramework) # Enable profile guided optimization add_pgo(coreclr) diff --git a/src/coreclr/src/dlls/mscorrc/CMakeLists.txt b/src/coreclr/src/dlls/mscorrc/CMakeLists.txt index d61e9ae..ab6a5a2 100644 --- a/src/coreclr/src/dlls/mscorrc/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscorrc/CMakeLists.txt @@ -16,7 +16,7 @@ if(CLR_CMAKE_HOST_WIN32) ) install_clr(TARGETS mscorrc) - install_clr(TARGETS mscorrc DESTINATION sharedFramework SKIP_STRIP) + install_clr(TARGETS mscorrc DESTINATION sharedFramework) else() build_resources(${CMAKE_CURRENT_SOURCE_DIR}/include.rc mscorrc TARGET_CPP_FILE) diff --git a/src/coreclr/src/jit/standalone/CMakeLists.txt b/src/coreclr/src/jit/standalone/CMakeLists.txt index b5cb1bc..fa10b2a 100644 --- a/src/coreclr/src/jit/standalone/CMakeLists.txt +++ b/src/coreclr/src/jit/standalone/CMakeLists.txt @@ -11,7 +11,7 @@ endif(FEATURE_READYTORUN) add_jit(clrjit) # add the install targets -install_clr(TARGETS clrjit DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS clrjit DESTINATION sharedFramework) # Enable profile guided optimization add_pgo(clrjit) diff --git a/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt index 3466303..874a457 100644 --- a/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt +++ b/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt @@ -72,4 +72,4 @@ set_target_properties(coreclrtraceptprovider PROPERTIES LINKER_LANGUAGE CXX) _install(TARGETS eventprovider DESTINATION lib) # Install the static coreclrtraceptprovider library install_clr(TARGETS coreclrtraceptprovider) -install_clr(TARGETS coreclrtraceptprovider DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS coreclrtraceptprovider DESTINATION sharedFramework) diff --git a/src/coreclr/src/tools/crossgen/CMakeLists.txt b/src/coreclr/src/tools/crossgen/CMakeLists.txt index 32130c9..f8cd5b0 100644 --- a/src/coreclr/src/tools/crossgen/CMakeLists.txt +++ b/src/coreclr/src/tools/crossgen/CMakeLists.txt @@ -82,4 +82,4 @@ add_subdirectory(../../vm/crossgen ../../vm/crossgen) # add the install targets install_clr(TARGETS crossgen) -install_clr(TARGETS crossgen DESTINATION sharedFramework SKIP_STRIP) +install_clr(TARGETS crossgen DESTINATION sharedFramework) diff --git a/src/coreclr/tests/CMakeLists.txt b/src/coreclr/tests/CMakeLists.txt index 1ea31cd..3b82b26 100644 --- a/src/coreclr/tests/CMakeLists.txt +++ b/src/coreclr/tests/CMakeLists.txt @@ -3,15 +3,13 @@ cmake_minimum_required(VERSION 3.14.2) cmake_policy(SET CMP0042 NEW) project(Tests) -include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake) +include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake) set(INC_PLATFORM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Common/Platform) if (CLR_CMAKE_TARGET_WIN32) add_definitions(-DWINDOWS) endif() -# Include global configure settings -include(${CMAKE_CURRENT_SOURCE_DIR}/../configurecompiler.cmake) # Compile options if (CLR_CMAKE_HOST_WIN32) diff --git a/src/installer/corehost/CMakeLists.txt b/src/installer/corehost/CMakeLists.txt index 7d1854c..63abbbe 100644 --- a/src/installer/corehost/CMakeLists.txt +++ b/src/installer/corehost/CMakeLists.txt @@ -2,7 +2,10 @@ cmake_minimum_required(VERSION 3.14.2) project(corehost) -include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake) -include(../settings.cmake) -include(../functions.cmake) +include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake) + +if(MSVC) + add_compile_options(/W1) +endif() + add_subdirectory(cli) diff --git a/src/installer/corehost/cli/apphost/apphost.windows.cpp b/src/installer/corehost/cli/apphost/apphost.windows.cpp index 7902430..7d0212d 100644 --- a/src/installer/corehost/cli/apphost/apphost.windows.cpp +++ b/src/installer/corehost/cli/apphost/apphost.windows.cpp @@ -12,7 +12,7 @@ namespace { pal::string_t g_buffered_errors; - void buffering_trace_writer(const pal::char_t* message) + void __cdecl buffering_trace_writer(const pal::char_t* message) { // Add to buffer for later use. g_buffered_errors.append(message).append(_X("\n")); diff --git a/src/installer/corehost/cli/hostmisc/pal.h b/src/installer/corehost/cli/hostmisc/pal.h index 5e71932..c9adc99 100644 --- a/src/installer/corehost/cli/hostmisc/pal.h +++ b/src/installer/corehost/cli/hostmisc/pal.h @@ -68,7 +68,7 @@ #define LIB_PREFIX #define MAKE_LIBNAME(NAME) (_X(NAME) _X(".dll")) #define FALLBACK_HOST_RID _X("win10") -#elif defined(__APPLE__) +#elif defined(TARGET_DARWIN) #define LIB_PREFIX _X("lib") #define MAKE_LIBNAME(NAME) (LIB_PREFIX _X(NAME) _X(".dylib")) #define FALLBACK_HOST_RID _X("osx.10.12") @@ -176,7 +176,7 @@ namespace pal #define __cdecl /* nothing */ #define __stdcall /* nothing */ - #if !defined(__FreeBSD__) + #if !defined(TARGET_FREEBSD) #define __fastcall /* nothing */ #else #include diff --git a/src/installer/corehost/cli/hostmisc/pal.unix.cpp b/src/installer/corehost/cli/hostmisc/pal.unix.cpp index 789d18b..e3cfb39 100644 --- a/src/installer/corehost/cli/hostmisc/pal.unix.cpp +++ b/src/installer/corehost/cli/hostmisc/pal.unix.cpp @@ -15,15 +15,15 @@ #include #include -#if defined(__APPLE__) +#if defined(TARGET_DARWIN) #include #include #include #endif -#if defined(__LINUX__) +#if defined(TARGET_LINUX) #define symlinkEntrypointExecutable "/proc/self/exe" -#elif !defined(__APPLE__) +#elif !defined(TARGET_DARWIN) #define symlinkEntrypointExecutable "/proc/curproc/exe" #endif @@ -162,7 +162,7 @@ bool pal::get_loaded_library( /*out*/ pal::string_t *path) { pal::string_t library_name_local; -#if defined(__APPLE__) +#if defined(TARGET_DARWIN) if (!pal::is_path_rooted(library_name)) library_name_local.append("@rpath/"); #endif @@ -467,7 +467,7 @@ bool pal::get_default_installation_dir(pal::string_t* recv) } // *************************** -#if defined(__APPLE__) +#if defined(TARGET_DARWIN) recv->assign(_X("/usr/local/share/dotnet")); #else recv->assign(_X("/usr/share/dotnet")); @@ -491,7 +491,7 @@ pal::string_t trim_quotes(pal::string_t stringToCleanup) return stringToCleanup; } -#if defined(__APPLE__) +#if defined(TARGET_DARWIN) pal::string_t pal::get_current_os_rid_platform() { pal::string_t ridOS; @@ -531,7 +531,7 @@ pal::string_t pal::get_current_os_rid_platform() return ridOS; } -#elif defined(__FreeBSD__) +#elif defined(TARGET_FREEBSD) // On FreeBSD get major verion. Minors should be compatible pal::string_t pal::get_current_os_rid_platform() { @@ -679,7 +679,7 @@ pal::string_t pal::get_current_os_rid_platform() } #endif -#if defined(__APPLE__) +#if defined(TARGET_DARWIN) bool pal::get_own_executable_path(pal::string_t* recv) { uint32_t path_length = 0; @@ -694,7 +694,7 @@ bool pal::get_own_executable_path(pal::string_t* recv) } return false; } -#elif defined(__FreeBSD__) +#elif defined(TARGET_FREEBSD) bool pal::get_own_executable_path(pal::string_t* recv) { int mib[4]; @@ -903,7 +903,7 @@ bool pal::is_running_in_wow64() bool pal::are_paths_equal_with_normalized_casing(const string_t& path1, const string_t& path2) { -#if defined(__APPLE__) +#if defined(TARGET_DARWIN) // On Mac, paths are case-insensitive return (strcasecmp(path1.c_str(), path2.c_str()) == 0); #else diff --git a/src/installer/corehost/cli/hostmisc/pal.windows.cpp b/src/installer/corehost/cli/hostmisc/pal.windows.cpp index 1e0ff1d..0cb6d2f 100644 --- a/src/installer/corehost/cli/hostmisc/pal.windows.cpp +++ b/src/installer/corehost/cli/hostmisc/pal.windows.cpp @@ -226,10 +226,10 @@ void pal::unload_library(dll_t library) static bool get_wow_mode_program_files(pal::string_t* recv) { -#if defined(_TARGET_AMD64_) - pal::char_t* env_key = _X("ProgramFiles(x86)"); +#if defined(TARGET_AMD64) + const pal::char_t* env_key = _X("ProgramFiles(x86)"); #else - pal::char_t* env_key = _X("ProgramFiles"); + const pal::char_t* env_key = _X("ProgramFiles"); #endif return get_file_path_from_env(env_key,recv); @@ -274,7 +274,7 @@ bool pal::get_default_installation_dir(pal::string_t* recv) } // *************************** - pal::char_t* program_files_dir; + const pal::char_t* program_files_dir; if (pal::is_running_in_wow64()) { program_files_dir = _X("ProgramFiles(x86)"); @@ -296,7 +296,7 @@ bool pal::get_default_installation_dir(pal::string_t* recv) namespace { - void get_dotnet_install_location_registry_path(HKEY * key_hive, pal::string_t * sub_key, pal::char_t ** value) + void get_dotnet_install_location_registry_path(HKEY * key_hive, pal::string_t * sub_key, const pal::char_t ** value) { *key_hive = HKEY_LOCAL_MACHINE; // The registry search occurs in the 32-bit registry in all cases. @@ -322,12 +322,12 @@ namespace bool pal::get_dotnet_self_registered_config_location(pal::string_t* recv) { -#if !defined(_TARGET_AMD64_) && !defined(_TARGET_X86_) +#if !defined(TARGET_AMD64) && !defined(TARGET_X86) return false; #else HKEY key_hive; pal::string_t sub_key; - pal::char_t* value; + const pal::char_t* value; get_dotnet_install_location_registry_path(&key_hive, &sub_key, &value); *recv = (key_hive == HKEY_CURRENT_USER ? _X("HKCU\\") : _X("HKLM\\")) + sub_key + _X("\\") + value; @@ -337,7 +337,7 @@ bool pal::get_dotnet_self_registered_config_location(pal::string_t* recv) bool pal::get_dotnet_self_registered_dir(pal::string_t* recv) { -#if !defined(_TARGET_AMD64_) && !defined(_TARGET_X86_) +#if !defined(TARGET_AMD64) && !defined(TARGET_X86) // Self-registered SDK installation directory is only supported for x64 and x86 architectures. return false; #else @@ -354,7 +354,7 @@ bool pal::get_dotnet_self_registered_dir(pal::string_t* recv) HKEY hkeyHive; pal::string_t sub_key; - pal::char_t* value; + const pal::char_t* value; get_dotnet_install_location_registry_path(&hkeyHive, &sub_key, &value); // Must use RegOpenKeyEx to be able to specify KEY_WOW64_32KEY to access the 32-bit registry in all cases. diff --git a/src/installer/corehost/cli/hostmisc/trace.h b/src/installer/corehost/cli/hostmisc/trace.h index 37f69a5..0f9a176 100644 --- a/src/installer/corehost/cli/hostmisc/trace.h +++ b/src/installer/corehost/cli/hostmisc/trace.h @@ -20,7 +20,7 @@ namespace trace void println(); void flush(); - typedef void (*error_writer_fn)(const pal::char_t* message); + typedef void (__cdecl *error_writer_fn)(const pal::char_t* message); // Sets a callback which is called whenever error is to be written // The setting is per-thread (thread local). If no error writer is set for a given thread diff --git a/src/installer/corehost/cli/hostmisc/utils.cpp b/src/installer/corehost/cli/hostmisc/utils.cpp index f176729..4e0d8ab 100644 --- a/src/installer/corehost/cli/hostmisc/utils.cpp +++ b/src/installer/corehost/cli/hostmisc/utils.cpp @@ -187,13 +187,13 @@ pal::string_t get_replaced_char(const pal::string_t& path, pal::char_t match, pa const pal::char_t* get_arch() { -#if defined(_TARGET_AMD64_) +#if defined(TARGET_AMD64) return _X("x64"); -#elif defined(_TARGET_X86_) +#elif defined(TARGET_X86) return _X("x86"); -#elif defined(_TARGET_ARM_) +#elif defined(TARGET_ARM) return _X("arm"); -#elif defined(_TARGET_ARM64_) +#elif defined(TARGET_ARM64) return _X("arm64"); #else #error "Unknown target" diff --git a/src/installer/corehost/cli/hostmisc/utils.h b/src/installer/corehost/cli/hostmisc/utils.h index 020b45b..c9afbb6 100644 --- a/src/installer/corehost/cli/hostmisc/utils.h +++ b/src/installer/corehost/cli/hostmisc/utils.h @@ -11,7 +11,7 @@ #define _STRINGIFY(s) _X(s) #if defined(_WIN32) #define DOTNET_CORE_INSTALL_PREREQUISITES_URL _X("https://go.microsoft.com/fwlink/?linkid=798306") -#elif defined(__APPLE__) +#elif defined(TARGET_DARWIN) #define DOTNET_CORE_INSTALL_PREREQUISITES_URL _X("https://go.microsoft.com/fwlink/?linkid=2063366") #else #define DOTNET_CORE_INSTALL_PREREQUISITES_URL _X("https://go.microsoft.com/fwlink/?linkid=2063370") @@ -61,7 +61,7 @@ bool test_only_getenv(const pal::char_t* name, pal::string_t* recv); class propagate_error_writer_t { public: - typedef trace::error_writer_fn(*set_error_writer_fn)(trace::error_writer_fn error_writer); + typedef trace::error_writer_fn(__cdecl *set_error_writer_fn)(trace::error_writer_fn error_writer); private: set_error_writer_fn m_set_error_writer; diff --git a/src/installer/corehost/cli/hostpolicy/hostpolicy.cpp b/src/installer/corehost/cli/hostpolicy/hostpolicy.cpp index b248e27..5c7d766 100644 --- a/src/installer/corehost/cli/hostpolicy/hostpolicy.cpp +++ b/src/installer/corehost/cli/hostpolicy/hostpolicy.cpp @@ -44,7 +44,7 @@ namespace std::atomic g_context_initializing(false); std::condition_variable g_context_initializing_cv; - int create_coreclr() + int HOSTPOLICY_CALLTYPE create_coreclr() { int rc; { @@ -266,7 +266,7 @@ int run_app_for_context( return exit_code; } -int run_app(const int argc, const pal::char_t *argv[]) +int HOSTPOLICY_CALLTYPE run_app(const int argc, const pal::char_t *argv[]) { const std::shared_ptr context = get_hostpolicy_context(/*require_runtime*/ true); if (context == nullptr) @@ -439,7 +439,7 @@ int corehost_libhost_init(const hostpolicy_init_t &hostpolicy_init, const pal::s namespace { - int get_delegate(coreclr_delegate_type type, void **delegate) + int HOSTPOLICY_CALLTYPE get_delegate(coreclr_delegate_type type, void **delegate) { if (delegate == nullptr) return StatusCode::InvalidArgFailure; @@ -492,7 +492,7 @@ namespace } } - int get_property(const pal::char_t *key, const pal::char_t **value) + int HOSTPOLICY_CALLTYPE get_property(const pal::char_t *key, const pal::char_t **value) { if (key == nullptr) return StatusCode::InvalidArgFailure; @@ -507,7 +507,7 @@ namespace return StatusCode::Success; } - int set_property(const pal::char_t *key, const pal::char_t *value) + int HOSTPOLICY_CALLTYPE set_property(const pal::char_t *key, const pal::char_t *value) { if (key == nullptr) return StatusCode::InvalidArgFailure; @@ -531,7 +531,7 @@ namespace return StatusCode::Success; } - int get_properties(size_t * count, const pal::char_t **keys, const pal::char_t **values) + int HOSTPOLICY_CALLTYPE get_properties(size_t * count, const pal::char_t **keys, const pal::char_t **values) { if (count == nullptr) return StatusCode::InvalidArgFailure; diff --git a/src/installer/corehost/cli/ijwhost/CMakeLists.txt b/src/installer/corehost/cli/ijwhost/CMakeLists.txt index c89996f..7174983 100644 --- a/src/installer/corehost/cli/ijwhost/CMakeLists.txt +++ b/src/installer/corehost/cli/ijwhost/CMakeLists.txt @@ -8,7 +8,7 @@ set(DOTNET_PROJECT_NAME "ijwhost") # Include directories include_directories(../fxr) -include_directories(${ARCH_SPECIFIC_FOLDER_NAME}) +include_directories(${ARCH_SOURCES_DIR}) # CMake does not recommend using globbing since it messes with the freshness checks set(SOURCES @@ -17,7 +17,7 @@ set(SOURCES ../fxr_resolver.cpp pedecoder.cpp bootstrap_thunk_chunk.cpp - ${ARCH_SPECIFIC_FOLDER_NAME}/bootstrap_thunk.cpp + ${ARCH_SOURCES_DIR}/bootstrap_thunk.cpp ) if(CLR_CMAKE_TARGET_WIN32) @@ -26,7 +26,7 @@ if(CLR_CMAKE_TARGET_WIN32) endif() set (ASM_HELPERS_SOURCES - ${ARCH_SPECIFIC_FOLDER_NAME}/asmhelpers.asm) + ${ARCH_SOURCES_DIR}/asmhelpers.asm) add_definitions(-DFEATURE_LIBHOST=1) diff --git a/src/installer/corehost/cli/ijwhost/AMD64/asmhelpers.asm b/src/installer/corehost/cli/ijwhost/amd64/asmhelpers.asm similarity index 100% rename from src/installer/corehost/cli/ijwhost/AMD64/asmhelpers.asm rename to src/installer/corehost/cli/ijwhost/amd64/asmhelpers.asm diff --git a/src/installer/corehost/cli/ijwhost/AMD64/asmmacros.inc b/src/installer/corehost/cli/ijwhost/amd64/asmmacros.inc similarity index 100% rename from src/installer/corehost/cli/ijwhost/AMD64/asmmacros.inc rename to src/installer/corehost/cli/ijwhost/amd64/asmmacros.inc diff --git a/src/installer/corehost/cli/ijwhost/AMD64/bootstrap_thunk.cpp b/src/installer/corehost/cli/ijwhost/amd64/bootstrap_thunk.cpp similarity index 100% rename from src/installer/corehost/cli/ijwhost/AMD64/bootstrap_thunk.cpp rename to src/installer/corehost/cli/ijwhost/amd64/bootstrap_thunk.cpp diff --git a/src/installer/corehost/cli/ijwhost/AMD64/bootstrap_thunk.h b/src/installer/corehost/cli/ijwhost/amd64/bootstrap_thunk.h similarity index 98% rename from src/installer/corehost/cli/ijwhost/AMD64/bootstrap_thunk.h rename to src/installer/corehost/cli/ijwhost/amd64/bootstrap_thunk.h index 6b4ecda..2d8e407 100644 --- a/src/installer/corehost/cli/ijwhost/AMD64/bootstrap_thunk.h +++ b/src/installer/corehost/cli/ijwhost/amd64/bootstrap_thunk.h @@ -5,7 +5,7 @@ #ifndef IJW_BOOTSTRAP_THUNK_H #define IJW_BOOTSTRAP_THUNK_H -#if !defined(_TARGET_AMD64_) +#if !defined(TARGET_AMD64) #error "This file should only be included on amd64 builds." #endif @@ -56,4 +56,4 @@ public: }; #include -#endif \ No newline at end of file +#endif diff --git a/src/installer/corehost/cli/ijwhost/arm/bootstrap_thunk.h b/src/installer/corehost/cli/ijwhost/arm/bootstrap_thunk.h index 516e369..4d27433 100644 --- a/src/installer/corehost/cli/ijwhost/arm/bootstrap_thunk.h +++ b/src/installer/corehost/cli/ijwhost/arm/bootstrap_thunk.h @@ -5,7 +5,7 @@ #ifndef IJW_BOOTSTRAP_THUNK_H #define IJW_BOOTSTRAP_THUNK_H -#if !defined(_TARGET_ARM_) +#if !defined(TARGET_ARM) #error "This file should only be included on arm builds." #endif @@ -53,4 +53,4 @@ public: }; #include -#endif \ No newline at end of file +#endif diff --git a/src/installer/corehost/cli/ijwhost/arm64/bootstrap_thunk.h b/src/installer/corehost/cli/ijwhost/arm64/bootstrap_thunk.h index 1e38d3e..b486bd1 100644 --- a/src/installer/corehost/cli/ijwhost/arm64/bootstrap_thunk.h +++ b/src/installer/corehost/cli/ijwhost/arm64/bootstrap_thunk.h @@ -5,7 +5,7 @@ #ifndef IJW_BOOTSTRAP_THUNK_H #define IJW_BOOTSTRAP_THUNK_H -#if !defined(_TARGET_ARM64_) +#if !defined(TARGET_ARM64) #error "This file should only be included on arm64 builds." #endif @@ -53,4 +53,4 @@ public: }; #include -#endif \ No newline at end of file +#endif diff --git a/src/installer/corehost/cli/ijwhost/i386/bootstrap_thunk.h b/src/installer/corehost/cli/ijwhost/i386/bootstrap_thunk.h index 8ffbf8c..63994a9 100644 --- a/src/installer/corehost/cli/ijwhost/i386/bootstrap_thunk.h +++ b/src/installer/corehost/cli/ijwhost/i386/bootstrap_thunk.h @@ -5,7 +5,7 @@ #ifndef IJW_BOOTSTRAP_THUNK_H #define IJW_BOOTSTRAP_THUNK_H -#if !defined(_TARGET_X86_) +#if !defined(TARGET_X86) #error "This file should only be included on x86 builds." #endif @@ -56,4 +56,4 @@ public: }; #include -#endif \ No newline at end of file +#endif diff --git a/src/installer/corehost/cli/ijwhost/ijwthunk.cpp b/src/installer/corehost/cli/ijwhost/ijwthunk.cpp index 2b1e1c8..97e8b70 100644 --- a/src/installer/corehost/cli/ijwhost/ijwthunk.cpp +++ b/src/installer/corehost/cli/ijwhost/ijwthunk.cpp @@ -26,7 +26,7 @@ namespace bootstrap_thunk_chunk* g_pVtableBootstrapThunkChunkList; // We swallow the trace messages so we don't output to a stderr of a process that we do not own unless tracing is enabled. - void swallow_trace(const pal::char_t* msg) + void __cdecl swallow_trace(const pal::char_t* msg) { (void)msg; } @@ -187,4 +187,4 @@ bool are_thunks_installed_for_module(pal::dll_t instance) } return false; -} \ No newline at end of file +} diff --git a/src/installer/corehost/cli/nethost/nethost.cpp b/src/installer/corehost/cli/nethost/nethost.cpp index d7fb4a3..dc0cd69 100644 --- a/src/installer/corehost/cli/nethost/nethost.cpp +++ b/src/installer/corehost/cli/nethost/nethost.cpp @@ -12,7 +12,7 @@ namespace { // Swallow the trace messages so we don't output to stderr of a process that we do not own unless tracing is enabled. - void swallow_trace(const pal::char_t* msg) + void __cdecl swallow_trace(const pal::char_t* msg) { (void)msg; } diff --git a/src/installer/corehost/cli/redirected_error_writer.cpp b/src/installer/corehost/cli/redirected_error_writer.cpp index aa8fda4..ba97a2d 100644 --- a/src/installer/corehost/cli/redirected_error_writer.cpp +++ b/src/installer/corehost/cli/redirected_error_writer.cpp @@ -20,7 +20,7 @@ void reset_redirected_error_writer() get_redirected_error_stream().swap(newstream); } -void redirected_error_writer(const pal::char_t* msg) +void __cdecl redirected_error_writer(const pal::char_t* msg) { get_redirected_error_stream() << msg; } diff --git a/src/installer/corehost/cli/redirected_error_writer.h b/src/installer/corehost/cli/redirected_error_writer.h index 7b330bd..8022929 100644 --- a/src/installer/corehost/cli/redirected_error_writer.h +++ b/src/installer/corehost/cli/redirected_error_writer.h @@ -9,8 +9,8 @@ void reset_redirected_error_writer(); -void redirected_error_writer(const pal::char_t* msg); +void __cdecl redirected_error_writer(const pal::char_t* msg); pal::string_t get_redirected_error_string(); -#endif /* _COREHOST_CLI_REDIRECTED_ERROR_WRITER_H_ */ \ No newline at end of file +#endif /* _COREHOST_CLI_REDIRECTED_ERROR_WRITER_H_ */ diff --git a/src/installer/functions.cmake b/src/installer/functions.cmake deleted file mode 100644 index 58a6c81..0000000 --- a/src/installer/functions.cmake +++ /dev/null @@ -1,154 +0,0 @@ - -# Build a list of compiler definitions by putting -D in front of each define. -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 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 "$<${CMAKE_MATCH_1}:-D${CMAKE_MATCH_2}>") - endif() - 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) - -# Build a list of include directories -function(get_include_directories IncludeDirectories) - get_directory_property(dirs INCLUDE_DIRECTORIES) - foreach(dir IN LISTS dirs) - - if (CLR_CMAKE_TARGET_ARCH_ARM AND CLR_CMAKE_TARGET_WIN32) - list(APPEND INC_DIRECTORIES /I${dir}) - else() - list(APPEND INC_DIRECTORIES -I${dir}) - endif(CLR_CMAKE_TARGET_ARCH_ARM AND CLR_CMAKE_TARGET_WIN32) - - endforeach() - set(${IncludeDirectories} ${INC_DIRECTORIES} PARENT_SCOPE) -endfunction(get_include_directories) - -#Preprocess file -function(preprocess_file inputFilename outputFilename) - get_compile_definitions(PREPROCESS_DEFINITIONS) - 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() - -# Build a list of include directories for consumption by the assembler -function(get_include_directories_asm IncludeDirectories) - get_directory_property(dirs INCLUDE_DIRECTORIES) - - if (CLR_CMAKE_TARGET_ARCH_ARM AND CLR_CMAKE_TARGET_WIN32) - list(APPEND INC_DIRECTORIES "-I ") - endif() - - foreach(dir IN LISTS dirs) - if (CLR_CMAKE_TARGET_ARCH_ARM AND CLR_CMAKE_TARGET_WIN32) - list(APPEND INC_DIRECTORIES ${dir};) - else() - list(APPEND INC_DIRECTORIES -I${dir}) - endif() - endforeach() - - set(${IncludeDirectories} ${INC_DIRECTORIES} PARENT_SCOPE) -endfunction(get_include_directories_asm) - -# Set the passed in RetSources variable to the list of sources with added current source directory -# to form absolute paths. -# The parameters after the RetSources are the input files. -function(convert_to_absolute_path RetSources) - set(Sources ${ARGN}) - foreach(Source IN LISTS Sources) - list(APPEND AbsolutePathSources ${CMAKE_CURRENT_SOURCE_DIR}/${Source}) - endforeach() - set(${RetSources} ${AbsolutePathSources} PARENT_SCOPE) -endfunction(convert_to_absolute_path) diff --git a/src/installer/settings.cmake b/src/installer/settings.cmake deleted file mode 100644 index c43bdbf..0000000 --- a/src/installer/settings.cmake +++ /dev/null @@ -1,214 +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. - -set (CMAKE_CXX_STANDARD 11) - -if (NOT CLR_CMAKE_HOST_WIN32) - # Try to locate the paxctl tool. Failure to find it is not fatal, - # but the generated executables won't work on a system where PAX is set - # to prevent applications to create executable memory mappings. - find_program(PAXCTL paxctl) - - if (CLR_CMAKE_HOST_DARWIN) - # Ensure that dsymutil and strip are present - find_program(DSYMUTIL dsymutil) - if (DSYMUTIL STREQUAL "DSYMUTIL-NOTFOUND") - message(FATAL_ERROR "dsymutil not found") - endif() - - find_program(STRIP strip) - if (STRIP STREQUAL "STRIP-NOTFOUND") - message(FATAL_ERROR "strip not found") - endif() - endif (CLR_CMAKE_HOST_DARWIN) -endif () - -function(install_symbols targetName destination_path) - if(CLR_CMAKE_TARGET_WIN32) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb DESTINATION ${destination_path}) - else() - strip_symbols(${targetName} strip_destination_file NO) - install(FILES ${strip_destination_file} DESTINATION ${destination_path}) - endif() -endfunction() - -# Disable PAX mprotect that would prevent JIT and other codegen in coreclr from working. -# PAX mprotect prevents: -# - changing the executable status of memory pages that were -# not originally created as executable, -# - making read-only executable pages writable again, -# - creating executable pages from anonymous memory, -# - making read-only-after-relocations (RELRO) data pages writable again. -function(disable_pax_mprotect targetName) - if (NOT PAXCTL STREQUAL "PAXCTL-NOTFOUND") - add_custom_command( - TARGET ${targetName} - POST_BUILD - VERBATIM - COMMAND ${PAXCTL} -c -m $ - ) - endif() -endfunction() - -if(CLR_CMAKE_HOST_WIN32) - add_definitions(-DWIN32) - add_definitions(-D_WIN32=1) - if(IS_64BIT_BUILD) - add_definitions(-D_WIN64=1) - endif() - add_compile_options($<$:-DDEBUG>) - add_compile_options($<$:-DNDEBUG>) - add_compile_options($<$:-DNDEBUG>) - add_compile_options($<$:/Od>) - add_compile_options(/guard:cf) - add_compile_options(/d2Zi+) # make optimized builds debugging easier - add_compile_options(/Oi) # enable intrinsics - add_compile_options(/Oy-) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls - add_compile_options(/GF) # enable read-only string pooling - add_compile_options(/FC) # use full pathnames in diagnostics - add_compile_options(/DEBUG) - add_compile_options(/Zi) # enable debugging information - add_compile_options(/GS) - add_compile_options(/W1) - add_compile_options(/we5038) # make reorder warnings into errors - add_compile_options(/Zc:inline) - add_compile_options(/fp:precise) - add_compile_options(/EHsc) - - 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} /DEBUG") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL:NO") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /PDBCOMPRESS") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1572864") - - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /GUARD:CF") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /GUARD:CF") - - # Debug build specific flags - set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /NOVCFEATURE") - - # Release build specific flags - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") - 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") - - # RelWithDebInfo specific flags - set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG /OPT:REF /OPT:ICF") - set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /DEBUG /OPT:REF /OPT:ICF") - 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") -else() - add_compile_options(-g) # enable debugging information - add_compile_options(-Wall) - add_compile_options(-Wextra) - if(CMAKE_C_COMPILER_ID STREQUAL Clang) - # Uncomment to enable additional, but likely irrelvant, warnings. For - # example, this will warn about using c++11 features even when - # compiling with -std=c++11. - # add_compile_options(-Weverything) - endif() - # Suppress warnings-as-errors in release branches to reduce servicing churn - if (PRERELEASE) - add_compile_options(-Werror) - endif() - add_compile_options(-Wno-missing-field-initializers) - add_compile_options(-Wno-unused-function) - add_compile_options(-Wno-unused-local-typedef) - add_compile_options(-Wno-unused-macros) - add_compile_options(-Wno-unused-parameter) - - if(CLR_CMAKE_TARGET_ARCH_ARM) - if (NOT DEFINED CLR_ARM_FPU_TYPE) - set(CLR_ARM_FPU_TYPE vfpv3) - endif(NOT DEFINED CLR_ARM_FPU_TYPE) - - if (NOT DEFINED CLR_ARM_FPU_CAPABILITY) - set(CLR_ARM_FPU_CAPABILITY 0x7) - endif(NOT DEFINED CLR_ARM_FPU_CAPABILITY) - - add_definitions(-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY}) - endif() -endif() - -# Older CMake doesn't support CMAKE_CXX_STANDARD and GCC/Clang need a switch to enable C++ 11 -if(${CMAKE_CXX_COMPILER_ID} MATCHES "(Clang|GNU)") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -endif() - -# This is required to map a symbol reference to a matching definition local to the module (.so) -# containing the reference instead of using definitions from other modules. -if(CLR_CMAKE_TARGET_LINUX) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions") - add_link_options(-Wl,--build-id=sha1 -Wl,-z,relro,-z,now) - add_compile_options(-fstack-protector-strong) -elseif(CLR_CMAKE_TARGET_DARWIN) - add_compile_options(-fstack-protector) -elseif(CLR_CMAKE_TARGET_FREEBSD) - add_link_options(-fuse-ld=lld -Wl,--build-id=sha1 -Wl,-z,relro,-z,now) - add_compile_options(-fstack-protector) -endif() - -if(CLR_CMAKE_TARGET_ANDROID) - add_compile_options(-Wno-user-defined-warnings) -endif() - -add_definitions(-D_NO_ASYNCRTIMP) -add_definitions(-D_NO_PPLXIMP) -if(CLR_CMAKE_TARGET_LINUX) - add_definitions(-D__LINUX__) -endif() - -if(CLR_CMAKE_TARGET_ARCH_I386) - add_definitions(-D_TARGET_X86_=1) - set(ARCH_SPECIFIC_FOLDER_NAME "i386") -elseif(CLR_CMAKE_TARGET_ARCH_AMD64) - add_definitions(-D_TARGET_AMD64_=1) - set(ARCH_SPECIFIC_FOLDER_NAME "AMD64") -elseif(CLR_CMAKE_TARGET_ARCH_ARM) - add_definitions(-D_TARGET_ARM_=1) - set(ARCH_SPECIFIC_FOLDER_NAME "arm") -elseif(CLR_CMAKE_TARGET_ARCH_ARM64) - add_definitions(-D_TARGET_ARM64_=1) - set(ARCH_SPECIFIC_FOLDER_NAME "arm64") -else() - message(FATAL_ERROR "Unknown target architecture") -endif() - -# Specify the Windows SDK to be used for Arm builds -if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)) - if(NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION OR CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION STREQUAL "" ) - message(FATAL_ERROR "Windows SDK is required for the Arm32 or Arm64 build.") - else() - message("Using Windows SDK version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") - endif() -endif () - -if (CLR_CMAKE_HOST_WIN32) - if(CLR_CMAKE_HOST_ARCH_ARM) - # Explicitly specify the assembler to be used for Arm32 compile - file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm\\armasm.exe" CMAKE_ASM_COMPILER) - - set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER}) - message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}") - - # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly - # use ml[64].exe as the assembler. - enable_language(ASM) - elseif(CLR_CMAKE_HOST_ARCH_ARM64) - # Explicitly specify the assembler to be used for Arm64 compile - file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm64\\armasm64.exe" CMAKE_ASM_COMPILER) - - set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER}) - message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}") - - # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly - # use ml[64].exe as the assembler. - enable_language(ASM) - else() - enable_language(ASM_MASM) - endif() -endif() diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index f32da9d..5e9c0f0 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -5,10 +5,6 @@ project(CoreFX C) include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake) -if(CLR_CMAKE_TARGET_IOS) - cmake_minimum_required(VERSION 3.14.5) -endif() - if(NOT CLR_CMAKE_TARGET_ARCH_WASM) cmake_policy(SET CMP0083 NEW) endif(NOT CLR_CMAKE_TARGET_ARCH_WASM) @@ -131,7 +127,7 @@ else () endif () if(CLR_CMAKE_TARGET_ARCH_WASM) -elseif (CLR_CMAKE_TARGET_DARWIN OR CLR_CMAKE_TARGET_IOS) +elseif (CLR_CMAKE_TARGET_DARWIN) add_definitions(-D__APPLE_USE_RFC_3542) # We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2) @@ -158,19 +154,6 @@ endif(CLR_CMAKE_TARGET_FREEBSD) if(CLR_CMAKE_TARGET_UNIX) if (CLR_CMAKE_TARGET_DARWIN) add_link_options(-Wl,-bind_at_load) - - # Ensure that dsymutil and strip are present - find_program(DSYMUTIL dsymutil) - if (DSYMUTIL STREQUAL "DSYMUTIL-NOTFOUND") - message(FATAL_ERROR "dsymutil not found") - endif() - - find_program(STRIP strip) - if (STRIP STREQUAL "STRIP-NOTFOUND") - message(FATAL_ERROR "strip not found") - endif() - elseif (CLR_CMAKE_TARGET_IOS) - # No object stripping for iOS elseif (CLR_CMAKE_TARGET_ARCH_WASM) # No object stripping for WASM else (CLR_CMAKE_TARGET_DARWIN) @@ -184,23 +167,9 @@ if(CLR_CMAKE_TARGET_UNIX) endif(CLR_CMAKE_TARGET_UNIX) function(install_library_and_symbols targetName) - strip_symbols(${targetName} strip_destination_file NO) - - # 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_symbols(${targetName} .) + set(install_source_file $) install(PROGRAMS ${install_source_file} DESTINATION .) - if(CLR_CMAKE_TARGET_WIN32) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb DESTINATION PDB) - else() - install(FILES ${strip_destination_file} DESTINATION .) - endif() endfunction() include(configure.cmake) @@ -219,18 +188,15 @@ endif() add_subdirectory(System.Native) -if (NOT CLR_CMAKE_TARGET_ARCH_WASM) -if (NOT CLR_CMAKE_TARGET_IOS) # TODO: reenable +if (NOT CLR_CMAKE_TARGET_ARCH_WASM AND NOT CLR_CMAKE_TARGET_IOS) # TODO: reenable for iOS add_subdirectory(System.Globalization.Native) add_subdirectory(System.Net.Security.Native) -endif() -if (NOT CLR_CMAKE_TARGET_IOS) + # disable System.Security.Cryptography.Native build on iOS, # only used for interacting with OpenSSL which isn't useful there add_subdirectory(System.Security.Cryptography.Native) endif() -endif() -if(CLR_CMAKE_TARGET_DARWIN OR CLR_CMAKE_TARGET_IOS) +if(CLR_CMAKE_TARGET_DARWIN) add_subdirectory(System.Security.Cryptography.Native.Apple) endif() -- 2.7.4