From 19a962fc0d69bd31e97939dcca839cd4970b7d9f Mon Sep 17 00:00:00 2001 From: Gideon Date: Tue, 22 Dec 2020 17:33:25 +0100 Subject: [PATCH] GH-actions and CMake: fix ImGui builds. Also deactivated ImGui build for coverage builds etc. --- .github/workflows/ci.yml | 18 ++++++++++++------ ui-cpp/CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3be66c33..c6316408d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,13 +27,19 @@ jobs: build-type: Release env: BUILD_TYPE: ${{ matrix.build-type }} - CMAKE_FLAGS: -DSPIRIT_UI_CXX_USE_QT=OFF + CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=ON -DSPIRIT_UI_CXX_USE_QT=OFF OMP_NUM_THREADS: 4 EXCLUDETESTS: ${{ matrix.excludetests }} steps: - uses: actions/checkout@v2 + - name: Install required system packages + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt update + sudo apt install xorg-dev libglu1-mesa-dev libgtk-3-dev + - name: Create build folder run: cmake -E make_directory ${{runner.workspace}}/build @@ -66,7 +72,7 @@ jobs: runs-on: ubuntu-latest env: BUILD_TYPE: Release - CMAKE_FLAGS: -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_TEST_COVERAGE=ON + CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_TEST_COVERAGE=ON steps: - uses: actions/checkout@v2 @@ -119,7 +125,7 @@ jobs: runs-on: ubuntu-latest env: BUILD_TYPE: Release - CMAKE_FLAGS: -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_ENABLE_PINNING=ON -DSPIRIT_ENABLE_DEFECTS=ON + CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_ENABLE_PINNING=ON -DSPIRIT_ENABLE_DEFECTS=ON steps: - uses: actions/checkout@v2 @@ -155,7 +161,7 @@ jobs: - os: ubuntu-18.04 env: BUILD_TYPE: Release - CMAKE_FLAGS: -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_USE_CUDA=ON -DSPIRIT_CUDA_ARCH=sm_70 + CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_USE_CUDA=ON -DSPIRIT_CUDA_ARCH=sm_70 steps: - uses: actions/checkout@v2 @@ -180,7 +186,7 @@ jobs: runs-on: ubuntu-18.04 env: BUILD_TYPE: Release - CMAKE_FLAGS: -DSPIRIT_UI_CXX_USE_QT=ON + CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=ON steps: - uses: actions/checkout@v2 @@ -247,7 +253,7 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] env: BUILD_TYPE: Release - CMAKE_FLAGS: -DSPIRIT_UI_CXX_USE_QT=OFF + CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF SPIRIT_ADD_VERSION_SUFFIX: true steps: diff --git a/ui-cpp/CMakeLists.txt b/ui-cpp/CMakeLists.txt index 83a407dd6..4261a97d0 100644 --- a/ui-cpp/CMakeLists.txt +++ b/ui-cpp/CMakeLists.txt @@ -182,6 +182,21 @@ if( SPIRIT_UI_USE_IMGUI ) target_sources( nativefiledialog PRIVATE ${NFD_SRC_DIR}/nfd_emscripten.cpp ) elseif( UNIX ) target_sources( nativefiledialog PRIVATE ${NFD_SRC_DIR}/nfd_gtk.c ) + + # Use the package PkgConfig to detect GTK+ headers/library files + FIND_PACKAGE( PkgConfig REQUIRED ) + PKG_CHECK_MODULES( GTK REQUIRED gtk+-3.0 ) + + # Setup CMake to use GTK+, tell the compiler where to look for headers + # and the linker where to look for libraries + target_include_directories( nativefiledialog PUBLIC ${GTK_INCLUDE_DIRS} ) + target_link_directories( nativefiledialog PUBLIC ${GTK_LIBRARY_DIRS} ) + + # Add other flags to the compiler + add_definitions( ${GTK_CFLAGS_OTHER} ) + + # Link the target to the GTK+ libraries + target_link_libraries( nativefiledialog ${GTK_LIBRARIES} ) endif() endif() ####################################################################