Don't build assimp from source in CI
This commit is contained in:
parent
5f6608e1d8
commit
62eab82d1d
|
@ -13,61 +13,21 @@ jobs:
|
|||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
cmake: -DCMAKE_PREFIX_PATH="/home/runner/work/qtk/Qt/6.3.1/gcc_64/;../assimp"
|
||||
cmake: -DCMAKE_PREFIX_PATH="/home/runner/work/qtk/Qt/6.3.1/gcc_64/"
|
||||
- os: windows-latest
|
||||
cmake: -DCMAKE_PREFIX_PATH="D:/a/qtk/qtk/Qt/6.3.1/mingw81_64/;../assimp" -DASSIMP_NEW_INTERFACE=on
|
||||
cmake: -DCMAKE_PREFIX_PATH="D:/a/qtk/qtk/Qt/6.3.1/mingw81_64/"
|
||||
- os: macos-latest
|
||||
cmake: -DCMAKE_PREFIX_PATH="/home/runner/work/qtk/Qt/6.3.1/gcc_64/;../assimp" -DASSIMP_NEW_INTERFACE=on
|
||||
cmake: -DCMAKE_PREFIX_PATH="/home/runner/work/qtk/Qt/6.3.1/gcc_64/"
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Clone Assimp
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'assimp/assimp'
|
||||
path: 'assimp'
|
||||
|
||||
- name: Build Assimp
|
||||
shell: bash
|
||||
run: |
|
||||
pwd
|
||||
ls
|
||||
cmake -S assimp/ -B assimp/build/ -DCMAKE_INSTALL_PREFIX=../assimp && cmake --build assimp/build
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
version: '6.3.1'
|
||||
|
||||
# - 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: Install Assimp Windows
|
||||
# if: matrix.os == 'windows-latest'
|
||||
# shell: bash
|
||||
# run: |
|
||||
# git clone https://github.com/Microsoft/vcpkg.git
|
||||
# cd vcpkg
|
||||
# ./bootstrap-vcpkg.sh
|
||||
# ./vcpkg integrate install
|
||||
# vcpkg install assimp
|
||||
|
||||
- name: Install Assimp MacOS
|
||||
if: matrix.os == 'macos-latest'
|
||||
shell: bash
|
||||
run: |
|
||||
brew install assimp
|
||||
|
||||
- name: Build Qtk
|
||||
shell: bash
|
||||
run: |
|
||||
|
|
|
@ -19,16 +19,20 @@ set(CMAKE_AUTORCC ON)
|
|||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
add_compile_options(/wd4131 /wd4127)
|
||||
endif()
|
||||
|
||||
# Qtk build options
|
||||
option(QTK_DEBUG "Enable debugger" ON)
|
||||
option(BUILD_SHARED_LIBS "Build shared library" ON)
|
||||
option(UPDATE_SUBMODULES "Update external project (assimp) git submodule" ON)
|
||||
|
||||
# Qt options
|
||||
set(QT_DIR "$ENV{HOME}/Code/Clones/Qt/6.3.1/gcc_64/" CACHE PATH "Path to Qt6")
|
||||
|
||||
# Options for bringing your own assimp installation; Otherwise not needed
|
||||
set(ASSIMP_DIR "" CACHE PATH "Path to local installation of assimp")
|
||||
# + If assimp is available system-wide we can just set UPDATE_SUBMODULES OFF
|
||||
option(UPDATE_SUBMODULES "Update external project (assimp) git submodule" ON)
|
||||
option(ASSIMP_NEW_INTERFACE "Use the assimp::assimp interface (WIN / OSX)" OFF)
|
||||
|
||||
################################################################################
|
||||
|
@ -50,21 +54,9 @@ if (UPDATE_SUBMODULES)
|
|||
include("${CMAKE_SOURCE_DIR}/cmake/include/git_submodule.cmake")
|
||||
submodule_update(extern/assimp/assimp/)
|
||||
add_subdirectory(extern/assimp/assimp)
|
||||
else()
|
||||
if (ASSIMP_DIR)
|
||||
message(STATUS "Using custom ASSIMP_DIR: ${ASSIMP_DIR}")
|
||||
list(APPEND CMAKE_PREFIX_PATH "${ASSIMP_DIR}")
|
||||
endif()
|
||||
find_package(assimp REQUIRED)
|
||||
if (assimp_FOUND)
|
||||
message(STATUS "Found assimp: ${assimp_DIR}")
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find assimp at: ${CMAKE_PREFIX_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
# Qtk
|
||||
################################################################################
|
||||
|
@ -101,7 +93,6 @@ set(SOURCE_FILES
|
|||
include(GenerateExportHeader)
|
||||
qt_add_library(qtk-widget STATIC ${PUBLIC_HEADERS} ${SOURCE_FILES})
|
||||
target_include_directories(qtk-widget PRIVATE src/ app/)
|
||||
generate_export_header(qtk-widget)
|
||||
|
||||
set_target_properties(qtk-widget PROPERTIES
|
||||
PUBLIC_HEADER "${PUBLIC_HEADERS}"
|
||||
|
@ -110,10 +101,10 @@ set_target_properties(qtk-widget PROPERTIES
|
|||
|
||||
target_link_libraries(qtk-widget PUBLIC Qt6::OpenGLWidgets)
|
||||
|
||||
if ((UPDATE_SUBMODULES AND NOT ASSIMP_DIR) OR NOT ASSIMP_NEW_INTERFACE)
|
||||
target_link_libraries(qtk-widget PRIVATE assimp)
|
||||
if (UPDATE_SUBMODULES OR NOT ASSIMP_NEW_INTERFACE)
|
||||
target_link_libraries(qtk-widget PUBLIC assimp)
|
||||
elseif(ASSIMP_NEW_INTERFACE)
|
||||
target_link_libraries(qtk-widget PRIVATE assimp::assimp)
|
||||
target_link_libraries(qtk-widget PUBLIC assimp::assimp)
|
||||
endif()
|
||||
|
||||
if(QTK_DEBUG)
|
||||
|
@ -126,6 +117,7 @@ if(WIN32)
|
|||
target_link_libraries(qtk-widget PUBLIC OpenGL::GL)
|
||||
endif()
|
||||
|
||||
generate_export_header(qtk-widget)
|
||||
# Install files
|
||||
install(TARGETS qtk-widget
|
||||
# Associate qtk-widget target with qtk-export
|
||||
|
@ -150,7 +142,13 @@ install(EXPORT qtk-export
|
|||
# Final Application
|
||||
################################################################################
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources.h "#ifndef QTK_RESOURCES_H\n#define QTK_RESOURCES_H\n#define QTK_RESOURCES_DIR \"${CMAKE_SOURCE_DIR}/resources\"\n#endif\n")
|
||||
file(
|
||||
WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources.h
|
||||
"#ifndef QTK_RESOURCES_H\n"
|
||||
"#define QTK_RESOURCES_H\n"
|
||||
"#define QTK_RESOURCES_DIR \"${CMAKE_SOURCE_DIR}/resources\"\n"
|
||||
"#endif\n"
|
||||
)
|
||||
|
||||
# Add our Qt resources.qrc file to our application
|
||||
set(QTK_APP_SOURCES app/main.cpp
|
||||
|
|
Loading…
Reference in New Issue