Skip to content

Commit

Permalink
enable vcpkg for all platforms on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcnor committed Apr 30, 2024
1 parent 95eacee commit 91ca41d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,25 @@ jobs:
run: |
sudo apt update
sudo apt install -y --no-install-recommends \
ninja-build cmake g++ libgtest-dev libsdl1.2-dev libsdl-image1.2-dev libncurses-dev zlib1g-dev
ninja-build cmake g++ libgtest-dev libsdl1.2-dev libsdl-image1.2-dev libncurses-dev zlib1g-dev \
libx11-dev libxft-dev libxext-dev \
libwayland-dev libxkbcommon-dev libegl1-mesa-dev \
libibus-1.0-dev autopoint
- name: Configure CMake
- uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: "501cb01e517ee5689577bb01ba8bd1b4c1041a53"

- name: Configure and build
uses: lukka/run-cmake@v10
env:
CC: ${{ matrix.os.cc }}
CXX: ${{ matrix.os.cxx }}
VCPKG_ROOT: C:/vcpkg
run: cmake --preset ${{ matrix.os.preset }} -DBUILD_TESTING=ON

- name: Build ${{ matrix.build_type }}
run: cmake --build --preset ${{ matrix.os.preset }} --config ${{ matrix.build_type }} --verbose
with:
configurePreset: ${{matrix.os.preset}}
configurePresetAdditionalArgs: "['-DBUILD_TESTING=ON']"
buildPreset: ${{matrix.os.preset}}
buildPresetAdditionalArgs: "['--config ${{matrix.build_type}}', '--verbose']"

- name: Run ${{ matrix.build_type }} Unittests
run: ctest --preset ${{ matrix.os.preset }} -C ${{ matrix.build_type }}
Expand Down
1 change: 0 additions & 1 deletion Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ cask "xquartz"

# SDL
brew "sdl12-compat"
brew "sdl2_image"

brew "cmake"
brew "googletest"
Expand Down
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,15 @@ add_custom_target(get_git_hash ALL
DEPENDS ${PROJECT_BINARY_DIR}/Descent3/d3_version.h
)

find_package(SDL2 CONFIG REQUIRED)
if(UNIX)
set(D3_GAMEDIR "~/Descent3/")

add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-Wno-multichar;${BITS};${EXTRA_CXX_FLAGS}>")
add_compile_options("$<$<COMPILE_LANGUAGE:C>:${BITS}>")

# FIXME: Remove after SDL2 port
find_package(SDL REQUIRED)
if(APPLE)
# Provide FIND_PACKAGE( SDL_image ) below with an include dir and library that work with brew-installed sdl2_image
find_path(SDL_IMAGE_INCLUDE_DIR NAMES SDL_image.h PATH_SUFFIXES include/SDL2)
find_library(SDL_IMAGE_LIBRARY NAMES SDL2_image)
endif()

find_package(SDL_image REQUIRED)
find_package(Curses REQUIRED)
find_package(OpenGL REQUIRED)
message("SDL Include Dir is " ${SDL_INCLUDE_DIR})
Expand Down
6 changes: 3 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{
"name": "defaults",
"hidden": true,
"binaryDir": "${sourceDir}/builds/${presetName}"
"binaryDir": "${sourceDir}/builds/${presetName}",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "win",
Expand All @@ -15,8 +16,7 @@
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"architecture": "Win32",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
"architecture": "Win32"
},
{
"name": "mac",
Expand Down
2 changes: 2 additions & 0 deletions Descent3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ add_executable(Descent3
${HEADERS} ${CPPS} ${PLATFORM_CPPS} ${INCS}
)
target_link_libraries(Descent3
$<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
2dlib AudioEncode bitmap cfile czip d3music ddio_common libmve libacm
fix grtext manage mem misc model module movie stream_audio
music networking physics renderer rtperformance sndlib ui unzip vecmat md5
Expand Down
13 changes: 12 additions & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
"builtin-baseline": "000d1bda1ffa95a73e0b40334fa4103d6f4d3d48",
"dependencies": [
"gtest",
"zlib"
"zlib",
{
"name": "sdl2",
"version>=": "2.30.1",
"features": ["x11", "wayland"],
"platform": "linux"
},
{
"name": "sdl2",
"version>=": "2.30.1",
"platform": "!linux"
}
]
}

0 comments on commit 91ca41d

Please sign in to comment.