Skip to content

Commit

Permalink
linux vcpkg changes and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosciusz committed Jun 15, 2024
1 parent 3f0be36 commit e2e2f79
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@
# SPDX short identifier: MIT
#
# Source: https://raw.githubusercontent.com/lukka/CppBuildTasks-Validation/v10/.github/workflows/hosted-ninja-vcpkg_submod-autocache.yml
name: windows build
name: CI
on: [push, workflow_dispatch]

jobs:
job:
name: ${{ github.workflow }}
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
os: [windows, ubuntu]
include:
- os: windows
preset: windows-release
package: windows-release
- os: ubuntu
preset: linux-vcpkg
runs-on: ${{ matrix.os }}-latest
name: ${{ github.workflow }}-${{ matrix.os }}

steps:
- name: Checkout repository
Expand Down Expand Up @@ -48,11 +56,12 @@ jobs:
id: runcmake
with:
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
configurePreset: 'windows-release'
buildPreset: 'windows-release'
packagePreset: 'windows-release'
configurePreset: ${{ matrix.preset }}
buildPreset: ${{ matrix.preset }}
packagePreset: ${{ matrix.package }}

- name: Read output package name
if: ${{ matrix.package }}
id: readpkg
shell: bash
run: |
Expand All @@ -61,6 +70,7 @@ jobs:
echo "package_file_name=$PACKAGE_FILE_NAME" >> "$GITHUB_OUTPUT"
- name: Upload windows binaries artifact
if: ${{ matrix.package }}
uses: actions/upload-artifact@v4
with:
name: windows-binaries-${{ github.sha }}
Expand All @@ -72,6 +82,7 @@ jobs:
build/release/src/game/*.dll
- name: Upload windows installer artifact
if: ${{ matrix.package }}
uses: actions/upload-artifact@v4
with:
name: windows-installer-latest # keep only one artifact to limit storage requirements
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ build_*
/vsbuild/.vs/raceintospace/v16
CMakeUserPresets.json
.vscode
vcpkg_installed
vcpkg_installed
.cache
58 changes: 54 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "vcpkg",
"hidden": true,
"displayName": "Common vcpkg settings",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "./vcpkg/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "windows",
"displayName": "Windows build vcpkg & ninja settings",
Expand All @@ -30,17 +38,14 @@
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "./vcpkg/scripts/buildsystems/vcpkg.cmake",
"VCPKG_TARGET_TRIPLET": "x64-windows"
}
},
{
"name": "windows-release",
"displayName": "Windows release build",
"inherits": [
"release",
"vcpkg",
"windows"
]
},
Expand All @@ -49,8 +54,43 @@
"displayName": "Windows debug build",
"inherits": [
"debug",
"vcpkg",
"windows"
]
},
{
"name": "linux",
"displayName": "Linux build vcpkg & ninja settings",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "linux-release",
"displayName": "Linux release build",
"inherits": [
"release",
"linux"
]
},
{
"name": "linux-debug",
"displayName": "Linux debug build",
"inherits": [
"debug",
"linux"
]
},
{
"name": "linux-vcpkg",
"displayName": "Linux vcpkg debug build",
"inherits": [
"debug",
"vcpkg",
"linux"
]
}
],
"buildPresets": [
Expand All @@ -63,6 +103,16 @@
"name": "windows-debug",
"displayName": "Windows debug build",
"configurePreset": "windows-debug"
},
{
"name": "linux-release",
"displayName": "Linux release build",
"configurePreset": "linux-release"
},
{
"name": "linux-vcpkg",
"displayName": "Linux vcpkg build",
"configurePreset": "linux-vcpkg"
}
],
"packagePresets": [
Expand Down
4 changes: 2 additions & 2 deletions src/game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ set (ui_sources
find_package(Ogg REQUIRED)
find_package(unofficial-theora CONFIG REQUIRED)
find_package(PhysFS CONFIG REQUIRED)
find_package(JsonCPP REQUIRED)
find_package(jsoncpp REQUIRED)
find_package(cereal REQUIRED)
find_package(Boost REQUIRED)
find_package(ZLIB REQUIRED)
Expand All @@ -101,7 +101,7 @@ set(game_libraries
Ogg::ogg
unofficial::theora::theoradec
JsonCpp::JsonCpp
PhysFS::PhysFS
$<IF:$<TARGET_EXISTS:PhysFS::PhysFS>,PhysFS::PhysFS,PhysFS::PhysFS-static>
ZLIB::ZLIB
raceintospace_display
raceintospace_protobuf
Expand Down
8 changes: 5 additions & 3 deletions src/game/platform_misc/platform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ add_definitions(-DHAVE_SDL_GETENV)
# Make sure we can find fake_unistd.h
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/platform_misc)

# Add the platform-specific source files needed for testing
# Make sure music dependencies are met
find_package(Vorbis CONFIG REQUIRED)
list(APPEND ui_sources music_vorbis.cpp)
list(APPEND game_libraries Vorbis::vorbis)

set(app "raceintospace")

Expand All @@ -16,9 +18,9 @@ add_executable(${app}
platform_misc/main.c
)

target_link_libraries(${app} ${game_libraries})
target_link_libraries(${app} PRIVATE ${game_libraries})

add_dependencies(${app} libs)
# add_dependencies(${app} libs)
install(TARGETS raceintospace DESTINATION bin)

file(GLOB data_dirs "${PROJECT_SOURCE_DIR}/data/*")
Expand Down
2 changes: 1 addition & 1 deletion src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/utils")
#include_directories(SYSTEM ${png_INCLUDE_DIR})
find_package(PNG REQUIRED)
find_package(ZLIB REQUIRED)
find_package(JsonCpp REQUIRED)
find_package(jsoncpp REQUIRED)

add_executable(but2png EXCLUDE_FROM_ALL but2png.c)
set_target_properties(but2png PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)
Expand Down

0 comments on commit e2e2f79

Please sign in to comment.