-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
93 lines (73 loc) · 2.95 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
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)
if (WIN32)
# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
endif()
project(InfraredBrickTower)
## Find dependencies
find_package(glfw3 REQUIRED)
# Use cmake -S . -B build/ -DOpenGL_GL_PREFERENCE=GLVND
# to skip legacy OpenGL library
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)
find_package(imgui REQUIRED)
find_package(PkgConfig REQUIRED)
IF (WIN32)
else()
pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0)
endif()
add_subdirectory(IBTController)
add_subdirectory(ConsoleTester)
add_subdirectory(Common)
add_subdirectory(PBrickLogic)
add_subdirectory(TowerLogic)
include_directories("${CMAKE_SOURCE_DIR}/Common")
include_directories("${CMAKE_SOURCE_DIR}/PBrickLogic")
include_directories("${CMAKE_SOURCE_DIR}/TowerLogic")
include_directories("${CMAKE_SOURCE_DIR}/lib/imgui_filebrowser/imgui-filebrowser")
add_executable(
InfraredBrickTower
IBTController/IBTController.cpp
IBTController/ControllerUI.h
IBTController/ControllerUI.cpp)
add_executable(
IBTConsole
ConsoleTester/ConsoleTester.cpp)
target_link_libraries(InfraredBrickTower PRIVATE imgui::imgui)
if (WIN32)
add_library(winusb STATIC IMPORTED)
set_target_properties(winusb PROPERTIES
IMPORTED_LOCATION "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64/winusb.lib"
INTERFACE_INCLUDE_DIRECTORIES "C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um"
)
add_library(cfgmgr32 STATIC IMPORTED)
set_target_properties(cfgmgr32 PROPERTIES
IMPORTED_LOCATION "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64/cfgmgr32.lib"
INTERFACE_INCLUDE_DIRECTORIES "C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um"
)
endif()
target_link_libraries(InfraredBrickTower PRIVATE glfw)
target_link_libraries(InfraredBrickTower PRIVATE Common)
target_link_libraries(InfraredBrickTower PRIVATE TowerLogic)
target_link_libraries(InfraredBrickTower PRIVATE PBrickLogic)
target_link_libraries(IBTConsole PRIVATE Common)
target_link_libraries(IBTConsole PRIVATE TowerLogic)
target_link_libraries(IBTConsole PRIVATE PBrickLogic)
if (WIN32)
target_link_libraries(InfraredBrickTower PRIVATE winusb)
target_link_libraries(InfraredBrickTower PRIVATE cfgmgr32)
target_link_libraries(InfraredBrickTower PRIVATE opengl32.lib)
target_link_libraries(IBTConsole PRIVATE winusb)
target_link_libraries(IBTConsole PRIVATE cfgmgr32)
else()
target_link_libraries(InfraredBrickTower PRIVATE PkgConfig::libusb)
target_link_libraries(InfraredBrickTower PRIVATE OpenGL)
target_link_libraries(IBTConsole PRIVATE PkgConfig::libusb)
endif()