[CMake] Raise minimum CMake requirement
[WebKit-https.git] / Source / cmake / OptionsJSCOnly.cmake
1 find_package(Threads REQUIRED)
2
3 if (MSVC)
4     include(OptionsMSVC)
5 endif ()
6
7 add_definitions(-DBUILDING_JSCONLY__)
8
9 set(PROJECT_VERSION_MAJOR 1)
10 set(PROJECT_VERSION_MINOR 0)
11 set(PROJECT_VERSION_MICRO 0)
12 set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_MICRO})
13
14 WEBKIT_OPTION_BEGIN()
15 WEBKIT_OPTION_DEFINE(ENABLE_STATIC_JSC "Whether to build JavaScriptCore as a static library." PUBLIC OFF)
16 if (WIN32)
17     # FIXME: Enable FTL on Windows. https://bugs.webkit.org/show_bug.cgi?id=145366
18     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTL_JIT PRIVATE OFF)
19     # FIXME: Port bmalloc to Windows. https://bugs.webkit.org/show_bug.cgi?id=143310
20     WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PRIVATE ON)
21 endif ()
22
23 WEBKIT_OPTION_END()
24
25 set(ALL_EVENT_LOOP_TYPES
26     GLib
27     Generic
28 )
29
30 set(DEFAULT_EVENT_LOOP_TYPE "Generic")
31
32 set(EVENT_LOOP_TYPE ${DEFAULT_EVENT_LOOP_TYPE} CACHE STRING "Implementation of event loop to be used in JavaScriptCore (one of ${ALL_EVENT_LOOP_TYPES})")
33
34 set(ENABLE_WEBCORE OFF)
35 set(ENABLE_WEBKIT_LEGACY OFF)
36 set(ENABLE_WEBKIT OFF)
37
38 if (WIN32)
39     set(ENABLE_API_TESTS OFF)
40 else ()
41     set(ENABLE_API_TESTS ON)
42 endif ()
43
44 if (WTF_CPU_X86 OR WTF_CPU_X86_64)
45     SET_AND_EXPOSE_TO_BUILD(USE_UDIS86 1)
46 endif ()
47
48 # FIXME: JSCOnly on WIN32 seems to only work with fully static build
49 # https://bugs.webkit.org/show_bug.cgi?id=172862
50 if (ENABLE_STATIC_JSC OR WIN32)
51     set(JavaScriptCore_LIBRARY_TYPE STATIC)
52 endif ()
53
54 if (WIN32)
55     add_definitions(-DNOMINMAX)
56
57     if (NOT WEBKIT_LIBRARIES_DIR)
58         if (DEFINED ENV{WEBKIT_LIBRARIES})
59             set(WEBKIT_LIBRARIES_DIR "$ENV{WEBKIT_LIBRARIES}")
60         else ()
61             set(WEBKIT_LIBRARIES_DIR "${CMAKE_SOURCE_DIR}/WebKitLibraries/win")
62         endif ()
63     endif ()
64
65     set(CMAKE_PREFIX_PATH ${WEBKIT_LIBRARIES_DIR})
66
67     if (WTF_CPU_X86_64)
68         set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS OFF)
69         set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
70
71         set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64)
72         set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
73     endif ()
74 endif ()
75
76 string(TOLOWER ${EVENT_LOOP_TYPE} LOWERCASE_EVENT_LOOP_TYPE)
77 if (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "glib")
78     find_package(GLIB 2.36 REQUIRED COMPONENTS gio gobject)
79     SET_AND_EXPOSE_TO_BUILD(USE_GLIB 1)
80     SET_AND_EXPOSE_TO_BUILD(USE_GLIB_EVENT_LOOP 1)
81     SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)
82 else ()
83     SET_AND_EXPOSE_TO_BUILD(USE_GENERIC_EVENT_LOOP 1)
84     SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)
85 endif ()
86
87 if (NOT APPLE)
88     find_package(ICU REQUIRED)
89 else ()
90     set(ICU_LIBRARIES libicucore.dylib)
91 endif ()