- Revision
- 231843
- Author
- be...@igalia.com
- Date
- 2018-05-16 06:33:50 -0700 (Wed, 16 May 2018)
Log Message
[CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
https://bugs.webkit.org/show_bug.cgi?id=182622
Reviewed by Michael Catanzaro.
.:
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsJSCOnly.cmake:
* Source/cmake/OptionsWPE.cmake:
Enable THREADS_PREFER_PTHREAD_FLAG. This uses -pthread instead of
-lpthread, fixing the 64-bit RISC-V build of the GTK+ port due to
missing atomic primitives.
* Source/cmake/WebKitCompilerFlags.cmake:
Move the test to detect whether we need to link against libatomic
to a common CMake file so it can be used from both _javascript_Core
and WebKit.
Source/_javascript_Core:
We were linking _javascript_Core against libatomic in MIPS because
in that architecture __atomic_fetch_add_8() is not a compiler
intrinsic and is provided by that library instead. However other
architectures (e.g armel) are in the same situation, so we need a
generic test.
That test already exists in WebKit/CMakeLists.txt, so we just have
to move it to a common file (WebKitCompilerFlags.cmake) and use
its result (ATOMIC_INT64_REQUIRES_LIBATOMIC) here.
* CMakeLists.txt:
Source/WebKit:
Move the test to determine whether we need to link against
libatomic to the common file WebKitCompilerFlags.cmake so it can
also be used for _javascript_Core.
* CMakeLists.txt:
Modified Paths
Diff
Modified: trunk/ChangeLog (231842 => 231843)
--- trunk/ChangeLog 2018-05-16 13:09:37 UTC (rev 231842)
+++ trunk/ChangeLog 2018-05-16 13:33:50 UTC (rev 231843)
@@ -1,3 +1,22 @@
+2018-05-16 Alberto Garcia <be...@igalia.com>
+
+ [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
+ https://bugs.webkit.org/show_bug.cgi?id=182622
+
+ Reviewed by Michael Catanzaro.
+
+ * Source/cmake/OptionsGTK.cmake:
+ * Source/cmake/OptionsJSCOnly.cmake:
+ * Source/cmake/OptionsWPE.cmake:
+ Enable THREADS_PREFER_PTHREAD_FLAG. This uses -pthread instead of
+ -lpthread, fixing the 64-bit RISC-V build of the GTK+ port due to
+ missing atomic primitives.
+
+ * Source/cmake/WebKitCompilerFlags.cmake:
+ Move the test to detect whether we need to link against libatomic
+ to a common CMake file so it can be used from both _javascript_Core
+ and WebKit.
+
2018-05-14 Zan Dobersek <zdober...@igalia.com>
[GTK] REGRESSION(r231170) Build broken with Clang 5.0
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (231842 => 231843)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2018-05-16 13:09:37 UTC (rev 231842)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2018-05-16 13:33:50 UTC (rev 231843)
@@ -124,14 +124,8 @@
list(APPEND _javascript_Core_LIBRARIES capstone)
endif ()
-# Since r228149, on MIPS we need to link with -latomic, because
-# __atomic_fetch_add_8 is not available as a compiler intrinsic. It is
-# available on other platforms (including 32-bit Arm), so the link with
-# libatomic is only neede on MIPS.
-if (WTF_CPU_MIPS)
- list(APPEND _javascript_Core_LIBRARIES
- -latomic
- )
+if (ATOMIC_INT64_REQUIRES_LIBATOMIC)
+ list(APPEND _javascript_Core_LIBRARIES atomic)
endif ()
set(_javascript_Core_SCRIPTS_SOURCES_DIR "${_javascript_CORE_DIR}/Scripts")
Modified: trunk/Source/_javascript_Core/ChangeLog (231842 => 231843)
--- trunk/Source/_javascript_Core/ChangeLog 2018-05-16 13:09:37 UTC (rev 231842)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-05-16 13:33:50 UTC (rev 231843)
@@ -1,3 +1,22 @@
+2018-05-16 Alberto Garcia <be...@igalia.com>
+
+ [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
+ https://bugs.webkit.org/show_bug.cgi?id=182622
+
+ Reviewed by Michael Catanzaro.
+
+ We were linking _javascript_Core against libatomic in MIPS because
+ in that architecture __atomic_fetch_add_8() is not a compiler
+ intrinsic and is provided by that library instead. However other
+ architectures (e.g armel) are in the same situation, so we need a
+ generic test.
+
+ That test already exists in WebKit/CMakeLists.txt, so we just have
+ to move it to a common file (WebKitCompilerFlags.cmake) and use
+ its result (ATOMIC_INT64_REQUIRES_LIBATOMIC) here.
+
+ * CMakeLists.txt:
+
2018-05-15 Yusuke Suzuki <utatane....@gmail.com>
[JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function
Modified: trunk/Source/WebKit/CMakeLists.txt (231842 => 231843)
--- trunk/Source/WebKit/CMakeLists.txt 2018-05-16 13:09:37 UTC (rev 231842)
+++ trunk/Source/WebKit/CMakeLists.txt 2018-05-16 13:33:50 UTC (rev 231843)
@@ -810,22 +810,8 @@
set(_javascript_Core_SCRIPTS_DIR "${FORWARDING_HEADERS_DIR}/_javascript_Core/Scripts")
endif ()
-if (COMPILER_IS_GCC_OR_CLANG)
- set(ATOMIC_TEST_SOURCE
- "
- #include <atomic>
- int main() { std::atomic<int64_t> i(0); i++; return 0; }
- "
- )
- check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_IS_BUILTIN)
- if (NOT ATOMIC_INT64_IS_BUILTIN)
- set(CMAKE_REQUIRED_LIBRARIES atomic)
- check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_REQUIRES_LIBATOMIC)
- if (ATOMIC_INT64_REQUIRES_LIBATOMIC)
- list(APPEND WebKit_LIBRARIES PRIVATE atomic)
- endif ()
- unset(CMAKE_REQUIRED_LIBRARIES)
- endif ()
+if (ATOMIC_INT64_REQUIRES_LIBATOMIC)
+ list(APPEND WebKit_LIBRARIES PRIVATE atomic)
endif ()
if (UNIX)
Modified: trunk/Source/WebKit/ChangeLog (231842 => 231843)
--- trunk/Source/WebKit/ChangeLog 2018-05-16 13:09:37 UTC (rev 231842)
+++ trunk/Source/WebKit/ChangeLog 2018-05-16 13:33:50 UTC (rev 231843)
@@ -1,3 +1,16 @@
+2018-05-16 Alberto Garcia <be...@igalia.com>
+
+ [CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64-bit atomic operations
+ https://bugs.webkit.org/show_bug.cgi?id=182622
+
+ Reviewed by Michael Catanzaro.
+
+ Move the test to determine whether we need to link against
+ libatomic to the common file WebKitCompilerFlags.cmake so it can
+ also be used for _javascript_Core.
+
+ * CMakeLists.txt:
+
2018-05-15 Yusuke Suzuki <utatane....@gmail.com>
[JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function
Modified: trunk/Source/cmake/OptionsGTK.cmake (231842 => 231843)
--- trunk/Source/cmake/OptionsGTK.cmake 2018-05-16 13:09:37 UTC (rev 231842)
+++ trunk/Source/cmake/OptionsGTK.cmake 2018-05-16 13:33:50 UTC (rev 231843)
@@ -17,6 +17,8 @@
set(INTROSPECTION_INSTALL_GIRDIR "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0")
set(INTROSPECTION_INSTALL_TYPELIBDIR "${LIB_INSTALL_DIR}/girepository-1.0")
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+
find_package(Cairo 1.10.2 REQUIRED)
find_package(Fontconfig 2.8.0 REQUIRED)
find_package(Freetype2 2.4.2 REQUIRED)
Modified: trunk/Source/cmake/OptionsJSCOnly.cmake (231842 => 231843)
--- trunk/Source/cmake/OptionsJSCOnly.cmake 2018-05-16 13:09:37 UTC (rev 231842)
+++ trunk/Source/cmake/OptionsJSCOnly.cmake 2018-05-16 13:33:50 UTC (rev 231843)
@@ -1,3 +1,4 @@
+set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if (MSVC)
Modified: trunk/Source/cmake/OptionsWPE.cmake (231842 => 231843)
--- trunk/Source/cmake/OptionsWPE.cmake 2018-05-16 13:09:37 UTC (rev 231842)
+++ trunk/Source/cmake/OptionsWPE.cmake 2018-05-16 13:33:50 UTC (rev 231843)
@@ -12,6 +12,8 @@
set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}" CACHE PATH "Absolute path to executable installation directory")
set(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/wpe-webkit-${WPE_API_VERSION}" CACHE PATH "Absolute path to install executables executed by the library")
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+
WEBKIT_OPTION_BEGIN()
include(GStreamerDefinitions)
Modified: trunk/Source/cmake/WebKitCompilerFlags.cmake (231842 => 231843)
--- trunk/Source/cmake/WebKitCompilerFlags.cmake 2018-05-16 13:09:37 UTC (rev 231842)
+++ trunk/Source/cmake/WebKitCompilerFlags.cmake 2018-05-16 13:33:50 UTC (rev 231843)
@@ -230,3 +230,16 @@
DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c++" "${CMAKE_CXX_COMPILER}" "${CMAKE_CXX_FLAGS}" SYSTEM_INCLUDE_DIRS)
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
endif ()
+
+if (COMPILER_IS_GCC_OR_CLANG)
+ set(ATOMIC_TEST_SOURCE "
+ #include <atomic>
+ int main() { std::atomic<int64_t> i(0); i++; return 0; }
+ ")
+ check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_IS_BUILTIN)
+ if (NOT ATOMIC_INT64_IS_BUILTIN)
+ set(CMAKE_REQUIRED_LIBRARIES atomic)
+ check_cxx_source_compiles("${ATOMIC_TEST_SOURCE}" ATOMIC_INT64_REQUIRES_LIBATOMIC)
+ unset(CMAKE_REQUIRED_LIBRARIES)
+ endif ()
+endif ()