-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
73 lines (60 loc) · 2.06 KB
/
CMakeLists.txt
File metadata and controls
73 lines (60 loc) · 2.06 KB
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
cmake_minimum_required(VERSION 3.20)
project(Food_Rpi LANGUAGES CXX)
# Set the C++ Standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set no optimization for debugging
add_compile_options(-O0 -g -Wall)# -Wall -Wextra -Werror -Wconversion -Wshadow -Wformat=2 -Wfloat-equal -Wpointer-arith -Wcast-align -Wstrict-overflow=5 -Wswitch-enum -Wunreachable-code -Wredundant-decls -Wmissing-declarations -Wnull-dereference)
# Specify the source and header directories
include_directories(${PROJECT_SOURCE_DIR}/headers)
include_directories(/usr/local/include)
include_directories(/usr/include/opencv4)
# Find and include external libraries
find_package(OpenCV REQUIRED)
find_package(CURL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(PkgConfig REQUIRED)
# Find SQLite3 using pkg-config
pkg_check_modules(SQLITE3 REQUIRED sqlite3)
# Pigpio library (manual inclusion)
find_library(PIGPIO_LIB pigpio REQUIRED)
find_library(RT_LIB rt REQUIRED)
# ZXing library (assuming it is installed and can be found with -lZXing)
find_library(ZXING_LIB ZXing REQUIRED)
# Collect C++ source files
file(GLOB CPP_SOURCES
${PROJECT_SOURCE_DIR}/src/Components/*.cpp
${PROJECT_SOURCE_DIR}/src/App/*.cpp
${PROJECT_SOURCE_DIR}/src/StateManager/*.cpp
${PROJECT_SOURCE_DIR}/src/*.cpp
)
# Collect C source files
file(GLOB C_SOURCES ${PROJECT_SOURCE_DIR}/src/jsonxx.cc)
# Collect header files (if needed)
file(GLOB HEADERS
${PROJECT_SOURCE_DIR}/headers/Components/*.h
${PROJECT_SOURCE_DIR}/headers/*.h
)
# Add the executable
add_executable(main ${PROJECT_SOURCE_DIR}/main.cpp ${CPP_SOURCES} ${C_SOURCES})
# Link the external libraries to the executable
target_link_libraries(main PRIVATE
${SQLITE3_LIBRARIES}
${OpenCV_LIBS}
${CURL_LIBRARIES}
${PIGPIO_LIB}
${RT_LIB}
${ZXING_LIB}
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES}
ssl
crypto
brotlidec
pthread
)
# Specify include directories for the main target
target_include_directories(main PRIVATE
${PROJECT_SOURCE_DIR}/headers
${SQLITE3_INCLUDE_DIRS}
)