diff --git a/.github/workflows/build_vcpkg.yml b/.github/workflows/build_vcpkg.yml new file mode 100644 index 0000000..b654bec --- /dev/null +++ b/.github/workflows/build_vcpkg.yml @@ -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/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4033f84 --- /dev/null +++ b/CMakeLists.txt @@ -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) \ No newline at end of file diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..8bebdbe --- /dev/null +++ b/vcpkg-configuration.json @@ -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" + } + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..c2712cd --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,9 @@ +{ + "dependencies": [ + "sdl2", + "sdl2-image", + "sdl2-ttf", + "sdl2-mixer", + "sdl2-gfx" + ] +}