-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cmake config and vcpkg build configuration
- Loading branch information
1 parent
f2b250f
commit 3f77c66
Showing
4 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Build with VCPKG | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Allows you to run this workflow manually target the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- { os: windows-latest, env: Windows x86_64, triplet: x64-windows-static, binary: Release/retrotime.exe } | ||
- { os: macos-13, env: Mac Os x64, triplet: x64-osx, binary: retrotime } | ||
- { os: macos-latest, env: Mac Os arm64, triplet: arm64-osx, binary: retrotime } | ||
- { os: ubuntu-20.04, env: Ubuntu x86_64, triplet: x64-linux, binary: retrotime } | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
if: runner.os == 'Windows' | ||
- name: install vcpkg | ||
run : | | ||
git clone --depth 1 https://github.com/microsoft/vcpkg "$HOME/vcpkg" | ||
- name: bootstrap vcpkg | ||
if: runner.os == 'Windows' | ||
run: | | ||
cd "$HOME/vcpkg" | ||
"bootstrap-vcpkg.bat" | ||
- name: bootstrap vcpkg | ||
if: runner.os != 'Windows' | ||
run: | | ||
cd "$HOME/vcpkg" | ||
"./bootstrap-vcpkg.sh" | ||
- name: configure triplet | ||
run: | | ||
cp "$HOME/vcpkg/triplets/${{ matrix.triplet }}.cmake" "$HOME/vcpkg/triplets/community/${{ matrix.triplet }}-release-only.cmake" | ||
echo "set(VCPKG_BUILD_TYPE release)" >> "$HOME/vcpkg/triplets/community/${{ matrix.triplet }}-release-only.cmake" | ||
- name: Configure | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake "-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }}-release-only" "-DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake" .. | ||
- name: Build | ||
run: | | ||
cd build | ||
cmake --build . --config Release | ||
- name: Make Executable | ||
if: runner.os != 'Windows' | ||
run: | | ||
chmod +x build/${{ matrix.binary }} | ||
- name: Copy Game And Assets | ||
run: | | ||
mkdir ./Release | ||
mkdir ./Release/RetroTime | ||
cp retrotime.exe ./Release/RetroTime/ | ||
cp -R ./retrotimefs ./Release/RetroTime/ | ||
cp ./README.md ./Release/Retrotime/ | ||
cp ./LICENSE ./Release/Retrotime/ | ||
- name: Tar Gzip everything | ||
if: runner.os != 'Windows' | ||
run : | | ||
cd Release | ||
tar -czvf "../RetroTime ${{ matrix.env }}.tar.gz" RetroTime | ||
- name: Store build | ||
uses: actions/upload-artifact@v4 | ||
if: runner.os != 'Windows' | ||
with: | ||
name: RetroTime ${{ matrix.env }} | ||
path: ./RetroTime ${{ matrix.env }}.tar.gz | ||
- name: Store build | ||
uses: actions/upload-artifact@v4 | ||
if: runner.os == 'Windows' | ||
with: | ||
name: RetroTime ${{ matrix.env }} | ||
path: ./Release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{CMAKE_TOOLCHAIN_FILE}) | ||
set(CMAKE_TOOLCHAIN_FILE $ENV{CMAKE_TOOLCHAIN_FILE}) | ||
endif() | ||
|
||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
set(MACOSX TRUE) | ||
endif() | ||
|
||
project(ttftovircon) | ||
|
||
find_package(SDL2 CONFIG REQUIRED) | ||
find_package(SDL2_image CONFIG REQUIRED) | ||
find_package(SDL2_ttf CONFIG REQUIRED) | ||
find_package(SDL2_mixer CONFIG REQUIRED) | ||
find_package(SDL2_gfx CONFIG REQUIRED) | ||
|
||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS ON) | ||
file(GLOB SRC CONFIGURE_DEPENDS | ||
"${PROJECT_SOURCE_DIR}/src/*.cpp" | ||
"${PROJECT_SOURCE_DIR}/src/*.h" | ||
) | ||
|
||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") | ||
set(BUILD_SHARED_LIBS OFF) | ||
if (! ${MACOSX}) | ||
set(CMAKE_EXE_LINKER_FLAGS "-static") | ||
endif() | ||
|
||
add_executable(ttftovircon) | ||
target_sources(${PROJECT_NAME} PRIVATE ${SRC} ) | ||
if (! ${MACOSX}) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++) | ||
endif() | ||
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_image::SDL2_image-static SDL2_ttf::SDL2_ttf-static SDL2_mixer::SDL2_mixer-static SDL2_gfx::SDL2_gfx-static SDL2::SDL2main SDL2::SDL2-static) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"default-registry": { | ||
"kind": "git", | ||
"baseline": "e832b2a0d2c9bcf0f69160ee5c52c372112ac0f6", | ||
"repository": "https://github.com/microsoft/vcpkg" | ||
}, | ||
"registries": [ | ||
{ | ||
"kind": "artifact", | ||
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", | ||
"name": "microsoft" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"dependencies": [ | ||
"sdl2", | ||
"sdl2-image", | ||
"sdl2-ttf", | ||
"sdl2-mixer", | ||
"sdl2-gfx" | ||
] | ||
} |