-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
155 lines (124 loc) · 3.88 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
cmake_minimum_required(VERSION 2.6)
project(rengine)
file(MAKE_DIRECTORY lib)
set(CMAKE_CXX_FLAGS "-Wall -std=c++11")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY lib)
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
################################################################################
#
# Options
#
option(RENGINE_LOG_INFO "LogInfo" ON)
if (RENGINE_LOG_INFO)
message("LogInfo: enabled")
add_definitions(-DRENGINE_LOG_INFO)
endif()
option(RENGINE_LOG_DEBUG "LogDebug" OFF)
if (RENGINE_LOG_DEBUG)
message("LogDebug: enabled")
add_definitions(-DRENGINE_LOG_DEBUG)
endif()
option(RENGINE_LOG_WARNING "LogWarning" ON)
if (RENGINE_LOG_WARNING)
message("LogWarning: enabled")
add_definitions(-DRENGINE_LOG_WARNING)
endif()
option(RENGINE_LOG_ERROR "LogError" ON)
if (RENGINE_LOG_ERROR)
message("LogError: enabled")
add_definitions(-DRENGINE_LOG_ERROR)
endif()
option(RENGINE_USE_SDL "SDL Backend" OFF)
################################################################################
#
# Macros
#
macro(add_rengine_example name)
set(EXAMPLE_NAME "ex_${name}")
add_executable(${EXAMPLE_NAME} "examples/${name}.cpp")
target_link_libraries(${EXAMPLE_NAME} ${RENGINE_LIBS})
endmacro(add_rengine_example)
macro(add_rengine_test name)
set(TEST_NAME "tst_${name}")
add_executable(${TEST_NAME} "tests/tst_${name}.cpp")
add_test(${TEST_NAME} ${TEST_NAME})
target_link_libraries(${TEST_NAME} ${RENGINE_LIBS})
endmacro(add_rengine_test)
################################################################################
#
# Resolving backend stuff
#
if(RENGINE_USE_SFHWC)
message("-- SFHWC backend")
add_definitions(-DRENGINE_BACKEND_SFHWC)
include_directories(# android headers
/usr/lib/droid-devel/droid-headers
# libhybris headers
/usr/include/hybris/hwcomposerwindow
/usr/include/hybris/eglplatformcommon)
set(RENGINE_LIBS ${RENGINE_LIBS}
-lhardware
-lhybris-common
-lhybris-eglplatformcommon
-lhybris-hwcomposerwindow
-lsync
-lEGL
-lpthread
-lmtdev)
else() # (RENGINE_USE_SDL)
message("-- SDL backend")
include(FindPkgConfig)
pkg_search_module(SDL2 REQUIRED sdl2)
include_directories(${SDL2_INCLUDE_DIRS})
if (LINUX)
set(RENGINE_LIBS ${RENGINE_LIBS} -lpthread)
endif()
set(RENGINE_LIBS ${RENGINE_LIBS} -L/usr/local/lib ${SDL2_LIBRARIES})
add_definitions(-DRENGINE_BACKEND_SDL)
endif()
find_package(OpenGL)
if (OPENGL_FOUND)
set(RENGINE_LIBS ${RENGINE_LIBS} ${OPENGL_LIBRARIES})
add_definitions(-DRENGINE_OPENGL_DESKTOP)
else()
message(WARNING, "OpenGL was not found, assuming OpenGL ES 2.0 in default locations...")
set(RENGINE_LIBS ${RENGINE_LIBS} -lGLESv2)
endif()
################################################################################
#
# Misc..
#
add_executable(renginec "src/renginec/main.cpp")
include_directories(include 3rdparty)
enable_testing()
################################################################################
#
# Tests and Examples
#
# add_rengine_example(rectangles)
# add_rengine_example(layeredopacity)
add_rengine_example(benchmark_rectangles)
# add_rengine_example(filters)
# add_rengine_example(blur)
# add_rengine_example(shadow)
add_rengine_example(benchmark_blend)
# add_rengine_example(touch)
# add_rengine_example(text)
add_executable(demo
"examples/button.cpp"
"examples/imageutils.cpp"
"examples/main.cpp"
"examples/rootwindow.cpp"
)
target_link_libraries(demo ${RENGINE_LIBS})
add_rengine_test(node)
add_rengine_test(mathtypes)
#add_rengine_test(keyframes)
add_rengine_test(render)
add_rengine_test(property)
add_rengine_test(signal)
add_rengine_test(layout)
add_rengine_test(workqueue)
add_rengine_test(units)