[FTW] Build JavaScriptCore
[WebKit-https.git] / Source / cmake / OptionsFTW.cmake
1 if (CMAKE_VERSION VERSION_LESS 3.14)
2     message(FATAL_ERROR "CMake 3.14 or greater is required to compile WebKitFTW")
3 endif ()
4
5 if (MSVC_VERSION VERSION_LESS 1920)
6     message(FATAL_ERROR "Visual Studio 2019 is required to compile WebKitFTW")
7 endif ()
8
9 if (${WTF_CPU_X86})
10     message(FATAL_ERROR "WebKitFTW does not support 32-bit builds")
11 endif ()
12
13 set(PORT FTW)
14
15 # Compilation options
16 include(OptionsMSVC)
17
18 add_definitions(-DWTF_PLATFORM_FTW=1)
19 # Prevent min() and max() macros from being exposed
20 add_definitions(-DNOMINMAX)
21 # Use unicode
22 add_definitions(-DUNICODE -D_UNICODE)
23 # If <winsock2.h> is not included before <windows.h> redefinition errors occur
24 # unless _WINSOCKAPI_ is defined before <windows.h> is included
25 add_definitions(-D_WINSOCKAPI_=)
26
27 # Setup library paths
28 if (NOT WEBKIT_LIBRARIES_DIR)
29     if (DEFINED ENV{WEBKIT_LIBRARIES})
30         file(TO_CMAKE_PATH "$ENV{WEBKIT_LIBRARIES}" WEBKIT_LIBRARIES_DIR)
31     else ()
32         file(TO_CMAKE_PATH "${CMAKE_SOURCE_DIR}/WebKitLibraries/win" WEBKIT_LIBRARIES_DIR)
33     endif ()
34 endif ()
35
36 set(CMAKE_PREFIX_PATH ${WEBKIT_LIBRARIES_DIR})
37
38 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS OFF)
39 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
40
41 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64)
42 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64)
43 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin64)
44
45 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
46 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
47 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
48 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
49 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
50 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
51
52 WEBKIT_OPTION_BEGIN()
53
54 # Enabled features
55
56 # Experimental features
57 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
58 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
59
60 # Features to investigate
61 #
62 # Features that are temporarily turned off because an implementation is not
63 # present at this time
64 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTL_JIT PRIVATE OFF)
65
66 # No support planned
67
68 # FIXME: Port bmalloc to Windows. https://bugs.webkit.org/show_bug.cgi?id=143310
69 WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PRIVATE ON)
70
71 WEBKIT_OPTION_END()
72
73 find_package(ICU REQUIRED COMPONENTS data i18n uc)
74
75 SET_AND_EXPOSE_TO_BUILD(USE_EXPORT_MACROS ON)
76 SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ${ENABLE_REMOTE_INSPECTOR})
77
78 set(WTF_LIBRARY_TYPE SHARED)
79 set(JavaScriptCore_LIBRARY_TYPE SHARED)
80
81 set(ENABLE_API_TESTS OFF)
82 set(ENABLE_WEBCORE OFF)
83 set(ENABLE_WEBKIT OFF)
84 set(ENABLE_WEBKIT_LEGACY OFF)
85
86 # Override headers directories
87 set(WTF_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/WTF/Headers)
88 set(JavaScriptCore_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/JavaScriptCore/Headers)
89 set(JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/JavaScriptCore/PrivateHeaders)
90
91 # Override derived sources directories
92 set(WTF_DERIVED_SOURCES_DIR ${CMAKE_BINARY_DIR}/WTF/DerivedSources)
93 set(JavaScriptCore_DERIVED_SOURCES_DIR ${CMAKE_BINARY_DIR}/JavaScriptCore/DerivedSources)
94
95 # Override scripts directories
96 set(WTF_SCRIPTS_DIR ${CMAKE_BINARY_DIR}/WTF/Scripts)
97 set(JavaScriptCore_SCRIPTS_DIR ${CMAKE_BINARY_DIR}/JavaScriptCore/Scripts)