-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: use conan for dependencies #1818
base: master
Are you sure you want to change the base?
Changes from all commits
0dc7286
f2ea85d
694223e
077849c
2a38f63
e31663c
79acf1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
from conan import ConanFile, __version__ as conan_version | ||
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout | ||
from conan.tools.files import load | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.scm import Version | ||
import os | ||
|
||
required_conan_version = ">=2.0.0" | ||
|
||
class RecoilConan(ConanFile): | ||
name = "recoil" | ||
license = "GPL-2.0-or-later" | ||
homepage = "https://github.com/beyond-all-reason/spring" | ||
description = "Recoil is an open source real time strategy game engine." | ||
topics = ("game-engine", "open-source") | ||
package_type = "application" | ||
version="105.0" | ||
|
||
exports_sources = "CMakeLists.txt", "src/*", "cmake/*", "cpack/*", "docs/*", "examples/*", "share/*", "tests/*",\ | ||
"VERSION", "README.md" | ||
no_copy_source = True | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = { | ||
} | ||
default_options = { | ||
} | ||
|
||
@property | ||
def _testing_enabled(self): | ||
return not self.conf.get("tools.build:skip_test", default=True, check_type=bool) | ||
|
||
def requirements(self): | ||
self.requires("opengl/system") | ||
self.requires("glew/2.2.0") | ||
self.requires("zlib/1.2.13") | ||
self.requires("devil/1.8.0") | ||
self.requires("libunwind/1.8.1", force=True) | ||
self.requires("zstd/1.5.6", override=True) | ||
#self.requires("libpng/1.6.37") | ||
#self.requires("giflib/5.2.1") | ||
self.requires("ogg/1.3.5") | ||
self.requires("vorbis/1.3.7") | ||
self.requires("sdl/2.0.20") | ||
self.requires("libcurl/7.88.1") | ||
self.requires("openal-soft/1.23.1") | ||
|
||
def configure(self): | ||
self.options["glew"].with_glu = "system" | ||
self.options["openal-soft"].shared = True | ||
if self.settings.os == "Linux": | ||
self.options["sdl"].wayland = False # Disable wayland build for now | ||
self.options["sdl"].pulse = False | ||
self.options["sdl"].alsa = False | ||
|
||
def build_requirements(self): | ||
pass | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.user_presets_path = False | ||
tc.generate() | ||
|
||
deps = CMakeDeps(self) | ||
deps.generate() | ||
|
||
def validate(self): | ||
check_min_cppstd(self, "20") | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
if self._testing_enabled: | ||
cmake.test() | ||
|
||
def package(self): | ||
cmake = CMake(self) | ||
cmake.install() | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
build_folder = self.conf.get("user.cmake.cmake_layout:build_folder", | ||
default=f"cmake-build-{str(self.settings.build_type).lower()}") | ||
|
||
self.folders.build = build_folder | ||
self.folders.generators = f"{build_folder}/conan" | ||
self.folders.source = "." | ||
self.cpp.source.includedirs = "src" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,33 @@ RUN apt-get update \ | |
&& add-apt-repository ppa:ubuntu-toolchain-r/test --yes \ | ||
&& apt-get update \ | ||
&& apt-get install --no-install-recommends --yes \ | ||
curl gcc-13 g++-13 git ninja-build curl p7zip-full python3-pip python3-setuptools \ | ||
libsdl2-dev libopenal-dev libfreetype6-dev libfontconfig1-dev \ | ||
curl gcc-13 g++-13 git ninja-build p7zip-full python3.8 python3.8-distutils \ | ||
xz-utils build-essential \ | ||
libgl-dev \ | ||
libglu-dev \ | ||
xorg-dev \ | ||
libxcb1-dev \ | ||
libxcb-util-dev \ | ||
libxcb-render-util0-dev \ | ||
libxcb-xkb-dev \ | ||
libxcb-icccm4-dev \ | ||
libxcb-image0-dev \ | ||
libxcb-keysyms1-dev \ | ||
libxcb-xinerama0-dev \ | ||
libxcb-cursor-dev \ | ||
libxcb-composite0-dev \ | ||
libxcb-ewmh-dev \ | ||
libxcb-res0-dev \ | ||
Comment on lines
+14
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are added because conan's |
||
uuid-dev \ | ||
&& apt-get remove --purge --yes software-properties-common \ | ||
&& apt-get autoremove --purge --yes \ | ||
&& apt-get upgrade --yes \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# pip for python3.8 | ||
RUN curl -L -O https://bootstrap.pypa.io/get-pip.py && python3.8 get-pip.py && rm get-pip.py | ||
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 10 | ||
|
||
# We need a newer ccache for compression support | ||
ARG CCACHE_VERSION="4.10.2" | ||
RUN curl -L -O https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz \ | ||
|
@@ -33,16 +53,17 @@ RUN git clone --depth 1 --branch v1.5.6 https://github.com/facebook/zstd.git \ | |
|
||
RUN pip3 install --upgrade pip \ | ||
&& pip3 install scikit-build \ | ||
&& pip3 install cmake==3.27.* | ||
&& pip3 install cmake==3.27.* \ | ||
&& pip3 install conan==2.10.2 | ||
|
||
WORKDIR /build | ||
RUN mkdir src cache out artifacts && chmod a+rwx cache out artifacts | ||
|
||
# Fetch library dependencies and configure resolution | ||
RUN git clone --depth=1 https://github.com/beyond-all-reason/spring-static-libs.git -b 18.04 spring-static-libs | ||
ENV PKG_CONFIG_LIBDIR=/build/spring-static-libs/lib/pkgconfig | ||
ENV PKG_CONFIG="pkg-config --define-prefix --static" | ||
ENV CMAKE_PREFIX_PATH=/build/spring-static-libs/ | ||
#RUN git clone --depth=1 https://github.com/beyond-all-reason/spring-static-libs.git -b 18.04 spring-static-libs | ||
#ENV PKG_CONFIG_LIBDIR=/build/spring-static-libs/lib/pkgconfig | ||
#ENV PKG_CONFIG="pkg-config --define-prefix --static" | ||
#ENV CMAKE_PREFIX_PATH=/build/spring-static-libs/ | ||
ENV PREFER_STATIC_LIBS=TRUE | ||
|
||
# Set up default cmake toolchain | ||
|
@@ -54,3 +75,4 @@ COPY ccache.conf . | |
ENV CCACHE_CONFIGPATH=/build/ccache.conf | ||
ENV CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
ENV CMAKE_C_COMPILER_LAUNCHER=ccache | ||
ENV CONAN_HOME=/build/.conan2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[settings] | ||
arch=x86_64 | ||
build_type=RelWithDebInfo | ||
compiler=gcc | ||
compiler.cppstd=gnu20 | ||
compiler.libcxx=libstdc++11 | ||
compiler.version=13 | ||
os=Linux | ||
|
||
[conf] | ||
tools.build:compiler_executables={'c': '/usr/bin/gcc-13', 'cpp': '/usr/bin/g++-13' } | ||
tools.cmake.cmaketoolchain:user_toolchain+=/build/toolchain.cmake | ||
user.cmake.cmake_layout:build_folder=/build/out | ||
tools.build.cross_building:cross_build=True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[settings] | ||
arch=x86_64 | ||
build_type=RelWithDebInfo | ||
compiler=gcc | ||
compiler.cppstd=gnu20 | ||
compiler.libcxx=libstdc++11 | ||
compiler.version=13 | ||
os=Linux | ||
|
||
[conf] | ||
tools.build:compiler_executables={'c': '/usr/bin/gcc-13', 'cpp': '/usr/bin/g++-13' } | ||
tools.cmake.cmaketoolchain:user_toolchain+=/build/toolchain.cmake | ||
user.cmake.cmake_layout:build_folder=/build/out | ||
tools.build.cross_building:cross_build=True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
export CMAKE_TOOLCHAIN_FILE= | ||
|
||
conan install \ | ||
-u \ | ||
-r conancenter \ | ||
-pr:h conan_profile \ | ||
-pr:b conan_build_profile \ | ||
--build=missing \ | ||
/build/src |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
conan graph info \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This prints out useful info (i.e. what all packages are being built and what packages are depending on other packages) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's non-obvious enough to require a comment here, it probably warrants a proper comment in the file. Ditto for the other one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can do so, I mostly commented as I'm not sure how familiar people are with conan |
||
-u \ | ||
-r conancenter \ | ||
-pr:h conan_profile \ | ||
-pr:b conan_build_profile \ | ||
--format=html \ | ||
/build/src > /build/out/graph.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? I use engine natively on Wayland
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right now I had a lot of issues with the SDL recipe to actually build with wayland. I'll try and get it working before making the PR ready