forked from CobaltBSD/neosurf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
112 lines (97 loc) · 4.35 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
cmake_minimum_required(VERSION 3.20)
project(neosurf LANGUAGES C)
#FIXME: Abort if -ffast-math compile option is used (such as when enabled by -Ofast)
set(NEOSURF_ABI 14)
set(NEOSURF_VERSION 17)
add_definitions(-DNDEBUG -DWITH_OPENSSL -DWITH_BMP -DWITH_GIF -DWITH_NS_SVG -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -DNEOSURF_VERSION=${NEOSURF_VERSION})
add_compile_options(-std=c99 -Wno-unused-parameter -Wno-deprecated-declarations -Wno-strict-prototypes -Wno-unused-but-set-variable -Wno-int-conversion)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_BINARY_DIR}")
include(GNUInstallDirs)
# Abort if source or build directory has white space
if(${CMAKE_SOURCE_DIR} MATCHES "^(.* +.*)+$")
message(FATAL_ERROR "neosurf's source cannot be in a directory containing white space. Please move to a different location and try again.")
endif()
if(${CMAKE_BINARY_DIR} MATCHES "^(.* +.*)+$")
message(FATAL_ERROR "neosurf cannot be built in a directory containing white space. Please move to a different location and try again.")
endif()
# Check for required programs
find_program(GPERF gperf)
if(${GPERF} STREQUAL GPERF-NOTFOUND)
message(FATAL_ERROR "Missing `gperf` utility. Please refer to your distribution package manager for obtaining this.")
endif()
find_program(PYTHON3 python3)
if(${PYTHON3} STREQUAL PYTHON3-NOTFOUND)
message(FATAL_ERROR "Missing Python3 executable. Please refer to your distribution package manager for obtaining this.")
endif()
find_program(FLEX flex)
if(${FLEX} STREQUAL FLEX-NOTFOUND)
message(FATAL_ERROR "Missing `flex` utility. Please refer to your distribution package manager for obtaining this.")
endif()
find_program(BISON bison)
find_program(BYACC byacc)
if(${BISON} STREQUAL BISON-NOTFOUND AND ${BYACC} STREQUAL BYACC-NOTFOUND)
message(FATAL_ERROR "Missing `bison` or `byacc` utility. Please refer to your distribution package manager for obtaining one or the other.")
else()
if(${BISON} STREQUAL BISON-NOTFOUND)
set(YACC byacc)
else()
set(YACC bison)
endif()
endif()
message("yacc program found: ${YACC}")
find_program(PKGCONFIG pkg-config)
find_program(PKGCONF pkgconf)
if(${PKGCONFIG} STREQUAL PKGCONFIG-NOTFOUND AND ${PKGCONF} STREQUAL PKGCONF-NOTFOUND)
message(FATAL_ERROR "Missing `pkg-config` or `pkgconf` utility. Please refer to your distribution package manager for obtaining one or the other.")
endif()
find_program(M4 m4)
if(${M4} STREQUAL M4-NOTFOUND)
message(FATAL_ERROR "Missing `m4` utility. Please refer to your distribution package manager for obtaining this.")
endif()
option(NEOSURF_USE_PNG "Include png support" ON)
if(${NEOSURF_USE_PNG})
add_definitions(-DWITH_PNG)
set(PNG_SRC content/handlers/image/png.c)
endif()
option(NEOSURF_USE_JPEG "Include jpeg support" ON)
if(${NEOSURF_USE_JPEG})
add_definitions(-DWITH_JPEG)
set(JPEG_SRC content/handlers/image/jpeg.c)
endif()
option(NEOSURF_USE_WEBP "Include webp support" ON)
if(${NEOSURF_USE_WEBP})
add_definitions(-DWITH_WEBP)
set(WEBP_SRC content/handlers/image/webp.c)
endif()
option(NEOSURF_BUILD_GTK_FRONTEND "Build and install the bundled Gtk frontend" ON)
if(NEOSURF_BUILD_GTK_FRONTEND)
add_definitions(-Dgtk -Dnsgtk)
endif()
option(NEOSURF_BUILD_VI_FRONTEND "Build and install the bundled Visurf frontend" ON)
if(NEOSURF_BUILD_VI_FRONTEND)
add_definitions(-Dvi -Dnsvi)
endif()
option(NEOSURF_INSTALL_NSGENBIND "Installs the nsgenbind utility with neosurf" OFF)
option(NEOSURF_INSTALL_GEN_PARSER "Installs the libcss gen_parser utility with neosurf" OFF)
include_directories(
"${CMAKE_SOURCE_DIR}/contrib/libsvgtiny/include"
"${CMAKE_SOURCE_DIR}/contrib/libdom/include"
"${CMAKE_SOURCE_DIR}/contrib/libnsutils/include"
"${CMAKE_SOURCE_DIR}/contrib/libnsgif/include"
"${CMAKE_BINARY_DIR}/contrib/libsvgtiny"
"${CMAKE_SOURCE_DIR}/contrib/libnsbmp/include"
"${CMAKE_SOURCE_DIR}/contrib/libhubbub/include"
"${CMAKE_SOURCE_DIR}/contrib/libparserutils/include"
"${CMAKE_SOURCE_DIR}/contrib/libcss/include"
"${CMAKE_BINARY_DIR}/contrib/libcss"
"${CMAKE_SOURCE_DIR}/contrib/libsvgtiny/src"
"${CMAKE_BINARY_DIR}/contrib/libhubbub/src"
"${CMAKE_SOURCE_DIR}/frontends"
)
add_subdirectory(contrib)
add_subdirectory(src)
add_subdirectory(frontends)
#TODO: quickjs/wasm3
install(DIRECTORY include/neosurf DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
#FIXME: gtk frontend seems to segfault if no proper GTK cursor theme is installed
#FIXME: will fail in mysterious ways if user does not have write access to their ~/.config/