From e2fc3fe340e8852e3ec38765cb86d7187025be3f Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Sun, 22 Jun 2025 19:45:49 +0200 Subject: [PATCH] feat: Use conan for dependency management --- .github/workflows/build.yml | 49 ++++- .gitmodules | 3 - CMakeLists.txt | 22 ++- CMakePresets.json | 3 + ci/profile_linux | 11 ++ ci/profile_mac | 11 ++ ci/profile_win | 15 ++ cmake/dbus/CMakeLists.txt | 35 +--- cmake/event/CMakeLists.txt | 32 ---- cmake/install.cmake | 178 +++++++++++++++++- cmake/modules/FindVATSIMAuth.cmake | 62 ++++++ cmake/modules/FindXPSDK.cmake | 52 +++++ cmake/opus/CMakeLists.txt | 32 ---- cmake/sodium/CMakeLists.txt | 34 ---- cmake/vatsimauth/CMakeLists.txt | 28 --- cmake/xp/CMakeLists.txt | 28 --- conanfile.py | 41 ++++ installer/installbuilder/project.xml | 9 - installer/installbuilder/swift-externals.xml | 39 +++- src/core/CMakeLists.txt | 5 +- .../simulator/flightgear/CMakeLists.txt | 2 +- src/plugins/simulator/xplane/CMakeLists.txt | 2 +- src/sound/CMakeLists.txt | 2 +- src/xswiftbus/CMakeLists.txt | 45 ++--- src/xswiftbus/xplanemp2 | 2 +- third_party/CMakeLists.txt | 1 - third_party/nlohmann_json | 1 - 27 files changed, 488 insertions(+), 256 deletions(-) create mode 100644 ci/profile_linux create mode 100644 ci/profile_mac create mode 100644 ci/profile_win delete mode 100644 cmake/event/CMakeLists.txt create mode 100644 cmake/modules/FindVATSIMAuth.cmake create mode 100644 cmake/modules/FindXPSDK.cmake delete mode 100644 cmake/opus/CMakeLists.txt delete mode 100644 cmake/sodium/CMakeLists.txt delete mode 100644 cmake/vatsimauth/CMakeLists.txt delete mode 100644 cmake/xp/CMakeLists.txt create mode 100644 conanfile.py delete mode 160000 third_party/nlohmann_json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd9306d2d..97916f17b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ env: bitrock_version: qt-professional-24.7.0 bitrock_url: https://releases.installbuilder.com/installbuilder externals: swift-project/externals - externals_sha: e67552f92d6b5ba49aa3f1f4ebae6de51192c34e + externals_sha: dfe49bbeb8f0ca664afa293ad3f454cffe751acf use_externals: ${{ secrets.EXTERNALS_PAT != '' }} jobs: @@ -131,8 +131,8 @@ jobs: BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }} - name: Install dependencies run: | - sudo apt-get -y install dbus-x11 libglu1-mesa-dev libopus-dev libsodium-dev libpulse-dev libdbus-1-dev libevent-dev libpng-dev ninja-build - pip3 install requests + sudo apt-get -y install dbus-x11 libglu1-mesa-dev libpulse-dev libdbus-1-dev ninja-build + pip3 install requests conan - name: Checkout repository uses: actions/checkout@v4 with: @@ -148,6 +148,17 @@ jobs: ref: ${{ env.externals_sha }} token: ${{ env.EXTERNALS_PAT }} path: 'third_party/externals' + - name: Install conan dependencies + shell: bash + env: + ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} + ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} + run: | + conan profile detect + conan remote disable conancenter + conan remote add swift https://artifactory.swift-project.org/artifactory/api/conan/conan-local + conan remote login swift "$ARTIFACTORY_USER" --password "$ARTIFACTORY_TOKEN" + conan install . --output-folder=build_conan --deployer=full_deploy -pr=ci/profile_linux - name: Start DBus session bus run: | dbus-launch --sh-syntax | tee session.sh @@ -235,7 +246,7 @@ jobs: BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }} - name: Install dependencies run: | - pip install requests PyInstaller + pip install requests PyInstaller conan - name: Checkout repository uses: actions/checkout@v4 with: @@ -251,6 +262,17 @@ jobs: ref: ${{ env.externals_sha }} token: ${{ env.EXTERNALS_PAT }} path: 'third_party/externals' + - name: Install conan dependencies + shell: bash + env: + ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} + ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} + run: | + conan profile detect + conan remote disable conancenter + conan remote add swift https://artifactory.swift-project.org/artifactory/api/conan/conan-local + conan remote login swift "$ARTIFACTORY_USER" --password "$ARTIFACTORY_TOKEN" + conan install . --output-folder=build_conan --deployer=full_deploy -pr=ci/profile_win - name: Create Vatsim key file if: ${{ env.do_vatsim_key == 'true' }} run: | @@ -263,12 +285,14 @@ jobs: - uses: Trass3r/setup-cpp@1b63900ecf3f0b7c60ee53aa7be122f2c4fe7a2c - name: Build swift (without symbols) if: ${{ env.do_symbols != 'true' }} + shell: cmd run: | - python -u scripts/build.py -w 64 -t msvc + build_conan\\build\\RelWithDebInfo\\generators\\conanrun.bat && python -u scripts/build.py -w 64 -t msvc - name: Build swift (with symbols) if: ${{ env.do_symbols == 'true' }} + shell: cmd run: | - python -u scripts/build.py -w 64 -t msvc --upload-symbols + build_conan\\build\\RelWithDebInfo\\generators\\conanrun.bat && python -u scripts/build.py -w 64 -t msvc --upload-symbols - name: Upload installer uses: actions/upload-artifact@v4 with: @@ -328,7 +352,7 @@ jobs: BITROCK_LICENSE: ${{ secrets.BITROCK_LICENSE }} - name: Install dependencies run: | - pip3 install requests + pip3 install requests conan - name: Checkout repository uses: actions/checkout@v4 with: @@ -344,6 +368,17 @@ jobs: ref: ${{ env.externals_sha }} token: ${{ env.EXTERNALS_PAT }} path: 'third_party/externals' + - name: Install conan dependencies + shell: bash + env: + ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} + ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} + run: | + conan profile detect + conan remote disable conancenter + conan remote add swift https://artifactory.swift-project.org/artifactory/api/conan/conan-local + conan remote login swift "$ARTIFACTORY_USER" --password "$ARTIFACTORY_TOKEN" + conan install . --output-folder=build_conan --deployer=full_deploy -pr=ci/profile_mac - name: Create Vatsim key file if: ${{ env.do_vatsim_key == 'true' }} run: | diff --git a/.gitmodules b/.gitmodules index a7d9da3b2..2e9321b3b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,3 @@ [submodule "third_party/msgpack"] path = third_party/msgpack url = https://github.com/msgpack/msgpack-c.git -[submodule "third_party/nlohmann_json"] - path = third_party/nlohmann_json - url = https://github.com/nlohmann/json.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 685610114..87f2ddcaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,8 @@ if(APPLE) list(APPEND SWIFT_LANGUAGES OBJC OBJCXX) endif() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") + project(swift LANGUAGES ${SWIFT_LANGUAGES}) include(cmake/tools.cmake) @@ -88,6 +90,18 @@ endif() # Find dependencies find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Multimedia Network OpenGL Concurrent Xml Qml Widgets Svg Test) +find_package(Opus REQUIRED) +find_package(libsodium REQUIRED) +find_package(nlohmann_json REQUIRED) +if(UNIX AND NOT APPLE) + add_subdirectory(cmake/dbus) +else() + find_package(DBus1 REQUIRED) +endif() + +if(SWIFT_VATSIM_SUPPORT) + find_package(VATSIMAuth REQUIRED) +endif() # Global compiler options if(MSVC) @@ -136,17 +150,13 @@ if(MSVC) endif() # Add external folders -add_subdirectory(cmake/vatsimauth) -add_subdirectory(cmake/dbus) -add_subdirectory(cmake/sodium) -add_subdirectory(cmake/opus) add_subdirectory(cmake/simconnect) add_subdirectory(third_party) if(SWIFT_BUILD_XSWIFTBUS) - add_subdirectory(cmake/xp) - add_subdirectory(cmake/event) + find_package(XPSDK REQUIRED) + find_package(Libevent REQUIRED) endif() # Add source folders diff --git a/CMakePresets.json b/CMakePresets.json index c08ecf203..07d36e305 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -4,11 +4,14 @@ { "name": "ci-base", "hidden": true, + "toolchainFile": "build_conan/build/RelWithDebInfo/generators/conan_toolchain.cmake", "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo", "SWIFT_MINIFY_DEBUG_SYMBOLS": "ON", "SWIFT_USE_CRASHPAD": "OFF", "SWIFT_BUILD_SAMPLES": "OFF", + "VATSIM_AUTH_PATH": "${sourceDir}/third_party/externals", + "XP_SDK_PATH": "${sourceDir}/third_party/externals/XPLM/SDK", "VATSIM_KEY_JSON": "vatsim.json", "CMAKE_INSTALL_PREFIX": "${sourceDir}/dist" } diff --git a/ci/profile_linux b/ci/profile_linux new file mode 100644 index 000000000..7e5f94f0d --- /dev/null +++ b/ci/profile_linux @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors +# SPDX-License-Identifier: CC0-1.0 + +[settings] +arch=x86_64 +build_type=RelWithDebInfo +compiler=gcc +compiler.cppstd=gnu17 +compiler.libcxx=libstdc++11 +compiler.version=11 +os=Linux diff --git a/ci/profile_mac b/ci/profile_mac new file mode 100644 index 000000000..1df818604 --- /dev/null +++ b/ci/profile_mac @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors +# SPDX-License-Identifier: CC0-1.0 + +[settings] +arch=x86_64 +build_type=RelWithDebInfo +compiler=apple-clang +compiler.cppstd=gnu17 +compiler.libcxx=libc++ +compiler.version=15 +os=Macos diff --git a/ci/profile_win b/ci/profile_win new file mode 100644 index 000000000..737e181f7 --- /dev/null +++ b/ci/profile_win @@ -0,0 +1,15 @@ +# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors +# SPDX-License-Identifier: CC0-1.0 + +[settings] +arch=x86_64 +build_type=RelWithDebInfo +compiler=msvc +compiler.cppstd=17 +compiler.runtime=dynamic +compiler.version=194 +os=Windows + +# Force Ninja generator +[conf] +tools.cmake.cmaketoolchain:generator=Ninja diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt index 48cb3d02e..aa9cfbc71 100644 --- a/cmake/dbus/CMakeLists.txt +++ b/cmake/dbus/CMakeLists.txt @@ -1,39 +1,12 @@ # SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors # SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 -add_library(externals_dbus SHARED IMPORTED GLOBAL) - -if(UNIX AND NOT APPLE) +if (UNIX AND NOT APPLE) + add_library(externals_dbus SHARED IMPORTED GLOBAL) find_package(PkgConfig REQUIRED) pkg_search_module(DBUS REQUIRED dbus-1) target_include_directories(externals_dbus INTERFACE ${DBUS_INCLUDE_DIRS}) set_target_properties(externals_dbus PROPERTIES IMPORTED_LOCATION ${DBUS_LINK_LIBRARIES}) -elseif(SWIFT_WIN32) - target_include_directories(externals_dbus INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/common/include) - target_include_directories(externals_dbus INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/include) - - set_target_properties(externals_dbus PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/dbus-1.lib) - set_target_properties(externals_dbus PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/dbus-1-3.dll) - install(IMPORTED_RUNTIME_ARTIFACTS externals_dbus DESTINATION xswiftbus/64) - install(IMPORTED_RUNTIME_ARTIFACTS externals_dbus DESTINATION bin) - install(FILES ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/bin/dbus-daemon.exe DESTINATION bin) -elseif(SWIFT_WIN64) - target_include_directories(externals_dbus INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/common/include) - target_include_directories(externals_dbus INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/include) - - set_target_properties(externals_dbus PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/dbus-1.lib) - set_target_properties(externals_dbus PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/dbus-1-3.dll) - install(IMPORTED_RUNTIME_ARTIFACTS externals_dbus DESTINATION xswiftbus/64) - install(IMPORTED_RUNTIME_ARTIFACTS externals_dbus DESTINATION bin) - install(FILES ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/bin/dbus-daemon.exe DESTINATION bin) -elseif(APPLE) - target_include_directories(externals_dbus INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/common/include) - target_include_directories(externals_dbus INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/include/) - - set_target_properties(externals_dbus PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/lib/libdbus-1.3.dylib) - install(IMPORTED_RUNTIME_ARTIFACTS externals_dbus DESTINATION xswiftbus/64 PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) - install(IMPORTED_RUNTIME_ARTIFACTS externals_dbus DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) - install(FILES ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/bin/dbus-daemon DESTINATION bin) - install(FILES ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/bin/dbus-uuidgen DESTINATION bin) -endif() + add_library(dbus-1 ALIAS externals_dbus) +endif () diff --git a/cmake/event/CMakeLists.txt b/cmake/event/CMakeLists.txt deleted file mode 100644 index 2cc386941..000000000 --- a/cmake/event/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors -# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -add_library(externals_event SHARED IMPORTED GLOBAL) - -target_include_directories(externals_event INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/common/include) - -if(SWIFT_WIN64) - target_include_directories(externals_event INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/include) - - set_target_properties(externals_event PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/event_core.lib) - set_target_properties(externals_event PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/event_core.dll) -elseif(APPLE) - target_include_directories(externals_event INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/include) - set_target_properties(externals_event PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/lib/libevent_core.2.1.8.dylib) -else() - find_package(PkgConfig REQUIRED) - pkg_search_module(libevent_core REQUIRED libevent_core) - - # Adapted from CMake file() documentation to resolve symbolic link - file(READ_SYMLINK ${libevent_core_LINK_LIBRARIES} LIBEVENT_CORE_ABS) - if(NOT IS_ABSOLUTE "${LIBEVENT_CORE_ABS}") - get_filename_component(dir "${libevent_core_LINK_LIBRARIES}" DIRECTORY) - set(LIBEVENT_CORE_ABS "${dir}/${LIBEVENT_CORE_ABS}") - endif() - - string(REGEX MATCH "libevent_core-2.1.so.[1-9]+" SOMAJOR_VERSION ${LIBEVENT_CORE_ABS}) - set_target_properties(externals_event PROPERTIES IMPORTED_SONAME ${SOMAJOR_VERSION}) - set_target_properties(externals_event PROPERTIES IMPORTED_LOCATION ${LIBEVENT_CORE_ABS}) -endif() - -install(IMPORTED_RUNTIME_ARTIFACTS externals_event DESTINATION xswiftbus/64 PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) diff --git a/cmake/install.cmake b/cmake/install.cmake index 059ced856..bea0fc40e 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -28,11 +28,6 @@ elseif(APPLE) endif() install(PROGRAMS ${crashpad_handler_path} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -# create_dbus_machineid -if(APPLE) - install(FILES ${swift_SOURCE_DIR}/third_party/externals/macx-clang/64/bin/create_dbus_machineid.scpt DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -endif() - # Deploy qt libs # Workaround to get Qt paths for deployment (until switching to Qt6 deployment tool) @@ -128,3 +123,176 @@ elseif(APPLE) install(DIRECTORY ${QT_INSTALL_PLUGINS}/tls DESTINATION bin FILES_MATCHING PATTERN "*.dylib") endif() + +macro(CheckPathExists PATH LIBS) + foreach (LIB IN LISTS LIBS) + if (NOT EXISTS ${PATH}/${LIB}) + message(WARNING "Expected deploy directory ${PATH}/${LIB} not found. Installation will not work!") + endif () + endforeach () +endmacro() + +set(SWIFT_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) +if(SWIFT_SYSTEM_PROCESSOR STREQUAL "AMD64") + set(SWIFT_SYSTEM_PROCESSOR "x86_64") +endif() + +set(CONAN_DEPLOY_DIR ${PROJECT_SOURCE_DIR}/build_conan/full_deploy/host) +set(OPUS_PATH ${CONAN_DEPLOY_DIR}/opus/1.3.1/${CMAKE_BUILD_TYPE}/${SWIFT_SYSTEM_PROCESSOR}) +set(EVENT_PATH ${CONAN_DEPLOY_DIR}/libevent/2.1.12/${CMAKE_BUILD_TYPE}/${SWIFT_SYSTEM_PROCESSOR}) +set(SODIUM_PATH ${CONAN_DEPLOY_DIR}/libsodium/1.0.18/${CMAKE_BUILD_TYPE}/${SWIFT_SYSTEM_PROCESSOR}) +set(DBUS_PATH ${CONAN_DEPLOY_DIR}/dbus/1.15.8/${CMAKE_BUILD_TYPE}/${SWIFT_SYSTEM_PROCESSOR}) +set(EXPAT_PATH ${CONAN_DEPLOY_DIR}/expat/2.7.1/${CMAKE_BUILD_TYPE}/${SWIFT_SYSTEM_PROCESSOR}) +set(NLOHMANN_JSON_PATH ${CONAN_DEPLOY_DIR}/nlohmann_json/3.11.3) + +CheckPathExists(${SODIUM_PATH} licenses/LICENSE) +install(FILES ${SODIUM_PATH}/licenses/LICENSE DESTINATION licenses RENAME LICENSE.LIBSODIUM.txt) + +CheckPathExists(${OPUS_PATH} licenses/COPYING) +install(FILES ${OPUS_PATH}/licenses/COPYING DESTINATION licenses RENAME COPYING.OPUS.txt) + +# xswiftbus licenses +if(SWIFT_BUILD_XSWIFTBUS) + CheckPathExists(${PROJECT_SOURCE_DIR} LICENSES/GPL-3.0-or-later.txt) + CheckPathExists(${PROJECT_SOURCE_DIR} LICENSES/LicenseRef-swift-pilot-client-1.txt) + install(FILES ${PROJECT_SOURCE_DIR}/LICENSES/GPL-3.0-or-later.txt DESTINATION xswiftbus/licenses RENAME LICENSE.XSWIFTBUS.GPL-3.0-or-later.txt) + install(FILES ${PROJECT_SOURCE_DIR}/LICENSES/LicenseRef-swift-pilot-client-1.txt DESTINATION xswiftbus/licenses RENAME LICENSE.XSWIFTBUS.LicenseRef-swift-pilot-client-1.txt.txt) + + CheckPathExists(${EVENT_PATH} licenses/LICENSE) + install(FILES ${EVENT_PATH}/licenses/LICENSE DESTINATION xswiftbus/licenses RENAME LICENSE.LIBEVENT.txt) + + CheckPathExists(${NLOHMANN_JSON_PATH} licenses/LICENSE.MIT) + install(FILES ${NLOHMANN_JSON_PATH}/licenses/LICENSE.MIT DESTINATION xswiftbus/licenses RENAME LICENSE.NLOHMANN_JSON.txt) + + if(APPLE OR WIN32) + CheckPathExists(${DBUS_PATH} licenses/COPYING) + install(FILES ${DBUS_PATH}/licenses/COPYING DESTINATION xswiftbus/licenses RENAME LICENSE.DBUS.txt) + install(FILES ${DBUS_PATH}/licenses/AFL-2.1.txt DESTINATION xswiftbus/licenses RENAME LICENSE.DBUS.AFL-2.1.txt) + install(FILES ${DBUS_PATH}/licenses/GPL-2.0-or-later.txt DESTINATION xswiftbus/licenses RENAME LICENSE.DBUS.GPL-2.0-or-later.txt) + + CheckPathExists(${EXPAT_PATH} licenses/COPYING) + install(FILES ${EXPAT_PATH}/licenses/COPYING DESTINATION xswiftbus/licenses RENAME LICENSE.EXPAT.txt) + endif() + + string(REPLACE "\\" "/" XP_SDK_PATH_ESCAPED "${XP_SDK_PATH}") + CheckPathExists(${XP_SDK_PATH_ESCAPED} license.txt) + install(FILES ${XP_SDK_PATH_ESCAPED}/license.txt DESTINATION xswiftbus/licenses RENAME LICENSE.XPSDK.txt) + + CheckPathExists(${PROJECT_SOURCE_DIR}/src/xswiftbus/xplanemp2 LICENSE.md) + install(FILES ${PROJECT_SOURCE_DIR}/src/xswiftbus/xplanemp2/LICENSE.md DESTINATION xswiftbus/licenses RENAME LICENSE.XPLANEMP2.txt) +endif() + +# dbus licenses +if(APPLE OR WIN32) + CheckPathExists(${DBUS_PATH} licenses/COPYING) + install(FILES ${DBUS_PATH}/licenses/COPYING DESTINATION licenses RENAME LICENSE.DBUS.txt) + install(FILES ${DBUS_PATH}/licenses/AFL-2.1.txt DESTINATION licenses RENAME LICENSE.DBUS.AFL-2.1.txt) + install(FILES ${DBUS_PATH}/licenses/GPL-2.0-or-later.txt DESTINATION licenses RENAME LICENSE.DBUS.GPL-2.0-or-later.txt) +endif() + +if (UNIX AND NOT APPLE) + # Opus + set(OPUS_LIBS libopus.so.0.8.0 libopus.so.0 libopus.so) + CheckPathExists(${OPUS_PATH}/lib ${OPUS_LIBS}) + foreach (LIB IN LISTS OPUS_LIBS) + install(FILES ${OPUS_PATH}/lib/${LIB} DESTINATION lib) + endforeach () + + # sodium + set(SODIUM_LIBS libsodium.so.23.3.0 libsodium.so.23 libsodium.so) + CheckPathExists(${SODIUM_PATH}/lib ${SODIUM_LIBS}) + foreach (LIB IN LISTS SODIUM_LIBS) + install(FILES ${SODIUM_PATH}/lib/${LIB} DESTINATION lib) + endforeach () + + # libevent + if(SWIFT_BUILD_XSWIFTBUS) + set(EVENT_LIBS + libevent_core-2.1.so.7.0.1 + libevent_core-2.1.so.7 + libevent_core-2.1.so + libevent_core.so + ) + CheckPathExists(${EVENT_PATH}/lib ${EVENT_LIBS}) + foreach (LIB IN LISTS EVENT_LIBS) + install(FILES ${EVENT_PATH}/lib/${LIB} DESTINATION xswiftbus/64) + endforeach () + endif() + +elseif (APPLE) + # Opus + set(OPUS_LIBS libopus.0.8.0.dylib libopus.0.dylib libopus.dylib) + CheckPathExists(${OPUS_PATH}/lib ${OPUS_LIBS}) + foreach (LIB IN LISTS OPUS_LIBS) + install(FILES ${OPUS_PATH}/lib/${LIB} DESTINATION lib) + endforeach () + + # sodium + set(SODIUM_LIBS libsodium.23.dylib libsodium.dylib) + CheckPathExists(${SODIUM_PATH}/lib ${SODIUM_LIBS}) + foreach (LIB IN LISTS SODIUM_LIBS) + install(FILES ${SODIUM_PATH}/lib/${LIB} DESTINATION lib) + endforeach () + + # libevent + if(SWIFT_BUILD_XSWIFTBUS) + set(EVENT_LIBS + libevent_core-2.1.7.dylib + libevent_core.dylib + ) + CheckPathExists(${EVENT_PATH}/lib ${EVENT_LIBS}) + foreach (LIB IN LISTS EVENT_LIBS) + install(FILES ${EVENT_PATH}/lib/${LIB} DESTINATION xswiftbus/64) + endforeach () + endif() + + # DBus + set(DBUS_LIBS libdbus-1.3.dylib libdbus-1.dylib) + CheckPathExists(${DBUS_PATH}/lib ${DBUS_LIBS}) + foreach (LIB IN LISTS DBUS_LIBS) + install(FILES ${DBUS_PATH}/lib/${LIB} DESTINATION lib) + if(SWIFT_BUILD_XSWIFTBUS) + install(FILES ${DBUS_PATH}/lib/${LIB} DESTINATION xswiftbus/64) + endif() + endforeach () + install(FILES ${DBUS_PATH}/bin/dbus-daemon DESTINATION bin) + install(FILES ${DBUS_PATH}/bin/dbus-uuidgen DESTINATION bin) + +elseif (SWIFT_WIN64) + # Opus + set(OPUS_LIBS opus.dll) + CheckPathExists(${OPUS_PATH}/bin ${OPUS_LIBS}) + foreach (LIB IN LISTS OPUS_LIBS) + install(FILES ${OPUS_PATH}/bin/${LIB} DESTINATION bin) + endforeach () + + # sodium + set(SODIUM_LIBS libsodium.dll) + CheckPathExists(${SODIUM_PATH}/bin ${SODIUM_LIBS}) + foreach (LIB IN LISTS SODIUM_LIBS) + install(FILES ${SODIUM_PATH}/bin/${LIB} DESTINATION bin) + endforeach () + + # libevent + if(SWIFT_BUILD_XSWIFTBUS) + set(EVENT_LIBS event_core.dll) + CheckPathExists(${EVENT_PATH}/bin ${EVENT_LIBS}) + foreach (LIB IN LISTS EVENT_LIBS) + install(FILES ${EVENT_PATH}/bin/${LIB} DESTINATION xswiftbus/64) + endforeach () + endif() + + # DBus + set(DBUS_LIBS dbus-1-3.dll) + CheckPathExists(${DBUS_PATH}/bin ${DBUS_LIBS}) + foreach (LIB IN LISTS DBUS_LIBS) + install(FILES ${DBUS_PATH}/bin/${LIB} DESTINATION bin) + if(SWIFT_BUILD_XSWIFTBUS) + install(FILES ${DBUS_PATH}/bin/${LIB} DESTINATION xswiftbus/64) + endif() + endforeach () + install(FILES ${DBUS_PATH}/bin/dbus-daemon.exe DESTINATION bin) + if(SWIFT_BUILD_XSWIFTBUS) + install(FILES ${DBUS_PATH}/bin/dbus-daemon.exe DESTINATION xswiftbus/64) + endif() +endif () diff --git a/cmake/modules/FindVATSIMAuth.cmake b/cmake/modules/FindVATSIMAuth.cmake new file mode 100644 index 000000000..049104aa1 --- /dev/null +++ b/cmake/modules/FindVATSIMAuth.cmake @@ -0,0 +1,62 @@ +# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors +# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 + + +macro(CheckPackageFound MSG) + include(FindPackageHandleStandardArgs) + + find_package_handle_standard_args(VATSIMAuth + REQUIRED_VARS VATSIM_AUTH_FOUND + FAIL_MESSAGE "VATSIMAuth not found. ${MSG}" + ) +endmacro() + +if (NOT DEFINED VATSIM_AUTH_PATH) + CheckPackageFound("VATSIM_AUTH_PATH not set") + return() +endif() + +if (NOT EXISTS ${VATSIM_AUTH_PATH}) + CheckPackageFound("VATSIM_AUTH_PATH does not exist") + return() +endif() + +if (NOT EXISTS "${VATSIM_AUTH_PATH}/common/include/vatsim/vatsimauth.h" OR NOT EXISTS "${VATSIM_AUTH_PATH}/linux-g++/64/lib/libvatsimauth.so") + CheckPackageFound("VATSIM_AUTH_PATH does not contain VATSIMAuth") + return() +endif() + + +add_library(VATSIMAuth::VATSIMAuth SHARED IMPORTED GLOBAL) + +target_include_directories(VATSIMAuth::VATSIMAuth INTERFACE ${VATSIM_AUTH_PATH}/common/include) + + + + + +if(UNIX AND NOT APPLE) + set_target_properties(VATSIMAuth::VATSIMAuth PROPERTIES IMPORTED_LOCATION ${VATSIM_AUTH_PATH}/linux-g++/64/lib/libvatsimauth.so) +elseif(APPLE) + set_target_properties(VATSIMAuth::VATSIMAuth PROPERTIES IMPORTED_LOCATION ${VATSIM_AUTH_PATH}/macx-clang/64/lib/libvatsimauth.dylib) +elseif(SWIFT_WIN32) + set_target_properties(VATSIMAuth::VATSIMAuth PROPERTIES IMPORTED_IMPLIB ${VATSIM_AUTH_PATH}/win32-msvc/32/lib/vatsimauth.lib) + set_target_properties(VATSIMAuth::VATSIMAuth PROPERTIES IMPORTED_LOCATION ${VATSIM_AUTH_PATH}/win32-msvc/32/lib/vatsimauth.dll) +elseif(SWIFT_WIN64) + set_target_properties(VATSIMAuth::VATSIMAuth PROPERTIES IMPORTED_IMPLIB ${VATSIM_AUTH_PATH}/win32-msvc/64/lib/vatsimauth.lib) + set_target_properties(VATSIMAuth::VATSIMAuth PROPERTIES IMPORTED_LOCATION ${VATSIM_AUTH_PATH}/win32-msvc/64/lib/vatsimauth.dll) +endif() + +if(UNIX AND NOT APPLE) + # https://gitlab.kitware.com/cmake/cmake/-/issues/19860#note_642079 + set_target_properties(VATSIMAuth::VATSIMAuth PROPERTIES IMPORTED_NO_SONAME TRUE) +endif() + +install(IMPORTED_RUNTIME_ARTIFACTS VATSIMAuth::VATSIMAuth + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + + +set(VATSIM_AUTH_FOUND TRUE) +CheckPackageFound("Found") diff --git a/cmake/modules/FindXPSDK.cmake b/cmake/modules/FindXPSDK.cmake new file mode 100644 index 000000000..494a6fee3 --- /dev/null +++ b/cmake/modules/FindXPSDK.cmake @@ -0,0 +1,52 @@ +# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors +# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 + + +macro(CheckPackageFound MSG) + include(FindPackageHandleStandardArgs) + + find_package_handle_standard_args(XPSDK + REQUIRED_VARS XP_SDK_FOUND + FAIL_MESSAGE "XP SDK not found. ${MSG}" + ) +endmacro() + +if (NOT DEFINED XP_SDK_PATH) + CheckPackageFound("XP_SDK_PATH not set") + return() +endif () + +if (NOT EXISTS ${XP_SDK_PATH}) + CheckPackageFound("XP_SDK_PATH does not exist") + return() +endif () + +if (NOT EXISTS "${XP_SDK_PATH}/CHeaders" OR NOT EXISTS "${XP_SDK_PATH}/Libraries") + CheckPackageFound("XP_SDK_PATH content does not look like XP SDK") + return() +endif () + + +if (SWIFT_WIN64 OR APPLE) + add_library(XPSDK::XPLM STATIC IMPORTED GLOBAL) + add_library(XPSDK::XPWidgets STATIC IMPORTED GLOBAL) +elseif (UNIX) + add_library(XPSDK::XPLM IMPORTED INTERFACE) + add_library(XPSDK::XPWidgets IMPORTED INTERFACE) +endif () + +target_include_directories(XPSDK::XPLM INTERFACE ${XP_SDK_PATH}/CHeaders ${XP_SDK_PATH}/CHeaders/XPLM) +target_include_directories(XPSDK::XPWidgets INTERFACE ${XP_SDK_PATH}/CHeaders ${XP_SDK_PATH}/CHeaders/Widgets) + +if (SWIFT_WIN64) + set_target_properties(XPSDK::XPLM PROPERTIES IMPORTED_LOCATION ${XP_SDK_PATH}/Libraries/Win/XPLM_64.lib) + set_target_properties(XPSDK::XPWidgets PROPERTIES IMPORTED_LOCATION ${XP_SDK_PATH}/Libraries/Win/XPWidgets_64.lib) + +elseif (APPLE) + set_target_properties(XPSDK::XPLM PROPERTIES IMPORTED_LOCATION ${XP_SDK_PATH}/Libraries/Mac/XPLM.framework/XPLM) + set_target_properties(XPSDK::XPWidgets PROPERTIES IMPORTED_LOCATION ${XP_SDK_PATH}/Libraries/Mac/XPWidgets.framework/XPWidgets) + +endif () + +set(XP_SDK_FOUND TRUE) +CheckPackageFound("Found") diff --git a/cmake/opus/CMakeLists.txt b/cmake/opus/CMakeLists.txt deleted file mode 100644 index d1aabde98..000000000 --- a/cmake/opus/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors -# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -add_library(externals_opus SHARED IMPORTED GLOBAL) - - -if(UNIX AND NOT APPLE) - find_package(PkgConfig REQUIRED) - pkg_search_module(OPUS REQUIRED opus) - set_target_properties(externals_opus PROPERTIES IMPORTED_LOCATION ${OPUS_LINK_LIBRARIES}) -else() - target_include_directories(externals_opus INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/common/include) -endif() - -if(APPLE) - set_target_properties(externals_opus PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/lib/libopus.0.dylib) -endif() - -if(SWIFT_WIN32) - set_target_properties(externals_opus PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/opus.lib) - set_target_properties(externals_opus PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/opus.dll) -elseif(SWIFT_WIN64) - set_target_properties(externals_opus PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/opus.lib) - set_target_properties(externals_opus PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/opus.dll) -endif() - -if(WIN32 OR APPLE) - install(IMPORTED_RUNTIME_ARTIFACTS externals_opus - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin - ) -endif() diff --git a/cmake/sodium/CMakeLists.txt b/cmake/sodium/CMakeLists.txt deleted file mode 100644 index 6e2e04088..000000000 --- a/cmake/sodium/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors -# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -add_library(externals_sodium SHARED IMPORTED GLOBAL) - -if(UNIX AND NOT APPLE) - find_package(PkgConfig REQUIRED) - pkg_search_module(SODIUM REQUIRED libsodium) - - file(READ_SYMLINK ${SODIUM_LINK_LIBRARIES} SODIUM_ABS) - set_target_properties(externals_sodium PROPERTIES IMPORTED_SONAME ${SODIUM_ABS}) - - string(REGEX MATCH "libsodium.so.[1-9]+" SOMAJOR_VERSION ${SODIUM_ABS}) - get_filename_component(dir "${SODIUM_LINK_LIBRARIES}" DIRECTORY) - set(SOMAJOR_VERSION_ABS "${dir}/${SOMAJOR_VERSION}") - set_target_properties(externals_sodium PROPERTIES IMPORTED_LOCATION ${SOMAJOR_VERSION_ABS}) -else() - target_include_directories(externals_sodium INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/common/include) -endif() - -if(APPLE) - set_target_properties(externals_sodium PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/lib/libsodium.23.dylib) -elseif(SWIFT_WIN32) - set_target_properties(externals_sodium PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/sodium.lib) - set_target_properties(externals_sodium PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/libsodium.dll) -elseif(SWIFT_WIN64) - set_target_properties(externals_sodium PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/sodium.lib) - set_target_properties(externals_sodium PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/libsodium.dll) -endif() - -install(IMPORTED_RUNTIME_ARTIFACTS externals_sodium - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) diff --git a/cmake/vatsimauth/CMakeLists.txt b/cmake/vatsimauth/CMakeLists.txt deleted file mode 100644 index 761e120f1..000000000 --- a/cmake/vatsimauth/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors -# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -add_library(externals_vatsim_auth SHARED IMPORTED GLOBAL) - -target_include_directories(externals_vatsim_auth INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/common/include/) - -if(UNIX AND NOT APPLE) - set_target_properties(externals_vatsim_auth PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/linux-g++/64/lib/libvatsimauth.so) -elseif(APPLE) - set_target_properties(externals_vatsim_auth PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/lib/libvatsimauth.dylib) -elseif(SWIFT_WIN32) - set_target_properties(externals_vatsim_auth PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/vatsimauth.lib) - set_target_properties(externals_vatsim_auth PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/vatsimauth.dll) -elseif(SWIFT_WIN64) - set_target_properties(externals_vatsim_auth PROPERTIES IMPORTED_IMPLIB ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/vatsimauth.lib) - set_target_properties(externals_vatsim_auth PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/vatsimauth.dll) -endif() - -if(UNIX AND NOT APPLE) - # https://gitlab.kitware.com/cmake/cmake/-/issues/19860#note_642079 - set_target_properties(externals_vatsim_auth PROPERTIES IMPORTED_NO_SONAME TRUE) -endif() - -install(IMPORTED_RUNTIME_ARTIFACTS externals_vatsim_auth - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) diff --git a/cmake/xp/CMakeLists.txt b/cmake/xp/CMakeLists.txt deleted file mode 100644 index 7c2d03ce9..000000000 --- a/cmake/xp/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors -# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -if(SWIFT_WIN64 OR APPLE) - add_library(externals_xplm STATIC IMPORTED GLOBAL) -elseif(UNIX) - add_library(externals_xplm INTERFACE) -endif() - - -target_include_directories(externals_xplm INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/common/include ${PROJECT_SOURCE_DIR}/third_party/externals/common/include/XPLM) - -if(SWIFT_WIN64) - set_target_properties(externals_xplm PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/XPLM_64.lib) -elseif(APPLE) - set_target_properties(externals_xplm PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/lib/XPLM.framework/XPLM) -endif() - -if(SWIFT_WIN64 OR APPLE) - add_library(externals_xpwidgets STATIC IMPORTED GLOBAL) - target_include_directories(externals_xpwidgets INTERFACE ${PROJECT_SOURCE_DIR}/third_party/externals/common/include) - - if(SWIFT_WIN64) - set_target_properties(externals_xpwidgets PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/XPWidgets_64.lib) - elseif(APPLE) - set_target_properties(externals_xpwidgets PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/macx-clang/64/lib/XPWidgets.framework/XPWidgets) - endif() -endif() diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 000000000..de9f287d0 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,41 @@ +# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors +# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 + +from conan import ConanFile +from conan.tools.cmake import cmake_layout + + +class SwiftRecipe(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + def requirements(self): + self.requires("opus/1.3.1") + self.requires("libsodium/1.0.18") + self.requires("libevent/2.1.12") + if self.settings.os != "Linux": + self.requires("dbus/1.15.8") + + # Transitive dependency of dbus + self.requires("expat/2.7.1") + + self.requires("nlohmann_json/3.11.3") + + # External dependencies not managed via conan: + # Qt + # msgpack + # qjsonwebtoken + # simplecrypt + # dbus (on linux only) + + def configure(self): + self.options["libevent"].with_openssl = False + self.options["libevent"].shared = True + self.options["libsodium"].shared = True + self.options["opus"].shared = True + if self.settings.os != "Linux": + self.options["dbus"].shared = True + self.options["dbus"].message_bus = True + + def layout(self): + cmake_layout(self) diff --git a/installer/installbuilder/project.xml b/installer/installbuilder/project.xml index 6eac101a1..420c12db1 100644 --- a/installer/installbuilder/project.xml +++ b/installer/installbuilder/project.xml @@ -135,15 +135,6 @@ It must be closed before the installation can proceed - - osascript - -l AppleScript ${installdir}/bin/create_dbus_machineid.scpt - - - osx - - - ${user_home_directory}/Library/LaunchAgents diff --git a/installer/installbuilder/swift-externals.xml b/installer/installbuilder/swift-externals.xml index 413596c87..45931957c 100644 --- a/installer/installbuilder/swift-externals.xml +++ b/installer/installbuilder/swift-externals.xml @@ -54,9 +54,6 @@ ../../dist/bin/7za - - ../../dist/bin/create_dbus_machineid.scpt - @@ -68,9 +65,34 @@ ../../dist/lib/libvatsimauth.so + + ../../dist/lib/libsodium.so.23.3.0 + + + ../../dist/lib/libsodium.so.23 + + + ../../dist/lib/libsodium.so + + + ../../dist/lib/libopus.so.0.8.0 + + + ../../dist/lib/libopus.so.0 + + + ../../dist/lib/libopus.so + + + + + licenses + ${installdir}/licenses + licenses + 1 - ../../dist/lib/libsodium.so.* + ../../dist/licenses/* @@ -83,6 +105,15 @@ ../../dist/lib/libsodium.23.dylib + + ../../dist/lib/libsodium.dylib + + + ../../dist/lib/libopus.0.8.0.dylib + + + ../../dist/lib/libopus.dylib + ../../dist/lib/libopus.0.dylib diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d8b3478ca..1a4f7e67f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -256,7 +256,8 @@ target_link_libraries(core misc input sound - externals_sodium + Opus::opus + libsodium::libsodium msgpack-cxx config PRIVATE @@ -266,7 +267,7 @@ target_link_libraries(core ) if(SWIFT_VATSIM_SUPPORT) - target_link_libraries(core PUBLIC externals_vatsim_auth) + target_link_libraries(core PUBLIC VATSIMAuth::VATSIMAuth) endif() target_compile_definitions(core PRIVATE BUILD_SWIFT_CORE_LIB) diff --git a/src/plugins/simulator/flightgear/CMakeLists.txt b/src/plugins/simulator/flightgear/CMakeLists.txt index dc3bffe1c..5735b283c 100644 --- a/src/plugins/simulator/flightgear/CMakeLists.txt +++ b/src/plugins/simulator/flightgear/CMakeLists.txt @@ -20,7 +20,7 @@ target_include_directories(simulatorflightgear PUBLIC ${PROJECT_SOURCE_DIR}/src) target_link_libraries(simulatorflightgear PUBLIC misc - externals_dbus + dbus-1 plugincommon ) diff --git a/src/plugins/simulator/xplane/CMakeLists.txt b/src/plugins/simulator/xplane/CMakeLists.txt index 78a9d5bc1..a8e39d7e8 100644 --- a/src/plugins/simulator/xplane/CMakeLists.txt +++ b/src/plugins/simulator/xplane/CMakeLists.txt @@ -26,7 +26,7 @@ target_include_directories(simulatorxplane PUBLIC ${PROJECT_SOURCE_DIR}/src) target_link_libraries(simulatorxplane PUBLIC misc - externals_dbus + dbus-1 plugincommon ) diff --git a/src/sound/CMakeLists.txt b/src/sound/CMakeLists.txt index 3427d303d..1da1a5dfc 100644 --- a/src/sound/CMakeLists.txt +++ b/src/sound/CMakeLists.txt @@ -75,7 +75,7 @@ target_link_libraries(sound config Qt::Multimedia misc - externals_opus + Opus::opus ) install(TARGETS sound diff --git a/src/xswiftbus/CMakeLists.txt b/src/xswiftbus/CMakeLists.txt index 847c5575a..53701274b 100644 --- a/src/xswiftbus/CMakeLists.txt +++ b/src/xswiftbus/CMakeLists.txt @@ -92,39 +92,17 @@ target_include_directories(xswiftbus PUBLIC if(SWIFT_WIN64) - target_link_libraries(xswiftbus PUBLIC externals_xplm externals_xpwidgets) + target_link_libraries(xswiftbus PUBLIC XPSDK::XPLM XPSDK::XPWidgets) elseif(APPLE) - target_link_libraries(xswiftbus PRIVATE externals_xplm externals_xpwidgets "-framework Cocoa" "-framework CoreFoundation") + target_link_libraries(xswiftbus PRIVATE XPSDK::XPLM XPSDK::XPWidgets "-framework Cocoa" "-framework CoreFoundation") target_compile_definitions(xswiftbus PRIVATE XUTILS_EXCLUDE_MAC_CRAP) elseif(UNIX) + target_link_libraries(xswiftbus PUBLIC XPSDK::XPLM XPSDK::XPWidgets) # Flags needed because there is no XPLM link library target_link_options(xswiftbus PUBLIC -nodefaultlibs -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/xswiftbus.map) endif() - -target_link_libraries(xswiftbus PUBLIC externals_event nlohmann_json::nlohmann_json externals_dbus externals_xplm) - - -if(SWIFT_WIN32) - set(PNG_LIBRARIES ${swift_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/png.lib) - set(ZLIB_LIBRARIES ${swift_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/z.lib) -elseif(SWIFT_WIN64) - set(PNG_LIBRARIES ${swift_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/png.lib) - set(ZLIB_LIBRARIES ${swift_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/z.lib) - -else() - find_package(PNG REQUIRED) - find_package(ZLIB REQUIRED) -endif() - -# Externals required by xplanemp2 -if(WIN32) - find_package(OpenGL REQUIRED) - - target_link_libraries(xswiftbus PUBLIC ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} OpenGL::GL OpenGL::GLU) -elseif(UNIX AND NOT APPLE) - target_link_libraries(xswiftbus PUBLIC ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) -endif() +target_link_libraries(xswiftbus PUBLIC libevent::core nlohmann_json::nlohmann_json dbus-1) if(MSVC) target_compile_definitions(xswiftbus PRIVATE _CRT_SECURE_NO_WARNINGS) @@ -186,10 +164,19 @@ if(WIN32) set(DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL "") configure_file(${swift_SOURCE_DIR}/src/misc/share/dbus-1/session.conf.in ${CMAKE_CURRENT_BINARY_DIR}/session.conf) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/session.conf DESTINATION xswiftbus/64/share/dbus-1/) - - install(FILES ${swift_SOURCE_DIR}/third_party/externals/win32-msvc/64/bin/dbus-daemon.exe DESTINATION xswiftbus/64/) - install(FILES ${swift_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/expat.dll DESTINATION xswiftbus/64/) endif() install(DIRECTORY LegacyData DESTINATION xswiftbus) install(FILES xswiftbus.conf ${CMAKE_CURRENT_BINARY_DIR}/readme.txt DESTINATION xswiftbus) + +if (DEFINED SWIFT_DEV_X_PLANE_PLUGINS_DIR) + # Copy xswiftbus to X-Plane folder for development + add_custom_target(copy_xswiftbus + DEPENDS xswiftbus + COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_INSTALL_PREFIX}/xswiftbus ${SWIFT_DEV_X_PLANE_PLUGINS_DIR}/xswiftbus + + COMMENT "Installing xswiftbus into X-Plane plugins dir" + + ) +endif () diff --git a/src/xswiftbus/xplanemp2 b/src/xswiftbus/xplanemp2 index db6d1cbb7..8b07d1daf 160000 --- a/src/xswiftbus/xplanemp2 +++ b/src/xswiftbus/xplanemp2 @@ -1 +1 @@ -Subproject commit db6d1cbb731e5755eab3c6be8bf7ae1c34b7d6aa +Subproject commit 8b07d1daf8283cad8c0cf401e5ddf7f3f11a9b70 diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 70bbb101b..122731948 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -3,5 +3,4 @@ add_subdirectory(simplecrypt) add_subdirectory(qjsonwebtoken) -add_subdirectory(nlohmann_json) add_subdirectory(cmake/msgpack EXCLUDE_FROM_ALL SYSTEM) diff --git a/third_party/nlohmann_json b/third_party/nlohmann_json deleted file mode 160000 index 9cca280a4..000000000 --- a/third_party/nlohmann_json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03