-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
92 lines (76 loc) · 2.73 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
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
cmake_minimum_required (VERSION 3.12)
# Define colors
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColorReset "${Esc}[m")
set(ColorBold "${Esc}[1m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Yellow "${Esc}[33m")
set(Blue "${Esc}[34m")
set(Magenta "${Esc}[35m")
set(Cyan "${Esc}[36m")
set(White "${Esc}[37m")
set(BoldRed "${Esc}[1;31m")
set(BoldGreen "${Esc}[1;32m")
set(BoldYellow "${Esc}[1;33m")
set(BoldBlue "${Esc}[1;34m")
set(BoldMagenta "${Esc}[1;35m")
set(BoldCyan "${Esc}[1;36m")
set(BoldWhite "${Esc}[1;37m")
endif()
project ("tinymatrixmath" C CXX)
set (CMAKE_CXX_STANDARD 14)
# Options
option(${PROJECT_NAME}_BUILD_TESTS "Build all projects in the 'test' folder (requires GoogleTest)" ON)
option(${PROJECT_NAME}_BUILD_EXAMPLES "Build all projects in the 'examples' folder" ON)
option(${PROJECT_NAME}_BUILD_DOCS "Build documentation (requires Doxygen)" ON)
# Set the macro/helper directory
set(MACRO_DIRECTORY ${CMAKE_HOME_DIRECTORY}/CMake/macros)
message("${BoldMagenta}CMake utility directory: ${MACRO_DIRECTORY}${ColorReset}")
# By using CMake, it's safe to assume that the Standard Library is available.
# (That's not the case when we're using this library in an Arduino library!)
# Manually define a compile-time definition
# add_compile_definitions(USING_STANDARD_LIBRARY=1)
# TinyMatrixMath
add_library (${PROJECT_NAME}
src/TinyMatrixMath.hpp
src/TMM_enable_if.hpp
src/TMM_matrix.hpp
src/TMM_matrix.cpp
src/TinyMatrixMath.cpp
)
target_link_libraries (${PROJECT_NAME})
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_compile_definitions(${PROJECT_NAME} PUBLIC USING_STANDARD_LIBRARY)
message("${BoldYellow}Library search complete!${ColorReset}")
# Include tests.
if(${PROJECT_NAME}_BUILD_TESTS)
add_subdirectory ("test")
endif()
# Include examples.
if(${PROJECT_NAME}_BUILD_EXAMPLES)
add_subdirectory(cmake_examples)
endif()
# Documentation
if(${PROJECT_NAME}_BUILD_DOCS)
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(DOXYGEN_GENERATE_HTML YES)
set(DOXYGEN_GENERATE_MAN YES)
set(DOXYGEN_GENERATE_TREEVIEW YES)
set(DOXYGEN_DISABLE_INDEX NO)
set(DOXYGEN_FULL_SIDEBAR NO)
set(DOXYGEN_HTML_STYLESHEET ${PROJECT_SOURCE_DIR}/docs/thirdparty/doxygen-awesome-css/doxygen-awesome.css)
set(DOXYGEN_HTML_COLORSTYLE LIGHT)
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE ${PROJECT_SOURCE_DIR}/README.md)
doxygen_add_docs(
${PROJECT_NAME}_docs
${PROJECT_SOURCE_DIR}/README.md
${PROJECT_SOURCE_DIR}/src
COMMENT "Generate docs"
)
endif()
endif()