diff --git a/.gitignore b/.gitignore index 656c726..bd0ec68 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,7 @@ .vscode/ CMakeUserPresets.json cmake-build/ -cmake-build-debug/ -cmake-build-release/ +cmake-build-*/ conan_provider.cmake spectator/valid_chars.inc venv/ \ No newline at end of file diff --git a/Dockerfiles/Ubuntu.Dockerfile b/Dockerfiles/Ubuntu.Dockerfile index 97662a8..690e193 100644 --- a/Dockerfiles/Ubuntu.Dockerfile +++ b/Dockerfiles/Ubuntu.Dockerfile @@ -1,21 +1,26 @@ # Use the official Ubuntu base image from Docker Hub FROM ubuntu:latest -# Add a few required packages for building and developer tools -RUN apt-get update && apt-get install -y \ +# Add a few required packages for building and developer tools. build.sh requires gcc-15, which comes from the same +# toolchain PPA that CI uses. +RUN apt-get update && apt-get install -y software-properties-common \ + && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ + && apt-get update && apt-get install -y \ vim \ git \ python3 \ python3-venv \ - gcc-13\ - g++-13 \ + gcc-15 \ + g++-15 \ + binutils-dev \ + libiberty-dev \ cmake \ build-essential # Create a default working directory WORKDIR /home/ubuntu/spectator-cpp -# Copy all files & folders in the projects root directory +# Copy all files & folders in the projects root directory # Exclude files listed in the dockerignore file COPY ../ /home/ubuntu/spectator-cpp diff --git a/Dockerfiles/Ubuntu.Dockerfile.dockerignore b/Dockerfiles/Ubuntu.Dockerfile.dockerignore index 462844a..d2a6416 100644 --- a/Dockerfiles/Ubuntu.Dockerfile.dockerignore +++ b/Dockerfiles/Ubuntu.Dockerfile.dockerignore @@ -1,2 +1,3 @@ -# Ignore copying the default build folder if it exists -cmake-build/ \ No newline at end of file +# Ignore copying the build folders and the host's virtual environment, which the image rebuilds for Linux +cmake-build*/ +venv/ \ No newline at end of file diff --git a/build.sh b/build.sh index 17f22ba..773f739 100755 --- a/build.sh +++ b/build.sh @@ -50,12 +50,15 @@ if [[ ! -f "$HOME/.conan2/profiles/default" ]]; then conan profile detect fi -## Modify the default profile to set the compiler version and C++ standard +## Modify the default profile to set the C++ standard, and on Linux the compiler version. On macOS, `conan profile detect` +## records the Apple clang version itself. DEFAULT_PROFILE="$HOME/.conan2/profiles/default" -sed -i.bak -E \ - -e 's/^compiler\.version=.*/compiler.version=15.2/' \ - -e 's/^compiler\.cppstd=.*/compiler.cppstd=23/' \ - "$DEFAULT_PROFILE" +PROFILE_EDITS=(-e 's/^compiler\.cppstd=.*/compiler.cppstd=23/') +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + # The build requires gcc-15 (checked above), and Conan accepts the major version for gcc. + PROFILE_EDITS+=(-e 's/^compiler\.version=.*/compiler.version=15/') +fi +sed -i.bak -E "${PROFILE_EDITS[@]}" "$DEFAULT_PROFILE" rm -f "$DEFAULT_PROFILE.bak" if [[ ! -d $BUILD_DIR ]]; then