mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-31 05:20:52 +01:00
build with clang
Linux CI switches to clang 22; fixes what that exposed - export on out-of-line member definitions, missing std includes, missing glm imports. GCC 16 still builds.
This commit is contained in:
26
.github/workflows/build.yml
vendored
26
.github/workflows/build.yml
vendored
@@ -37,12 +37,21 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y \
|
sudo apt-get install -y \
|
||||||
build-essential gcc-14 g++-14 ninja-build \
|
build-essential ninja-build wget lsb-release software-properties-common gnupg \
|
||||||
libgl1-mesa-dev libglew-dev libglfw3-dev \
|
libgl1-mesa-dev libglew-dev libglfw3-dev \
|
||||||
libpng-dev libopenal-dev libluajit-5.1-dev \
|
libpng-dev libopenal-dev libluajit-5.1-dev \
|
||||||
libserialport-dev libsndfile1-dev \
|
libserialport-dev libsndfile1-dev \
|
||||||
xorg-dev libxkbcommon-dev libwayland-dev wayland-protocols
|
xorg-dev libxkbcommon-dev libwayland-dev wayland-protocols
|
||||||
|
|
||||||
|
- name: Install LLVM/Clang 22
|
||||||
|
run: |
|
||||||
|
# Noble ships Clang 18, whose C++20 module support is not good enough
|
||||||
|
# for this tree; apt.llvm.org has current releases.
|
||||||
|
wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh
|
||||||
|
chmod +x /tmp/llvm.sh
|
||||||
|
sudo /tmp/llvm.sh 22
|
||||||
|
sudo apt-get install -y clang-tools-22 # clang-scan-deps, needed to scan modules
|
||||||
|
|
||||||
- name: Build current OpenAL Soft
|
- name: Build current OpenAL Soft
|
||||||
run: |
|
run: |
|
||||||
git clone --depth 1 --branch 1.24.2 https://github.com/kcat/openal-soft.git /tmp/openal-soft
|
git clone --depth 1 --branch 1.24.2 https://github.com/kcat/openal-soft.git /tmp/openal-soft
|
||||||
@@ -52,28 +61,19 @@ jobs:
|
|||||||
sudo cmake --install /tmp/openal-soft/build
|
sudo cmake --install /tmp/openal-soft/build
|
||||||
sudo ldconfig
|
sudo ldconfig
|
||||||
|
|
||||||
# A little bit of magic for unbreaking GCC. Not an issue for Clang and MSVC.
|
|
||||||
# Fix for specific hard-errors for a combo of: varargs and always_inline
|
|
||||||
- name: Patch GLM for GCC
|
|
||||||
run: |
|
|
||||||
sed -i 's/GLM_FUNC_QUALIFIER std::string format(const char\* message, \.\.\.)/inline std::string format(const char* message, ...)/' \
|
|
||||||
ref/glm/glm/gtx/string_cast.inl
|
|
||||||
grep -n "std::string format(const char\* message" ref/glm/glm/gtx/string_cast.inl
|
|
||||||
|
|
||||||
- name: Install SonarQube Cloud Build Wrapper
|
- name: Install SonarQube Cloud Build Wrapper
|
||||||
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6.0.0
|
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6.0.0
|
||||||
|
|
||||||
- name: Configure (CMake)
|
- name: Configure (CMake)
|
||||||
env:
|
env:
|
||||||
# C++20 named modules need GCC 14+; noble's default build-essential is GCC 13
|
CC: clang-22
|
||||||
CC: gcc-14
|
CXX: clang++-22
|
||||||
CXX: g++-14
|
|
||||||
run: |
|
run: |
|
||||||
cmake -S . -B build -G Ninja \
|
cmake -S . -B build -G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DWITH_BETTER_RENDERER=OFF \
|
-DWITH_BETTER_RENDERER=OFF \
|
||||||
-DWITH_ZMQ=OFF -DWITH_OPENVR=OFF -DUSE_LTO=OFF \
|
-DWITH_ZMQ=OFF -DWITH_OPENVR=OFF -DUSE_LTO=OFF \
|
||||||
-DCMAKE_CXX_FLAGS="-Wno-attributes -fno-inline-functions-called-once" \
|
-DCMAKE_CXX_FLAGS="-Wno-attributes" \
|
||||||
-DPython3_EXECUTABLE="$(which python3)"
|
-DPython3_EXECUTABLE="$(which python3)"
|
||||||
|
|
||||||
- name: Build under Build Wrapper
|
- name: Build under Build Wrapper
|
||||||
|
|||||||
22
.github/workflows/build_bin.yml
vendored
22
.github/workflows/build_bin.yml
vendored
@@ -149,7 +149,7 @@ jobs:
|
|||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
||||||
sudo apt-get install -y \
|
sudo apt-get install -y \
|
||||||
build-essential gcc-14 g++-14 ninja-build \
|
build-essential ninja-build wget lsb-release software-properties-common gnupg \
|
||||||
libgl1-mesa-dev \
|
libgl1-mesa-dev \
|
||||||
libglew-dev \
|
libglew-dev \
|
||||||
libglfw3-dev \
|
libglfw3-dev \
|
||||||
@@ -163,6 +163,15 @@ jobs:
|
|||||||
libwayland-dev \
|
libwayland-dev \
|
||||||
wayland-protocols
|
wayland-protocols
|
||||||
|
|
||||||
|
- name: Install LLVM/Clang 22
|
||||||
|
run: |
|
||||||
|
# Noble ships Clang 18, whose C++20 module support is not good enough
|
||||||
|
# for this tree; apt.llvm.org has current releases.
|
||||||
|
wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh
|
||||||
|
chmod +x /tmp/llvm.sh
|
||||||
|
sudo /tmp/llvm.sh 22
|
||||||
|
sudo apt-get install -y clang-tools-22 # clang-scan-deps, needed to scan modules
|
||||||
|
|
||||||
#
|
#
|
||||||
# Existing MaSzyna CI already builds OpenAL Soft 1.24.2,
|
# Existing MaSzyna CI already builds OpenAL Soft 1.24.2,
|
||||||
# so retain that instead of relying only on Ubuntu's package.
|
# so retain that instead of relying only on Ubuntu's package.
|
||||||
@@ -193,17 +202,16 @@ jobs:
|
|||||||
|
|
||||||
- name: Show environment
|
- name: Show environment
|
||||||
run: |
|
run: |
|
||||||
gcc-14 --version
|
clang-22 --version
|
||||||
g++-14 --version
|
clang-scan-deps-22 --version
|
||||||
ninja --version
|
ninja --version
|
||||||
cmake --version
|
cmake --version
|
||||||
python --version
|
python --version
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
env:
|
env:
|
||||||
# C++20 named modules need GCC 14+; noble's default build-essential is GCC 13
|
CC: clang-22
|
||||||
CC: gcc-14
|
CXX: clang++-22
|
||||||
CXX: g++-14
|
|
||||||
run: |
|
run: |
|
||||||
cmake \
|
cmake \
|
||||||
-S . \
|
-S . \
|
||||||
@@ -215,7 +223,7 @@ jobs:
|
|||||||
-DWITH_OPENVR=OFF \
|
-DWITH_OPENVR=OFF \
|
||||||
-DUSE_LTO=OFF \
|
-DUSE_LTO=OFF \
|
||||||
-DPython3_EXECUTABLE="${{ steps.python.outputs.python-path }}" \
|
-DPython3_EXECUTABLE="${{ steps.python.outputs.python-path }}" \
|
||||||
-DCMAKE_CXX_FLAGS="-Wno-attributes -fno-inline-functions-called-once"
|
-DCMAKE_CXX_FLAGS="-Wno-attributes"
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -483,14 +483,13 @@ target_sources(${PROJECT_NAME}
|
|||||||
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
|
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
# GCC's lazy loading of module interfaces trips over the simulation-core partition
|
# Clang is the compiler this project is built and tested with (Clang 22 in CI);
|
||||||
# ("failed to load pendings" / "Bad file data" while reading eu07.simcore:dynobj).
|
# it needs none of the workarounds below. GCC 16 still builds the tree, but only
|
||||||
# Loading eagerly avoids it; drop this once the compiler bug is fixed.
|
# with eager module loading: its lazy loading is broken here, reading
|
||||||
# GCC 16's lazy loading of module interfaces is broken for this project: reading
|
# eu07.simcore:dynobj gives "Bad file data" and eu07.glm gives "recursive lazy
|
||||||
# eu07.simcore:dynobj gives "Bad file data", and eu07.glm gives "recursive lazy
|
# load" / "failed to load pendings for glm::vec". Eager loading costs roughly
|
||||||
# load" / "failed to load pendings for glm::vec". Eager loading is the only way
|
# twice the memory per compiler process. Drop this and the job pool below once
|
||||||
# through, and it costs roughly twice the memory per compiler process.
|
# the compiler bug is fixed.
|
||||||
# Drop both this and the job pool below once the compiler bug is fixed.
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -fno-module-lazy)
|
target_compile_options(${PROJECT_NAME} PRIVATE -fno-module-lazy)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <memory>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <memory>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <memory>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
#include <memory>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "utilities/Globals_macros.h"
|
#include "utilities/Globals_macros.h"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <memory>
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <memory>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -213,6 +213,8 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // export -- out-of-line member definitions are not namespace-scope
|
||||||
|
// declarations, so they cannot carry `export`; the class itself is exported.
|
||||||
template <typename Type_>
|
template <typename Type_>
|
||||||
void
|
void
|
||||||
fixedstep_modifier<Type_>::update( Type_ &Variable, double const Timedelta ) const {
|
fixedstep_modifier<Type_>::update( Type_ &Variable, double const Timedelta ) const {
|
||||||
@@ -251,4 +253,5 @@ fixedstep_modifier<Type_>::deserialize( cParser &Input ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
} // export
|
} // export
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ module;
|
|||||||
#include "global_include/interfaces/ITexture_macros.h"
|
#include "global_include/interfaces/ITexture_macros.h"
|
||||||
|
|
||||||
module eu07.scene.scenenodegroups;
|
module eu07.scene.scenenodegroups;
|
||||||
|
import eu07.glm;
|
||||||
import eu07.simulation.simulation;
|
import eu07.simulation.simulation;
|
||||||
import eu07.utilities.globals;
|
import eu07.utilities.globals;
|
||||||
import eu07.simcore;
|
import eu07.simcore;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <variant>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "utilities/utilities_macros.h"
|
#include "utilities/utilities_macros.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export inline float Dot(const float4 &q1, const float4 &q2);
|
|||||||
export inline float4 &operator*=(float4 &v1, float const d);
|
export inline float4 &operator*=(float4 &v1, float const d);
|
||||||
export inline float4 Slerp(const float4 &q0, const float4 &q1, float t);
|
export inline float4 Slerp(const float4 &q0, const float4 &q1, float t);
|
||||||
export inline float3 operator*(const float4x4 &m, const float3 &v);
|
export inline float3 operator*(const float4x4 &m, const float3 &v);
|
||||||
inline glm::vec3 operator*(const float4x4 &m, const glm::vec3 &v);
|
export inline glm::vec3 operator*(const float4x4 &m, const glm::vec3 &v);
|
||||||
export inline float4x4 operator*(const float4x4 &m1, const float4x4 &m2);
|
export inline float4x4 operator*(const float4x4 &m1, const float4x4 &m2);
|
||||||
export inline float Det2x2(float a, float b, float c, float d);
|
export inline float Det2x2(float a, float b, float c, float d);
|
||||||
export inline float Det3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3);
|
export inline float Det3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3);
|
||||||
@@ -302,7 +302,7 @@ export inline float3 operator*(const float4x4 &m, const float3 &v) {
|
|||||||
v.x * m[0][2] + v.y * m[1][2] + v.z * m[2][2] + m[3][2]);
|
v.x * m[0][2] + v.y * m[1][2] + v.z * m[2][2] + m[3][2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline glm::vec3 operator*(const float4x4 &m, const glm::vec3 &v) {
|
export inline glm::vec3 operator*(const float4x4 &m, const glm::vec3 &v) {
|
||||||
return glm::vec3(
|
return glm::vec3(
|
||||||
v.x * m[0][0] + v.y * m[1][0] + v.z * m[2][0] + m[3][0],
|
v.x * m[0][0] + v.y * m[1][0] + v.z * m[2][0] + m[3][0],
|
||||||
v.x * m[0][1] + v.y * m[1][1] + v.z * m[2][1] + m[3][1],
|
v.x * m[0][1] + v.y * m[1][1] + v.z * m[2][1] + m[3][1],
|
||||||
|
|||||||
@@ -385,6 +385,8 @@ struct global_settings {
|
|||||||
export_as_text( std::ostream &Output, std::string const Key, Type_ const &Value ) const;
|
export_as_text( std::ostream &Output, std::string const Key, Type_ const &Value ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // export -- out-of-line member definitions are not namespace-scope
|
||||||
|
// declarations, so they cannot carry `export`; the class itself is exported.
|
||||||
template <typename Type_>
|
template <typename Type_>
|
||||||
void
|
void
|
||||||
global_settings::export_as_text( std::ostream &Output, std::string const Key, Type_ const &Value ) const {
|
global_settings::export_as_text( std::ostream &Output, std::string const Key, Type_ const &Value ) const {
|
||||||
@@ -392,9 +394,6 @@ global_settings::export_as_text( std::ostream &Output, std::string const Key, Ty
|
|||||||
Output << Key << " " << Value << "\n";
|
Output << Key << " " << Value << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // export -- out-of-line member definitions and explicit
|
|
||||||
// specialisations are not namespace-scope declarations, so they cannot
|
|
||||||
// carry `export`; the class itself is exported and that is what counts.
|
|
||||||
template <>
|
template <>
|
||||||
void
|
void
|
||||||
global_settings::export_as_text( std::ostream &Output, std::string const Key, std::string const &Value ) const;
|
global_settings::export_as_text( std::ostream &Output, std::string const Key, std::string const &Value ) const;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <memory>
|
||||||
#include "utilities/Globals_macros.h"
|
#include "utilities/Globals_macros.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|||||||
@@ -659,6 +659,9 @@ public:
|
|||||||
std::string OwnerName() const;
|
std::string OwnerName() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // export -- out-of-line member definitions are not namespace-scope
|
||||||
|
// declarations, so they cannot carry `export`; the class itself is exported.
|
||||||
|
|
||||||
inline TOrders TController::OrderCurrentGet() const {
|
inline TOrders TController::OrderCurrentGet() const {
|
||||||
return OrderList[ OrderPos ];
|
return OrderList[ OrderPos ];
|
||||||
}
|
}
|
||||||
@@ -667,4 +670,5 @@ inline TOrders TController::OrderNextGet() const {
|
|||||||
return OrderList[ OrderPos + 1 ];
|
return OrderList[ OrderPos + 1 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
} // export
|
} // export
|
||||||
|
|||||||
@@ -736,6 +736,8 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // export -- out-of-line member definitions are not namespace-scope
|
||||||
|
// declarations, so they cannot carry `export`; the class itself is exported.
|
||||||
inline
|
inline
|
||||||
void
|
void
|
||||||
basic_event::group( scene::group_handle Group ) {
|
basic_event::group( scene::group_handle Group ) {
|
||||||
@@ -762,6 +764,7 @@ basic_event::init_targets( TableType_ &Repository, std::string const &Targettype
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
} // export
|
} // export
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <memory>
|
||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module;
|
module;
|
||||||
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "utilities/Globals_macros.h"
|
#include "utilities/Globals_macros.h"
|
||||||
#include "vehicle/DynObj_macros.h"
|
#include "vehicle/DynObj_macros.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user