2022-09-02 19:41:26 +02:00

147 lines
4.0 KiB
CMake

#For TLS
#target_compile_definitions(WebSocketServerXPlane PUBLIC
#IXWEBSOCKET_USE_TLS
#IXWEBSOCKET_USE_OPEN_SSL
#)
#Link to ssl(requires OpenSLL for macOS and Windows)
file(GLOB websocket CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/websocket/*.cpp)
file(GLOB file CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/file/*.cpp)
add_library(germanairlinesva_xplugin SHARED
${websocket}
${file}
makeRwysXP.cpp
main.cpp
)
target_include_directories(germanairlinesva_xplugin PRIVATE
${CMAKE_SOURCE_DIR}/ixwebsocket/include
${CMAKE_SOURCE_DIR}/websocket/include
${CMAKE_SOURCE_DIR}/XPSDK/CHeaders
${CMAKE_SOURCE_DIR}/nlohmann
${CMAKE_SOURCE_DIR}/file
)
set_target_properties(germanairlinesva_xplugin PROPERTIES
PREFIX ""
SUFFIX ".xpl"
)
target_compile_definitions(germanairlinesva_xplugin PRIVATE
XPLM200
XPLM210
_USE_MATH_DEFINES
)
target_compile_options(germanairlinesva_xplugin PRIVATE
-Wall
-Wextra
-pedantic
-fvisibility=hidden
)
if(DEBUG)
target_compile_options(germanairlinesva_xplugin PRIVATE
-g
)
target_link_options(germanairlinesva_xplugin PRIVATE
-g
)
else()
target_compile_options(germanairlinesva_xplugin PRIVATE
-O2
)
endif()
if(APPLE)
message("Building for MacOSX Universal into ${PROJECT_BINARY_DIR}/${PLUGIN_NAME}/${BIT}")
set_target_properties(germanairlinesva_xplugin PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}
INSTALL_RPATH "@loader_path"
OUTPUT_NAME mac
)
target_compile_definitions(germanairlinesva_xplugin PUBLIC
APL
)
target_compile_options(germanairlinesva_xplugin PRIVATE
#"SHELL:-arch i386"
"SHELL:-arch x86_64"
)
target_link_options(germanairlinesva_xplugin PRIVATE
#"SHELL:-arch i386"
"SHELL:-arch x86_64"
)
target_link_libraries(germanairlinesva_xplugin PRIVATE
${CMAKE_SOURCE_DIR}/XPSDK/Libraries/Mac/XPLM.framework/XPLM
ixwebsocket
)
elseif(UNIX)
message("Building for Linux ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
set_target_properties(germanairlinesva_xplugin PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}
INSTALL_RPATH "\$ORIGIN"
OUTPUT_NAME lin
)
target_compile_definitions(germanairlinesva_xplugin PUBLIC
LIN
)
target_compile_options(germanairlinesva_xplugin PRIVATE
-nodefaultlibs
)
if(BIT STREQUAL "32")
target_compile_options(germanairlinesva_xplugin PRIVATE
-m32
)
target_link_options(germanairlinesva_xplugin PRIVATE
-m32
)
endif()
target_link_libraries(germanairlinesva_xplugin PRIVATE
crypto
pthread
ixwebsocket
)
elseif(WIN32)
message("Building for Windows ${BIT} into ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}")
set_target_properties(germanairlinesva_xplugin PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Plugin/${PLUGIN_NAME}/${BIT}
OUTPUT_NAME win
)
target_compile_definitions(germanairlinesva_xplugin PUBLIC
IBM
)
if(DEBUG)
target_compile_options(germanairlinesva_xplugin PRIVATE
-gcodeview
)
target_link_options(germanairlinesva_xplugin PRIVATE
-Wl,-pdb=
)
endif()
target_link_options(germanairlinesva_xplugin PRIVATE
-static
-static-libgcc
-static-libstdc++
)
target_link_libraries(germanairlinesva_xplugin PRIVATE
ws2_32.lib
ixwebsocket
)
if(BIT STREQUAL "32")
target_link_libraries(germanairlinesva_xplugin PRIVATE
${CMAKE_SOURCE_DIR}/XPSDK/Libraries/Win/XPLM.lib
)
else()
target_link_libraries(germanairlinesva_xplugin PRIVATE
${CMAKE_SOURCE_DIR}/XPSDK/Libraries/Win/XPLM_64.lib
)
endif()
target_sources(germanairlinesva_xplugin PRIVATE
xPluginWin.cpp
)
endif()