diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a310f076..3174e24ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,11 @@ name: Build -on: [push, pull_request] +on: + push: + paths-ignore: + - 'docs/**' + pull_request: + paths-ignore: + - 'docs/**' env: BUILD_TYPE: Release jobs: @@ -14,7 +20,6 @@ jobs: os: windows-latest cc: "cl" cxx: "cl" - environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat" - name: "Ubuntu Latest GCC" os: ubuntu-latest cc: "gcc" @@ -25,9 +30,17 @@ jobs: cxx: "clang++" steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: 'recursive' + - name: Resolve MSVC environment (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath + $vcvars = Join-Path $vsPath "VC\Auxiliary\Build\vcvars64.bat" + echo "VCVARS64=$vcvars" >> $env:GITHUB_ENV - name: Cache vcpkg installed libraries uses: actions/cache@v3 with: @@ -73,11 +86,10 @@ jobs: run: | set(ENV{CC} ${{ matrix.config.cc }}) set(ENV{CXX} ${{ matrix.config.cxx }}) - # If we are on windows, run the environment script, parse it with cmake - # and set environment variables with it (required for Visual Studio) - if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") + + if ("${{ runner.os }}" STREQUAL "Windows") execute_process( - COMMAND "${{ matrix.config.environment_script }}" && set + COMMAND "$ENV{VCVARS64}" && set OUTPUT_FILE environment_script_output.txt ) file(STRINGS environment_script_output.txt output_lines) @@ -119,11 +131,9 @@ jobs: - name: Build shell: cmake -P {0} run: | - # If we are on windows, run the environment script, parse it with cmake - # and set environment variables with it (required for Visual Studio) - if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") + if ("${{ runner.os }}" STREQUAL "Windows") execute_process( - COMMAND "${{ matrix.config.environment_script }}" && set + COMMAND "$ENV{VCVARS64}" && set OUTPUT_FILE environment_script_output.txt ) file(STRINGS environment_script_output.txt output_lines) diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml deleted file mode 100644 index bde566e98..000000000 --- a/.github/workflows/coverity.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Coverity -on: - schedule: - - cron: "0 7 * * 1" - workflow_dispatch: -jobs: - build: - name: Coverity - runs-on: ubuntu-latest - environment: Coverity - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - name: Install package dependencies - id: cmake_and_ninja - shell: cmake -P {0} - run: | - execute_process(COMMAND sudo apt-get update) - execute_process(COMMAND sudo apt-get install libcairo2-dev) - execute_process(COMMAND sudo apt-get install libgtk-3-dev) - execute_process(COMMAND sudo apt-get install ninja-build) - execute_process(COMMAND sudo apt-get install libwebp-dev) - execute_process(COMMAND sudo apt-get install wget) - - name: Download Coverity Build Tool - run: | - wget -q https://scan.coverity.com/download/linux64 --post-data "token=$TOKEN&project=cycfi%2Felements" -O cov-analysis-linux64.tar.gz - mkdir cov-analysis-linux64 - tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 - env: - TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} - - name: Configure - shell: cmake -P {0} - run: | - set(ENV{CC} gcc) - set(ENV{CXX} g++) - - execute_process( - COMMAND ${CMAKE_COMMAND} - -S . - -B build - -D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} - -G Ninja - -D CMAKE_MAKE_PROGRAM=ninja - RESULT_VARIABLE result - ERROR_VARIABLE error_message - ) - - if (NOT result EQUAL 0) - message(FATAL_ERROR "Could not run with ${CMAKE_COMMAND}: Got ${error_message} - ${result}") - endif() - - name: Build - shell: cmake -P {0} - run: | - execute_process( - COMMAND cov-analysis-linux64/bin/cov-build --dir cov-int ${CMAKE_COMMAND} --build build - RESULT_VARIABLE result - ERROR_VARIABLE error_message - ) - - if (NOT result EQUAL 0) - message(FATAL_ERROR "Could not run with ${CMAKE_COMMAND}: Got ${error_message} - ${result}") - endif() - - name: Submit the result to Coverity Scan - run: | - tar czvf elements.tgz cov-int - curl \ - --form token=$TOKEN \ - --form email=$EMAIL \ - --form file=@elements.tgz \ - --form version="master" \ - --form description="master" \ - https://scan.coverity.com/builds?project=cycfi%2Felements - env: - TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} - EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }} diff --git a/.gitignore b/.gitignore index c0efa808e..af5457d19 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ xcuserdata/ /.vscode/ /.idea/ /build/ +/build-*/ /cmake-build-debug/ /cmake-build-release/ /.vs/ @@ -34,3 +35,6 @@ xcuserdata/ /docs/antora/node_modules/ /docs/antora/build/ /.cache/ +/vcpkg_installed/ +/lib/artist/ +/ai/ diff --git a/cmake/ElementsConfigApp.cmake b/cmake/ElementsConfigApp.cmake index 437d6441a..42c4b29fe 100644 --- a/cmake/ElementsConfigApp.cmake +++ b/cmake/ElementsConfigApp.cmake @@ -100,7 +100,7 @@ elseif (WIN32) if (MSVC) - if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + if (CMAKE_BUILD_TYPE STREQUAL "Debug") set_property(TARGET ${ELEMENTS_APP_PROJECT} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDebug" ) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 70543b675..119eb3a2e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -295,7 +295,7 @@ elseif (WIN32) BOOST_REGEX_NO_LIB ) - if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + if (CMAKE_BUILD_TYPE STREQUAL "Debug") set_property(TARGET elements PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDebug" ) diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000..b543b334b --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,6 @@ +{ + "name": "elements", + "version-date": "2026-06-20", + "dependencies": ["pkgconf", "cairo", "fontconfig", "freetype", "libwebp"], + "builtin-baseline": "566f9496b7e00ee0cc00aca0ab90493d122d148a" +}