-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
103 lines (72 loc) · 2.3 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
cmake_minimum_required(VERSION 3.13)
project("HAR"
LANGUAGES C CXX
VERSION 2.0)
set(CMAKE_CXX_STANDARD 17)
set(PROJECT_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread")
endif ()
set(CMAKE_CXX_PROTO_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_PROTO_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_PROTO_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
include(cmake/RessourceCompiler.cmake)
add_subdirectory(lib/har)
add_subdirectory(lib/hargui)
add_subdirectory(lib/harduino)
add_subdirectory(lib/gti)
#region package
#TODO: Figure out CPack
#endregion
#region Examples
include_directories(include)
#region Blink
find_library(harduino
NAMES harduino libharduino
HINTS "${CMAKE_BINARY_DIR}/harduino")
set(DUINO_LIBRARY_NAME harduino)
link_directories(${CMAKE_BINARY_DIR}/harduino)
#To allow Arduino sketches without explicit includes of <Arduino.h>
if (MSVC)
set_source_files_properties(src/example/blink.c PROPERTIES COMPILE_FLAGS /FI"include/Arduino.h")
else ()
set_source_files_properties(src/example/blink.c PROPERTIES COMPILE_FLAGS "-include Arduino.h")
endif ()
add_executable(example_blink
include/Arduino.h
src/example/blink.c)
target_link_libraries(example_blink
-Wl,--whole-archive
${DUINO_LIBRARY_NAME}
-Wl,--no-whole-archive)
#endregion
#region Game of Life
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_PROTO_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_PROTO_FLAGS_RELEASE} -O3 -fno-exceptions")
find_package(PkgConfig)
pkg_check_modules(GTKMM REQUIRED gtkmm-3.0)
pkg_check_modules(GLIBMM REQUIRED glibmm-2.4)
include_directories(
${PROJECT_INCLUDE_DIR}
include
../hargui/include
${GTKMM_INCLUDE_DIRS}
${GLIBMM_INCLUDE_DIRS})
link_directories(
${GTKMM_LIBRARY_DIRS}
${GLIBMM_LIBRARY_DIRS})
add_executable(example_gol
src/example/game_of_life.cpp)
target_link_libraries(example_gol
${DUINO_LIBRARY_NAME}
${GTKMM_LIBRARIES}
${GLIBMM_LIBRARIES})
#endregion
#endregion
#region Documentation
find_package(Doxygen)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} docs/Doxyfile
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
#endregion