blob: 8439403d8931e97763cdaaeebe6da58db4de0899 (
plain)
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
|
cmake_minimum_required(VERSION 3.1)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 14) # C++14
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(RBA_API_VERSION 1.0)
set(PROJECT_NAME "rba")
project(${PROJECT_NAME})
if(USE_GCOV)
set(LIB_NAME ${PROJECT_NAME}_gcov)
else()
set(LIB_NAME ${PROJECT_NAME})
endif(USE_GCOV)
set(SRC_DIR src)
set(INCLUDE_DIR include)
file(GLOB_RECURSE SRC ${SRC_DIR}/*.cpp)
include_directories(
${INCLUDE_DIR}/rba
${SRC_DIR}/core/logic
${SRC_DIR}/core/model
${SRC_DIR}/core/expression
${SRC_DIR}/factory
${SRC_DIR}/log
${SRC_DIR}/optimize
${SRC_DIR}/public
${SRC_DIR}/sound
${SRC_DIR}/view
${SRC_DIR}/animation
)
if(NOLOG)
# compile without log
else()
add_definitions(-DRBA_USE_LOG)
endif(NOLOG)
if(WIN32)
# for Windows
add_definitions(-D_WINDLL)
add_definitions(-D_USRDLL)
add_definitions(-DNDEBUG)
add_definitions(-DRBA_EXPORTS)
add_definitions(/source-charset:utf-8)
add_definitions(/MP9)
set(CMAKE_SHARED_LINKER_FLAGS "/SUBSYSTEM:WINDOWS")
set(rba_BINARY_DIR ${PROJECT_SOURCE_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/lib)
else()
# for Linux
add_definitions("-Wall")
if(RELEASE)
add_definitions("-O2")
else()
if(USE_GPROF)
add_definitions("-pg")
else()
add_definitions("-g")
endif(USE_GPROF)
endif(RELEASE)
if(USE_GCOV)
add_definitions(-fprofile-arcs -ftest-coverage -fno-exceptions)
set(CMAKE_SHARED_LINKER_FLAGS "--coverage")
else()
if(USE_GPROF)
set(CMAKE_SHARED_LINKER_FLAGS "-pg")
endif(USE_GPROF)
endif(USE_GCOV)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
endif(WIN32)
add_library(${PROJECT_NAME} SHARED ${SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${RBA_API_VERSION} SOVERSION ${RBA_API_VERSION})
if(WIN32)
else()
add_library(rba_static STATIC ${SRC})
set_target_properties(rba_static PROPERTIES OUTPUT_NAME ${LIB_NAME})
endif(WIN32)
if(WIN32)
target_link_libraries(rba_shared
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib
)
endif(WIN32)
if(DEBUG_CMAKE)
message(STATUS "*** dump start cmake variables ***")
get_cmake_property(_variableNames VARIABLES)
foreach(_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
message(STATUS "*** dump end ***")
endif(DEBUG_CMAKE)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/librba.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/librba.pc"
@ONLY
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/librba.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib${LIB_SUFFIX}
)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/rba/
DESTINATION include
FILES_MATCHING
PATTERN "*.h*"
)
# end of file
|