-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
206 lines (182 loc) · 5.88 KB
/
Copy pathCMakeLists.txt
File metadata and controls
206 lines (182 loc) · 5.88 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
cmake_minimum_required(VERSION 3.15)
project(shlcpp VERSION 0.1.0 LANGUAGES C CXX)
set(CMAKE_SKIP_INSTALL_RULES TRUE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# compiler warning config
if(MSVC)
add_compile_options(/W3 /EHsc)
else()
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-variable)
endif()
option(SHL_ENABLE_ASAN "Enable AddressSanitizer" OFF)
if(SHL_ENABLE_ASAN)
if(MSVC)
add_compile_options(/fsanitize=address)
else()
add_compile_options(-fsanitize=address,undefined)
add_link_options(-fsanitize=address,undefined)
endif()
endif()
include(FetchContent)
FetchContent_Declare(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG v1.3.1
)
FetchContent_MakeAvailable(zlib)
set(ZLIB_FOUND TRUE CACHE BOOL "" FORCE)
set(ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR} CACHE PATH "" FORCE)
set(ZLIB_LIBRARIES zlibstatic CACHE STRING "" FORCE)
set(ZLIB_LIBRARY zlibstatic CACHE STRING "" FORCE)
set(ZLIB_INCLUDE_DIR ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR} CACHE PATH "" FORCE)
if(NOT TARGET ZLIB::ZLIB)
add_library(ZLIB::ZLIB ALIAS zlibstatic)
endif()
FetchContent_Declare(
curl
GIT_REPOSITORY https://github.com/curl/curl.git
GIT_TAG curl-8_7_1
)
set(BUILD_CURL_EXE OFF CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(CURL_USE_OPENSSL OFF CACHE BOOL "" FORCE)
set(CURL_DISABLE_INSTALL ON CACHE BOOL "" FORCE)
set(CURL_ENABLE_EXPORT_TARGET OFF CACHE BOOL "" FORCE)
if(WIN32)
set(CURL_USE_SCHANNEL ON CACHE BOOL "" FORCE)
elseif(APPLE)
set(CURL_USE_SECTRANSP ON CACHE BOOL "" FORCE)
endif()
FetchContent_MakeAvailable(curl)
FetchContent_Declare(
clip
GIT_REPOSITORY https://github.com/dacap/clip.git
GIT_TAG main
)
FetchContent_MakeAvailable(clip)
FetchContent_Declare(
SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-2.30.2
)
set(SDL2_DISABLE_INSTALL ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(SDL2)
FetchContent_Declare(
imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG v1.90.5
)
FetchContent_MakeAvailable(imgui)
FetchContent_Declare(
httplib
GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git
GIT_TAG v0.15.3
)
set(HTTPLIB_COMPILE ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(httplib)
FetchContent_Declare(
libzip
GIT_REPOSITORY https://github.com/nih-at/libzip.git
GIT_TAG v1.10.1
)
set(ENABLE_GNUTLS OFF CACHE BOOL "" FORCE)
set(ENABLE_MBEDTLS OFF CACHE BOOL "" FORCE)
set(ENABLE_OPENSSL OFF CACHE BOOL "" FORCE)
set(BUILD_TOOLS OFF CACHE BOOL "" FORCE)
set(BUILD_REGRESS OFF CACHE BOOL "" FORCE)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_DOC OFF CACHE BOOL "" FORCE)
set(LIBZIP_DO_INSTALL OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(libzip)
FetchContent_Declare(
sqlite3
GIT_REPOSITORY https://github.com/azadkuh/sqlite-amalgamation.git
GIT_TAG master
)
FetchContent_MakeAvailable(sqlite3)
set(SHELL_LITE_SRCS
shell_lite/main.cpp
shell_lite/parser/parser_core.cpp
shell_lite/parser/parser_control_flow.cpp
shell_lite/parser/parser_functions.cpp
shell_lite/parser/parser_nlp.cpp
shell_lite/parser/parser_web_db.cpp
shell_lite/parser/parser_concurrency.cpp
shell_lite/parser/parser_imports.cpp
shell_lite/parser/parser_expressions.cpp
shell_lite/error/error_reporter.cpp
shell_lite/formatter.cpp
shell_lite/concurrency/thread_pool.cpp
shell_lite/compiler.cpp
shell_lite/vm.cpp
shell_lite/objects.cpp
shell_lite/gc.cpp
shell_lite/modules/module_core.cpp
shell_lite/modules/module_csv.cpp
shell_lite/modules/module_archive.cpp
shell_lite/modules/module_net.cpp
shell_lite/modules/module_os.cpp
shell_lite/modules/module_math.cpp
shell_lite/modules/module_web.cpp
shell_lite/modules/module_db.cpp
shell_lite/modules/module_io.cpp
shell_lite/modules/module_nlp.cpp
shell_lite/modules/module_ui.cpp
shell_lite/ui/ui_subsystem.cpp
)
if(WIN32)
list(APPEND SHELL_LITE_SRCS shell_lite/pal/platform_win.cpp)
else()
list(APPEND SHELL_LITE_SRCS shell_lite/pal/platform_posix.cpp)
endif()
set(SOURCES
${SHELL_LITE_SRCS}
shell_lite/lexer.cpp
shell_lite/gbp_core_logic.cpp
shell_lite/gbp_chunk_cache.cpp
shell_lite/value.cpp
shell_lite/chunk.cpp
shell_lite/event_loop.cpp
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl2.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer2.cpp
)
add_library(shell_lite_core OBJECT ${SOURCES})
set_target_properties(shell_lite_core PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(shell_lite_core PUBLIC
shell_lite
${sqlite3_SOURCE_DIR}
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
)
target_link_libraries(shell_lite_core PUBLIC libcurl clip SDL2-static httplib zip SQLite3)
if(WIN32)
target_link_libraries(shell_lite_core PUBLIC ws2_32 user32 gdi32)
endif()
add_executable(shell_lite_exec $<TARGET_OBJECTS:shell_lite_core>)
target_include_directories(shell_lite_exec PRIVATE
shell_lite
${sqlite3_SOURCE_DIR}
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
)
target_link_libraries(shell_lite_exec PRIVATE libcurl clip SDL2-static httplib zip SQLite3)
if(WIN32)
target_link_libraries(shell_lite_exec PRIVATE ws2_32 user32 gdi32)
endif()
add_library(shell_lite_lib SHARED $<TARGET_OBJECTS:shell_lite_core>)
target_include_directories(shell_lite_lib PRIVATE
shell_lite
${sqlite3_SOURCE_DIR}
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
)
target_link_libraries(shell_lite_lib PRIVATE libcurl clip SDL2-static httplib zip SQLite3)
if(WIN32)
target_link_libraries(shell_lite_lib PRIVATE ws2_32 user32 gdi32)
endif()