Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 47 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
#os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
build_type: [Release]
c_compiler: [gcc, cl]
include:
Expand All @@ -35,49 +36,65 @@ jobs:
- os: ubuntu-latest
c_compiler: cl

env:
VULKAN_SDK: ""
VCPKG_ROOT: ${{ github.workspace }}/vcpkg

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

# configure vcpkg and set vcpkg dir to VCPKG_ROOT
- name: Setup vcpkg
uses: microsoft/vcpkg@master
- name: Preparing vcpkg
uses: actions/checkout@v2
with:
vcpkg-branch: master
vcpkg-directory: ${{ github.workspace }}/vcpkg
vcpkg-keep: true
vcpkg-commit: true
vcpkg-allow-outdated: true
vcpkg-triplets: ${{ matrix.triplets }}
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
repository: microsoft/vcpkg
path: ${{ github.workspace }}/vcpkg
ref: 8b04a7bd93bef991818fc372bb83ce00ec1c1c16

# install vulkan sdk whatever on windows or linux
- name: Install Vulkan SDK
if: matrix.triplets == 'x64-windows' || matrix.triplets == 'x64-linux'
- name: Configure vcpkg
run: |
if [ ${{ matrix.triplets }} == 'x64-windows' ]; then
choco install vulkan-sdk
else
sudo apt-get install libvulkan-dev
fi
cd ${{ github.workspace }}/vcpkg
./bootstrap-vcpkg.sh

# if windows set VULKAN_SDK to vulkan sdk path
- name: Set VULKAN_SDK
if: matrix.triplets == 'x64-windows'
- name: Prepare Vulkan SDK
uses: humbletim/setup-vulkan-sdk@v1.2.0
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true

# add libsdl2 libsdl2-image
- name: Install dependencies (Linux)
if: matrix.triplets == 'x64-linux'
run: |
echo "VULKAN_SDK=C:/Program Files/LunarG/VulkanSDK/
sudo apt-get install libsdl2-dev libsdl2-image-dev

- name: Configure CMake
- name: Configure CMake (Linux)
if: matrix.triplets == 'x64-linux'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
--preset=${{ matrix.triplets }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
cmake -B ${{ steps.strings.outputs.build-output-dir }} \
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-S ${{ github.workspace }} \

- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Configure CMake (Windows)
if: matrix.triplets == 'x64-windows'
run: |
cmake -B ${{ steps.strings.outputs.build-output-dir }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -S ${{ github.workspace }}

- name: Build (Linux)
if: matrix.triplets == 'x64-linux'
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -- -j 16

- name: Build (Windows)
if: matrix.triplets == 'x64-windows'
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -- /maxcpucount:16
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ GameResources
vcpkg_installed
.idea

!third-party/**/*.lib
!third-party/**/*.bin
!third-party/**/*.so

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

Expand Down
23 changes: 18 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
cmake_minimum_required(VERSION 3.0)
message("Unnamed O2 Game Clone Project - CMake Build System")

# check if CXX_COMPILER is not cl.exe then set
# check CMAKE_TOOLCHAIN_FILE
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
SET(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "cmake_tool_chain_file")
endif()

project(O2Game)

Expand Down Expand Up @@ -91,21 +94,31 @@ endif()
message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE} ${LIB_INDEX}")

if (WIN32)
set(BASS "${PROJECT_SOURCE_DIR}/third-party/lib/${O2GAME_PLATFORM}-windows/${CMAKE_BUILD_TYPE}/bass.lib")
set(BASS_FX "${PROJECT_SOURCE_DIR}/third-party/lib/${O2GAME_PLATFORM}-windows/${CMAKE_BUILD_TYPE}/bass_fx.lib")

set(THIRD_PARTY_LIBS
"${PROJECT_SOURCE_DIR}/third-party/lib/${O2GAME_PLATFORM}-windows/${CMAKE_BUILD_TYPE}/bass.lib"
"${PROJECT_SOURCE_DIR}/third-party/lib/${O2GAME_PLATFORM}-windows/${CMAKE_BUILD_TYPE}/bass_fx.lib"
${BASS}
${BASS_FX}
)

elseif (UNIX AND NOT APPLE)
set(BASS "${PROJECT_SOURCE_DIR}/third-party/bin/${O2GAME_PLATFORM}-linux/${CMAKE_BUILD_TYPE}/libbass.so")
set(BASS_FX "${PROJECT_SOURCE_DIR}/third-party/bin/${O2GAME_PLATFORM}-linux/${CMAKE_BUILD_TYPE}/libbass_fx.so")

set(THIRD_PARTY_LIBS
"${PROJECT_SOURCE_DIR}/third-party/lib/${O2GAME_PLATFORM}-linux/${CMAKE_BUILD_TYPE}/libbass.so"
"${PROJECT_SOURCE_DIR}/third-party/lib/${O2GAME_PLATFORM}-linux/${CMAKE_BUILD_TYPE}/libbass_fx.so"
${BASS}
${BASS_FX}
dl
pthread
m
)
endif()

if (NOT EXISTS ${BASS} OR NOT EXISTS ${BASS_FX})
message(FATAL_ERROR "BASS or BASS_FX not found")
endif()

# check if FREETYPE_LIBRAIES is a list then check first index if optimized
if (FREETYPE_LIBRARIES MATCHES ";")
list(GET FREETYPE_LIBRARIES ${LIB_INDEX} LIB_FREETYPE)
Expand Down
Binary file added third-party/bin/x64-linux/Release/libbass.so
Binary file not shown.
Binary file added third-party/bin/x64-linux/Release/libbass_fx.so
Binary file not shown.