-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
139 lines (119 loc) · 4.47 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
cmake_minimum_required(VERSION 3.13)
project(UniversalFlightConnector VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 20)
find_package(PkgConfig REQUIRED)
pkg_check_modules(yamlcpp REQUIRED yaml-cpp)
pkg_check_modules(lua REQUIRED lua)
if(UNIX AND NOT APPLE)
pkg_check_modules(hidapi REQUIRED hidapi-libusb)
elseif(UNIX AND APPLE)
pkg_check_modules(hidapi REQUIRED hidapi)
else()
message(FATAL_ERROR "Unsupported platform")
endif()
# Optional dependencies, used for the PFD display
pkg_check_modules(libgeek libgeek)
pkg_check_modules(glm glm)
pkg_check_modules(sdl2 sdl2)
# Third Party Modules
add_subdirectory(luacpp/Source EXCLUDE_FROM_ALL)
set(DATADIR ${CMAKE_INSTALL_PREFIX}/share/ufc)
SET(FLAGS_COMMON "-Wall -Werror")
SET(CMAKE_CXX_FLAGS_DEBUG "${FLAGS_COMMON} -O0 -g -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer")
SET(CMAKE_CXX_FLAGS_RELEASE "${FLAGS_COMMON} -O3")
include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/luacpp/Source)
#add_definitions(-I/usr/local/include ${sdl2_CFLAGS} ${libgeek_CFLAGS} ${yamlcpp_CFLAGS} ${glm_CFLAGS} ${hidapi_CFLAGS})
add_definitions(-I/usr/local/include ${yamlcpp_CFLAGS} ${hidapi_CFLAGS} ${lua_CFLAGS})
add_library(ufc SHARED
src/libufc/aircraftstate.cpp
src/libufc/flightconnector.cpp
src/libufc/data.cpp
src/libufc/logger.cpp
src/libufc/datasources/simulator.cpp
src/libufc/datasources/simulator.h
src/libufc/datasources/xplane/xplane.cpp
src/libufc/datasources/xplane/xplane.h
src/libufc/datasources/xplane/xplaneclient.cpp
src/libufc/datasources/xplane/xplaneclient.h
src/libufc/devices/consoleoutput.cpp
src/libufc/devices/consoleoutput.h
src/libufc/devices/device.cpp
include/ufc/aircraftstate.h
include/ufc/datasource.h
include/ufc/device.h
include/ufc/flightconnector.h
include/ufc/logger.h
include/ufc/data.h
src/libufc/devices/arduinotest.cpp
src/libufc/devices/arduinotest.h
include/ufc/usbhiddevice.h
src/libufc/devices/usbhiddevice.cpp
src/libufc/devices/winwingfcu.cpp
src/libufc/devices/winwingfcu.h
src/libufc/datasources/xplane/datadefs.h
include/ufc/utils.h
src/libufc/utils.cpp
include/ufc/airports.h
src/libufc/airport.cpp
include/ufc/geoutils.h
src/libufc/geoutils.cpp
src/libufc/datasources/xplane/navdata/airports.cpp
src/libufc/datasources/xplane/navdata/navdata.cpp
src/libufc/devices/customradiohid.cpp
src/libufc/devices/customradiohid.h
)
if(UNIX AND APPLE)
target_link_options(ufc PUBLIC -all_load)
endif()
target_compile_definitions(ufc PUBLIC -DDATADIR=${DATADIR})
target_link_libraries(ufc
luacpp_static
${yamlcpp_LDFLAGS}
${hidapi_LDFLAGS}
${lua_LDFLAGS}
)
install(TARGETS ufc DESTINATION lib)
add_executable(ufctool src/ufctool/main.cpp)
target_link_libraries(ufctool
-Wl,-rpath -Wl,/usr/local/lib
-L/usr/local/lib
ufc
)
if (${libgeek_FOUND})
add_executable(xpfd
src/pfd/main.cpp
src/pfd/display.cpp
src/pfd/display.h
src/pfd/gfxutils.cpp
src/pfd/gfxutils.h
src/pfd/widgets/adi.cpp
src/pfd/widgets/adi.h
src/pfd/widgets/speedindicator.cpp
src/pfd/widgets/speedindicator.h
src/pfd/widgets/altitudeindicator.cpp
src/pfd/widgets/altitudeindicator.h
src/pfd/widgets/headingindicator.cpp
src/pfd/widgets/headingindicator.h
src/pfd/widgets/widget.h
)
target_include_directories(xpfd PUBLIC ${CMAKE_SOURCE_DIR}/src)
target_compile_options(xpfd PUBLIC ${libgeek_CFLAGS} ${sdl2_CFLAGS})
target_link_libraries(xpfd
-Wl,-rpath -Wl,/usr/local/lib
-L/usr/local/lib
-lbrick
ufc
${libgeek_LDFLAGS}
${sdl2_LDFLAGS}
${yamlcpp_LDFLAGS}
${glm_LDFLAGS}
${hidapi_LDFLAGS}
)
endif()
install(DIRECTORY include/ufc DESTINATION include FILES_MATCHING PATTERN "*.h" )
set(PKGCONFIG_CFLAGS_LIST -I${CMAKE_INSTALL_PREFIX}/include ${yamlcpp_CFLAGS} ${hidapi_CFLAGS})
string(REPLACE ";" " " PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS_LIST}")
set(PKGCONFIG_LDFLAGS_LIST -L${CMAKE_INSTALL_PREFIX}/lib -lufc ${yamlcpp_LDFLAGS} ${hidapi_LDFLAGS})
string(REPLACE ";" " " PKGCONFIG_LDFLAGS "${PKGCONFIG_LDFLAGS_LIST}")
configure_file(libufc.pc.in libufc.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/libufc.pc DESTINATION "lib${LIB_SUFFIX}/pkgconfig")