-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
172 lines (153 loc) · 4.81 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
## 3499App CMakeLists.txt
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(CMAKE_GENERATOR "Unix Makefiles")
PROJECT(BoostWebApp)
SET(QT_DONT_USE_QTGUI TRUE)
FIND_PACKAGE(Qt4 REQUIRED)
SET(BOOST_LIBRARYDIR /usr/lib/boost) # Set this to the location of your Boost Library Binaries
SET(Boost_USE_STATIC_LIBS ON)
FIND_PACKAGE(Boost COMPONENTS thread REQUIRED)
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! README !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ###
# BoostWebApp should build on any Unix/Linux platform.
# This app uses CMake to generate makefiles. Do NOT build this with Qmake, it will fail.
# The Qmake project file is used to tell the IDE (QtCreator) how to parse the project, so AutoCompletion works correctly.
# If you are using QtCreator, open the Qmake project file with QtCreator, and change the build commands to CMake.
# Typical Debug Command: (run in build directory) cmake -DDEBUG=1 <source_directory>
# Typical Debug Command: (run in build directory) cmake -DRELEASE=1 <source_directory>
#
# You must have the Boost and Qt Libraries and Header Files installed correctly to build this application.
#
# To run BoostWebApp correctly, some command-line arguments are required.
# ./(build_dir)/webapp <address-to-bind> <port> <thread-pool-size> <document-root>
# Typical Development Run Command: $ ./webapp 0.0.0.0 8080 10 docroot
# You need to be root to run on port 80, so:
# Typical Release Deployment: # ./webapp 0.0.0.0 80 10 docroot
### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ###
SET(BoostWebApp_HEADERS ### =================== HEADERS =================== ###
generated.h
global.h
pagescommin.h
request_handler.hpp
websession.h
# Server
server/connection.hpp
server/logger.h
server/mime_types.hpp
server/reply.hpp
server/request.hpp
server/request_parser.hpp
server/server.hpp
# Commands
commands/user.h
commands/userdata.h
# Pages
pages/aboutpage.h
pages/devpages.h
pages/errorpage.h
pages/gallerypage.h
pages/helppage.h
pages/homepage.h
pages/pagebase.h
pages/pages.h
pages/raytracepages.h
# Zennix Libs
zlib/asar.h
zlib/database.h
zlib/zfile.h
zlib/zstring.h
zlib/sqlite3.h
)
SET(BoostWebApp_SOURCES ### =================== SOURCES =================== ###
main.cpp
pagescommon.cpp
request_handler.cpp
request_switch.cpp
staticfile.cpp
websession.cpp
# Server
server/connection.cpp
server/logger.cpp
server/mime_types.cpp
server/reply.cpp
server/request_parser.cpp
server/server.cpp
# Commands
commands/user.cpp
# Pages
pages/aboutpage.cpp
pages/devpages.cpp
pages/errorpage.cpp
pages/gallerypage.cpp
pages/helppage.cpp
pages/homepage.cpp
pages/pagebase.cpp
pages/raytracepage.cpp
# Zennix Libs
#zlib/asar.tpp
zlib/database.cpp
zlib/zfile.cpp
zlib/zstring.cpp
zlib/sqlite3.c
# Boost
lib/system/error_code.cpp
)
INCLUDE(${QT_USE_FILE})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}
./
server/
commands/
pages/
zlib/
zlib/SQLite/
)
### =================== CONFIG =================== ###
EXECUTE_PROCESS(COMMAND date OUTPUT_VARIABLE MAKE_BUILD_TIME)
STRING(STRIP ${MAKE_BUILD_TIME} MAKE_BUILD_TIME)
CONFIGURE_FILE(generated.h gen.h @ONLY)
ADD_CUSTOM_TARGET(resources
COMMAND echo Refreshing Resources ...
COMMAND rm -Rf ${CMAKE_BINARY_DIR}/docroot
COMMAND rm -Rf ${CMAKE_BINARY_DIR}/sessions
COMMAND rm -Rf ${CMAKE_BINARY_DIR}/logs
COMMAND rm -Rf ${CMAKE_BINARY_DIR}/parts
COMMAND rm -Rf ${CMAKE_BINARY_DIR}/db
COMMAND cp -R ${CMAKE_SOURCE_DIR}/docroot ${CMAKE_BINARY_DIR}/docroot
COMMAND cp -R ${CMAKE_SOURCE_DIR}/parts ${CMAKE_BINARY_DIR}/parts
COMMAND mkdir ${CMAKE_BINARY_DIR}/sessions
COMMAND mkdir ${CMAKE_BINARY_DIR}/logs
COMMAND mkdir ${CMAKE_BINARY_DIR}/db
COMMAND echo Done.
)
### =================== BUILD =================== ###
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DHAS_BOOST)
# Required - Resolves some conditions that change during build
ADD_DEFINITIONS(-D BUILDING)
# Used for QDateTime
ADD_DEFINITIONS(-D ZSTRING_USE_QT)
#ADD_DEFINITIONS(-D ZFILE_USE_QT)
IF(DEBUG)
ADD_DEFINITIONS(-g)
ADD_CUSTOM_TARGET(building
COMMAND echo Debug Build Starting...
)
ELSEIF(RELEASE)
ADD_DEFINITIONS(-O3)
ADD_CUSTOM_TARGET(building
COMMAND echo Release Build Starting...
)
ELSE()
ADD_CUSTOM_TARGET(building
COMMAND echo Normal Build Starting...
)
ENDIF()
ADD_DEFINITIONS(-pthread)
ADD_EXECUTABLE(webapp ${BoostWebApp_SOURCES})
TARGET_LINK_LIBRARIES(webapp ${QT_LIBRARIES} ${Boost_THREAD_LIBRARY})
ADD_CUSTOM_COMMAND(TARGET webapp POST_BUILD
COMMAND ./webapp db
)
ADD_DEPENDENCIES(webapp building)
ADD_DEPENDENCIES(building resources)