From 0b2877a538db5572514a7f3fa4331098f32958dc Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 19:53:46 -0700 Subject: [PATCH] fixups --- .github/workflows/build-linux.yml | 11 +++++++---- .github/workflows/build.yml | 4 ++-- CMakeLists.txt | 30 ++++++++++++++++-------------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 51c933ef1..034cfc989 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -22,7 +22,7 @@ on: default: false stonesense: type: boolean - default: true + default: false extras: type: boolean default: false @@ -32,7 +32,7 @@ on: jobs: build-linux64: - name: Linux package + name: Build linux64 runs-on: ubuntu-22.04 steps: - name: Install basic build dependencies @@ -78,6 +78,8 @@ jobs: -G Ninja \ -DCMAKE_INSTALL_PREFIX=build/image \ -DCMAKE_BUILD_TYPE=Release \ + ${{ inputs.platform-files && '-DCMAKE_C_COMPILER_LAUNCHER=ccache' || '' }} \ + ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache' || '' }} \ -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} \ -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} \ -DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} \ @@ -90,6 +92,7 @@ jobs: - name: Build DFHack run: ninja -C build install - name: Run cpp tests + if: inputs.platform-files run: ninja -C build test - name: Trim cache if: inputs.platform-files @@ -98,7 +101,7 @@ jobs: ccache --cleanup ccache --show-stats - name: Format artifact name - if: ${{ inputs.append-date-and-hash }} + if: inputs.append-date-and-hash id: artifactname run: | echo name=${{ inputs.artifact-name }}-$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT @@ -106,5 +109,5 @@ jobs: if: inputs.artifact-name uses: actions/upload-artifact@v3 with: - name: ${{ inputs.append-date-and-hash && inputs.artifact-name || steps.artifactname.outputs.name}} + name: ${{ inputs.append-date-and-hash && steps.artifactname.outputs.name || inputs.artifact-name }} path: build/image/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73038b649..a2567132a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,8 @@ jobs: name: Build (Linux ${{ matrix.type }}, GCC ${{ matrix.gcc }}) uses: ./.github/workflows/build-linux.yml with: - artifact-name: ${{ matrix.artifact-name != 0 && matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }} - append-date-and-hash: ${{ matrix.append-date-and-hash }} + artifact-name: ${{ matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }} + append-date-and-hash: ${{ matrix.append-date-and-hash && true || false }} cache-id: ${{ matrix.type }} stonesense: ${{ matrix.stonesense }} docs: ${{ matrix.type == 'release' }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 2451b768a..b15cbf962 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,20 +289,22 @@ endif() find_package(ZLIB REQUIRED) include_directories(${ZLIB_INCLUDE_DIRS}) -# Download SDL release and extract into depends in the build dir -# all we need are the header files (including generated headers), so the same release package -# will work for all platforms -# (the above statement is untested for OSX) -set(SDL_VERSION 2.26.2) -set(SDL_ZIP_MD5 574daf26d48de753d0b1e19823c9d8bb) -set(SDL_ZIP_FILE SDL2-devel-${SDL_VERSION}-VC.zip) -set(SDL_ZIP_PATH ${dfhack_SOURCE_DIR}/depends/SDL2/) -download_file("https://github.com/libsdl-org/SDL/releases/download/release-${SDL_VERSION}/${SDL_ZIP_FILE}" - ${SDL_ZIP_PATH}${SDL_ZIP_FILE} - ${SDL_ZIP_MD5}) -file(ARCHIVE_EXTRACT INPUT ${SDL_ZIP_PATH}${SDL_ZIP_FILE} - DESTINATION ${SDL_ZIP_PATH}) -include_directories(${SDL_ZIP_PATH}/SDL2-${SDL_VERSION}/include) +if(BUILD_LIBRARY) + # Download SDL release and extract into depends in the build dir + # all we need are the header files (including generated headers), so the same release package + # will work for all platforms + # (the above statement is untested for OSX) + set(SDL_VERSION 2.26.2) + set(SDL_ZIP_MD5 574daf26d48de753d0b1e19823c9d8bb) + set(SDL_ZIP_FILE SDL2-devel-${SDL_VERSION}-VC.zip) + set(SDL_ZIP_PATH ${dfhack_SOURCE_DIR}/depends/SDL2/) + download_file("https://github.com/libsdl-org/SDL/releases/download/release-${SDL_VERSION}/${SDL_ZIP_FILE}" + ${SDL_ZIP_PATH}${SDL_ZIP_FILE} + ${SDL_ZIP_MD5}) + file(ARCHIVE_EXTRACT INPUT ${SDL_ZIP_PATH}${SDL_ZIP_FILE} + DESTINATION ${SDL_ZIP_PATH}) + include_directories(${SDL_ZIP_PATH}/SDL2-${SDL_VERSION}/include) +endif() if(APPLE) # libstdc++ (GCC 4.8.5 for OS X 10.6)