Added new port JSCOnly.
[WebKit-https.git] / Source / cmake / OptionsJSCOnly.cmake
1 find_package(ICU REQUIRED)
2 find_package(Threads REQUIRED)
3
4 set(PROJECT_VERSION_MAJOR 1)
5 set(PROJECT_VERSION_MINOR 0)
6 set(PROJECT_VERSION_MICRO 0)
7 set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_MICRO})
8
9 WEBKIT_OPTION_BEGIN()
10 WEBKIT_OPTION_DEFINE(ENABLE_STATIC_JSC "Whether to build JavaScriptCore as a static library." PUBLIC OFF)
11 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTL_JIT PUBLIC ON)
12 WEBKIT_OPTION_END()
13
14 set(ALL_EVENTLOOP_TYPES
15     GLib
16     None
17 )
18
19 if (UNIX AND NOT APPLE)
20     set(DEFAULT_EVENTLOOP_TYPE "GLib")
21 else ()
22     # TODO: Use native Mac and Win implementations
23     set(DEFAULT_EVENTLOOP_TYPE "None")
24 endif ()
25
26 set(EVENTLOOP_TYPE ${DEFAULT_EVENTLOOP_TYPE} CACHE STRING "Implementation of event loop to be used in JavaScriptCore (one of ${ALL_EVENTLOOP_TYPES})")
27
28 set(ENABLE_WEBKIT OFF)
29 set(ENABLE_WEBKIT2 OFF)
30 set(ENABLE_API_TESTS OFF)
31
32 if (WTF_CPU_X86 OR WTF_CPU_X86_64)
33     set(WTF_USE_UDIS86 1)
34 endif ()
35
36 if (ENABLE_STATIC_JSC)
37     set(JavaScriptCore_LIBRARY_TYPE STATIC)
38 endif ()
39
40 string(TOLOWER ${EVENTLOOP_TYPE} LOWERCASE_EVENTLOOP_TYPE)
41 if (LOWERCASE_EVENTLOOP_TYPE STREQUAL "glib")
42     find_package(GLIB 2.36 REQUIRED COMPONENTS gio gobject)
43     SET_AND_EXPOSE_TO_BUILD(USE_GLIB 1)
44 endif ()
45
46 # From OptionsGTK.cmake
47 if (CMAKE_MAJOR_VERSION LESS 3)
48     # Before CMake 3 it was necessary to use a build script instead of using cmake --build directly
49     # to preserve colors and pretty-printing.
50
51     build_command(COMMAND_LINE_TO_BUILD)
52     # build_command unconditionally adds -i (ignore errors) for make, and there's
53     # no reasonable way to turn that off, so we just replace it with -k, which has
54     # the same effect, except that the return code will indicate that an error occurred.
55     # See: http://www.cmake.org/cmake/help/v3.0/command/build_command.html
56     string(REPLACE " -i" " -k" COMMAND_LINE_TO_BUILD ${COMMAND_LINE_TO_BUILD})
57     file(WRITE
58         ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/build.sh
59         "#!/bin/sh\n"
60         "${COMMAND_LINE_TO_BUILD} $@"
61     )
62     file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/build.sh
63         DESTINATION ${CMAKE_BINARY_DIR}
64         FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
65     )
66 endif ()