From 8a4cf998eeb1b1b16040f591826955eeddf73515 Mon Sep 17 00:00:00 2001 From: Martijn Courteaux Date: Thu, 26 Oct 2023 14:27:46 +0200 Subject: [PATCH] Idk, let's see if this dependency installation trick works. --- .github/workflows/build.yml | 68 +++++++++++++++++++++++++------------ CMakeLists.txt | 11 ++++-- 2 files changed, 56 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ff4bee..5860695 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,42 +20,68 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, windows-latest, macos-latest] + #os: [ubuntu-22.04, ubuntu-20.04, windows-latest, macos-latest] + os: [windows-latest] include: - - os: ubuntu-22.04 - outputsuffix: ubuntu-2204 - archive_type: tar - archive_extension: tar.gz - - os: ubuntu-20.04 - outputsuffix: ubuntu-2004 - archive_type: tar - archive_extension: tar.gz - - os: ubuntu-18.04 - outputsuffix: ubuntu-1804 - archive_type: tar - archive_extension: tar.gz - - os: macos-latest - outputsuffix: mac - archive_type: tar - archive_extension: tar.gz + #- os: ubuntu-22.04 + # outputsuffix: ubuntu-2204 + # archive_type: tar + # archive_extension: tar.gz + #- os: ubuntu-20.04 + # outputsuffix: ubuntu-2004 + # archive_type: tar + # archive_extension: tar.gz + #- os: ubuntu-18.04 + # outputsuffix: ubuntu-1804 + # archive_type: tar + # archive_extension: tar.gz + #- os: macos-latest + # outputsuffix: mac + # archive_type: tar + # archive_extension: tar.gz - os: windows-latest outputsuffix: win archive_type: zip archive_extension: zip + steps: + - name: Print env + if: runner.os == 'Windows' + run: set + - uses: actions/checkout@v3 with: submodules: recursive + - name: Install vcpkg (Windows) + if: runner.os == 'Windows' + run: | + vcpkg install libjpeg-turbo + + - name: Configure CMake + if: runner.os == 'Windows' + # Configure CMake in a 'build' subdirectory. + run: cmake -S . -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} --toolchain="${{env.VCPKG_INSTALLATION_ROOT}}/scripts/buildsystems/vcpkg.cmake" + - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + if: runner.os != 'Windows' + # Configure CMake in a 'build' subdirectory. + run: cmake -S . -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel + + - name: Cache vcpkg libraries + if: runner.os == 'Windows' + uses: actions/cache@v2 + with: + path: | + vcpkg/installed + vcpkg/vcpkg + key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }} + - name: Archive Release uses: thedoctor0/zip-release@0.7.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index b67c69a..fdf5b56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,6 @@ target_include_directories(ctpl INTERFACE "lib/ctpl/") set(JSON_MultipleHeaders ON CACHE BOOL "" FORCE) add_subdirectory(lib/json) -find_package(JPEG REQUIRED) set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) @@ -56,13 +55,21 @@ target_link_libraries(reproject PUBLIC OpenEXR::OpenEXR ctpl nlohmann_json - JPEG::JPEG ) set_target_properties(reproject PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" ) +if (WIN32) + set(VCPKG_LIBRARY_LINKAGE static) + find_package(libjpeg-turbo) + target_link_libraries(reproject PUBLIC libjpeg-tubo::turbojpeg-static) +else() + find_package(JPEG) + target_link_libraries(reproject PUBLIC JPEG::JPEG) +endif() + foreach(LIBRARY OpenEXRCore OpenEXR Imath Iex IlmThread) set_target_properties(${LIBRARY} PROPERTIES