-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcompileCmesh
More file actions
executable file
·46 lines (38 loc) · 1.46 KB
/
compileCmesh
File metadata and controls
executable file
·46 lines (38 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/zsh
# Making sure we're using the right compiler
export CC=gcc
export CXX=g++
rm -rf cadmeshBuild
mkdir cadmeshBuild
cd cadmeshBuild
# Setting
ncpu=$(getconf _NPROCESSORS_ONLN)
opt="-j$ncpu"
echo
echo "Compiling with options $opt"
echo
# Determine the OS type
os_type=$(uname -s)
# Switch based on the OS type
case "$os_type" in
Linux)
echo "Patching ${G4INSTALL}/lib/Geant4-${G4_VERSION}/Geant4PackageCache.cmake in Linux using sed"
[[ -f "${G4INSTALL}/lib/Geant4-${G4_VERSION}/Geant4PackageCache.cmake" ]] && \
sed -i '/geant4_set_and_check_package_variable(EXPAT_LIBRARY "" "")/s/^/#/' "${G4INSTALL}/lib/Geant4-${G4_VERSION}/Geant4PackageCache.cmake"
[[ -f "${G4INSTALL}/lib64/Geant4-${G4_VERSION}/Geant4PackageCache.cmake" ]] && \
sed -i '/geant4_set_and_check_package_variable(EXPAT_LIBRARY "" "")/s/^/#/' "${G4INSTALL}/lib64/Geant4-${G4_VERSION}/Geant4PackageCache.cmake"
;;
Darwin)
echo "Patching ${G4INSTALL}/lib/Geant4-${G4_VERSION}/Geant4PackageCache.cmake in Darwin using /usr/bin/sed"
/usr/bin/sed -i '' '/geant4_set_and_check_package_variable(EXPAT_LIBRARY "" "")/s/^/#/' "${G4INSTALL}/lib/Geant4-${G4_VERSION}/Geant4PackageCache.cmake"
;;
*)
echo "Unsupported OS: $os_type"
exit 1
;;
esac
# Optional: Indicate successful patching if script continues
echo "Patching check complete."
cmake ../cadmesh -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_INSTALL_PREFIX:PATH=$MLIBRARY
make $opt install
echo "done"