-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
77 lines (65 loc) · 1.97 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
cmake_minimum_required(VERSION 3.28)
project(led-matrix-zmq-server
LANGUAGES CXX
)
option(BUILD_SERVER "Build the server" ON)
option(BUILD_TOOLS "Build tools" ON)
option(BUILD_VIRTUAL "Build virtual server" OFF)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(COMPILE_FEATURES cxx_std_20)
set(COMPILE_OPTIONS -O3 -Wall -Wextra)
find_package(PkgConfig REQUIRED)
pkg_check_modules(ZMQ REQUIRED libzmq cppzmq)
include(FetchContent)
FetchContent_Declare(
argparse
GIT_REPOSITORY https://github.com/p-ranav/argparse.git
GIT_TAG v3.1
)
FetchContent_Declare(
plog
GIT_REPOSITORY https://github.com/SergiusTheBest/plog.git
GIT_TAG 1.1.10
)
FetchContent_MakeAvailable(argparse plog)
if(
BUILD_SERVER
AND (
CMAKE_SYSTEM_PROCESSOR MATCHES "arm"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64"
)
)
find_package(RpiRgbLedMatrix REQUIRED)
add_executable(led-matrix-zmq-server
src/server_main.cpp
src/color_temp.cpp
)
target_link_libraries(led-matrix-zmq-server PRIVATE
argparse
plog
pthread
RpiRgbLedMatrix::RpiRgbLedMatrix
zmq
)
target_compile_features(led-matrix-zmq-server PRIVATE ${COMPILE_FEATURES})
target_compile_options(led-matrix-zmq-server PRIVATE ${COMPILE_OPTIONS})
endif()
if (BUILD_TOOLS)
add_executable(led-matrix-zmq-control src/control_main.cpp)
target_link_libraries(led-matrix-zmq-control PRIVATE argparse plog zmq)
target_compile_features(led-matrix-zmq-control PRIVATE ${COMPILE_FEATURES})
add_executable(led-matrix-zmq-pipe src/pipe_main.cpp)
target_link_libraries(led-matrix-zmq-pipe PRIVATE argparse plog zmq)
target_compile_features(led-matrix-zmq-pipe PRIVATE ${COMPILE_FEATURES})
endif()
if (BUILD_VIRTUAL)
find_package(SDL2 REQUIRED)
add_executable(led-matrix-zmq-virtual src/virtual_main.cpp)
target_link_libraries(led-matrix-zmq-virtual PRIVATE
argparse
plog
SDL2::SDL2
zmq
)
target_compile_features(led-matrix-zmq-virtual PRIVATE ${COMPILE_FEATURES})
endif()