-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMFrob.cmake
189 lines (173 loc) · 4.34 KB
/
CMFrob.cmake
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
find_package(Threads REQUIRED)
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses REQUIRED)
if (ENABLE_TADSNET)
find_package(CURL REQUIRED)
endif()
set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARIES})
check_function_exists(use_default_colors HAVE_USE_DEFAULT_COLORS)
set(CMAKE_REQUIRED_LIBRARIES)
check_include_files(termios.h HAVE_TERMIOS_H)
check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H)
# Some systems might now provide the SIGWINCH signal.
check_symbol_exists(SIGWINCH signal.h HAVE_SIGWINCH)
# If the use of TIOCGWINSZ requires <sys/ioctl.h>, then define
# GWINSZ_IN_SYS_IOCTL. Otherwise we assume that TIOCGWINSZ can be found in
# <termios.h>.
check_symbol_exists(TIOCGWINSZ sys/ioctl.h GWINSZ_IN_SYS_IOCTL)
# Check if we can ioctl() TIOCGWINSZ. This is the portable way of getting the
# terminal size.
if (GWINSZ_IN_SYS_IOCTL)
set(CMAKE_REQUIRED_DEFINITIONS -DGWINSZ_IN_SYS_IOCTL)
endif()
if (HAVE_TERMIOS_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_TERMIOS_H)
endif()
if (HAVE_SYS_IOCTL_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_IOCTL_H)
endif()
check_cxx_source_compiles ("
#ifndef GWINSZ_IN_SYS_IOCTL
#if HAVE_TERMIOS_H
#include <termios.h>
#endif
#endif
#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
int main() {struct winsize size; ioctl(0, TIOCGWINSZ, &size);}"
HAVE_TIOCGWINSZ
)
# Check if we can ioctl() TIOCGSIZE. This is the BSD way of getting the
# terminal size.
check_cxx_source_compiles ("
#if HAVE_TERMIOS_H
#include <termios.h>
#endif
#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
int main() {struct ttysize size; ioctl(0, TIOCGSIZE, &size);}"
HAVE_TIOCGSIZE
)
set(CMAKE_REQUIRED_DEFINITIONS)
add_library (
FROB_OBJECTS OBJECT
src/colors.h
src/frobappctx.cc
src/frobappctx.h
src/frobtadsapp.cc
src/frobtadsapp.h
src/frobtadsappcurses.cc
src/frobtadsappcurses.h
src/frobtadsappplain.h
src/frobcurses.h
src/tadswindow.h
src/main.cc
src/oemcurses.c
src/options.cc
src/options.h
src/oscurses.cc
src/osscurses.cc
tads2/osgen3.c
tads2/dbgtr.c
tads2/trd.c
tads2/execmd.c
tads2/vocab.c
tads2/qas.c
tads2/runstat.c
tads2/argize.c
tads2/ply.c
tads2/linfdum.c
tads3/tcprsnf.cpp
tads3/tcprsnl.cpp
tads3/tcprs_rt.cpp
tads3/tct3_d.cpp
tads3/tct3nl.cpp
tads3/vmbifl.cpp
tads3/vmmain.cpp
tads3/vmsa.cpp
)
if (ENABLE_TADSNET)
target_sources(FROB_OBJECTS PUBLIC
tads3/osifcnet.cpp
tads3/unix/osnetunix.cpp
tads3/vmbifnet.cpp
tads3/vmbifregn.cpp
tads3/vmhttpreq.cpp
tads3/vmhttpsrv.cpp
tads3/vmnetcfg.cpp
tads3/vmnet.cpp
tads3/vmnetfil.cpp
)
else()
target_sources(FROB_OBJECTS PUBLIC
tads3/vmbifreg.cpp
)
endif()
target_compile_definitions (
FROB_OBJECTS PRIVATE
RUNTIME
)
add_executable (
frob
${TADS2_HEADERS}
${TADS3_HEADERS}
src/osportable.cc
tads3/vmrun.cpp
$<TARGET_OBJECTS:FROB_OBJECTS>
$<TARGET_OBJECTS:COMMON_OBJECTS>
$<TARGET_OBJECTS:TADS2_RC_OBJECTS>
$<TARGET_OBJECTS:TADS3_RC_OBJECTS>
$<TARGET_OBJECTS:TADS3_RC_OBJECTS_ND>
)
target_compile_definitions (
frob PRIVATE
RUNTIME
)
target_include_directories (
frob PRIVATE
${CURL_INCLUDE_DIRS}
${CURSES_INCLUDE_DIR}
)
target_link_libraries (
frob
${CURL_LIBRARIES}
${CURSES_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
if (ENABLE_FROBD)
add_executable (
frobd
${TADS2_HEADERS}
${TADS3_HEADERS}
src/osportable.cc
src/debugui.cc
tads3/vmdbg.cpp
tads3/vmrun.cpp
tads3/vmbt3_d.cpp
tads3/vmimg_d.cpp
tads3/vmini_d.cpp
$<TARGET_OBJECTS:FROB_OBJECTS>
$<TARGET_OBJECTS:COMMON_OBJECTS>
$<TARGET_OBJECTS:TADS2_RC_OBJECTS>
$<TARGET_OBJECTS:TADS3_RC_OBJECTS>
)
target_compile_definitions (
frobd PRIVATE
RUNTIME VM_DEBUGGER
)
target_include_directories (
frobd PRIVATE
${CURL_INCLUDE_DIRS}
${CURSES_INCLUDE_DIR}
)
target_link_libraries (
frobd
${CURL_LIBRARIES}
${CURSES_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
install(TARGETS frobd DESTINATION bin)
endif(ENABLE_FROBD)
install(TARGETS frob DESTINATION bin)