if (AWK STREQUAL "AWK-NOTFOUND")
message(FATAL_ERROR "AWK not found")
endif()
+
+ if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+ # Ensure that dsymutil and strip is 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()
+
+ else (CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+ # Ensure that objcopy is present
+ find_program(OBJCOPY objcopy)
+ if (OBJCOPY STREQUAL "OBJCOPY-NOTFOUND")
+ message(FATAL_ERROR "objcopy not found")
+ endif()
+ endif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
endif(WIN32)
# Build a list of compiler definitions by putting -D in front of each define.
endif(MSVC)
endfunction()
+function(strip_symbols targetName outputFilename)
+ if(CLR_CMAKE_PLATFORM_UNIX)
+ if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
+
+ # 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(CMAKE_SYSTEM_NAME STREQUAL 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(CMAKE_SYSTEM_NAME STREQUAL 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(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+ set(${outputFilename} ${strip_destination_file} PARENT_SCOPE)
+ endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
+ endif(CLR_CMAKE_PLATFORM_UNIX)
+endfunction()
+
+function(install_clr targetName)
+ strip_symbols(${targetName} strip_destination_file)
+
+ # On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE
+ # generator expression doesn't work correctly returning the wrong path and on
+ # the newer cmake versions the LOCATION property isn't supported anymore.
+ if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
+ set(install_source_file $<TARGET_FILE:${targetName}>)
+ else()
+ get_property(install_source_file TARGET ${targetName} PROPERTY LOCATION)
+ endif()
+
+ install(PROGRAMS ${install_source_file} DESTINATION .)
+ if(WIN32)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb DESTINATION PDB)
+ else()
+ install(FILES ${strip_destination_file} DESTINATION .)
+ endif()
+endfunction()
+
# Includes
if (CMAKE_CONFIGURATION_TYPES) # multi-configuration generator?
target_link_libraries(sos ${SOS_LIBRARY})
# add the install targets
-install (TARGETS sos DESTINATION .)
-if(WIN32)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/sos.pdb DESTINATION PDB)
-else(WIN32)
- install (FILES sosdocsunix.txt DESTINATION .)
-endif(WIN32)
+install_clr(sos)
+
+if(NOT WIN32)
+ install(FILES sosdocsunix.txt DESTINATION .)
+endif(NOT WIN32)
endif()
# add the install targets
-install (TARGETS sosplugin DESTINATION .)
+install_clr(sosplugin)
\ No newline at end of file
)
# Can't compile on linux yet so only add for windows
- # add the install targets
- install (TARGETS CoreConsole DESTINATION .)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$ENV{__BuildType}/CoreConsole.pdb DESTINATION PDB)
+ install_clr(CoreConsole)
endif(CLR_CMAKE_PLATFORM_UNIX)
\ No newline at end of file
)
# Can't compile on linux yet so only add for windows
- # add the install targets
- install (TARGETS CoreRun DESTINATION .)
+ install_clr(CoreRun)
- # We will generate PDB only for the debug configuration
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/CoreRun.pdb DESTINATION PDB)
-
endif(CLR_CMAKE_PLATFORM_UNIX)
\ No newline at end of file
coreclr
)
-install (TARGETS osxbundlerun DESTINATION .)
+install_clr(osxbundlerun)
coreclr
)
-install (TARGETS coreconsole DESTINATION .)
+install_clr(coreconsole)
\ No newline at end of file
coreclr
)
-install (TARGETS corerun DESTINATION .)
+install_clr(corerun)
\ No newline at end of file
add_definitions(-DU_DISABLE_RENAMING=1)
endif()
-install (TARGETS System.Globalization.Native DESTINATION .)
+# add the install targets
+install_clr(System.Globalization.Native)
\ No newline at end of file
)
# add the install targets
-install (TARGETS clretwrc DESTINATION .)
-
-if(WIN32)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/clretwrc.pdb DESTINATION PDB)
-endif(WIN32)
+install_clr(clretwrc)
\ No newline at end of file
target_link_libraries(dbgshim ${DBGSHIM_LIBRARIES})
# add the install targets
-install (TARGETS dbgshim DESTINATION .)
-if(WIN32)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/dbgshim.pdb DESTINATION PDB)
-endif(WIN32)
+install_clr(dbgshim)
target_link_libraries(mscordaccore ${COREDAC_LIBRARIES})
# add the install targets
-install (TARGETS mscordaccore DESTINATION .)
-if(WIN32)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/mscordaccore.pdb DESTINATION PDB)
-endif(WIN32)
+install_clr(mscordaccore)
\ No newline at end of file
endif(WIN32)
# add the install targets
-install (TARGETS mscordbi DESTINATION .)
-if(WIN32)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/mscordbi.pdb DESTINATION PDB)
-endif(WIN32)
+install_clr(mscordbi)
\ No newline at end of file
clr_unknown_arch()
endif()
- add_custom_command(TARGET coreclr
+ add_custom_command(
+ TARGET coreclr
POST_BUILD
COMMAND ${CMAKE_CXX_COMPILER} /P /EP /TP ${PREPROCESS_DEFINITIONS} ${INC_DIR} /Fi${CMAKE_CURRENT_BINARY_DIR}/daccess.i ${CLR_DIR}/src/debug/daccess/daccess.cpp
COMMAND ${BuildToolsDir}/dactablegen.exe /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/coreclr.pdb /dll:$<TARGET_FILE:coreclr> /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin
endif(WIN32)
# add the install targets
-install (TARGETS coreclr DESTINATION .)
-if(WIN32)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/coreclr.pdb DESTINATION PDB)
-endif(WIN32)
+install_clr(coreclr)
\ No newline at end of file
dl
)
endif(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
-
else()
target_link_libraries(ilasm
${ILASM_LINK_LIBRARIES}
oleaut32
shell32
)
-
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/ilasm.pdb DESTINATION PDB)
endif(CLR_CMAKE_PLATFORM_UNIX)
-install (TARGETS ilasm DESTINATION .)
+install_clr(ilasm)
\ No newline at end of file
oleaut32
shell32
)
-
- # We will generate PDB only for the debug configuration
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/ildasm.pdb DESTINATION PDB)
-
endif(CLR_CMAKE_PLATFORM_UNIX)
-install (TARGETS ildasm DESTINATION .)
+install_clr(ildasm)
\ No newline at end of file
)
# add the install targets
-install (TARGETS ryujit DESTINATION .)
-if(WIN32)
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/ryujit.pdb DESTINATION PDB)
-endif(WIN32)
+install_clr(ryujit)
\ No newline at end of file
add_subdirectory(tracepointprovider)
# Install the static eventprovider library
- install (TARGETS eventprovider DESTINATION lib)
+ install(TARGETS eventprovider DESTINATION lib)
""")
topCmake.close()
tracepointprovider_Cmake.write(""" )
target_link_libraries(coreclrtraceptprovider
- -llttng-ust
+ -llttng-ust
)
- #Install the static coreclrtraceptprovider library
- install (TARGETS coreclrtraceptprovider DESTINATION .)
+ # Install the static coreclrtraceptprovider library
+ install_clr(coreclrtraceptprovider)
""")
tracepointprovider_Cmake.close()
if (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64)
target_link_libraries(crossgen ${STATIC_MT_VCRT_LIB})
endif()
-
- # We will generate PDB only for the debug configuration
- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/crossgen.pdb DESTINATION PDB)
-
endif(CLR_CMAKE_PLATFORM_UNIX)
-install (TARGETS crossgen DESTINATION .)
-
add_subdirectory(../../zap/crossgen ../../zap/crossgen)
add_subdirectory(../../vm/crossgen ../../vm/crossgen)
add_subdirectory(../../vm/crossgen_mscorlib ../../vm/crossgen_mscorlib)
+
+# add the install targets
+install_clr(crossgen)
\ No newline at end of file