Link System.Globalization.Native into coreclr (#6928)
authorSantiago Fernandez Madero <safern@microsoft.com>
Mon, 3 Feb 2020 21:53:39 +0000 (13:53 -0800)
committerGitHub <noreply@github.com>
Mon, 3 Feb 2020 21:53:39 +0000 (13:53 -0800)
* Link System.Globalization.Native into coreclr

* Add more paths to coreclr subset filters

* Fix linux build

* PR Feedback

* PR Feedback 2

* Fix build (pass -DREPO_ROOT_DIR only on coreclr atm), System.IO.Ports.Native needs to be built first

* Remove version header file from static libs

* Remove CORECLR_BUILD variable definition

12 files changed:
eng/pipelines/runtime.yml
src/coreclr/CMakeLists.txt
src/coreclr/build.cmd
src/coreclr/build.sh
src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt
src/coreclr/src/libraries-native/CMakeLists.txt [new file with mode: 0644]
src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt
src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt
src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt
src/libraries/Native/Unix/System.Native/CMakeLists.txt
src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt
src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt

index e800372..117601b 100644 (file)
@@ -56,6 +56,8 @@ jobs:
     - subset: coreclr
       include:
       - src/libraries/System.Private.CoreLib/*
+      - src/libraries/Native/Unix/System.Globalization.Native/*
+      - src/libraries/Native/Unix/Common/*
       exclude:
       - eng/Version.Details.xml
       - '*.md'
index 30c01e5..4904605 100644 (file)
@@ -129,6 +129,8 @@ endif(CLR_CROSS_COMPONENTS_BUILD)
 #-------------------
 include(pgosupport.cmake)
 
+add_subdirectory(src/libraries-native)
+
 #-----------------------------------------
 # Add Projects
 #     - project which require platform header not clr's
index a524a80..7e8a3d7 100644 (file)
@@ -457,7 +457,7 @@ if %__BuildCrossArchNative% EQU 1 (
 
     set __CMakeBinDir=%__CrossComponentBinDir%
     set "__CMakeBinDir=!__CMakeBinDir:\=/!"
-    set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__BuildOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native"
+    set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__BuildOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%"
     call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossCompIntermediatesDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs!
 
     if not !errorlevel! == 0 (
index 6d81c65..131fd7c 100755 (executable)
@@ -503,7 +503,7 @@ restore_optdata
 generate_event_logging
 
 # Build the coreclr (native) components.
-__CMakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize $__CMakeArgs"
+__CMakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize -DCLR_REPO_ROOT_DIR=\"$__RepoRootDir\" $__CMakeArgs"
 
 if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then
     __CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs"
index efd7c60..ca9d8cd 100644 (file)
@@ -123,6 +123,7 @@ else()
         ${END_WHOLE_ARCHIVE}
         mscorrc_debug
         palrt
+        System.Globalization.Native-Static
     )
 endif(WIN32)
 
diff --git a/src/coreclr/src/libraries-native/CMakeLists.txt b/src/coreclr/src/libraries-native/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4835c64
--- /dev/null
@@ -0,0 +1,5 @@
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+if(CLR_CMAKE_HOST_UNIX AND NOT CLR_CROSS_COMPONENTS_BUILD)
+    add_subdirectory(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.Globalization.Native System.Globalization.Native)
+endif()
index bef0bc6..f6380c0 100644 (file)
@@ -58,23 +58,25 @@ set(NATIVEGLOBALIZATION_SOURCES
 )
 
 include_directories(${UTYPES_H})
+include_directories("../Common")
 
-add_library(System.Globalization.Native
-    SHARED
-    ${NATIVEGLOBALIZATION_SOURCES}
-    ${VERSION_FILE_PATH}
-)
+if (GEN_SHARED_LIB)
+    add_library(System.Globalization.Native
+        SHARED
+        ${NATIVEGLOBALIZATION_SOURCES}
+        ${VERSION_FILE_PATH}
+    )
 
-target_link_libraries(System.Globalization.Native
-    dl
-)
+    target_link_libraries(System.Globalization.Native
+        dl
+    )
 
-install_library_and_symbols (System.Globalization.Native)
+    install_library_and_symbols (System.Globalization.Native)
+endif()
 
 add_library(System.Globalization.Native-Static
     STATIC
     ${NATIVEGLOBALIZATION_SOURCES}
-    ${VERSION_FILE_PATH}
 )
 
 # Disable the "lib" prefix and override default name
@@ -84,11 +86,13 @@ set_target_properties(System.Globalization.Native-Static PROPERTIES OUTPUT_NAME
 install (TARGETS System.Globalization.Native-Static DESTINATION .)
 
 if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
-    add_custom_command(TARGET System.Globalization.Native POST_BUILD
-        COMMENT "Verifying System.Globalization.Native.so dependencies"
-        COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-so.sh
-            $<TARGET_FILE:System.Globalization.Native>
-            "Verification failed. System.Globalization.Native.so has undefined dependencies. These are likely ICU APIs that need to be added to icushim.h."
-        VERBATIM
-    )
+    if (GEN_SHARED_LIB)
+        add_custom_command(TARGET System.Globalization.Native POST_BUILD
+            COMMENT "Verifying System.Globalization.Native.so dependencies"
+            COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-so.sh
+                $<TARGET_FILE:System.Globalization.Native>
+                "Verification failed. System.Globalization.Native.so has undefined dependencies. These are likely ICU APIs that need to be added to icushim.h."
+            VERBATIM
+        )
+    endif()
 endif()
index 0d5338b..2b04724 100644 (file)
@@ -59,7 +59,6 @@ endif ()
 add_library(System.IO.Compression.Native-Static
     STATIC
     ${NATIVECOMPRESSION_SOURCES}
-    ${VERSION_FILE_PATH}
 )
 
 # Disable the "lib" prefix and override default name
index cd524dd..5155a68 100644 (file)
@@ -11,7 +11,6 @@ add_library(System.IO.Ports.Native-Static
     STATIC
     pal_termios.c
     pal_serial.c
-    ${VERSION_FILE_PATH}
 )
 
 # Disable the "lib" prefix and override default name
index 7421436..82e4a84 100644 (file)
@@ -60,7 +60,6 @@ endif ()
 add_library(System.Native-Static
     STATIC
     ${NATIVE_SOURCES}
-    ${VERSION_FILE_PATH}
 )
 
 # Disable the "lib" prefix and override default name
index b7a822a..95c9901 100644 (file)
@@ -34,7 +34,6 @@ add_library(System.Net.Security.Native
 add_library(System.Net.Security.Native-Static
     STATIC
     ${NATIVEGSS_SOURCES}
-    ${VERSION_FILE_PATH}
 )
 
 # Disable the "lib" prefix and override default name
index 6143c43..4bf9929 100644 (file)
@@ -30,7 +30,6 @@ add_library(System.Security.Cryptography.Native.Apple
 add_library(System.Security.Cryptography.Native.Apple-Static
     STATIC
     ${NATIVECRYPTO_SOURCES}
-    ${VERSION_FILE_PATH}
 )
 
 # Disable the "lib" prefix.