-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
138 lines (114 loc) · 4.46 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
cmake_minimum_required(VERSION 2.8)
project(crails_project)
option(USE_MEMCACHED "Memcached" OFF)
option(USE_MONGODB "MongoDB" ON)
option(USE_ODB "ODB ORM" ON)
option(USE_COOKIE_CIPHER "Include cookie cipher" OFF)
option(USE_SSL "Include ssl support" OFF)
option(USE_CRAILS_SYNC "crails-sync" ON)
option(DEVELOPER_MODE "Developer mode" ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
##
## Compiler Options
##
set(CMAKE_CXX_FLAGS "-Wall -Wno-unknown-pragmas -Wno-deprecated-declarations -pedantic")
if (DEVELOPER_MODE)
message("-- Building development server")
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSERVER_DEBUG")
else()
message("-- Building production server")
endif()
if (USE_COOKIE_CIPHER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCRAILS_WITH_COOKIE_ENCRYPTION")
include_directories(/usr/include/openssl-1.0)
endif()
if (USE_SSL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCRAILS_WITH_SSL -DBOOST_NETWORK_ENABLE_HTTPS")
endif()
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual -Wno-return-type-c-linkage")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
endif()
##
## Dependencies
##
find_package(cppnetlib REQUIRED)
find_package(Boost COMPONENTS thread filesystem program_options system random REQUIRED)
find_package(ImageMagick COMPONENTS Magick++)
find_package(webdriverxx)
include_directories(. include Boots/include /usr/local/include ${CPPNETLIB_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${ImageMagick_INCLUDE_DIRS} ${WEBDRIVERXX_INCLUDE_DIRS})
##
## Source files
##
file(GLOB crails_core
src/*.cpp
src/request_handlers/*.cpp
src/request_parsers/*.cpp
src/utils/*.cpp)
file(GLOB crails_sql
src/sql/*.cpp)
file(GLOB crails_tests
src/tests/*.cpp)
##
## Targets
##
if(DEVELOPER_MODE)
set(crails-suffix -debug)
endif()
add_library(crails-core${crails-suffix} SHARED ${crails_core})
add_library(crails-tests${crails-suffix} SHARED ${crails_tests})
file(GLOB headers_crails crails/*.h crails/*.hpp)
file(GLOB headers_crails_cki crails/session_store/*.hpp)
file(GLOB headers_crails_rhs crails/request_handlers/*.hpp)
file(GLOB headers_crails_uti crails/utils/*.hpp)
file(GLOB headers_crails_tst crails/tests/*.hpp)
file(GLOB scripts scripts/*.rb)
file(GLOB scripts_lib scripts/lib/*.rb)
file(GLOB scripts_templates scripts/guard/templates/*.erb)
file(GLOB_RECURSE app_template app_template/app/*)
file(GLOB_RECURSE task_template app_template/task/tasks/*)
file(GLOB guard_plugins scripts/guard/*.rb)
install(PROGRAMS scripts/crails DESTINATION bin)
instalL(FILES ${app_template} DESTINATION share/crails/app_template)
install(FILES ${task_template} DESTINATION share/crails/app_template/task)
install(FILES ${scripts} DESTINATION share/crails/scripts)
install(FILES ${scripts_lib} DESTINATION share/crails/scripts/lib)
install(FILES ${scripts_templates} DESTINATION share/crails/guard/templates)
install(FILES ${guard_plugins} DESTINATION share/crails/guard)
install(DIRECTORY crails DESTINATION include)
install(TARGETS crails-core${crails-suffix} LIBRARY DESTINATION lib)
install(TARGETS crails-tests${crails-suffix} LIBRARY DESTINATION lib)
add_subdirectory(modules/docker)
add_subdirectory(modules/html)
add_subdirectory(modules/json)
add_subdirectory(modules/mail)
add_subdirectory(modules/proxy)
add_subdirectory(modules/sentry)
add_subdirectory(modules/comet)
add_subdirectory(modules/sidekic)
add_subdirectory(modules/xmlrpc)
add_subdirectory(modules/signin)
add_subdirectory(modules/metarecord)
add_subdirectory(modules/crud)
add_subdirectory(modules/attachment)
if (${ImageMagick_Magick++_FOUND})
add_subdirectory(modules/image)
endif()
if (USE_MEMCACHED)
add_subdirectory(modules/cache)
endif()
if (USE_MONGODB)
# add_subdirectory(modules/mongodb)
endif()
if (USE_ODB)
add_subdirectory(modules/odb)
endif()
if (USE_CRAILS_SYNC)
add_subdirectory(modules/sync)
endif()
if (${WEBDRIVERXX_FOUND})
add_subdirectory(modules/selenium)
endif()