Skip to content

Commit

Permalink
🔧 Fixed build with Conan V2
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherFoxGuy committed May 2, 2023
1 parent f31e9e8 commit 2492840
Show file tree
Hide file tree
Showing 15 changed files with 140 additions and 94 deletions.
61 changes: 29 additions & 32 deletions .github/workflows/build-game.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ on: [ push, pull_request ]
jobs:
build-gcc:
name: Linux build on Ubuntu
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v3
with:
submodules: true

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

- name: Install dependencies
run: |
Expand Down Expand Up @@ -52,16 +52,12 @@ jobs:

- 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 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 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"
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
Expand All @@ -71,7 +67,7 @@ jobs:
shell: bash

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

build-msvc:
Expand All @@ -83,41 +79,42 @@ jobs:
steps:
- run: echo $env:BUILD_TOOLS_PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- uses: actions/checkout@v3.1.0
- uses: actions/checkout@v3
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}")
run: git clone https://git.anotherfoxguy.com/AnotherFoxGuy/build-tools.git %BUILD_TOOLS_PATH%
shell: cmd

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

- name: Enable Developer Command Prompt
uses: ilammy/[email protected].0
uses: ilammy/[email protected].1

- name: Configure
run: |
conan config set general.revisions_enabled=1
run: |
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"
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
ninja install
shell: cmd

- name: Upload redist folder
uses: actions/upload-artifact@v3
with:
name: stuntrally-win
path: build/redist

- name: Clean Conan pkgs
run: conan remove "*" -fsb
run: conan cache clean "*" -sbd
shell: cmd
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ Build/
EmscriptenDependencies
EmscriptenBuild
cmake-build-*/
.idea/
.idea/
_build
CMakeUserPresets.json
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ foreach (EXE ${EXE_LIST})

add_executable(${EXE} WIN32 ${EXE_SOURCES})

# Generate source groups for use in IDEs
source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${EXE_SOURCES})

foreach (subdir ${SRC_DIRS})
#message( STATUS ${subdir} )
target_include_directories(${EXE} PRIVATE ${subdir})
Expand All @@ -167,22 +170,24 @@ foreach (EXE ${EXE_LIST})
target_precompile_headers(${EXE} PRIVATE src/game/pch.h)
endif ()

# threads
target_link_libraries(
${EXE}
Boost::boost
${EXE}
PRIVATE
Threads::Threads
OGRE::OGRE
Bullet::Bullet
SDL2::SDL2
MyGUI::MyGUI
Vorbis::vorbis
Vorbis::vorbisfile
Ogg::ogg
OGRE::OGRE
OpenAL::OpenAL
SDL2::SDL2
Threads::Threads
Vorbis::vorbis
tinyxml2::tinyxml2
tinyxml::tinyxml
tinyxml2::tinyxml2
)

endforeach ()

message(STATUS "---------- SR end")

feature_summary(WHAT ALL)
34 changes: 34 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from conan import ConanFile


class StuntRally3(ConanFile):
name = "StuntRally3"
settings = "os", "compiler", "build_type", "arch"
generators = (
"CMakeDeps",
"CMakeToolchain",
)
default_options = {
"bullet3/*:extras": "True",
"bullet3/*:network_support": "True",
"sdl/*:sdl2main": "False",
}

def requirements(self):
self.requires("boost/1.81.0")
self.requires("ogre3d-next/2023.04@anotherfoxguy/stable" , override=True)
self.requires(
"bullet3/3.25@anotherfoxguy/patched"
) # Needs a patched to build on windows
self.requires("sdl/2.26.1")
self.requires("mygui-next/2023.04@anotherfoxguy/stable")
self.requires("ogg/1.3.5")
self.requires("vorbis/1.3.7")
self.requires("openal/1.22.2")
self.requires("enet/1.3.17")
self.requires("tinyxml/2.6.2")
self.requires("tinyxml2/9.0.0")

self.requires("libpng/1.6.39", override=True)
self.requires("libwebp/1.3.0", override=True)
self.requires("zlib/1.2.13", override=True)
27 changes: 0 additions & 27 deletions conanfile.txt

This file was deleted.

11 changes: 4 additions & 7 deletions tools/conan-profiles/vs-19-debug
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
compiler=msvc
compiler.version=192
compiler.runtime=dynamic
compiler.runtime_type=Debug
build_type=Debug
[options]
[build_requires]
[env]
8 changes: 4 additions & 4 deletions tools/conan-profiles/vs-19-debug-ninja
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
compiler=msvc
compiler.version=192
compiler.runtime=dynamic
compiler.runtime_type=Debug
build_type=Debug
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
11 changes: 4 additions & 7 deletions tools/conan-profiles/vs-19-release
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
compiler=msvc
compiler.version=192
compiler.runtime=dynamic
compiler.runtime_type=Release
build_type=Release
[options]
[build_requires]
[env]
8 changes: 4 additions & 4 deletions tools/conan-profiles/vs-19-release-ninja
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
compiler=msvc
compiler.version=192
compiler.runtime=dynamic
compiler.runtime_type=Release
build_type=Release
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
5 changes: 1 addition & 4 deletions tools/conan-profiles/vs-19-relwithdebinfo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@ arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
build_type=RelWithDebInfo
[options]
[build_requires]
[env]
build_type=RelWithDebInfo
8 changes: 8 additions & 0 deletions tools/conan-profiles/vs-22-debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[settings]
os=Windows
arch=x86_64
compiler=msvc
compiler.version=193
compiler.runtime=dynamic
compiler.runtime_type=Debug
build_type=Debug
10 changes: 10 additions & 0 deletions tools/conan-profiles/vs-22-debug-ninja
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
os=Windows
arch=x86_64
compiler=msvc
compiler.version=193
compiler.runtime=dynamic
compiler.runtime_type=Debug
build_type=Debug
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
8 changes: 8 additions & 0 deletions tools/conan-profiles/vs-22-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[settings]
os=Windows
arch=x86_64
compiler=msvc
compiler.version=193
compiler.runtime=dynamic
compiler.runtime_type=Release
build_type=Release
10 changes: 10 additions & 0 deletions tools/conan-profiles/vs-22-release-ninja
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
os=Windows
arch=x86_64
compiler=msvc
compiler.version=193
compiler.runtime=dynamic
compiler.runtime_type=Release
build_type=Release
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
8 changes: 8 additions & 0 deletions tools/conan-profiles/vs-22-relwithdebinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[settings]
os=Windows
arch=x86_64
compiler=msvc
compiler.version=193
compiler.runtime=dynamic
compiler.runtime_type=RelWithDebInfo
build_type=RelWithDebInfo

0 comments on commit 2492840

Please sign in to comment.