[CMake][Win] Conditionally select DLL CRT or static CRT
authordon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Nov 2017 21:16:50 +0000 (21:16 +0000)
committerdon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Nov 2017 21:16:50 +0000 (21:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170594

Reviewed by Alex Christensen.

.:

* Source/cmake/OptionsAppleWin.cmake:
* Source/cmake/OptionsMSVC.cmake:

Source/JavaScriptCore:

* shell/PlatformWin.cmake:

Source/WebKitLegacy:

* PlatformWin.cmake:

Tools:

* DumpRenderTree/PlatformWin.cmake:
* MiniBrowser/win/CMakeLists.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225191 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/shell/PlatformWin.cmake
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/PlatformWin.cmake
Source/cmake/OptionsAppleWin.cmake
Source/cmake/OptionsMSVC.cmake
Tools/ChangeLog
Tools/DumpRenderTree/PlatformWin.cmake
Tools/MiniBrowser/win/CMakeLists.txt

index 4ca1469..90139b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-11-27  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake][Win] Conditionally select DLL CRT or static CRT
+        https://bugs.webkit.org/show_bug.cgi?id=170594
+
+        Reviewed by Alex Christensen.
+
+        * Source/cmake/OptionsAppleWin.cmake:
+        * Source/cmake/OptionsMSVC.cmake:
+
 2017-11-27  Adrian Perez de Castro  <aperez@igalia.com>
 
         [CMake] Values of CMAKE_BUILD_TYPE from toolchain file are ignored
index 07a9498..0d2b204 100644 (file)
@@ -1,3 +1,12 @@
+2017-11-27  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake][Win] Conditionally select DLL CRT or static CRT
+        https://bugs.webkit.org/show_bug.cgi?id=170594
+
+        Reviewed by Alex Christensen.
+
+        * shell/PlatformWin.cmake:
+
 2017-11-27  Saam Barati  <sbarati@apple.com>
 
         Having a bad time watchpoint firing during compilation revealed a racy assertion
index 2e0fe88..0527863 100644 (file)
@@ -26,8 +26,8 @@ add_dependencies(testRegExp testRegExpLib)
 target_link_libraries(testRegExpLib JavaScriptCore)
 
 add_library(testapiLib SHARED ${TESTAPI_SOURCES})
-set_source_files_properties(../API/tests/CustomGlobalObjectClassTest.c PROPERTIES COMPILE_FLAGS "/TP /MT")
-set_source_files_properties(../API/tests/testapi.c PROPERTIES COMPILE_FLAGS "/TP /MT")
+set_source_files_properties(../API/tests/CustomGlobalObjectClassTest.c PROPERTIES COMPILE_FLAGS "/TP ${MSVC_RUNTIME_COMPILE_FLAG}")
+set_source_files_properties(../API/tests/testapi.c PROPERTIES COMPILE_FLAGS "/TP ${MSVC_RUNTIME_COMPILE_FLAG}")
 add_executable(testapi ${JSC_SOURCES})
 set_target_properties(testapi PROPERTIES OUTPUT_NAME "testapi${DEBUG_SUFFIX}")
 target_link_libraries(testapi shlwapi)
index 0c30909..b5bbd6b 100644 (file)
@@ -1,3 +1,12 @@
+2017-11-27  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake][Win] Conditionally select DLL CRT or static CRT
+        https://bugs.webkit.org/show_bug.cgi?id=170594
+
+        Reviewed by Alex Christensen.
+
+        * PlatformWin.cmake:
+
 2017-11-24  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [WinCairo] WebPreferences IDL not regenerating
index c7ef987..b30dd39 100644 (file)
@@ -469,7 +469,7 @@ string(REPLACE " " "\;" CXX_LIBS ${CMAKE_CXX_STANDARD_LIBRARIES})
 list(APPEND WebKitLegacy_LIBRARIES ${CXX_LIBS})
 set(CMAKE_CXX_STANDARD_LIBRARIES "")
 
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:MSVCRTD")
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MSVC_RUNTIME_LINKER_FLAGS}")
 
 # If this directory isn't created before midl runs and attempts to output WebKit.tlb,
 # It fails with an unusual error - midl failed - failed to save all changes
