diff --git a/.github/workflows/build-libsquish-linux.yml b/.github/workflows/build-libsquish-linux.yml deleted file mode 100644 index b92784b..0000000 --- a/.github/workflows/build-libsquish-linux.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Build libsquish - Linux -on: - workflow_call: - -env: - libsquish_src_suffix: libsquish/Source - libsquish_src_dir: ${{ github.workspace }}/libsquish/Source - libsquish_build_dir: ${{ github.workspace }}/libsquish/Build - -jobs: - build-libsquish: - name: Build libsquish - Linux (Release) - strategy: - fail-fast: false - matrix: - os: [ubuntu-20.04, ubuntu-22.04] - compiler: [gcc, clang] - lib_linkage: [shared, static] - include: - - os: ubuntu-20.04 - compiler: gcc - c_comp: gcc-10 - cxx_comp: g++-10 - - os: ubuntu-20.04 - compiler: clang - c_comp: clang-12 - cxx_comp: clang++-12 - - os: ubuntu-22.04 - compiler: gcc - c_comp: gcc-12 - cxx_comp: g++-12 - - os: ubuntu-22.04 - compiler: clang - c_comp: clang-14 - cxx_comp: clang++-14 - - lib_linkage: shared - cmake_bsl: ON - - lib_linkage: static - cmake_bsl: OFF - runs-on: ${{ matrix.os }} - env: - cmake_gen: Ninja Multi-Config - steps: - - name: Set derived variables with shell because GitHub Actions env context sucks - run: | - echo "libsquish_package_path=${{ env.libsquish_build_dir }}/out/dist" >> $GITHUB_ENV - libsquish_install_path="${{ env.libsquish_build_dir }}/out/install" - echo "libsquish_install_path=$libsquish_install_path" >> $GITHUB_ENV - - name: Install Doxygen - uses: oblivioncth/actions/ubuntu/install-doxygen-from-sourceforge@dev - with: - version: 1.9.4 - - name: Install Graphviz - run: sudo apt-get install graphviz - - name: Install Ninja - run: sudo apt-get install ninja-build - - name: Checkout libsquish - uses: actions/checkout@v3 - with: - path: ${{ env.libsquish_src_suffix }} - fetch-depth: 0 # Required for verbose versioning to work correctly - - name: Build/Install libsquish - working-directory: ${{ env.libsquish_src_dir }} - run: | - echo Configuring CMake... - cmake -G "$cmake_gen" -S "$libsquish_src_dir" -B "$libsquish_build_dir" -D CMAKE_CXX_COMPILER="${{ matrix.cxx_comp }}" -D CMAKE_C_COMPILER="${{ matrix.c_comp }}" -D BUILD_SHARED_LIBS="${{ matrix.cmake_bsl }}" -D LIBSQUISH_TESTS=ON -D LIBSQUISH_DOCS=ON -D LIBSQUISH_EXTRAS=ON - echo Changing to build directory... - cd "$libsquish_build_dir" - echo Building libsquish Release/Docs... - cmake --build . --target all --config Release - echo Installing libsquish Release/Docs - cmake --install . --config Release - echo Running tests... - ctest -C Release --output-on-failure - echo Packaging libsquish... - cpack -C "Release" - echo Build complete. - - name: Get libsquish artifact name - id: get_artifact_name - run: | - cpack_name=$(find "${{ env.libsquish_package_path }}" -type f -name "*.zip") - artifact_name="$(basename "$cpack_name" .zip) [${{ matrix.cxx_comp }}]" - echo "current_artifact_name=$artifact_name" >> $GITHUB_ENV - - name: Upload libsquish build artifact - uses: actions/upload-artifact@v3 - with: - name: ${{ env.current_artifact_name }} - path: ${{ env.libsquish_install_path }} - if-no-files-found: error diff --git a/.github/workflows/build-libsquish-windows.yml b/.github/workflows/build-libsquish-windows.yml deleted file mode 100644 index 2dab0df..0000000 --- a/.github/workflows/build-libsquish-windows.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Build libsquish - Windows -on: - workflow_call: - secrets: - ffynnon_cred: - description: 'Credentials for using Ffynnon-based actions' - required: true - outputs: - doc_artifact_name: - description: "Name of artifact used to update docs" - value: ${{ jobs.build-libsquish.outputs.doc_artifact_name }} -env: - libsquish_src_suffix: libsquish/Source - libsquish_src_dir: ${{ github.workspace }}/libsquish/Source - libsquish_build_dir: ${{ github.workspace }}/libsquish/Build - -jobs: - build-libsquish: - name: Build libsquish - Windows (Release) - strategy: - fail-fast: false - matrix: - lib_linkage: [shared, static] - include: - - lib_linkage: shared - cmake_bsl: ON - vcpkg_triplet: x64-windows - - lib_linkage: static - cmake_bsl: OFF - vcpkg_triplet: x64-windows-static - runs-on: windows-latest - env: - vs_dir: C:/Program Files/Microsoft Visual Studio/2022/Enterprise - cmake_gen: Ninja Multi-Config - outputs: - doc_artifact_name: ${{ steps.set_doc_artifact_name.outputs.doc_artifact_name }} - steps: - - name: Set derived variables with shell because GitHub Actions env context sucks - run: | - echo "libsquish_package_path=${{ env.libsquish_build_dir }}/out/dist" >> $Env:GITHUB_ENV - $libsquish_install_path="${{ env.libsquish_build_dir }}/out/install" - echo "libsquish_install_path=$libsquish_install_path" >> $Env:GITHUB_ENV - - name: Install libpng - run: vcpkg install libpng:${{ matrix.vcpkg_triplet }} - - name: Install Doxygen - uses: oblivioncth/actions/general/cache-and-install-doxygen-from-ffynnon@dev - with: - version: 1.9.4 - os: windows - credentials: ${{ secrets.ffynnon_cred }} - - name: Install Graphviz - run: choco install graphviz - - name: Checkout libsquish - uses: actions/checkout@v3 - with: - path: ${{ env.libsquish_src_suffix }} - fetch-depth: 0 # Required for verbose versioning to work correctly - - name: Build/Install libsquish - working-directory: ${{ env.libsquish_src_dir }} - shell: cmd - run: | - echo "Setup C++ Build Environment..." - CALL "${{ env.vs_dir }}\Common7\Tools\VsDevCmd.bat" -arch=amd64 - echo "Add vcpkg Toolchain Env Variable" - set "CMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%/scripts/buildsystems/vcpkg.cmake" - cmake -G "${{ env.cmake_gen }}" -S "${{ env.libsquish_src_dir}}" -B "${{ env.libsquish_build_dir }}" -D BUILD_SHARED_LIBS=${{ matrix.cmake_bsl }} -D LIBSQUISH_TESTS=ON -D LIBSQUISH_DOCS=ON -D LIBSQUISH_EXTRAS=ON -D VCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} - echo "Changing to build directory..." - cd "%libsquish_build_dir%" - echo "Building libsquish Release/Docs..." - cmake --build . --target all --config Release - echo "Installing libsquish Release/Docs..." - cmake --install . --config Release - echo "Running tests..." - ctest -C Release --output-on-failure - echo "Packaging libsquish..." - cpack -C "Release" - echo "Build complete." - - name: Get libsquish artifact name - run: | - $artifact_name=$((Get-ChildItem -Path "${{ env.libsquish_package_path }}" -Filter *.zip)[0].BaseName) - echo "current_artifact_name=$artifact_name" >> $Env:GITHUB_ENV - - name: Set doc artifact name - id: set_doc_artifact_name - if: matrix.lib_linkage == 'static' - run: echo "doc_artifact_name=${{ env.current_artifact_name }}" >> $Env:GITHUB_OUTPUT - - name: Upload libsquish build artifact - uses: actions/upload-artifact@v3 - with: - name: ${{ env.current_artifact_name }} - path: ${{ env.libsquish_install_path }} - if-no-files-found: error diff --git a/.github/workflows/build-project.yml b/.github/workflows/build-project.yml new file mode 100644 index 0000000..c4a7005 --- /dev/null +++ b/.github/workflows/build-project.yml @@ -0,0 +1,34 @@ +name: Build Project +on: + workflow_dispatch: + push: + branches-ignore: + - 'master' + workflow_run: + workflows: Tag and Sync + types: completed + branches: dev + # This is the branch that the original workflow ran on, which is technically dev, due to how + # the "pull_request" trigger works (it works off master correctly for a merged PR but is triggered + # by dev + +jobs: + trigger-build: + name: Build Project + if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' + uses: oblivioncth/actions/.github/workflows/build-cxx-project.yml@v1 + secrets: + ffynnon_access: ${{ secrets.OBYBOT_FFYNNON_ACCESS }} + with: + pre_build_steps: | + - name: Install OpenMP lib [Linux] + if: env.run_is_linux == 'true' + shell: pwsh + run: | + if($Env:run_compiler.StartsWith('g++-')) { + sudo apt-get install libgomp1 + } elseif($Env:run_compiler.StartsWith('clang++-')) { + $ver = $Env:run_compiler.replace('clang++-', '') + $pkg = "libomp-${ver}-dev" + sudo apt-get install $pkg + } diff --git a/.github/workflows/check-release-pr.yml b/.github/workflows/check-release-pr.yml new file mode 100644 index 0000000..ec28ae1 --- /dev/null +++ b/.github/workflows/check-release-pr.yml @@ -0,0 +1,10 @@ +name: Check Release PR +on: + pull_request: + types: [opened, synchronize, reopened] + branches: master + +jobs: + check-pr-correctness: + name: Release PR Correctness Check + uses: oblivioncth/actions/.github/workflows/validate-release-pr.yml@v1 diff --git a/.github/workflows/generate-release.yml b/.github/workflows/generate-release.yml new file mode 100644 index 0000000..db607da --- /dev/null +++ b/.github/workflows/generate-release.yml @@ -0,0 +1,19 @@ +name: Generate Release +on: + workflow_run: + workflows: Build Project + types: completed + branches: master + +jobs: + generate-release: + name: Generate Release + permissions: + actions: read + contents: write + pages: write + id-token: write + if: github.event.workflow_run.conclusion == 'success' + uses: oblivioncth/actions/.github/workflows/generate-cxx-release.yml@v1 + with: + artifacts_run_id: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml new file mode 100644 index 0000000..a53d957 --- /dev/null +++ b/.github/workflows/label-pr.yml @@ -0,0 +1,12 @@ +name: Label PR +on: + pull_request_target: + types: [opened, synchronize, reopened] + +jobs: + label-pr: + name: Label pull-request + permissions: + contents: read + pull-requests: write + uses: oblivioncth/actions/.github/workflows/label-pr.yml@v1 diff --git a/.github/workflows/master-pull-request-checks.yml b/.github/workflows/master-pull-request-checks.yml deleted file mode 100644 index f434e64..0000000 --- a/.github/workflows/master-pull-request-checks.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Master pull-request checks -on: - pull_request: - types: [opened, synchronize, reopened] - branches: master - -jobs: - check-pr-correctness: - name: Master PR correctness check - runs-on: windows-latest - steps: - - name: Ensure higher version - uses: oblivioncth/actions/cmake/ensure-project-version-gt-tag@dev \ No newline at end of file diff --git a/.github/workflows/master-pull-request-merge-reaction.yml b/.github/workflows/master-pull-request-merge-reaction.yml deleted file mode 100644 index 5912c45..0000000 --- a/.github/workflows/master-pull-request-merge-reaction.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Master pull-request merge reaction -on: - pull_request: - types: [closed] - branches: - - 'master' -env: - doc_artifact_path: ${{ github.workspace }}/DocArtifact - artifacts_path: ${{ github.workspace }}/Artifacts - zips_path: ${{ github.workspace }}/Zips - -jobs: - tag_master_and_sync_dev: - name: Tag master merge commit, FF back to dev - if: github.event.pull_request.merged == true - runs-on: windows-latest - outputs: - new_version: ${{ steps.get-proj-ver.outputs.version }} - steps: - - name: Get project version - id: get-proj-ver - uses: oblivioncth/actions/cmake/get-project-version@dev - - name: Set Git user to ObyBotCI - uses: oblivioncth/actions/git/set-git-user-to-oby-bot@dev - - name: Tag master with new version tag - uses: oblivioncth/actions/git/tag@dev - with: - tag: 'v${{ steps.get-proj-ver.outputs.version }}' - message: 'Release v${{ steps.get-proj-ver.outputs.version }}' - - name: Move 'latest' tag - uses: oblivioncth/actions/git/move-latest-tag@dev - - name: Fast-forward merge master into to dev - if: always() - uses: oblivioncth/actions/git/merge-branches@dev - with: - source_branch: master - target_branch: dev - ff: only - - build_libsquish_release_windows: - name: Build libsquish Release (Windows) - needs: tag_master_and_sync_dev - if: github.event.pull_request.merged == true - uses: ./.github/workflows/build-libsquish-windows.yml - secrets: - ffynnon_cred: ${{ secrets.OBYBOT_FFYNNON_CREDS }} - - build_libsquish_release_linux: - name: Build libsquish Release (Linux) - needs: tag_master_and_sync_dev - if: github.event.pull_request.merged == true - uses: ./.github/workflows/build-libsquish-linux.yml - - update-docs: - name: Update gh-pages - needs: [build_libsquish_release_windows] - if: github.event.pull_request.merged == true - permissions: - contents: read - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.page-deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - name: Download built static libsquish artifact - uses: actions/download-artifact@v3 - with: - name: ${{ needs.build_libsquish_release_windows.outputs.doc_artifact_name }} - path: ${{ env.doc_artifact_path }} - - name: Setup pages - uses: actions/configure-pages@v3 - - name: Upload pages artifact - uses: actions/upload-pages-artifact@v1 - with: - path: ${{ env.doc_artifact_path }}/doc/html - - name: Deploy pages artifact - id: page-deployment - uses: actions/deploy-pages@v1 - - create-release: - name: Create GitHub release - needs: [update-docs, build_libsquish_release_windows, build_libsquish_release_linux, tag_master_and_sync_dev] - if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - name: Download built libsquish artifacts - uses: actions/download-artifact@v3 - with: - path: ${{ env.artifacts_path }} - - name: Zip up release artifacts - shell: pwsh - run: | - $artifact_folders = Get-ChildItem -Directory -Path "${{ env.artifacts_path }}" -Exclude "github-pages" - foreach($art_dir in $artifact_folders) - { - $name = $art_dir.name - $path = $art_dir.fullname - 7z a "${{ env.zips_path }}/${name}.zip" "${path}/*" - } - - name: Generate release - uses: softprops/action-gh-release@v1 - with: - name: "libsquish Release v${{ needs.tag_master_and_sync_dev.outputs.new_version }}" - tag_name: "v${{ needs.tag_master_and_sync_dev.outputs.new_version }}" - fail_on_unmatched_files: true - generate_release_notes: true - files: | - ${{ env.zips_path }}/*.zip - - \ No newline at end of file diff --git a/.github/workflows/pull-request-labeler.yml b/.github/workflows/pull-request-labeler.yml deleted file mode 100644 index 55df907..0000000 --- a/.github/workflows/pull-request-labeler.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Pull-request auto-labeler -on: - pull_request: - types: [opened] - -jobs: - label_pr: - name: Label pull-request - runs-on: ubuntu-latest - steps: - - name: Label via convention - uses: oblivioncth/actions/pull-request/label-pr-conventionally@dev - \ No newline at end of file diff --git a/.github/workflows/push-reaction.yml b/.github/workflows/push-reaction.yml deleted file mode 100644 index 889c982..0000000 --- a/.github/workflows/push-reaction.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: libsquish Push Reaction -on: - workflow_dispatch: - push: - branches-ignore: - - 'master' - -jobs: - trigger-windows-build: - name: Build libsquish (Windows) - uses: ./.github/workflows/build-libsquish-windows.yml - secrets: - ffynnon_cred: ${{ secrets.OBYBOT_FFYNNON_CREDS }} - - trigger-linux-build: - name: Build libsquish (Linux) - uses: ./.github/workflows/build-libsquish-linux.yml \ No newline at end of file diff --git a/.github/workflows/tag-release-commit-and-sync-dev.yml b/.github/workflows/tag-release-commit-and-sync-dev.yml new file mode 100644 index 0000000..c2589c1 --- /dev/null +++ b/.github/workflows/tag-release-commit-and-sync-dev.yml @@ -0,0 +1,14 @@ +name: Tag and Sync +on: + pull_request: + types: [closed] + branches: + - 'master' + +jobs: + tag-master-and-sync-dev: + name: Tag master merge commit, FF back to dev + if: github.event.pull_request.merged == true + permissions: + contents: write + uses: oblivioncth/actions/.github/workflows/tag-main-and-sync-dev.yml@v1 diff --git a/CMakeLists.txt b/CMakeLists.txt index dfd2a6f..6832596 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,14 +12,14 @@ cmake_minimum_required(VERSION 3.23.0...3.26.0) # Project # NOTE: DON'T USE TRAILING ZEROS IN VERSIONS project(Squish - VERSION 1.15.1.1 + VERSION 1.15.1.2 LANGUAGES CXX DESCRIPTION "S3TC/DXT compliant image compression" ) # Get helper scripts include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FetchOBCMake.cmake) -fetch_ob_cmake("v0.3") +fetch_ob_cmake("v0.3.5") # Initialize project according to standard rules include(OB/Project) @@ -44,7 +44,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # Import OpenMP if(LIBSQUISH_USE_OPENMP) - find_package(OpenMP COMPONENTS C CXX) + find_package(OpenMP COMPONENTS CXX) endif() # Target - Lib diff --git a/doc/cmake/file_templates/mainpage.md.in b/doc/cmake/file_templates/mainpage.md.in index 043db98..6695a45 100644 --- a/doc/cmake/file_templates/mainpage.md.in +++ b/doc/cmake/file_templates/mainpage.md.in @@ -33,7 +33,7 @@ Packaging ---------- libsquish is provided as a CMake package composed of a single library and accompanying public header file, along with a couple optional executables. -#### Package Components: +### Package Components: - `Squish` - The main library - `Generator` - The color lookup table generator application @@ -151,7 +151,7 @@ The requirements for building from source are the same as for using libsquish, w It is recommended to use a multi-configuration generators such as Ninja Multi-Config or Visual Studio. -#### CMake Options: +### CMake Options: - `LIBSQUISH_USE_OPENMP` - Build libsquish using the OpenMP parallelization library (ON) - `LIBSQUISH_USE_SSE2` - Build libsquish using the SSE2 extended x86 instructions (ON) - `LIBSQUISH_USE_ALTIVEC` - Build libsquish using PPC AltiVec instructions (OFF) @@ -160,7 +160,7 @@ It is recommended to use a multi-configuration generators such as Ninja Multi-C - `LIBSQUISH_TESTS` - Enable the libsquish test targets (OFF) - `BUILD_SHARED_LIBS` - Build libsquish as a shared library instead of a static one (OFF) -#### CMake Targets: +### CMake Targets: - `all` - Builds the library, documentation if enabled, and 'extra' executables if enabled - `install` - Installs the build output into `CMAKE_INSTALL_PREFIX` @@ -170,7 +170,7 @@ It is recommended to use a multi-configuration generators such as Ninja Multi-C - `libsquish_png` - Builds the PNG compressor demo - `libsquish_tst_...` - Builds test targets. To actually run tests, just build the general CMake tests target `test`. -#### CMake Install Components: +### CMake Install Components: - `libsquish` - Installs top-level files (README.md, CMake package configuration files, etc.) - `libsquish_docs` - Installs the libsquish documentation @@ -180,13 +180,16 @@ It is recommended to use a multi-configuration generators such as Ninja Multi-C If libsquish is configured as a sub-project, its install components are automatically removed from the default install component, as to not pollute the install directory of the top-level project. They can still be installed by directly referencing their component names as shown above. -#### Documentation: +### Documentation: In order for the `@DOC_TARGET_NAME@` target to be generated the CMake cache variable **LIBSQUISH_DOCS** must be set to *ON* when CMake is invoked: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cmake.exe (...) -D LIBSQUISH_DOCS=ON ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#### Package +### Tests: +The project contains a suite of tests to ensure that the library functions as intended. + +### Package By default, the project configures CPack to create an artifact ZIP containing all installed components. The following is the general build process required to successfully generate this package via a shadow build on Windows: diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 53f4243..0581da0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -7,7 +7,7 @@ set(squish_defs "") set(squish_opts "") if(LIBSQUISH_USE_OPENMP AND OpenMP_FOUND) - list(APPEND squish_links "OpenMP::OpenMP_C OpenMP::OpenMP_CXX") + list(APPEND squish_links "OpenMP::OpenMP_CXX") list(APPEND squish_defs "SQUISH_USE_OPENMP") endif()