WebKit Bugzilla
Attachment 348954 Details for
Bug 189313
: [CMake] Allow port specific options on gtest
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189313.diff (text/plain), 5.07 KB, created by
Don Olmstead
on 2018-09-05 12:28:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Don Olmstead
Created:
2018-09-05 12:28:53 PDT
Size:
5.07 KB
patch
obsolete
>diff --git a/Source/ThirdParty/ChangeLog b/Source/ThirdParty/ChangeLog >index 9e65e0b2c70..4992b551a18 100644 >--- a/Source/ThirdParty/ChangeLog >+++ b/Source/ThirdParty/ChangeLog >@@ -1,3 +1,18 @@ >+2018-09-05 Don Olmstead <don.olmstead@sony.com> >+ >+ [CMake] Allow port specific options on gtest >+ https://bugs.webkit.org/show_bug.cgi?id=189313 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Allows a port to configure options within gtest for its platform. >+ The library type can be set otherwise it defaults to shared. Also the >+ compile definitions are propogated to TestWebKitAPI through a global >+ property. >+ >+ * gtest/CMakeLists.txt: >+ * gtest/PlatformWin.cmake: Added. >+ > 2018-09-04 Ross Kirsling <ross.kirsling@sony.com> > > Update googletest >diff --git a/Source/ThirdParty/gtest/CMakeLists.txt b/Source/ThirdParty/gtest/CMakeLists.txt >index 4307bc8b72f..51043e26692 100755 >--- a/Source/ThirdParty/gtest/CMakeLists.txt >+++ b/Source/ThirdParty/gtest/CMakeLists.txt >@@ -20,14 +20,22 @@ set(GTEST_SOURCES > ${GTEST_DIR}/src/gtest-typed-test.cc > ) > >-if (WIN32) >- # MSVC 2015 requires this definition for INTMAX_MAX to be defined. >- add_definitions(-D__STDC_LIMIT_MACROS -DGTEST_CREATE_SHARED_LIBRARY=0) >- # gtest crashes on exit on Windows if it is a dll. >- add_library(gtest STATIC ${GTEST_SOURCES}) >-else () >- add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1) >+set(gtest_DEFINITIONS -DGTEST_HAS_RTTI=0) >+ >+# Additional gtest configuration can be added in the port's cmake file >+WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() >+ >+# By default use a shared library >+if (NOT DEFINED gtest_LIBRARY_TYPE) >+ set(gtest_LIBRARY_TYPE SHARED) >+endif () >+ >+if (gtest_LIBRARY_TYPE MATCHES SHARED) >+ list(APPEND gtest_DEFINITIONS -DGTEST_CREATE_SHARED_LIBRARY=1) > add_library(gtest SHARED ${GTEST_SOURCES}) >+else () >+ list(APPEND gtest_DEFINITIONS -DGTEST_CREATE_SHARED_LIBRARY=0) >+ add_library(gtest STATIC ${GTEST_SOURCES}) > endif () > > include_directories(${GTEST_INCLUDE_DIRECTORIES}) >@@ -38,7 +46,12 @@ WEBKIT_ADD_TARGET_CXX_FLAGS(gtest -Wno-undef > > if (CMAKE_USE_PTHREADS_INIT) > target_link_libraries(gtest ${CMAKE_THREAD_LIBS_INIT}) >- add_definitions(-DGTEST_HAS_PTHREAD=1) >+ list(APPEND gtest_DEFINITIONS -DGTEST_HAS_PTHREAD=1) > else () >- add_definitions(-DGTEST_HAS_PTHREAD=0) >+ list(APPEND gtest_DEFINITIONS -DGTEST_HAS_PTHREAD=0) > endif () >+ >+add_definitions(${gtest_DEFINITIONS}) >+ >+# Create a global property so it can be accessed in TestWebKitAPI >+set_property(GLOBAL PROPERTY gtest_DEFINITIONS ${gtest_DEFINITIONS}) >diff --git a/Source/ThirdParty/gtest/PlatformWin.cmake b/Source/ThirdParty/gtest/PlatformWin.cmake >new file mode 100644 >index 00000000000..074fc891c75 >--- /dev/null >+++ b/Source/ThirdParty/gtest/PlatformWin.cmake >@@ -0,0 +1,4 @@ >+set(gtest_LIBRARY_TYPE STATIC) >+ >+# MSVC 2015 requires this definition for INTMAX_MAX to be defined. >+add_definitions(-D__STDC_LIMIT_MACROS) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index ce6e452cb18..ddec44e5864 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2018-09-05 Don Olmstead <don.olmstead@sony.com> >+ >+ [CMake] Allow port specific options on gtest >+ https://bugs.webkit.org/show_bug.cgi?id=189313 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Use the global property set by the gtest CMake file to add to the >+ compilation definitions for TestWebKitAPI rather than repeating the >+ logic. >+ >+ * TestWebKitAPI/CMakeLists.txt: >+ > 2018-09-05 David Kilzer <ddkilzer@apple.com> > > REGRESSION (r209470): EditingHistory folder is missing in EditingHistory Xcode project >diff --git a/Tools/TestWebKitAPI/CMakeLists.txt b/Tools/TestWebKitAPI/CMakeLists.txt >index 9c51972b4c0..caa85fcb53d 100644 >--- a/Tools/TestWebKitAPI/CMakeLists.txt >+++ b/Tools/TestWebKitAPI/CMakeLists.txt >@@ -236,22 +236,13 @@ if (ENABLE_WEBKIT) > endif () > endif () > >-if (WIN32) >- add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=0) >-else () >- add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1) >-endif () >+get_property(gtest_DEFINITIONS GLOBAL PROPERTY gtest_DEFINITIONS) > >-add_definitions(-DGTEST_HAS_RTTI=0 >+add_definitions( >+ ${gtest_DEFINITIONS} > -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit\" > ) > >-# FIXME: This works around compatibility problems in the old version of the third-pary >-# googletest source code checkout. It should be removed once we upgrade to a newer version. >-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") >- add_definitions(-DGTEST_HAS_TR1_TUPLE=0) >-endif () >- > add_executable(TestWTF > ${test_main_SOURCES} > ${TestWTF_SOURCES} >@@ -277,12 +268,6 @@ if (COMPILER_IS_GCC_OR_CLANG) > -Wno-unused-parameter) > endif () > >-# FIXME: This works around compatibility problems in the old version of the third-pary >-# googletest source code checkout. It should be removed once we upgrade to a newer version. >-if (COMPILER_IS_CLANG) >- add_definitions(-DGTEST_HAS_TR1_TUPLE=0) >-endif () >- > if (ENABLE_WEBKIT) > add_library(TestWebKitAPIBase > ${test_main_SOURCES}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189313
: 348954