-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
157 lines (142 loc) · 4.18 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
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
cmake_minimum_required(VERSION 3.13)
project(alpha)
################################################################################
option(ENABLE_FRONTEND_EXECUTION "Enable executing of TML in a browser." ON)
option(DISABLE_BACKEND_EXECUTION "Disable executing of TML remotely over the ba\
ckend" OFF)
################################################################################
set(CMAKE_VERBOSE_MAKEFILE true)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(alpha-common)
set(TML_DIR ${PROJECT_SOURCE_DIR}/submodules/TML)
set(WT_DIR ${PROJECT_SOURCE_DIR}/lib/wt)
set(ZLIB_DIR ${PROJECT_SOURCE_DIR}/lib/zlib)
set(EMSDK_DIR ${PROJECT_SOURCE_DIR}/lib/emsdk)
include(init_submodule)
init_submodule(${TML_DIR})
include(install_and_activate_emsdk)
install_and_activate_emsdk(${EMSDK_DIR})
set(ALPHA_HEADERS
src/alpha/agent.h
src/alpha/channel.h
src/alpha/defs.h
src/alpha/filter.h
src/alpha/message.h
src/alpha/config.h
src/alpha/protocol.h
src/alpha/storage.h
src/alpha/wt/app.h
src/alpha/wt/codemirror.h
src/alpha/wt/file_item.h
src/alpha/wt/splitjs.h
src/alpha/wt/TML_editor.h
src/alpha/wt/workspace.h
src/alpha/wt/ide/ide.h
src/alpha/wt/ide/menu.h
src/alpha/wt/ide/toolbar.h
src/alpha/wt/view/agent.h
src/alpha/wt/view/channel.h
src/alpha/wt/view/channels.h
src/alpha/wt/view/identities.h
src/alpha/wt/view/message.h
src/alpha/wt/view/register_form.h
src/tml/datafile.h
src/tml/query.h
src/tml/relation.h
src/tml/relationfile.h
)
set(ALPHA_SOURCES
src/main.cpp
src/alpha/filter.cpp
src/alpha/common.cpp
src/alpha/config.cpp
src/alpha/output.cpp
src/alpha/protocol_nonet.cpp
src/alpha/storage.cpp
src/alpha/wt/app.cpp
src/alpha/wt/file_item.cpp
src/alpha/wt/workspace.cpp
src/alpha/wt/ide/ide.cpp
src/alpha/wt/ide/runtime_backend.cpp
src/alpha/wt/ide/runtime_frontend.cpp
src/alpha/wt/view/agent.cpp
src/alpha/wt/view/channel.cpp
src/alpha/wt/view/channels.cpp
src/alpha/wt/view/identities.cpp
src/alpha/wt/view/message.cpp
src/alpha/wt/view/register_form.cpp
src/tml/datafile.cpp
src/tml/query.cpp
src/tml/relation.cpp
src/tml/relationfile.cpp
)
set(ALPHA_COMPILE_OPTION
"$<$<CONFIG:DEBUG>:-O0;-ggdb3>"
"$<$<CONFIG:RELEASE>:-O3;-flto>"
)
# zlib
include(build_zlib)
build_zlib()
set(ZLIB_INCLUDE_DIR ${ZLIB_DIR})
find_library(ZLIB_LIBRARY NAMES z PATHS ${ZLIB_DIR})
# boost
find_package(Boost REQUIRED COMPONENTS
"program_options;thread;atomic;system;filesystem;chrono;date_time"
)
# wt
include(build_wt)
build_wt()
find_package(Wt REQUIRED PATHS ${WT_INSTALL_DIR}/lib/cmake/wt)
set(Wt_INCLUDE_DIR ${WT_INSTALL_DIR}/include)
set(Wt_LIBRARY_DIR ${WT_INSTALL_DIR}/lib)
set(Wt_LIBRARY ${Wt_LIBRARY_DIR}/libwt.a)
set(Wt_HTTP_LIBRARY ${Wt_LIBRARY_DIR}/libwthttp.a)
# TML
add_subdirectory(${TML_DIR})
set_target_properties(tml TMLso PROPERTIES
CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}"
EXCLUDE_FROM_ALL 1 # do not build tml executable and so by default
EXCLUDE_FROM_DEFAULT_BUILD 1) # ... static library is enough
add_executable(alpha)
# add tml.js if emscripten available
set(EMSCRIPTEN_DIR "${EMSDK_DIR}/upstream/emscripten" CACHE STRING "")
list(APPEND CMAKE_MODULE_PATH ${TML_DIR}/cmake)
include(emscripten_toolchain)
emscripten_toolchain_available(EMSCRIPTEN_TOOLCHAIN_AVAILABLE)
if(ENABLE_FRONTEND_EXECUTION)
if(${EMSCRIPTEN_TOOLCHAIN_AVAILABLE})
include(add_tml_js_lib)
add_tml_js_lib()
add_dependencies(alpha tml_js_lib)
else()
message("--- emscripten toolchain not found. skipping tml.js")
endif()
endif()
target_setup(alpha)
target_sources(alpha PRIVATE ${ALPHA_SOURCES} ${ALPHA_HEADERS})
target_include_directories(alpha PRIVATE ${ZLIB_INCLUDE_DIR})
target_include_directories(alpha PRIVATE ${Wt_INCLUDE_DIR})
target_link_directories(alpha PRIVATE ${ZLIB_DIR})
target_link_directories(alpha PRIVATE ${Wt_LIBRARY_DIR})
target_link_libraries(alpha
TMLs
${ZLIB_LIBRARY}
boost_program_options
boost_thread
boost_atomic
boost_system
boost_filesystem
boost_chrono
boost_date_time
${Wt_LIBRARY}
${Wt_HTTP_LIBRARY}
pthread
z
wt wthttp
)
if(NOT ENABLE_FRONTEND_EXECUTION)
target_compile_definitions(alpha PRIVATE "DISABLE_FRONTEND_EXECUTION=1")
endif()
if(DISABLE_BACKEND_EXECUTION)
target_compile_definitions(alpha PRIVATE "DISABLE_BACKEND_EXECUTION=1")
endif()