-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
62 lines (45 loc) · 1.86 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
cmake_minimum_required(VERSION 3.12)
# Build system configuration
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED 11)
# Project configuration
project(XSharedCockpit)
set(XSharedCockpit_VERSION 1.3.0)
# Plugin configuration
file(GLOB_RECURSE PLUGIN_SRC "plugin.cpp")
add_library(plugin SHARED ${PLUGIN_SRC})
set_target_properties(plugin PROPERTIES OUTPUT_NAME "XSharedCockpit")
set_target_properties(plugin PROPERTIES SUFFIX ".xpl")
set_target_properties(plugin PROPERTIES PREFIX "")
# XSDK configuration
set(XSDK_DIR CACHE PATH "Path to the X-Plane SDK")
set(XSDK_LIBRARIES "${XSDK_DIR}/Libraries")
set(XSDK_INCLUDE "${XSDK_DIR}/CHeaders")
add_definitions(-DXPLM200 -DXPLM210 -DXPLM300 -DXPLM301)
# OS-Specifics
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(SYSTEM_NAME "mac_x64")
add_definitions(-DAPL=1)
set(XSDK_LIBRARIES "-F ${XSDK_LIBRARIES}/Mac -framework XPLM -framework XPWidgets")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(SYSTEM_NAME "lin_x64")
add_definitions(-DLIN=1)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++ -shared -fvisibility=hidden -rdynamic -nodefaultlibs -Wl,--warn-unresolved-symbols")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(SYSTEM_NAME "win_x64")
add_definitions(-DIBM=1)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
target_link_directories(plugin PRIVATE "${XSDK_LIBRARIES}/Win/")
set(XSDK_LIBRARIES "-lXPLM_64 -lXPWidgets_64 -lws2_32")
endif()
target_link_libraries(plugin ${XSDK_LIBRARIES})
# Modules
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED)
# Headers
target_include_directories(plugin PUBLIC "${XSDK_INCLUDE}/XPLM")
target_include_directories(plugin PUBLIC "${XSDK_INCLUDE}/XPWidgets")
target_include_directories(plugin PUBLIC ${Boost_INCLUDE_DIRS})
install(TARGETS plugin DESTINATION "XSharedCockpit/${SYSTEM_NAME}")