Skip to content

Commit

Permalink
🐛 Fixed build with conan
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherFoxGuy committed Feb 9, 2023
1 parent bc9e81b commit 36f04c7
Show file tree
Hide file tree
Showing 19 changed files with 399 additions and 2,513 deletions.
123 changes: 123 additions & 0 deletions .github/workflows/build-game.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
name: Build game

on: [ push, pull_request ]

jobs:
build-gcc:
name: Linux build on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
with:
submodules: true

- name: Cache conan
uses: actions/cache@v3.0.11
with:
key: conan-root-${{ hashFiles('conanfile.txt') }}
path: ~/.conan/

- 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 config set general.revisions_enabled=1
echo "tools.system.package_manager:mode = install" > ~/.conan/global.conf
echo "tools.system.package_manager:sudo = True" >> ~/.conan/global.conf
conan profile new --detect --force default
conan profile update conf.tools.cmake.cmaketoolchain:generator="Ninja" default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan remote add ror-conan https://git.anotherfoxguy.com/api/packages/rorbot/conan -f
mkdir build && cd build
conan install .. -s build_type=Release -b missing -pr:b=default
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_MASTER_SERVER=ON -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
shell: bash

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

- name: Clean Conan pkgs
run: conan remove "*" -fsb
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@v3.1.0
with:
submodules: true

- name: Install Build tools
shell: cmake -P {0}
run: |
file(MAKE_DIRECTORY $ENV{BUILD_TOOLS_PATH})
file(DOWNLOAD https://cdn.anotherfoxguy.com/build-tools.zip "$ENV{TMP}/build-tools.zip" SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf "$ENV{TMP}/build-tools.zip" WORKING_DIRECTORY "$ENV{BUILD_TOOLS_PATH}")
- name: Cache conan packages
uses: actions/cache@v3.0.11
with:
key: conan-${{ hashFiles('conanfile.txt') }}
path: ~/.conan

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

- name: Configure
run: |
conan config set general.revisions_enabled=1
conan remote add ror-conan https://git.anotherfoxguy.com/api/packages/rorbot/conan -f
mkdir build && cd build
conan install .. -b missing -pr:b=../tools/conan-profiles/vs-19-release-ninja
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=redist -DBUILD_MASTER_SERVER=ON -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"
shell: cmd

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

- name: Clean Conan pkgs
run: conan remove "*" -fsb
shell: cmd
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ AndroidDependencies/
Build/
EmscriptenDependencies
EmscriptenBuild
cmake-build-*/
.idea/
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 36f04c7

Please sign in to comment.