-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
59 lines (51 loc) · 2.1 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
cmake_minimum_required(VERSION 3.16)
project(ScreenFramer VERSION 1.2.2)
# dependencies
find_package(OpenCV 4 REQUIRED)
find_package(cxxopts 2 REQUIRED)
find_package(nlohmann_json 3.8 REQUIRED)
# compilation options
set(CMAKE_CXX_STANDARD 17)
add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-pedantic)
# configiration
set(SF_BINARY_NAME "screenframer")
set(SF_BINARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
set(SF_DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/${SF_BINARY_NAME}")
set(SF_TEMPLATES_INSTALL_DIR "${SF_DATA_INSTALL_DIR}/devices")
# definitions
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_compile_definitions(DEBUG)
add_compile_definitions(RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/Resources")
else()
add_compile_definitions(RELEASE)
add_compile_definitions(RESOURCES_PATH="${SF_TEMPLATES_INSTALL_DIR}")
message(STATUS "Resource dir: ${SF_TEMPLATES_INSTALL_DIR}")
endif()
add_compile_definitions(VERSION_NUMBER="${PROJECT_VERSION}")
# libscreenframer
set(ScreenFramerLib_SOURCES
Sources/Overlayer.cpp
Sources/OverlayTask.cpp
Sources/OutputConfig.cpp)
add_library(ScreenFramerLib STATIC ${ScreenFramerLib_SOURCES})
target_link_libraries(ScreenFramerLib ${OpenCV_LIBS})
set_target_properties(ScreenFramerLib PROPERTIES OUTPUT_NAME screenframer)
# screenframer exec
set(ScreenFramer_SOURCES
Sources/main.cpp
Sources/Utility.cpp)
add_executable(ScreenFramer ${ScreenFramer_SOURCES})
target_link_libraries(ScreenFramer ScreenFramerLib)
target_link_libraries(ScreenFramer ${OpenCV_LIBS})
target_link_libraries(ScreenFramer cxxopts::cxxopts)
target_link_libraries(ScreenFramer nlohmann_json::nlohmann_json)
target_include_directories(ScreenFramer PRIVATE ./Dependencies/cpptqdm)
target_include_directories(ScreenFramer PRIVATE ./Sources)
set_target_properties(ScreenFramer PROPERTIES OUTPUT_NAME ${SF_BINARY_NAME})
# test
add_subdirectory(Test)
# installation
install(TARGETS ScreenFramer DESTINATION ${SF_BINARY_INSTALL_DIR})
install(DIRECTORY Resources/ CONFIGURATIONS Release DESTINATION ${SF_TEMPLATES_INSTALL_DIR} PATTERN "Resources/*")