-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
101 lines (73 loc) · 3.71 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
cmake_minimum_required(VERSION 3.21)
project(saucer-bindings LANGUAGES CXX VERSION 5.0.0)
# --------------------------------------------------------------------------------------------------------
# Library switches
# --------------------------------------------------------------------------------------------------------
option(saucer_desktop "Enable support for the desktop module" ON)
option(saucer_pdf "Enable support for the pdf module" ON)
# --------------------------------------------------------------------------------------------------------
# CMake options
# --------------------------------------------------------------------------------------------------------
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# --------------------------------------------------------------------------------------------------------
# Setup library
# --------------------------------------------------------------------------------------------------------
add_library(${PROJECT_NAME} SHARED)
add_library(saucer::bindings ALIAS ${PROJECT_NAME})
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_23)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 23 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON)
if (PROJECT_IS_TOP_LEVEL AND NOT MSVC AND NOT CMAKE_CXX_SIMULATE_ID MATCHES "MSVC")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror -pedantic -pedantic-errors -Wfatal-errors)
endif()
if (NOT MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-unknown-warning-option -Wno-missing-field-initializers -Wno-cast-function-type)
endif()
# --------------------------------------------------------------------------------------------------------
# Export header
# --------------------------------------------------------------------------------------------------------
include("cmake/hide.cmake")
include("cmake/export.cmake")
saucer_bindings_hide_symbols(${PROJECT_NAME})
saucer_bindings_export(${PROJECT_NAME} "SAUCER_EXPORT")
# --------------------------------------------------------------------------------------------------------
# Include directories
# --------------------------------------------------------------------------------------------------------
target_include_directories(${PROJECT_NAME} PUBLIC "include")
target_include_directories(${PROJECT_NAME} PRIVATE "include/saucer" "private")
# --------------------------------------------------------------------------------------------------------
# Add Sources
# --------------------------------------------------------------------------------------------------------
target_sources(${PROJECT_NAME} PRIVATE
"src/app.cpp"
"src/options.cpp"
"src/memory.cpp"
"src/icon.cpp"
"src/stash.cpp"
"src/script.cpp"
"src/scheme.cpp"
"src/navigation.cpp"
"src/preferences.cpp"
"src/window.cpp"
"src/webview.cpp"
)
# --------------------------------------------------------------------------------------------------------
# Setup Dependencies
# --------------------------------------------------------------------------------------------------------
include("cmake/cpm.cmake")
CPMFindPackage(
NAME saucer
VERSION 6.0.0
GIT_REPOSITORY "https://github.com/saucer/saucer"
OPTIONS "saucer_static OFF" "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON"
)
target_link_libraries(${PROJECT_NAME} PUBLIC saucer::saucer)
# --------------------------------------------------------------------------------------------------------
# Setup Modules
# --------------------------------------------------------------------------------------------------------
include("cmake/module.cmake")
if (saucer_desktop)
add_subdirectory("modules/desktop")
endif()
if (saucer_pdf)
add_subdirectory("modules/pdf")
endif()