-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
128 lines (102 loc) · 6.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
cmake_minimum_required(VERSION 3.15.0)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
include(common)
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(OUT_DIR ${CMAKE_INSTALL_PREFIX})
set(COMMON_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${OUT_DIR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_FIND_ROOT_PATH=${OUT_DIR}
-DCMAKE_DEBUG_POSTFIX:STRING=
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
project(WebCore-Deps)
set(COMMON_ARGS ${COMMON_ARGS}
-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=${CMAKE_MSVC_RUNTIME_LIBRARY}
-DCMAKE_SYSROOT:PATH=${CMAKE_SYSROOT}
-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET})
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(COMMON_ARGS ${COMMON_ARGS} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW)
endif ()
include(ExternalProject)
message(STATUS "Building to: ${OUT_DIR}")
ExternalProject_Add(zlib
SOURCE_DIR ${SRC_DIR}/zlib-1.2.11
CMAKE_ARGS ${COMMON_ARGS} -DBUILD_SHARED_LIBS=OFF
)
ExternalProject_Add(libpng
SOURCE_DIR ${SRC_DIR}/libpng-1.6.37
CMAKE_ARGS ${COMMON_ARGS} -DPNG_SHARED=OFF -DPNG_TESTS=OFF -DPNG_BUILD_ZLIB=ON -DZLIB_LIBRARY:STRING=${OUT_DIR}/lib/zlibstat.lib -DZLIB_INCLUDE_DIR:STRING=${OUT_DIR}/include/
DEPENDS zlib
)
set(LIBJPEGTURBO_ARGS ${COMMON_ARGS} -DWITH_SIMD=ON -DWITH_TURBOJPEG=OFF -DENABLE_SHARED=OFF)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(LIBJPEGTURBO_ARGS ${LIBJPEGTURBO_ARGS} -DWITH_CRT_DLL=ON -DCMAKE_SYSTEM_PROCESSOR=amd64)
endif ()
ExternalProject_Add(libjpeg-turbo
SOURCE_DIR ${SRC_DIR}/libjpeg-turbo-2.0.4/libjpeg-turbo-2.0.4
CMAKE_ARGS ${LIBJPEGTURBO_ARGS}
)
ExternalProject_Add(icu
SOURCE_DIR ${SRC_DIR}/icu-67.1
CMAKE_ARGS ${COMMON_ARGS}
)
set(LIBXML2_ARGS ${COMMON_ARGS} -DLIBXML_THREAD_SAFETY=no -DWITH_THREAD_ALLOC=OFF -DWITH_C14N=OFF -DWITH_CATALOG=OFF -DWITH_DEBUG=OFF -DWITH_DOCB=OFF -DWITH_FTP=OFF -DWITH_FTP=OFF -DWITH_HTTP=OFF -DWITH_ICONV=OFF -DWITH_ICU=ON -DWITH_ISO8859X=ON -DWITH_LEGACY=OFF -DWITH_LZMA=OFF -DWITH_MEM_DEBUG=OFF -DWITH_MODULES=OFF -DWITH_OUTPUT=ON -DWITH_PATTERN=OFF -DWITH_PUSH=ON -DWITH_PYTHON=OFF -DWITH_READER=OFF -DWITH_REGEXPS=ON -DWITH_RUN_DEBUG=OFF -DWITH_SAX1=ON -DWITH_SCHEMAS=OFF -DWITH_SCHEMATRON=OFF -DWITH_VALID=OFF -DWITH_WALKER=ON -DWITH_WRITER=OFF -DWITH_XINCLUDE=OFF -DWITH_XPTR=OFF -DWITH_ZLIB=OFF -DWITH_HTML=ON -DWITH_TREE=ON -DWITH_XPATH=ON -DICU_ROOT=${OUT_DIR})
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(LIBXML2_ARGS ${LIBXML2_ARGS} -DLIBXML2_CONFIG_INCLUDE_DIR=win32/VC10)
else ()
set(LIBXML2_ARGS ${LIBXML2_ARGS} -DLIBXML2_CONFIG_INCLUDE_DIR=macos)
endif ()
ExternalProject_Add(libxml2
SOURCE_DIR ${SRC_DIR}/libxml2-v2.9.10/libxml2-v2.9.10
CMAKE_ARGS ${LIBXML2_ARGS}
DEPENDS icu
)
set(LIBXSLT_ARGS ${COMMON_ARGS} -DWITH_TRIO=OFF -DWITH_XSLT_DEBUG=OFF -DWITH_MEM_DEBUG=OFF -DWITH_DEBUGGER=OFF -DWITH_ICONV=OFF -DWITH_ZLIB=OFF -DWITH_CRYPTO=OFF -DWITH_MODULES=OFF -DLIBXML2_INCLUDE_DIR=${OUT_DIR}/include)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(LIBXSLT_ARGS ${LIBXSLT_ARGS} -DLIBXML2_LIBRARY=${OUT_DIR}/lib/xml2.lib)
else ()
set(LIBXSLT_ARGS ${LIBXSLT_ARGS} -DLIBXML2_LIBRARY=${OUT_DIR}/lib/libxml2.a)
endif ()
ExternalProject_Add(libxslt
SOURCE_DIR ${SRC_DIR}/libxslt-v1.1.34/libxslt-v1.1.34
CMAKE_ARGS ${LIBXSLT_ARGS}
DEPENDS libxml2
)
ExternalProject_Add(brotli
SOURCE_DIR ${SRC_DIR}/brotli-1.0.7
CMAKE_ARGS ${COMMON_ARGS} -DBROTLI_DISABLE_CLI=ON -DBROTLI_DISABLE_TESTS=ON
)
ExternalProject_Add(nghttp2
SOURCE_DIR ${SRC_DIR}/nghttp2-1.40.0
CMAKE_ARGS ${COMMON_ARGS} -DENABLE_LIB_ONLY=ON -DENABLE_ASIO_LIB=OFF -DENABLE_FAILMALLOC=OFF -DENABLE_THREADS=OFF -DENABLE_WERROR=OFF -DWITH_JEMALLOC=OFF -DWITH_LIBXML2=OFF -DWITH_MRUBY=OFF -DWITH_NEVERBLEED=OFF -DWITH_SPDYLAY=OFF -DENABLE_SHARED_LIB=OFF -DENABLE_STATIC_LIB=ON
)
ExternalProject_Add(libressl
SOURCE_DIR ${SRC_DIR}/libressl-3.0.2
CMAKE_ARGS ${COMMON_ARGS} -DLIBRESSL_APPS=OFF -DLIBRESSL_TESTS=OFF
)
ExternalProject_Add(curl
SOURCE_DIR ${SRC_DIR}/curl-7.69.1
CMAKE_ARGS ${COMMON_ARGS} -DBUILD_CURL_EXE=OFF -DBUILD_TESTING=OFF -DCMAKE_USE_GSSAPI=OFF -DCMAKE_USE_LIBSSH2=OFF -DCMAKE_USE_OPENLDAP=OFF -DCURL_BROTLI=ON -DCURL_ZLIB=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_CRYPTO_AUTH=OFF -DCURL_DISABLE_DICT=ON -DCURL_DISABLE_FILE=OFF -DCURL_DISABLE_FTP=ON -DCURL_DISABLE_GOPHER=ON -DCURL_DISABLE_HTTP=OFF -DCURL_DISABLE_IMAP=ON -DCURL_DISABLE_LDAP=ON -DCURL_DISABLE_LDAPS=ON -DCURL_DISABLE_POP3=ON -DCURL_DISABLE_PROXY=OFF -DCURL_DISABLE_RTSP=ON -DCURL_DISABLE_SMTP=ON -DCURL_DISABLE_TELNET=ON -DCURL_DISABLE_TFTP=ON -DENABLE_ARES=OFF -DENABLE_MANUAL=OFF -DENABLE_THREADED_RESOLVER=ON -DUSE_NGHTTP2=ON -DUSE_WIN32_LDAP=OFF -DENABLE_IPV6=ON -DUSE_OPENSSL=ON -DNGHTTP2_INCLUDE_DIR=${OUT_DIR}/include -DCURL_STATICLIB=ON -DBUILD_SHARED_LIBS=OFF -DZLIB_FOUND=1 -DZLIB_INCLUDE_DIRS:STRING=${OUT_DIR}/include -DBROTLI_FOUND=1 -DBROTLI_INCLUDE_DIRS:STRING=${OUT_DIR}/include/brotli
-DOPENSSL_INCLUDE_DIR=${OUT_DIR}/include -DCMAKE_PREFIX_PATH=${OUT_DIR} -DNGHTTP2_LIBRARY=${OUT_DIR}/lib/foobar.a
DEPENDS nghttp2 libressl brotli zlib
)
ExternalProject_Add(freetype
SOURCE_DIR ${SRC_DIR}/freetype-2.10.1
CMAKE_ARGS ${COMMON_ARGS} -DDISABLE_FORCE_DEBUG_POSTFIX=1 -DFT_WITH_ZLIB=ON -DFT_WITH_BZIP2=OFF -DFT_WITH_PNG=ON -DFT_WITH_HARFBUZZ=OFF -DPNG_PNG_INCLUDE_DIR=${OUT_DIR}/include/libpng16 -DPNG_LIBRARY=${OUT_DIR}/lib/foobar.a -DZLIB_INCLUDE_DIR=${OUT_DIR}/include -DZLIB_LIBRARY=${OUT_DIR}/lib/foobar.a
DEPENDS zlib libpng
)
set(HARFBUZZ_ARGS ${COMMON_ARGS} -DHB_HAVE_FREETYPE=ON -DHB_HAVE_ICU=ON -DHB_BUILD_UTILS=OFF -DHB_BUILD_SUBSET=OFF -DHB_BUILD_TESTS=OFF -DFREETYPE_INCLUDE_DIRS=${OUT_DIR}/include -DFREETYPE_LIBRARY=${OUT_DIR}/lib/foobar.a -DICU_ROOT=${OUT_DIR})
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CXX_FLAGS "-std=gnu++14")
list(APPEND HARFBUZZ_ARGS -DCMAKE_CXX_FLAGS=${CXX_FLAGS} )
endif ()
ExternalProject_Add(harfbuzz
SOURCE_DIR ${SRC_DIR}/harfbuzz-2.6.4
CMAKE_ARGS ${HARFBUZZ_ARGS}
DEPENDS freetype icu
)
add_custom_target(WebCore-Deps ALL DEPENDS zlib libpng libjpeg-turbo icu libxml2 libxslt brotli nghttp2 libressl curl freetype harfbuzz)
INSTALL(DIRECTORY "${OUT_DIR}/include" DESTINATION ".")
INSTALL(DIRECTORY "${OUT_DIR}/bin" DESTINATION ".")
INSTALL(DIRECTORY "${OUT_DIR}/lib" DESTINATION ".")
include(CreateSDK.cmake)