فهرست منبع

cross-platform: fix AutoSystemInfo Initialization

Oguz Bastemur 9 سال پیش
والد
کامیت
bc941d815e
3فایلهای تغییر یافته به همراه50 افزوده شده و 6 حذف شده
  1. 7 1
      bin/ChakraCore/CMakeLists.txt
  2. 35 3
      bin/GCStress/CMakeLists.txt
  3. 8 2
      bin/ch/CMakeLists.txt

+ 7 - 1
bin/ChakraCore/CMakeLists.txt

@@ -47,6 +47,13 @@ else()
   message("This platform is not yet supported")
 endif() # Linux ?
 
+# make sure to include Common.Core before others
+# this will help linker on some platforms for correct
+# initialization order
+set(lib_target "${lib_target}"
+  Chakra.Common.Core
+  )
+
 # common link deps
 set(lib_target "${lib_target}"
   Chakra.Runtime.Types
@@ -61,7 +68,6 @@ set(lib_target "${lib_target}"
   Chakra.Common.Util
   Chakra.Common.Memory
   Chakra.Common.Common
-  Chakra.Common.Core
   Chakra.Common.DataStructures
   Chakra.Common.Exceptions
   Chakra.Common.Codex

+ 35 - 3
bin/GCStress/CMakeLists.txt

@@ -15,12 +15,44 @@ target_include_directories (GCStress
 
 set(LINK_FLAGS ${LINK_FLAGS} "-Wl,-whole-archive")
 
-target_link_libraries (GCStress
+if(CMAKE_SYSTEM_NAME STREQUAL Linux)
+  set(lib_target
+    -Wl,--no-undefined
+    -Wl,--start-group
+    )
+elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+  set(lib_target
+    -Wl,-undefined,error
+    )
+else()
+  message("This platform is not yet supported")
+endif() # Linux ?
+
+# make sure to include Common.Core before others
+# this will help linker on some platforms for correct
+# initialization order
+set(lib_target "${lib_target}"
+  Chakra.Common.Core
+  )
+
+# common link deps
+set(lib_target "${lib_target}"
   Chakra.Common.Memory
   Chakra.Runtime.PlatformAgnostic
   Chakra.Common.Common
-  Chakra.Common.Core
   Chakra.Common.DataStructures
   Chakra.Common.Exceptions
-  Chakra.Pal
   )
+
+if(CMAKE_SYSTEM_NAME STREQUAL Linux)
+  set(lib_target "${lib_target}"
+    -Wl,--end-group
+    Chakra.Pal
+    )
+elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+  set(lib_target "${lib_target}"
+    Chakra.Pal
+    )
+endif() # Linux ?
+
+target_link_libraries (GCStress ${lib_target})

+ 8 - 2
bin/ch/CMakeLists.txt

@@ -56,6 +56,13 @@ if(STATIC_LIBRARY)
     message("This platform is not yet supported")
   endif() # Linux ?
 
+  # make sure to include Common.Core before others
+  # this will help linker on some platforms for correct
+  # initialization order
+  set(lib_target "${lib_target}"
+    Chakra.Common.Core
+    )
+
   # common link deps
   set(lib_target "${lib_target}"
     Chakra.Runtime.Types
@@ -70,7 +77,6 @@ if(STATIC_LIBRARY)
     Chakra.Common.Util
     Chakra.Common.Memory
     Chakra.Common.Common
-    Chakra.Common.Core
     Chakra.Common.DataStructures
     Chakra.Common.Exceptions
     Chakra.Common.Codex
@@ -118,4 +124,4 @@ if(NOT CC_XCODE_PROJECT)
     COMMAND ${CMAKE_COMMAND} -E copy_if_different
     "${CHAKRACORE_BINARY_DIR}/bin/ch/ch"
     ${CHAKRACORE_BINARY_DIR}/)
-endif()
+endif()