2 cmake_minimum_required (VERSION 2.6)
5 "-Wall" "-Wunused" "-pipe" "-gstabs+" "-fdefer-pop")
7 #option (WANT_DMALLOC "dmalloc debugging library" OFF)
8 option (FORGET_CHARSETS "Do not allow automatic conversions between character sets" OFF)
10 include (CheckIncludeFile)
11 CHECK_INCLUDE_FILE ("strings.h" HAVE_STRINGS_H)
12 CHECK_INCLUDE_FILE ("string.h" HAVE_STRING_H)
13 CHECK_INCLUDE_FILE ("io.h" HAVE_IO_H)
14 CHECK_INCLUDE_FILE ("rx.h" HAVE_RX_H)
15 CHECK_INCLUDE_FILE ("regex.h" HAVE_REGEX_H)
16 CHECK_INCLUDE_FILE ("errno.h" HAVE_ERRNO_H)
17 CHECK_INCLUDE_FILE ("wait.h" HAVE_WAIT_H)
18 CHECK_INCLUDE_FILE ("unistd.h" HAVE_UNISTD_H)
19 CHECK_INCLUDE_FILE ("unix.h" HAVE_UNIX_H)
20 CHECK_INCLUDE_FILE ("signal.h" HAVE_SIGNAL_H)
21 CHECK_INCLUDE_FILE ("syslog.h" HAVE_SYSLOG_H)
22 CHECK_INCLUDE_FILE ("time.h" HAVE_TIME_H)
23 CHECK_INCLUDE_FILE ("sys/soundcard.h" HAVE_SYS_SOUNDCARD_H)
24 CHECK_INCLUDE_FILE ("sys/audio.h" HAVE_SYS_AUDIO_H)
25 CHECK_INCLUDE_FILE ("sys/stat.h" HAVE_SYS_STAT_H)
26 CHECK_INCLUDE_FILE ("sys/ioctl.h" HAVE_SYS_IOCTL_H)
27 CHECK_INCLUDE_FILE ("sys/socket.h" HAVE_SYS_SOCKET_H)
28 CHECK_INCLUDE_FILE ("sys/select.h" HAVE_SYS_SELECT_H)
29 CHECK_INCLUDE_FILE ("sys/time.h" HAVE_SYS_TIME_H)
30 CHECK_INCLUDE_FILE ("sys/types.h" HAVE_SYS_TYPES_H)
31 CHECK_INCLUDE_FILE ("sys/termios.h" HAVE_SYS_TERMIOS_H)
32 CHECK_INCLUDE_FILE ("netdb.h" HAVE_NETDB_H)
33 CHECK_INCLUDE_FILE ("netinet/in.h" HAVE_NETINET_IN_H)
34 CHECK_INCLUDE_FILE ("linux/kd.h" HAVE_LINUX_KD_H)
35 CHECK_INCLUDE_FILE ("sys/kernel.h" HAVE_SYS_KERNEL_H)
36 CHECK_INCLUDE_FILE ("sys/name.h" HAVE_SYS_NAME_H)
37 CHECK_INCLUDE_FILE ("fcntl.h" HAVE_FCNTL_H)
39 include (CheckFunctionExists)
40 CHECK_FUNCTION_EXISTS ("strerror" HAVE_STRERROR)
41 CHECK_FUNCTION_EXISTS ("strdup" HAVE_STRDUP)
42 CHECK_FUNCTION_EXISTS ("fork" HAVE_FORK)
43 CHECK_FUNCTION_EXISTS ("getegid" HAVE_GETEGID)
44 CHECK_FUNCTION_EXISTS ("strcasecmp" HAVE_STRCASECMP)
45 CHECK_FUNCTION_EXISTS ("stricmp" HAVE_STRICMP)
46 CHECK_FUNCTION_EXISTS ("gethostname" HAVE_GETHOSTNAME)
47 CHECK_FUNCTION_EXISTS ("gettimeofday" HAVE_GETTIMEOFDAY)
48 CHECK_FUNCTION_EXISTS ("qnx_name_attach" HAVE_QNX_NAME_ATTACH)
49 CHECK_FUNCTION_EXISTS ("abort" HAVE_ABORT)
51 include (CheckLibraryExists)
52 CHECK_LIBRARY_EXISTS (socket main "${CMAKE_SYSTEM_LIBRARY_PATH}" HAVE_LIBSOCKET)
53 CHECK_LIBRARY_EXISTS (lnsl main "${CMAKE_SYSTEM_LIBRARY_PATH}" HAVE_LIBLNSL)
55 include (CheckCXXSourceCompiles)
57 CHECK_CXX_SOURCE_COMPILES (
58 "int main () {bool b; return 0;}"
61 if (HAVE_SYS_SOCKET_H)
62 set (_sockethdr "<sys/socket.h>")
63 else (HAVE_SYS_SOCKET_H)
64 set (_sockethdr "<sys/types.h>")
65 endif (HAVE_SYS_SOCKET_H)
67 CHECK_CXX_SOURCE_COMPILES (
68 "#include ${_sockethdr}
70 int main () {return 0;}"
74 set (_regexhdr "<rx.h>")
76 set (_regexhdr "<regex.h>")
78 set (_regexhdr "\"rx.h\"")
81 CHECK_CXX_SOURCE_COMPILES (
82 "#include <sys/types.h>
84 int main () {int result = REG_EEND; return 0;}"
87 CHECK_CXX_SOURCE_COMPILES (
88 "#include <sys/types.h>
90 int main () {regmatch_t rt; rt.rm_so; return 0;}"
93 CHECK_CXX_SOURCE_COMPILES (
94 "template <class any_type> class some_type{}; template class some_type<int>;
95 int main () {return 0;}"
98 include (CheckCXXSourceRuns)
100 CHECK_CXX_SOURCE_RUNS (
101 "extern \"C\" void exit(int);
107 } arr[2] = {{a, b, c},{c, c, c}};
108 int main () {exit (arr[1].n == 2);}"
109 BROKEN_ENUM_BITFIELDS)
111 configure_file ("${epos_SOURCE_DIR}/config.h.in" "${epos_BINARY_DIR}/config.h")
112 include_directories ("${epos_BINARY_DIR}")
115 src/common.h src/defaults.h
116 src/unit.h src/parser.h
117 src/rule.h src/text.h
118 src/encoding.h src/interf.h
119 src/function.h src/options.h
120 src/hash.h src/synth.h
121 src/voice.h src/exc.h)
122 list (APPEND epos_HEADERS
123 src/waveform.h src/ktdsyn.h
124 src/ptdsyn.h src/lpcsyn.h
125 src/tdpsyn.h src/tcpsyn.h
127 src/client.h src/agent.h
128 # If these didn't have this stupid extension,
129 # they could be here. CMake sees them
130 # as files to compile, not headers.
131 # src/nnet.cc src/block.cc src/exc.cc
134 set (epos_MODULES_SOURCES
135 src/parser.cc src/unit.cc src/rule.cc
136 src/text.cc src/encoding.cc
137 src/interf.cc src/function.cc
138 src/options.cc src/synth.cc src/ktdsyn.cc
139 src/ptdsyn.cc src/lpcsyn.cc src/tdpsyn.cc
140 src/tcpsyn.cc src/voice.cc src/waveform.cc)
142 set (epos_EPOS_SOURCES
143 ${epos_MODULES_SOURCES}
144 src/hashd.cc src/daemon.cc src/agent.cc
145 src/ttscp.cc src/nonblock.cc src/client.cc)
146 set (epos_EPOSM_SOURCES
147 ${epos_MODULES_SOURCES}
148 src/monolith.cc src/hash.cc src/client.cc)
151 set (epos_PLATFORM_SOURCES
153 list (APPEND epos_EPOS_SOURCES
154 arch/win/service/service.cpp
155 arch/win/service/service.h)
158 add_definitions ("-DBASE_DIR=${CMAKE_INSTALL_PREFIX}/lib/epos")
160 add_executable (epos ${epos_EPOS_SOURCES} ${epos_PLATFORM_SOURCES} ${epos_HEADERS})
161 add_executable (eposm EXCLUDE_FROM_ALL ${epos_EPOSM_SOURCES} ${epos_PLATFORM_SOURCES} ${epos_HEADERS})
162 target_link_libraries (epos pulse-simple pulse)
164 add_executable (say src/say.cc ${epos_HEADERS})
165 add_executable (vrfy src/vrfy.cc)
166 add_executable (gauge src/gauge.cc ${epos_HEADERS})
168 install (TARGETS epos say vrfy gauge RUNTIME DESTINATION bin)
169 install (DIRECTORY cfg/ DESTINATION lib/epos)
170 install (DIRECTORY doc DESTINATION lib/epos)