Skip to content

Commit

Permalink
Merge pull request #1 from AnotherFoxGuy/conan
Browse files Browse the repository at this point in the history
🚧 Added support for building with conan
  • Loading branch information
cryham authored Feb 2, 2024
2 parents 362ef92 + 75051e9 commit 1384067
Show file tree
Hide file tree
Showing 27 changed files with 452 additions and 2,597 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/build-game.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
name: Build game

on: [ push, pull_request ]

jobs:
build-gcc:
name: Linux build on Ubuntu
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Cache conan
uses: actions/cache@v4
with:
key: conan-ubuntu-${{ hashFiles('conanfile.py') }}
path: ~/.conan2/

- name: Install dependencies
run: |
curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash
sudo apt-get update
sudo apt-get -y install \
pkg-config \
ninja-build \
nvidia-cg-toolkit \
libsdl2-dev \
libfreetype6-dev \
libfreeimage-dev \
libzzip-dev \
libois-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libx11-dev \
libxt-dev \
libxaw7-dev \
libxrandr-dev \
libopenjp2-7-dev \
libbullet-dev \
libbullet-extras-dev \
libtinyxml-dev \
libtinyxml2-dev \
libenet-dev \
libboost-system-dev \
libboost-thread-dev \
libboost-system-dev \
libboost-wave-dev
shell: bash

- name: Configure
run: |
conan profile detect --force
echo "tools.system.package_manager:mode = install" > ~/.conan2/global.conf
echo "tools.system.package_manager:sudo = True" >> ~/.conan2/global.conf
conan remote add rigs-of-rods-deps https://conan.cloudsmith.io/rigs-of-rods/deps/ -f
conan install . -s build_type=Release -b missing -pr:b=default -c tools.cmake.cmaketoolchain:generator="Ninja" -of build
cmake --preset conan-release -DBUILD_MASTER_SERVER=ON
shell: bash

- name: Build
run: |
cd build
ninja
shell: bash

- name: Clean Conan pkgs
run: conan cache clean "*" -sbd
shell: bash

build-msvc:
name: Windows build
runs-on: windows-2019
env:
BUILD_TOOLS_PATH: C:\apps\build-tools\
CONAN_USER_HOME_SHORT: None
steps:
- run: echo $env:BUILD_TOOLS_PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- uses: actions/checkout@v4
with:
submodules: true

- name: Install Build tools
run: git clone https://git.anotherfoxguy.com/AnotherFoxGuy/build-tools.git %BUILD_TOOLS_PATH%
shell: cmd

- name: Cache conan packages
uses: actions/cache@v4
with:
key: conan-windows-${{ hashFiles('conanfile.py') }}
path: ~/.conan2

- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.12.1

- name: Configure
run: |
conan remote add rigs-of-rods-deps https://conan.cloudsmith.io/rigs-of-rods/deps/ -f
conan install . -b missing -pr:b=tools/conan-profiles/vs-19-release-ninja -pr=tools/conan-profiles/vs-19-release-ninja -of build
cmake --preset conan-release -DCMAKE_INSTALL_PREFIX=redist -DCREATE_CONTENT_FOLDER=ON
shell: cmd

- name: Build
run: |
cd build
ninja
shell: cmd

- name: Clean Conan pkgs
run: conan cache clean "*" -sbd
shell: cmd
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ AndroidDependencies/
Build/
EmscriptenDependencies
EmscriptenBuild
cmake-build-*/
.idea/
_build
CMakeUserPresets.json
88 changes: 44 additions & 44 deletions CMake/Bootstrap.cmake
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@

set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG" )
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")

if( NOT APPLE )
if( CMAKE_BUILD_TYPE STREQUAL "" )
set( CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE )
endif()
else()
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ogre3d.\${PRODUCT_NAME:rfc1034identifier}")
endif()
if (NOT APPLE)
if (CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
else ()
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ogre3d.\${PRODUCT_NAME:rfc1034identifier}")
endif ()

if( NOT MSVC )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1 -g" )
set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual" )
#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-overloaded-virtual" )
endif()
if (NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual")
#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-overloaded-virtual" )
endif ()

if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info" )
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info")
endif ()

# Determine if we are compiling for a 32bit or 64bit system
if( NOT APPLE )
include(CheckTypeSize)
CHECK_TYPE_SIZE("void*" ARCH_PTR_SIZE BUILTIN_TYPES_ONLY)
if (ARCH_PTR_SIZE EQUAL 8)
set(PLATFORM_X64 TRUE)
else ()
set(PLATFORM_X64 FALSE)
endif ()
endif()
if (NOT APPLE)
include(CheckTypeSize)
CHECK_TYPE_SIZE("void*" ARCH_PTR_SIZE BUILTIN_TYPES_ONLY)
if (ARCH_PTR_SIZE EQUAL 8)
set(PLATFORM_X64 TRUE)
else ()
set(PLATFORM_X64 FALSE)
endif ()
endif ()

if( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
if( NOT PLATFORM_X64 )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
endif()
add_definitions( -DUNICODE -D_UNICODE )
endif()
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
if (NOT PLATFORM_X64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
endif ()
add_definitions(-DUNICODE -D_UNICODE)
endif ()

if( APPLE )
macro( add_recursive dir retVal )
file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m )
endmacro()
else()
macro( add_recursive dir retVal )
file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c )
endmacro()
endif()
if (APPLE)
macro(add_recursive dir retVal)
file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m)
endmacro()
else ()
macro(add_recursive dir retVal)
file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c)
endmacro()
endif ()
Loading

0 comments on commit 1384067

Please sign in to comment.