Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdeel Mujahid <adeelbm@outlook.com>2020-03-10 03:08:21 +0300
committerGitHub <noreply@github.com>2020-03-10 03:08:21 +0300
commit253a0b4fb3fd1ae1860f121d9260eaae94ded701 (patch)
treef4d64b1383d9012cc1c21c0dc053952ad5efddd2 /src
parent1e04f68b1b97bf36e4f1fc75ea23b9d156c19920 (diff)
Consolidate objcopy detection (#33342)
Diffstat (limited to 'src')
-rw-r--r--src/coreclr/CMakeLists.txt3
-rw-r--r--src/installer/corehost/CMakeLists.txt1
-rw-r--r--src/installer/settings.cmake59
-rw-r--r--src/libraries/Native/Unix/CMakeLists.txt59
4 files changed, 2 insertions, 120 deletions
diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt
index f0baa256590..09072e1e2eb 100644
--- a/src/coreclr/CMakeLists.txt
+++ b/src/coreclr/CMakeLists.txt
@@ -7,9 +7,6 @@ project(CoreCLR)
include(${CLR_ENG_NATIVE_DIR}/configureplatform.cmake)
-# Include cmake functions
-include(${CLR_ENG_NATIVE_DIR}/functions.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}")
diff --git a/src/installer/corehost/CMakeLists.txt b/src/installer/corehost/CMakeLists.txt
index ca3a9bed66b..1d8dd85afde 100644
--- a/src/installer/corehost/CMakeLists.txt
+++ b/src/installer/corehost/CMakeLists.txt
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.14.2)
project(corehost)
-include(${CLR_ENG_NATIVE_DIR}/functions.cmake)
include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake)
include(${CLR_ENG_NATIVE_DIR}/configureplatform.cmake)
include(../settings.cmake)
diff --git a/src/installer/settings.cmake b/src/installer/settings.cmake
index e8e4e84d0e2..6c56313847a 100644
--- a/src/installer/settings.cmake
+++ b/src/installer/settings.cmake
@@ -21,71 +21,14 @@ if (NOT CLR_CMAKE_HOST_WIN32)
if (STRIP STREQUAL "STRIP-NOTFOUND")
message(FATAL_ERROR "strip not found")
endif()
- else (CLR_CMAKE_HOST_DARWIN)
- # Ensure that objcopy is present
- if(DEFINED ENV{ROOTFS_DIR})
- if(CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_I386)
- find_program(OBJCOPY ${TOOLCHAIN}-objcopy)
- else()
- message(FATAL_ERROR "Only AMD64, X86, ARM64 and ARM are supported")
- endif()
- else()
- find_program(OBJCOPY objcopy)
- endif()
- if (OBJCOPY STREQUAL "OBJCOPY-NOTFOUND" AND NOT CLR_CMAKE_TARGET_ARCH_I386)
- message(FATAL_ERROR "objcopy not found")
- endif()
endif (CLR_CMAKE_HOST_DARWIN)
endif ()
-function(strip_symbols targetName outputFilename)
- if(CLR_CMAKE_TARGET_UNIX)
- if(STRIP_SYMBOLS)
-
- # On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE
- # generator expression doesn't work correctly returning the wrong path and on
- # the newer cmake versions the LOCATION property isn't supported anymore.
- if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
- set(strip_source_file $<TARGET_FILE:${targetName}>)
- else()
- get_property(strip_source_file TARGET ${targetName} PROPERTY LOCATION)
- endif()
-
- if(CLR_CMAKE_TARGET_DARWIN)
- set(strip_destination_file ${strip_source_file}.dwarf)
-
- add_custom_command(
- TARGET ${targetName}
- POST_BUILD
- VERBATIM
- COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file}
- COMMAND ${STRIP} -u -r ${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 ${OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file}
- COMMAND ${OBJCOPY} --strip-unneeded ${strip_source_file}
- COMMAND ${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(STRIP_SYMBOLS)
- endif(CLR_CMAKE_TARGET_UNIX)
-endfunction()
-
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)
+ strip_symbols(${targetName} strip_destination_file NO)
install(FILES ${strip_destination_file} DESTINATION ${destination_path})
endif()
endfunction()
diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt
index 42728349a43..6f067a29aa0 100644
--- a/src/libraries/Native/Unix/CMakeLists.txt
+++ b/src/libraries/Native/Unix/CMakeLists.txt
@@ -161,20 +161,6 @@ if(CLR_CMAKE_TARGET_UNIX)
else (CLR_CMAKE_TARGET_DARWIN)
add_compile_options($<$<COMPILE_LANGUAGE:ASM>:-Wa,--noexecstack>)
add_link_options(-Wl,--build-id=sha1 -Wl,-z,relro,-z,now)
-
- # Ensure that objcopy is present
- if(DEFINED ENV{CROSSCOMPILE})
- if(CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_I386)
- find_program(OBJCOPY ${TOOLCHAIN}-objcopy)
- else()
- message(FATAL_ERROR "Only AMD64, X86, ARM64 and ARM are supported")
- endif()
- else()
- find_program(OBJCOPY objcopy)
- endif()
- if (OBJCOPY STREQUAL "OBJCOPY-NOTFOUND" AND NOT CLR_CMAKE_TARGET_ARCH_I386)
- message(FATAL_ERROR "objcopy not found")
- endif()
endif(CLR_CMAKE_TARGET_DARWIN)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CLR_ADDITIONAL_LINKER_FLAGS}")
@@ -182,51 +168,8 @@ if(CLR_CMAKE_TARGET_UNIX)
add_compile_options(${CLR_ADDITIONAL_COMPILER_OPTIONS})
endif(CLR_CMAKE_TARGET_UNIX)
-function(strip_symbols targetName outputFilename)
- if(CLR_CMAKE_TARGET_UNIX)
- if(STRIP_SYMBOLS)
-
- # On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE
- # generator expression doesn't work correctly returning the wrong path and on
- # the newer cmake versions the LOCATION property isn't supported anymore.
- if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
- set(strip_source_file $<TARGET_FILE:${targetName}>)
- else()
- get_property(strip_source_file TARGET ${targetName} PROPERTY LOCATION)
- endif()
-
- if(CLR_CMAKE_TARGET_DARWIN)
- set(strip_destination_file ${strip_source_file}.dwarf)
-
- add_custom_command(
- TARGET ${targetName}
- POST_BUILD
- VERBATIM
- COMMAND ${DSYMUTIL} --flat --minimize ${strip_source_file}
- COMMAND ${STRIP} -u -r ${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 ${OBJCOPY} --only-keep-debug ${strip_source_file} ${strip_destination_file}
- COMMAND ${OBJCOPY} --strip-unneeded ${strip_source_file}
- COMMAND ${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(STRIP_SYMBOLS)
- endif(CLR_CMAKE_TARGET_UNIX)
-endfunction()
-
function(install_library_and_symbols targetName)
- strip_symbols(${targetName} strip_destination_file)
+ 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