From 52521dc3316cc298e16ab26fc7c18671c2856c75 Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Sat, 6 Aug 2022 15:09:59 -0400 Subject: [PATCH] Add MacOS CI + (@-OgreTransporter) Merge patches from #4 --- .github/workflows/build-test.yml | 29 +++++++++++++++---- CMakeLists.txt | 48 ++++++++++++++------------------ 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 2898034..07beb6d 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -6,21 +6,40 @@ on: workflow_dispatch: jobs: - Ubuntu: - runs-on: ubuntu-latest + Build-Qtk: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + include: + - os: ubuntu-latest + CMAKE_PARAMS: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.3.1/gcc_64/ + - os: macos-latest + CMAKE_PARAMS: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.3.1/gcc_64/ -DASSIMP_NEW_INTERFACE=on + + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - name: Install Qt uses: jurplel/install-qt-action@v2 with: - version: '6.2.3' + version: '6.3.1' - - name: Install Assimp + - name: Install Assimp Linux + if: matrix.os == 'ubuntu-latest' + shell: bash run: | sudo apt install libassimp-dev -y + - name: Install Assimp MacOS + if: matrix.os == 'macos-latest' + shell: bash + run: | + brew install assimp + - name: Build Qtk + shell: bash run: | mkdir build && cd build - cmake .. -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.2.3/gcc_64/ && cmake --build . \ No newline at end of file + cmake .. ${{ matrix.CMAKE_PARAMS }} && cmake --build . diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b0d152..1dd8633 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,30 +27,25 @@ if (NOT Qt6_FOUND) message(FATAL_ERROR "Specify path to Qt6 with `cmake -DCMAKE_PREFIX_PATH=/path/to/Qt/6.x.x/gcc_64 -S /path/to/qtk -B /path/to/qtk/build && cmake --build /path/to/qtk/build -j $(nprocs)`") endif() -# Add our Qt resources.qrc file to our application -set(SOURCES app/main.cpp) -qt6_add_big_resources(SOURCES resources.qrc) - -add_executable( - qtk # Executable name - ${SOURCES} # Executable source code -) - ################################################################################ # External Libraries ################################################################################ # https://github.com/assimp/assimp/commit/6ac8279977c3a54118551e549d77329497116f66 find_package(assimp REQUIRED) - - -################################################################################ -# Custom Libraries -################################################################################ - -# Mainwidget +option(ASSIMP_NEW_INTERFACE "Use assimp::assimp as target instead of assimp" OFF) include(GenerateExportHeader) -add_library(main-widget STATIC + +################################################################################ +# Final Application +################################################################################ + +# Add our Qt resources.qrc file to our application +set(SOURCES app/main.cpp) +qt6_add_big_resources(SOURCES resources.qrc) +qt_add_executable(qtk ${SOURCES}) + +set(SOURCES src/mainwidget.cpp src/mainwidget.h src/mainwindow.cpp src/mainwindow.h src/mainwindow.ui src/input.cpp src/input.h @@ -65,29 +60,28 @@ add_library(main-widget STATIC src/scene.cpp src/scene.h src/resourcemanager.cpp src/resourcemanager.h ) +qt_add_library(main-widget STATIC ${SOURCES}) target_include_directories(main-widget PUBLIC src/) -#if(TARGET assimp) -target_link_libraries(main-widget PRIVATE assimp) -#else() -# target_link_libraries(main-widget PRIVATE assimp::assimp) -#endif() +if(ASSIMP_NEW_INTERFACE) + target_link_libraries(main-widget PRIVATE assimp::assimp) +else() + target_link_libraries(main-widget PRIVATE assimp) +endif() target_link_libraries(main-widget PUBLIC Qt6::OpenGLWidgets) if(WIN32) find_package(OpenGL REQUIRED) target_link_libraries(main-widget PUBLIC OpenGL::GL) endif() -################################################################################ -# Final Application -################################################################################ - -# Link qtk executable to main main-widget library target_link_libraries(qtk PUBLIC main-widget) +# Link qtk executable to main main-widget library set_target_properties(qtk PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} ) generate_export_header(main-widget)