forked from CasparCG/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
164 lines (138 loc) · 6.93 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
cmake_minimum_required (VERSION 2.6)
project ("CasparCG Server")
find_package(Git)
set(GIT_REV "0")
set(GIT_HASH "N/A")
if (GIT_FOUND)
exec_program("${GIT_EXECUTABLE}" "${PROJECT_SOURCE_DIR}"
ARGS rev-list --all --count
OUTPUT_VARIABLE GIT_REV)
exec_program("${GIT_EXECUTABLE}" "${PROJECT_SOURCE_DIR}"
ARGS rev-parse --verify --short HEAD
OUTPUT_VARIABLE GIT_HASH)
endif ()
configure_file("${PROJECT_SOURCE_DIR}/version.tmpl" "${PROJECT_SOURCE_DIR}/version.h")
set(DEPENDENCIES_FOLDER "${PROJECT_SOURCE_DIR}/dependencies64")
set(BOOST_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/boost")
set(RXCPP_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/RxCpp/include")
set(TBB_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/tbb/include")
set(GLEW_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/glew/include")
set(SFML_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/sfml/include")
set(FREETYPE_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/freetype/include")
if (MSVC)
set(FFMPEG_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/ffmpeg/include" "${DEPENDENCIES_FOLDER}/ffmpeg/include-win32")
else ()
set(FFMPEG_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/ffmpeg/include")
endif ()
set(FREEIMAGE_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/freeimage/include")
set(OPENAL_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/openal/include")
set(BLUEFISH_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/bluefish/include")
set(CEF_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/cef/include")
set(GTEST_INCLUDE_PATH "${DEPENDENCIES_FOLDER}/gtest/include")
if (MSVC)
set(PLATFORM_FOLDER_NAME "win32")
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(PLATFORM_FOLDER_NAME "linux")
endif ()
set(FFMPEG_BIN_PATH "${DEPENDENCIES_FOLDER}/ffmpeg/bin/${PLATFORM_FOLDER_NAME}")
set(FREEIMAGE_BIN_PATH "${DEPENDENCIES_FOLDER}/freeimage/bin/${PLATFORM_FOLDER_NAME}")
set(GLEW_BIN_PATH "${DEPENDENCIES_FOLDER}/glew/bin/${PLATFORM_FOLDER_NAME}")
set(OPENAL_BIN_PATH "${DEPENDENCIES_FOLDER}/openal/bin/${PLATFORM_FOLDER_NAME}")
set(TBB_BIN_PATH "${DEPENDENCIES_FOLDER}/tbb/bin/${PLATFORM_FOLDER_NAME}")
set(LIBERATION_FONTS_BIN_PATH "${DEPENDENCIES_FOLDER}/liberation-fonts")
set(CEF_PATH "${DEPENDENCIES_FOLDER}/cef")
set(CEF_BIN_PATH "${DEPENDENCIES_FOLDER}/cef/bin/${PLATFORM_FOLDER_NAME}")
link_directories("${DEPENDENCIES_FOLDER}/boost/stage/lib/${PLATFORM_FOLDER_NAME}")
link_directories("${DEPENDENCIES_FOLDER}/tbb/lib/${PLATFORM_FOLDER_NAME}")
link_directories("${DEPENDENCIES_FOLDER}/glew/lib/${PLATFORM_FOLDER_NAME}")
link_directories("${DEPENDENCIES_FOLDER}/sfml/lib/${PLATFORM_FOLDER_NAME}")
link_directories("${DEPENDENCIES_FOLDER}/sfml/extlibs/lib")
link_directories("${DEPENDENCIES_FOLDER}/freetype/objs/win32/vc2010")
link_directories("${DEPENDENCIES_FOLDER}/ffmpeg/lib/${PLATFORM_FOLDER_NAME}")
link_directories("${DEPENDENCIES_FOLDER}/asmlib")
link_directories("${DEPENDENCIES_FOLDER}/freeimage/lib/${PLATFORM_FOLDER_NAME}")
link_directories("${DEPENDENCIES_FOLDER}/openal/lib/${PLATFORM_FOLDER_NAME}")
link_directories("${DEPENDENCIES_FOLDER}/bluefish/lib")
link_directories("${DEPENDENCIES_FOLDER}/zlib/lib")
link_directories("${DEPENDENCIES_FOLDER}/cef/lib/${PLATFORM_FOLDER_NAME}")
link_directories("${DEPENDENCIES_FOLDER}/gtest/lib/${PLATFORM_FOLDER_NAME}")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_definitions( -DSFML_STATIC )
add_definitions( -DBOOST_THREAD_VERSION=4 )
add_definitions( -DTBB_USE_CAPTURED_EXCEPTION=0 )
add_definitions( -DUNICODE )
add_definitions( -D_UNICODE )
add_definitions( -DGLEW_NO_GLU )
add_definitions( "-DBOOST_ASIO_ERROR_CATEGORY_NOEXCEPT=noexcept(true)" ) # Workaround macro redefinition in boost
add_definitions( -D_GLIBCXX_USE_CXX11_ABI=0 ) # Allow compilation in GCC 5 while keeping old dependencies
add_definitions( -DCASPAR_SOURCE_PREFIX="${CMAKE_CURRENT_SOURCE_DIR}" )
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa /Zi /W4 /WX /MP /fp:fast /Zm192 /FIcommon/compiler/vs/disable_silly_warnings.h")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D TBB_USE_ASSERT=1 /D TBB_USE_DEBUG /bigobj")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /Ot /Gy /bigobj")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Oi /Ot /Gy /bigobj /Ob2")
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g")
add_compile_options( -std=c++11 )
add_compile_options( -msse3 )
add_compile_options( -mssse3 )
add_compile_options( -msse4.1 )
add_compile_options( -pthread )
add_compile_options( -fPIC )
add_compile_options( -fnon-call-exceptions ) # Allow signal handler to throw exception
add_definitions( -DBOOST_NO_SWPRINTF ) # swprintf on Linux seems to always use , as decimal point regardless of C-locale or C++-locale
endif ()
if (POLICY CMP0045)
cmake_policy(SET CMP0045 OLD)
endif ()
include(CMake/PrecompiledHeader.cmake)
set(CASPARCG_MODULE_INCLUDE_STATEMENTS "" CACHE INTERNAL "")
set(CASPARCG_MODULE_INIT_STATEMENTS "" CACHE INTERNAL "")
set(CASPARCG_MODULE_UNINIT_STATEMENTS "" CACHE INTERNAL "")
set(CASPARCG_MODULE_COMMAND_LINE_ARG_INTERCEPTORS_STATEMENTS "" CACHE INTERNAL "")
set(CASPARCG_MODULE_PROJECTS "" CACHE INTERNAL "")
set(CASPARCG_RUNTIME_DEPENDENCIES "" CACHE INTERNAL "")
function(casparcg_add_include_statement HEADER_FILE_TO_INCLUDE)
set(CASPARCG_MODULE_INCLUDE_STATEMENTS "${CASPARCG_MODULE_INCLUDE_STATEMENTS}"
"#include <${HEADER_FILE_TO_INCLUDE}>"
CACHE INTERNAL "")
endfunction()
function(casparcg_add_init_statement INIT_FUNCTION_NAME NAME_TO_LOG)
set(CASPARCG_MODULE_INIT_STATEMENTS "${CASPARCG_MODULE_INIT_STATEMENTS}"
" ${INIT_FUNCTION_NAME}(dependencies)\;"
" CASPAR_LOG(info) << L\"Initialized ${NAME_TO_LOG} module.\"\;"
""
CACHE INTERNAL "")
endfunction()
function(casparcg_add_uninit_statement UNINIT_FUNCTION_NAME)
set(CASPARCG_MODULE_UNINIT_STATEMENTS
" ${UNINIT_FUNCTION_NAME}()\;"
"${CASPARCG_MODULE_UNINIT_STATEMENTS}"
CACHE INTERNAL "")
endfunction()
function(casparcg_add_command_line_arg_interceptor INTERCEPTOR_FUNCTION_NAME)
set(CASPARCG_MODULE_COMMAND_LINE_ARG_INTERCEPTORS_STATEMENTS "${CASPARCG_MODULE_COMMAND_LINE_ARG_INTERCEPTORS_STATEMENTS}"
" if (${INTERCEPTOR_FUNCTION_NAME}(argc, argv))"
" return true\;"
""
CACHE INTERNAL "")
endfunction()
function(casparcg_add_module_project PROJECT)
set(CASPARCG_MODULE_PROJECTS "${CASPARCG_MODULE_PROJECTS}" "${PROJECT}" CACHE INTERNAL "")
endfunction()
# http://stackoverflow.com/questions/7172670/best-shortest-way-to-join-a-list-in-cmake
function(join_list VALUES GLUE OUTPUT)
string (REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}")
string (REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
endfunction()
function(casparcg_add_runtime_dependency FILE_TO_COPY)
set(CASPARCG_RUNTIME_DEPENDENCIES "${CASPARCG_RUNTIME_DEPENDENCIES}" "${FILE_TO_COPY}" CACHE INTERNAL "")
endfunction()
add_subdirectory(accelerator)
add_subdirectory(common)
add_subdirectory(core)
add_subdirectory(modules)
add_subdirectory(protocol)
add_subdirectory(shell)
add_subdirectory(unit-test)