-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
155 lines (137 loc) · 4.8 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.8.2)
project (neographics)
###################################################################
# Dependencies
###################################################################
include(ExternalProject)
ExternalProject_Add(
stb
GIT_REPOSITORY https://github.com/nothings/stb.git
GIT_TAG master
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/stb
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
UPDATE_DISCONNECTED 1
)
ExternalProject_Get_Property(stb source_dir)
set(STB_SOURCE_DIR ${source_dir})
###################################################################
# Utilities
###################################################################
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
enable_testing()
function(assign_source_group)
foreach(_source IN ITEMS ${ARGN})
if (IS_ABSOLUTE "${_source}")
file(RELATIVE_PATH _source_rel "${CMAKE_CURRENT_SOURCE_DIR}" "${_source}")
else()
set(_source_rel "${_source}")
endif()
get_filename_component(_source_path "${_source_rel}" PATH)
string(REPLACE "/" "\\" _source_path_msvc "${_source_path}")
source_group("${_source_path_msvc}" FILES "${_source}")
endforeach()
endfunction(assign_source_group)
###################################################################
# neographics
###################################################################
set(sources_neographics
src/draw_command/draw_command.c
src/draw_command/draw_command.h
src/fonts/fonts.c
src/fonts/fonts.h
src/gbitmap/gbitmap.c
src/gbitmap/gbitmap.h
src/gbitmap/blit.h
src/gbitmap/blit_color.c
src/gbitmap/blit_bw.c
src/path/path.c
src/path/path.h
src/primitives/circle.c
src/primitives/circle.h
src/primitives/line.c
src/primitives/line.h
src/primitives/rect.c
src/primitives/rect.h
src/text/text.c
src/text/text.h
src/types/color.h
src/types/colors.h
src/types/cornermask.h
src/types/point.h
src/types/rect.c
src/types/rect.h
src/types/size.h
src/common.c
src/common.h
src/context.c
src/context.h
src/graphics.h
src/macros.h
src/types.h
contrib/pebble_env/pebble.c
contrib/pebble_env/pebble.h
)
assign_source_group(${sources_neographics})
add_definitions(-DNGFX_IS_CORE)
include_directories("contrib/pebble_env")
if (NOT WIN32)
link_libraries(m) # everyone needs a bit of math (except windows)
endif()
add_library(neographics_rect ${sources_neographics} )
target_compile_definitions(neographics_rect PUBLIC PBL_RECT=1)
add_library(neographics_rect_bw ${sources_neographics} )
target_compile_definitions(neographics_rect_bw PUBLIC PBL_RECT=1 PBL_BW=1)
add_library(neographics_round ${sources_neographics} )
target_compile_definitions(neographics_round PUBLIC)
###################################################################
# tests
###################################################################
set(sources_test_neographics
test/tests.h
test/test.h
test/test_test.h
test/test_types.h
test/test_gbitmap.h
test/test_blit.h
contrib/testrunner_pc/testrunner.h
contrib/testrunner_pc/testrunner.c
contrib/testrunner_pc/tests.c
contrib/testrunner_pc/resources.c
contrib/testrunner_pc/utils.c
contrib/testrunner_pc/stb_impl.c
)
assign_source_group(${sources_test_neographics})
add_executable(test_neographics_rect ${sources_test_neographics} )
target_link_libraries(test_neographics_rect neographics_rect)
target_compile_definitions(neographics_rect PUBLIC PBL_TYPE=rect PBL_RECT=1)
target_include_directories(neographics_rect PUBLIC "src" ${STB_SOURCE_DIR})
add_dependencies(neographics_rect stb)
add_test(
NAME test_neographics_rect
COMMAND ${CMAKE_BINARY_DIR}/bin/test_neographics_rect
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_executable(test_neographics_rect_bw ${sources_test_neographics} )
target_link_libraries(test_neographics_rect_bw neographics_rect_bw)
target_compile_definitions(neographics_rect_bw PUBLIC PBL_TYPE=rect_bw PBL_RECT=1 PBL_BW=1)
target_include_directories(neographics_rect_bw PUBLIC "src" ${STB_SOURCE_DIR})
add_dependencies(neographics_rect_bw stb)
add_test(
NAME test_neographics_rect_bw
COMMAND ${CMAKE_BINARY_DIR}/bin/test_neographics_rect_bw
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_executable(test_neographics_round ${sources_test_neographics} )
target_link_libraries(test_neographics_round neographics_round)
target_compile_definitions(neographics_round PUBLIC PBL_TYPE=round)
target_include_directories(neographics_round PUBLIC "src" ${STB_SOURCE_DIR})
add_dependencies(neographics_round stb)
add_test(
NAME test_neographics_round
COMMAND ${CMAKE_BINARY_DIR}/bin/test_neographics_round
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)