Skip to content

Commit 82b3cbb

Browse files
Fixes to allow static linking
1 parent c120774 commit 82b3cbb

File tree

237 files changed

+538
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+538
-75
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def build_extension(self, ext):
7575

7676
setup(
7777
name="geant4_pybind",
78-
version="0.1.0",
78+
version="0.1.0b0",
7979
author="Benjamin H.",
8080
author_email="haarigerharald@gmx.at",
8181
description="Alternative python bindings for Geant4 via pybind11",

source/analysis/pyG4AnalysisManager.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <pybind11/pybind11.h>
2+
#include <pybind11/stl.h>
23

34
#include <G4RootAnalysisManager.hh>
45
#include <G4RootAnalysisReader.hh>
@@ -15,6 +16,7 @@
1516
#include "G4VNtupleFileManager.hh"
1617

1718
#include "typecast.hh"
19+
#include "opaques.hh"
1820
#include "holder.hh"
1921

2022
namespace py = pybind11;

source/analysis/pyG4TScoreNtupleWriter.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <pybind11/pybind11.h>
2+
#include <pybind11/stl.h>
23

34
#include <G4TScoreNtupleWriter.hh>
45

@@ -16,6 +17,7 @@
1617
#include "G4XmlAnalysisReader.hh"
1718

1819
#include "typecast.hh"
20+
#include "opaques.hh"
1921
#include "holder.hh"
2022

2123
namespace py = pybind11;

source/analysis/pyG4VAnalysisManager.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <tools/histo/hmpi>
1919

2020
#include "typecast.hh"
21+
#include "opaques.hh"
2122
#include "holder.hh"
2223

2324
namespace py = pybind11;

source/analysis/pyhisto.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <pybind11/pybind11.h>
2+
#include <pybind11/stl.h>
23

34
#include <tools/histo/h1d>
45
#include <tools/histo/h2d>
@@ -7,6 +8,7 @@
78
#include <tools/histo/p2d>
89

910
#include "typecast.hh"
11+
#include "opaques.hh"
1012
#include "holder.hh"
1113

1214
namespace py = pybind11;

source/analysis/pymodG4analysis.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include <pybind11/pybind11.h>
2+
#include <pybind11/stl.h>
23

34
#include "typecast.hh"
5+
#include "opaques.hh"
46

57
namespace py = pybind11;
68

source/datainit.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ def download_dataset(url, directory):
6161

6262

6363
def ask_for_download(data_directory):
64+
# Skip for automated tests
65+
if "CI" in os.environ and os.environ["CI"] == "true":
66+
return True
67+
6468
print("One or more Geant4 datasets were not found.")
6569
answer=input("Would you like to download the missing ones? [Y/n] ")
6670
if answer.lower() == 'y' or answer.lower() == 'yes':

source/digits_hits/pyG4HCofThisEvent.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#include <pybind11/pybind11.h>
2+
#include <pybind11/stl.h>
23

34
#include <G4HCofThisEvent.hh>
45

56
#include "holder.hh"
67
#include "typecast.hh"
8+
#include "opaques.hh"
79

810
namespace py = pybind11;
911

@@ -16,7 +18,7 @@ void export_G4HCofThisEvent(py::module &m)
1618
.def("AddHitsCollection",
1719
[](G4HCofThisEvent &self, G4int HCID, G4VHitsCollection *aHC) {
1820
owntrans_ptr<G4VHitsCollection>::remove(aHC);
19-
//TRAMPOLINE_REF_INCREASE(G4VHitsCollection, aHC);
21+
// TRAMPOLINE_REF_INCREASE(G4VHitsCollection, aHC);
2022
self.AddHitsCollection(HCID, aHC);
2123
})
2224

source/digits_hits/pyG4MultiFunctionalDetector.cc

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#include <pybind11/pybind11.h>
2+
#include <pybind11/stl.h>
23

34
#include <G4MultiFunctionalDetector.hh>
45
#include <G4VPrimitiveScorer.hh>
56
#include <G4VPrimitivePlotter.hh>
67

78
#include "holder.hh"
89
#include "typecast.hh"
10+
#include "opaques.hh"
911

1012
namespace py = pybind11;
1113

@@ -57,18 +59,20 @@ void export_G4MultiFunctionalDetector(py::module &m)
5759
.def("DrawAll", &G4MultiFunctionalDetector::DrawAll)
5860
.def("PrintAll", &G4MultiFunctionalDetector::PrintAll)
5961
.def("ProcessHits", &PublicG4MultiFunctionalDetector::ProcessHits)
60-
.def("RegisterPrimitive", [] (G4MultiFunctionalDetector & self, G4VPrimitivePlotter* plotter)
61-
{
62-
owntrans_ptr<G4VPrimitivePlotter>::remove(plotter);
63-
TRAMPOLINE_REF_INCREASE(G4VPrimitivePlotter, plotter);
64-
return self.RegisterPrimitive(plotter);
65-
})
66-
.def("RegisterPrimitive", [] (G4MultiFunctionalDetector & self, G4VPrimitiveScorer* scorer)
67-
{
68-
owntrans_ptr<G4VPrimitiveScorer>::remove(scorer);
69-
TRAMPOLINE_REF_INCREASE(G4VPrimitiveScorer, scorer);
70-
return self.RegisterPrimitive(scorer);
71-
})
62+
.def("RegisterPrimitive",
63+
[](G4MultiFunctionalDetector &self, G4VPrimitivePlotter *plotter) {
64+
owntrans_ptr<G4VPrimitivePlotter>::remove(plotter);
65+
TRAMPOLINE_REF_INCREASE(G4VPrimitivePlotter, plotter);
66+
return self.RegisterPrimitive(plotter);
67+
})
68+
69+
.def("RegisterPrimitive",
70+
[](G4MultiFunctionalDetector &self, G4VPrimitiveScorer *scorer) {
71+
owntrans_ptr<G4VPrimitiveScorer>::remove(scorer);
72+
TRAMPOLINE_REF_INCREASE(G4VPrimitiveScorer, scorer);
73+
return self.RegisterPrimitive(scorer);
74+
})
75+
7276
.def("RemovePrimitive", &G4MultiFunctionalDetector::RemovePrimitive) // TODO pass ownership
7377
.def("GetNumberOfPrimitives", &G4MultiFunctionalDetector::GetNumberOfPrimitives)
7478
.def("GetPrimitive", &G4MultiFunctionalDetector::GetPrimitive, py::return_value_policy::reference_internal);

source/digits_hits/pyG4SDFilter.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <pybind11/pybind11.h>
2+
#include <pybind11/stl.h>
23

34
#include <G4SDChargedFilter.hh>
45
#include <G4SDKineticEnergyFilter.hh>
@@ -11,6 +12,7 @@
1112

1213
#include "holder.hh"
1314
#include "typecast.hh"
15+
#include "opaques.hh"
1416

1517
namespace py = pybind11;
1618

0 commit comments

Comments
 (0)