Compare commits
4 Commits
fix-proper
...
andrea-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e09a614fa5 | ||
|
|
7f6323403d | ||
|
|
a53b3051de | ||
|
|
c53570192f |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
CMakeFiles/
|
||||
build/
|
||||
build*/
|
||||
.cache/
|
||||
CMakeUserPresets.json
|
||||
build_warnings*.log
|
||||
final_build.log
|
||||
cmake_configure.log
|
||||
|
||||
14
CLAUDE.md
14
CLAUDE.md
@@ -12,7 +12,7 @@ export MAMBA_ROOT_PREFIX="/home/share/micromamba"
|
||||
eval "$(/home/share/micromamba/bin/micromamba shell hook --shell bash)"
|
||||
micromamba activate mutom
|
||||
|
||||
# Configure (from repo root, using Conan preset)
|
||||
# Configure (from repo root, using Conan preset — uses Ninja + ccache)
|
||||
cmake --preset conan-release
|
||||
|
||||
# Build everything
|
||||
@@ -40,6 +40,18 @@ conan install . --output-folder=build --build=missing
|
||||
cmake --preset conan-release
|
||||
```
|
||||
|
||||
### Build acceleration (already configured)
|
||||
- **Ninja** generator — used automatically via the conan default profile (`~/.conan2/profiles/default`)
|
||||
- **ccache** — enabled via `CMAKE_CXX_COMPILER_LAUNCHER=ccache`; cached rebuilds are nearly instant (~0.3s vs ~25s cold)
|
||||
- **Clang 22 + lld** profile available (`~/.conan2/profiles/fast`) but blocked by template overload ambiguities in `src/Core/Archives.h` that need fixing for full compatibility
|
||||
|
||||
To reconfigure with the fast profile once Archives.h is fixed:
|
||||
```bash
|
||||
conan install . --output-folder=build --build=missing --profile=fast
|
||||
cmake -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build -j$(nproc)
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
**uLib** is a C++ framework for Cosmic Muon Tomography (CMT), structured as layered shared libraries:
|
||||
|
||||
@@ -169,6 +169,26 @@ if(Geant4_FOUND)
|
||||
add_compile_definitions(HAVE_GEANT4)
|
||||
set(HAVE_GEANT4 1)
|
||||
|
||||
# Workaround: Geant4's G4EXPATShim creates EXPAT::EXPAT (uppercase) with
|
||||
# IMPORTED_LOCATION "${EXPAT_LIBRARY}", but EXPAT_LIBRARY is empty when using
|
||||
# conda's config-mode expat package (which installs as expat::expat lowercase).
|
||||
# Resolve the actual library path from expat::expat or via find_library.
|
||||
if(TARGET EXPAT::EXPAT)
|
||||
get_target_property(_expat_loc EXPAT::EXPAT IMPORTED_LOCATION)
|
||||
if(NOT _expat_loc OR _expat_loc MATCHES "NOTFOUND|^$")
|
||||
if(TARGET expat::expat)
|
||||
get_target_property(_expat_loc expat::expat IMPORTED_LOCATION_NOCONFIG)
|
||||
endif()
|
||||
if(NOT _expat_loc OR _expat_loc MATCHES "NOTFOUND|^$")
|
||||
find_library(_expat_loc NAMES expat)
|
||||
endif()
|
||||
if(_expat_loc)
|
||||
set_target_properties(EXPAT::EXPAT PROPERTIES IMPORTED_LOCATION "${_expat_loc}")
|
||||
endif()
|
||||
endif()
|
||||
unset(_expat_loc)
|
||||
endif()
|
||||
|
||||
# Sanitize Geant4 targets to remove Qt5 dependencies that conflict with VTK/Qt6
|
||||
if(TARGET Geant4::G4interfaces)
|
||||
set_target_properties(Geant4::G4interfaces PROPERTIES
|
||||
|
||||
@@ -12,6 +12,22 @@
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "fast",
|
||||
"displayName": "Fast build: Ninja + clang + ccache",
|
||||
"description": "Uses Ninja generator, clang/lld compiler, and ccache",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_C_COMPILER": "clang",
|
||||
"CMAKE_CXX_COMPILER": "clang++",
|
||||
"CMAKE_EXE_LINKER_FLAGS": "-fuse-ld=lld",
|
||||
"CMAKE_SHARED_LINKER_FLAGS": "-fuse-ld=lld",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "ccache"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mutom",
|
||||
"description": "",
|
||||
@@ -19,4 +35,4 @@
|
||||
"inherits": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"version": 4,
|
||||
"vendor": {
|
||||
"conan": {}
|
||||
},
|
||||
"include": [
|
||||
"build/CMakePresets.json"
|
||||
]
|
||||
}
|
||||
36
README.md
36
README.md
@@ -41,7 +41,11 @@ conda activate mutom
|
||||
|
||||
### Configure and Build
|
||||
|
||||
1. **Configure Conan profile (if you haven't yet on your machine):**
|
||||
#### Standard build (GCC + Ninja + ccache)
|
||||
|
||||
The default conan profile uses **Ninja** as the generator and **ccache** for compiler caching, dramatically speeding up incremental rebuilds.
|
||||
|
||||
1. **Configure Conan profile (first time only):**
|
||||
```bash
|
||||
conan profile detect
|
||||
```
|
||||
@@ -51,17 +55,39 @@ conan profile detect
|
||||
conan install . --output-folder=build --build=missing
|
||||
```
|
||||
|
||||
3. **Configure the project with CMake:**
|
||||
3. **Configure with CMake:**
|
||||
```bash
|
||||
cmake --preset conan-release
|
||||
```
|
||||
*(Alternatively: `cd build && cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release`)*
|
||||
|
||||
4. **Build the project:**
|
||||
4. **Build:**
|
||||
```bash
|
||||
cmake --build build -j10
|
||||
cmake --build build -j$(nproc)
|
||||
```
|
||||
|
||||
#### LLVM/Clang build (clang + lld + ccache — fastest)
|
||||
|
||||
A `fast` conan profile is provided that uses **clang**, **lld** (LLVM linker), and **ccache**. Install them into your environment first:
|
||||
|
||||
```bash
|
||||
micromamba install -n mutom -y clang clangxx lld -c conda-forge
|
||||
```
|
||||
|
||||
Then build using the `fast` profile:
|
||||
|
||||
```bash
|
||||
conan install . --output-folder=build --build=missing --profile=fast
|
||||
cmake -B build -G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build -j$(nproc)
|
||||
```
|
||||
|
||||
The `fast` profile is defined at `~/.conan2/profiles/fast` and sets:
|
||||
- `CMAKE_C_COMPILER=clang` / `CMAKE_CXX_COMPILER=clang++`
|
||||
- `CMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld`
|
||||
- `CMAKE_CXX_COMPILER_LAUNCHER=ccache`
|
||||
|
||||
### Make python package
|
||||
|
||||
```bash
|
||||
|
||||
@@ -338,8 +338,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
using basic_xml_iarchive::load_override;
|
||||
|
||||
// Anything not an attribute should be a name value pair as nvp or hrp
|
||||
typedef boost::archive::detail::common_iarchive<Archive>
|
||||
detail_common_iarchive;
|
||||
@@ -357,6 +355,9 @@ public:
|
||||
// class_name_type can't be handled here as it depends upon the
|
||||
// char type used by the stream. So require the derived implementation.
|
||||
// derived in this case is xml_iarchive_impl or base ..
|
||||
// Note: using base::load_override covers all basic_xml_iarchive overloads
|
||||
// transitively, so a separate 'using basic_xml_iarchive::load_override'
|
||||
// is redundant and creates ambiguity with clang.
|
||||
using base::load_override;
|
||||
|
||||
void load_override(const char *str) {
|
||||
|
||||
@@ -121,14 +121,6 @@ void Object::PropertyUpdated() { ULIB_SIGNAL_EMIT(Object::PropertyUpdated); }
|
||||
template <class ArchiveT>
|
||||
void Object::save_override(ArchiveT &ar, const unsigned int version) {}
|
||||
|
||||
// Explicitly instantiate for all uLib archives
|
||||
template void Object::serialize(Archive::xml_oarchive &, const unsigned int);
|
||||
template void Object::serialize(Archive::xml_iarchive &, const unsigned int);
|
||||
template void Object::serialize(Archive::text_oarchive &, const unsigned int);
|
||||
template void Object::serialize(Archive::text_iarchive &, const unsigned int);
|
||||
template void Object::serialize(Archive::hrt_oarchive &, const unsigned int);
|
||||
template void Object::serialize(Archive::hrt_iarchive &, const unsigned int);
|
||||
template void Object::serialize(Archive::log_archive &, const unsigned int);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -182,7 +182,7 @@ typedef bool Bool_t; // Boolean (0=false, 1=true) (bool)
|
||||
\
|
||||
public: \
|
||||
typedef type_info::BaseClass BaseClass; \
|
||||
virtual const char *type_name() const { return type_info::name; } \
|
||||
virtual const char *type_name() const override { return type_info::name; } \
|
||||
/**/
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user