index 47b8dee..ea8d827 100644 (file)
@@ -1,3 +1,7 @@
+# The static runtime is required for AppleWin due to WebKitSystemInterface.lib
+# being compiled with a static runtime.
+set(MSVC_STATIC_RUNTIME ON)
+
 include(OptionsWin)
 
 SET_AND_EXPOSE_TO_BUILD(USE_CF ON)
index 2bff8dc..fd25bd4 100644 (file)
@@ -55,17 +55,27 @@ if (NOT ${CMAKE_CXX_FLAGS} STREQUAL "")
     string(REGEX REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Warnings are important
 endif ()
 
+if (MSVC_STATIC_RUNTIME)
+    message(STATUS "Using multithreaded, static version of the run-time library")
+    set(MSVC_RUNTIME_COMPILE_FLAG "/MT")
+    set(MSVC_RUNTIME_LINKER_FLAGS "/NODEFAULTLIB:MSVCRT /NODEFAULTLIB:MSVCRTD")
+else ()
+    message(STATUS "Using multithreaded, dynamic version of the run-time library")
+    set(MSVC_RUNTIME_COMPILE_FLAG "/MD")
+    # No linker flags are required
+endif ()
+
 foreach (flag_var
     CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
     CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
     CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
     CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
     # Use the multithreaded static runtime library instead of the default DLL runtime.
-    string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+    string(REGEX REPLACE "/MD" "${MSVC_RUNTIME_COMPILE_FLAG}" ${flag_var} "${${flag_var}}")
 
     # No debug runtime, even in debug builds.
     if (NOT DEBUG_SUFFIX)
-        string(REGEX REPLACE "/MTd" "/MT" ${flag_var} "${${flag_var}}")
+        string(REGEX REPLACE "${MSVC_RUNTIME_COMPILE_FLAG}d" "${MSVC_RUNTIME_COMPILE_FLAG}" ${flag_var} "${${flag_var}}")
         string(REGEX REPLACE "/D_DEBUG" "" ${flag_var} "${${flag_var}}")
     endif ()
 endforeach ()
index 3d6b2b3..99af30e 100644 (file)
@@ -1,3 +1,13 @@
+2017-11-27  Don Olmstead  <don.olmstead@sony.com>
+
+        [CMake][Win] Conditionally select DLL CRT or static CRT
+        https://bugs.webkit.org/show_bug.cgi?id=170594
+
+        Reviewed by Alex Christensen.
+
+        * DumpRenderTree/PlatformWin.cmake:
+        * MiniBrowser/win/CMakeLists.txt:
+
 2017-11-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
 
         [GTK][WPE] Add "enable-encrypted-media" property to WebKitWebSettings
index 626ede1..d91bf2e 100644 (file)
@@ -105,7 +105,7 @@ else ()
 endif ()
 
 WEBKIT_ADD_PRECOMPILED_HEADER("DumpRenderTreePrefix.h" "win/DumpRenderTreePrefix.cpp" DumpRenderTreeLib_SOURCES)
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:MSVCRTD")
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MSVC_RUNTIME_LINKER_FLAGS}")
 add_definitions(-DUSE_CONSOLE_ENTRY_POINT)
 
 add_library(DumpRenderTreeLib SHARED ${DumpRenderTreeLib_SOURCES})
index 796f015..b8956f8 100644 (file)
@@ -36,7 +36,7 @@ if (USE_CF)
     )
 endif ()
 
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:MSVCRTD")
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MSVC_RUNTIME_LINKER_FLAGS}")
 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wWinMainCRTStartup")
 
 if (${WTF_PLATFORM_WIN_CAIRO})