;;
stripsymbols|-stripsymbols)
- __CMakeArgs="-DSTRIP_SYMBOLS=true $__CMakeArgs"
;;
verbose|-verbose)
+include(${CMAKE_CURRENT_LIST_DIR}/configuretools.cmake)
+
# Set initial flags for each configuration
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_definitions("$<$<OR:$<CONFIG:DEBUG>,$<CONFIG:CHECKED>>:DEBUG;_DEBUG;_DBG;URTBLDENV_FRIENDLY=Checked;BUILDENV_CHECKED=1>")
add_compile_definitions("$<$<OR:$<CONFIG:RELEASE>,$<CONFIG:RELWITHDEBINFO>>: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)
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)
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)
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")
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)
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)
endif()
locate_toolchain_exec(objcopy CMAKE_OBJCOPY)
- endif()
+ endif(NOT CLR_CMAKE_TARGET_DARWIN)
endif()
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 "")
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 $<TARGET_FILE:${targetName}>)
-
- 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 $<TARGET_FILE:${targetName}>)
- 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}/$<CONFIG>/${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}")
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 $<TARGET_FILE:${targetName}> DESTINATION ${INSTALL_CLR_DESTINATION})
- if(WIN32)
- # We can't use the $<TARGET_PDB_FILE> generator expression here since
- # the generator expression isn't supported on resource DLLs.
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${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}/$<CONFIG>/${targetName}.pgd DESTINATION ${INSTALL_CLR_DESTINATION}/PGD OPTIONAL)
# - 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}
# 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)
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
#----------------------------------------------------
add_dependencies(createdump mscordaccore)
install_clr(TARGETS createdump)
-install_clr(TARGETS createdump DESTINATION sharedFramework SKIP_STRIP)
+install_clr(TARGETS createdump DESTINATION sharedFramework)
# 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)
# add the install targets
install_clr(TARGETS dbgshim)
-install_clr(TARGETS dbgshim DESTINATION sharedFramework SKIP_STRIP)
+install_clr(TARGETS dbgshim DESTINATION sharedFramework)
# 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})
# add the install targets
install_clr(TARGETS mscordbi)
-install_clr(TARGETS mscordbi DESTINATION sharedFramework SKIP_STRIP)
+install_clr(TARGETS mscordbi DESTINATION sharedFramework)
# 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)
)
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)
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)
_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)
# add the install targets
install_clr(TARGETS crossgen)
-install_clr(TARGETS crossgen DESTINATION sharedFramework SKIP_STRIP)
+install_clr(TARGETS crossgen DESTINATION sharedFramework)
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)
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)
{
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"));
#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")
#define __cdecl /* nothing */
#define __stdcall /* nothing */
- #if !defined(__FreeBSD__)
+ #if !defined(TARGET_FREEBSD)
#define __fastcall /* nothing */
#else
#include <sys/types.h>
#include <ctime>
#include <pwd.h>
-#if defined(__APPLE__)
+#if defined(TARGET_DARWIN)
#include <mach-o/dyld.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#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
/*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
}
// ***************************
-#if defined(__APPLE__)
+#if defined(TARGET_DARWIN)
recv->assign(_X("/usr/local/share/dotnet"));
#else
recv->assign(_X("/usr/share/dotnet"));
return stringToCleanup;
}
-#if defined(__APPLE__)
+#if defined(TARGET_DARWIN)
pal::string_t pal::get_current_os_rid_platform()
{
pal::string_t ridOS;
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()
{
}
#endif
-#if defined(__APPLE__)
+#if defined(TARGET_DARWIN)
bool pal::get_own_executable_path(pal::string_t* recv)
{
uint32_t path_length = 0;
}
return false;
}
-#elif defined(__FreeBSD__)
+#elif defined(TARGET_FREEBSD)
bool pal::get_own_executable_path(pal::string_t* recv)
{
int mib[4];
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
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);
}
// ***************************
- 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)");
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.
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;
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
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.
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
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"
#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")
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;
std::atomic<bool> g_context_initializing(false);
std::condition_variable g_context_initializing_cv;
- int create_coreclr()
+ int HOSTPOLICY_CALLTYPE create_coreclr()
{
int rc;
{
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<hostpolicy_context_t> context = get_hostpolicy_context(/*require_runtime*/ true);
if (context == nullptr)
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;
}
}
- 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;
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;
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;
# 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
../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)
endif()
set (ASM_HELPERS_SOURCES
- ${ARCH_SPECIFIC_FOLDER_NAME}/asmhelpers.asm)
+ ${ARCH_SOURCES_DIR}/asmhelpers.asm)
add_definitions(-DFEATURE_LIBHOST=1)
#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
};
#include <poppack.h>
-#endif
\ No newline at end of file
+#endif
#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
};
#include <poppack.h>
-#endif
\ No newline at end of file
+#endif
#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
};
#include <poppack.h>
-#endif
\ No newline at end of file
+#endif
#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
};
#include <poppack.h>
-#endif
\ No newline at end of file
+#endif
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;
}
}
return false;
-}
\ No newline at end of file
+}
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;
}
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;
}
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_ */
+++ /dev/null
-
-# 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. $<$<CONFIG:Debug>:_DEBUG> to $<$<CONFIG:Debug>:-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 $<TARGET_PROPERTY:prop> 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 "\\$<TARGET_PROPERTY:[^,>]+>" "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)
+++ /dev/null
-# 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}/$<CONFIG>/${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 $<TARGET_FILE:${targetName}>
- )
- 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($<$<CONFIG:Debug>:-DDEBUG>)
- add_compile_options($<$<CONFIG:Release>:-DNDEBUG>)
- add_compile_options($<$<CONFIG:RelWithDebInfo>:-DNDEBUG>)
- add_compile_options($<$<CONFIG:Debug>:/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()
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)
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)
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)
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 $<TARGET_FILE:${targetName}>)
- else()
- get_property(install_source_file TARGET ${targetName} PROPERTY LOCATION)
- endif()
-
+ install_symbols(${targetName} .)
+ set(install_source_file $<TARGET_FILE:${targetName}>)
install(PROGRAMS ${install_source_file} DESTINATION .)
- if(CLR_CMAKE_TARGET_WIN32)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb DESTINATION PDB)
- else()
- install(FILES ${strip_destination_file} DESTINATION .)
- endif()
endfunction()
include(configure.cmake)
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()