forked from CTCaer/jc_toolkit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
94 lines (81 loc) · 1.77 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
94
set(P JCToolKit)
project(${P})
set(CMAKE_CXX_STANDARD 17)
if(UNIX AND NOT APPLE) # Linux
set(LINUX TRUE)
endif()
if(WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:msvcrt.lib")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL$<$<CONFIG:Debug>:Debug>")
endif()
###########################
# We will be using hidapi #
###########################
# Find the proper hidapi source file for use on the target platform.
if (WIN32)
set(HIDAPI_SOURCE ${SOURCES}
hidapi/windows/hid.c)
elseif(LINUX)
set(HIDAPI_SOURCE ${SOURCES}
hidapi/linux/hid.c)
endif()
add_library(hidapi STATIC
${HIDAPI_SOURCE}
)
target_include_directories(hidapi PRIVATE
hidapi/hidapi
)
if(WIN32)
target_link_libraries(hidapi
setupapi
)
endif()
add_compile_options(
-D__jctool_disable_legacy_ui__
)
set(SOURCES
jctool/jctool.cpp
jctool/jctool_input.cpp
jctool/jctool_irsensor.cpp
jctool/jctool_leds.cpp
jctool/jctool_mcu.cpp
jctool/jctool_nfc.cpp
jctool/jctool_rumble.cpp
jctool/IRSensor.cpp
jctool/session/controller_session.cpp
jctool/com-builder/com_builder.cpp
)
if (JCTOOL_NO_UI)
add_compile_options(-D__jctool_no_UI__)
add_library(${P}
${SOURCES}
)
else()
add_subdirectory(easy-imgui)
add_executable(${P}
${SOURCES}
jctool/com-builder/com_builder_ui.cpp
jctool/jctool_ui.cpp
)
target_link_libraries(${P}
easy-imgui
)
endif()
# Link JCToolkit with hidapi.
target_link_libraries(${P}
hidapi
)
if(LINUX)
target_link_libraries(${P}
udev
pthread
)
endif()
target_include_directories(${P} PRIVATE
./
jctool
jctool/include
easy-imgui/imgui
easy-imgui/tools
hidapi/hidapi
)