Skip to content

Commit 589823f

Browse files
authored
fix: split shared lib compilation, fix installation (#193)
* Fix ODRs when using precompiled headers * Bump ViennaCore * Format
1 parent 7d1149a commit 589823f

File tree

6 files changed

+74
-73
lines changed

6 files changed

+74
-73
lines changed

CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ include("cmake/cpm.cmake")
105105

106106
CPMAddPackage(
107107
NAME ViennaCore
108-
VERSION 1.9.0
108+
VERSION 1.9.1
109109
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaCore"
110110
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON}
111111
OPTIONS "VIENNACORE_USE_GPU ${VIENNAPS_USE_GPU}")
@@ -122,13 +122,13 @@ CPMAddPackage(
122122
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON}
123123
OPTIONS "VIENNARAY_USE_GPU ${VIENNAPS_USE_GPU}")
124124

125-
CPMFindPackage(
125+
CPMAddPackage(
126126
NAME ViennaLS
127127
VERSION 5.4.0
128128
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaLS"
129129
EXCLUDE_FROM_ALL ${VIENNAPS_BUILD_PYTHON})
130130

131-
CPMFindPackage(
131+
CPMAddPackage(
132132
NAME ViennaCS
133133
VERSION 1.1.1
134134
GIT_REPOSITORY "https://github.com/ViennaTools/ViennaCS"
@@ -143,6 +143,7 @@ target_link_libraries(${PROJECT_NAME} INTERFACE ViennaTools::ViennaCore ViennaTo
143143

144144
if(VIENNAPS_PRECOMPILE_HEADERS)
145145
set(VIENNAPS_LINKAGE SHARED)
146+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
146147

147148
if(VIENNAPS_STATIC_BUILD)
148149
set(VIENNAPS_LINKAGE STATIC)
@@ -152,8 +153,10 @@ if(VIENNAPS_PRECOMPILE_HEADERS)
152153
add_library(${LIB_NAME} ${VIENNAPS_LINKAGE})
153154

154155
target_link_libraries(${LIB_NAME} PRIVATE ${PROJECT_NAME})
155-
target_compile_definitions(${LIB_NAME} PRIVATE VIENNAPS_USE_PRECOMPILED)
156-
target_sources(${LIB_NAME} PRIVATE "lib/specializations.cpp")
156+
target_compile_definitions(${LIB_NAME} PRIVATE VIENNAPS_USE_PRECOMPILED=1
157+
VIENNACORE_COMPILE_SHARED_LIB=1)
158+
target_sources(${LIB_NAME} PRIVATE "lib/specMain.cpp" "lib/specGeometries.cpp"
159+
"lib/specModels.cpp")
157160

158161
set_target_properties(
159162
${LIB_NAME}
@@ -227,4 +230,4 @@ packageProject(
227230
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include/viennaps
228231
INCLUDE_DESTINATION include/viennaps-${PROJECT_VERSION}
229232
COMPATIBILITY SameMajorVersion
230-
DEPENDENCIES "ViennaCore;ViennaLS;ViennaRay;ViennaCS;OpenMP")
233+
DEPENDENCIES "ViennaCore;ViennaLS;ViennaRay;ViennaCS")

include/viennaps/psCreateSurfaceMesh.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <lsDomain.hpp>
44
#include <lsMesh.hpp>
5+
#include <lsToSurfaceMesh.hpp>
56

67
#include <rayMesh.hpp>
78

include/viennaps/psVTKRenderWindow.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,9 @@ void InteractorOnChar(vtkRenderWindowInteractor *rwi,
611611
// Full definition of Custom3DInteractorStyle after VTKRenderWindow is complete
612612
class Custom3DInteractorStyle : public vtkInteractorStyleTrackballCamera {
613613
public:
614-
static Custom3DInteractorStyle *New();
614+
static Custom3DInteractorStyle *New() {
615+
VTK_STANDARD_NEW_BODY(Custom3DInteractorStyle);
616+
}
615617
vtkTypeMacro(Custom3DInteractorStyle, vtkInteractorStyleTrackballCamera);
616618

617619
void OnChar() override {
@@ -626,11 +628,13 @@ class Custom3DInteractorStyle : public vtkInteractorStyleTrackballCamera {
626628
viennaps::VTKRenderWindow<double, 3> *Window = nullptr;
627629
}; // namespace viennaps
628630

629-
vtkStandardNewMacro(Custom3DInteractorStyle);
631+
// vtkStandardNewMacro(Custom3DInteractorStyle);
630632

631633
class Custom2DInteractorStyle : public vtkInteractorStyleImage {
632634
public:
633-
static Custom2DInteractorStyle *New();
635+
static Custom2DInteractorStyle *New() {
636+
VTK_STANDARD_NEW_BODY(Custom2DInteractorStyle);
637+
}
634638
vtkTypeMacro(Custom2DInteractorStyle, vtkInteractorStyleImage);
635639

636640
void OnLeftButtonDown() override { this->StartPan(); }
@@ -649,7 +653,7 @@ class Custom2DInteractorStyle : public vtkInteractorStyleImage {
649653
viennaps::VTKRenderWindow<double, 2> *Window = nullptr;
650654
}; // namespace viennaps
651655

652-
vtkStandardNewMacro(Custom2DInteractorStyle);
656+
// vtkStandardNewMacro(Custom2DInteractorStyle);
653657

654658
// VTKRenderWindow::initialize() implementation - defined after
655659
// Custom3DInteractorStyle

lib/specGeometries.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <geometries/psGeometryFactory.hpp>
2+
#include <geometries/psMakeFin.hpp>
3+
#include <geometries/psMakeHole.hpp>
4+
#include <geometries/psMakePlane.hpp>
5+
#include <geometries/psMakeStack.hpp>
6+
#include <geometries/psMakeTrench.hpp>
7+
8+
namespace viennaps {
9+
10+
// Precompile specializations for geometries
11+
PRECOMPILE_SPECIALIZE(GeometryFactory)
12+
PRECOMPILE_SPECIALIZE(MakeFin)
13+
PRECOMPILE_SPECIALIZE(MakeHole)
14+
PRECOMPILE_SPECIALIZE(MakePlane)
15+
PRECOMPILE_SPECIALIZE(MakeStack)
16+
PRECOMPILE_SPECIALIZE(MakeTrench)
17+
18+
} // namespace viennaps

lib/specMain.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <gds/psGDSGeometry.hpp>
2+
#include <gds/psGDSReader.hpp>
3+
4+
#include <process/psProcess.hpp>
5+
#include <process/psProcessModel.hpp>
6+
7+
#include <psDomain.hpp>
8+
#include <psDomainSetup.hpp>
9+
#include <psExtrude.hpp>
10+
#include <psPlanarize.hpp>
11+
#include <psRateGrid.hpp>
12+
#include <psReader.hpp>
13+
#include <psSlice.hpp>
14+
#include <psToDiskMesh.hpp>
15+
#include <psWriter.hpp>
16+
17+
#include <lsPreCompileMacros.hpp>
18+
19+
// this include may only appear in a single source file:
20+
#include <optix_function_table_definition.h>
21+
22+
namespace viennaps {
23+
24+
// Precompile specializations for commonly used classes
25+
PRECOMPILE_SPECIALIZE(Domain)
26+
PRECOMPILE_SPECIALIZE(Process)
27+
PRECOMPILE_SPECIALIZE(Planarize)
28+
PRECOMPILE_SPECIALIZE(ProcessModelCPU)
29+
PRECOMPILE_SPECIALIZE(Reader)
30+
PRECOMPILE_SPECIALIZE(Writer)
31+
PRECOMPILE_SPECIALIZE(GDSGeometry)
32+
PRECOMPILE_SPECIALIZE(GDSReader)
33+
PRECOMPILE_SPECIALIZE(ToDiskMesh)
34+
PRECOMPILE_SPECIALIZE(RateGrid)
35+
PRECOMPILE_SPECIALIZE_PRECISION(Extrude)
36+
PRECOMPILE_SPECIALIZE_PRECISION(Slice)
37+
38+
} // namespace viennaps
Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,3 @@
1-
#include <gds/psGDSGeometry.hpp>
2-
#include <gds/psGDSReader.hpp>
3-
4-
#include <process/psProcess.hpp>
5-
#include <process/psProcessModel.hpp>
6-
7-
#include <psDomain.hpp>
8-
#include <psDomainSetup.hpp>
9-
#include <psExtrude.hpp>
10-
#include <psPlanarize.hpp>
11-
#include <psRateGrid.hpp>
12-
#include <psReader.hpp>
13-
#include <psSlice.hpp>
14-
#include <psToDiskMesh.hpp>
15-
#include <psWriter.hpp>
16-
17-
#include <lsPreCompileMacros.hpp>
18-
19-
namespace viennaps {
20-
21-
// Precompile specializations for commonly used classes
22-
PRECOMPILE_SPECIALIZE(Domain)
23-
PRECOMPILE_SPECIALIZE(Process)
24-
PRECOMPILE_SPECIALIZE(Planarize)
25-
PRECOMPILE_SPECIALIZE(ProcessModelCPU)
26-
PRECOMPILE_SPECIALIZE(Reader)
27-
PRECOMPILE_SPECIALIZE(Writer)
28-
PRECOMPILE_SPECIALIZE(GDSGeometry)
29-
PRECOMPILE_SPECIALIZE(GDSReader)
30-
PRECOMPILE_SPECIALIZE(ToDiskMesh)
31-
PRECOMPILE_SPECIALIZE(RateGrid)
32-
PRECOMPILE_SPECIALIZE_PRECISION(Extrude)
33-
PRECOMPILE_SPECIALIZE_PRECISION(Slice)
34-
35-
} // namespace viennaps
36-
37-
// ----------------------------------------------------------------
38-
// Specializations for process models
39-
// ----------------------------------------------------------------
40-
411
#include <models/psCF4O2Etching.hpp>
422
#include <models/psCSVFileProcess.hpp>
433
#include <models/psDirectionalProcess.hpp>
@@ -99,27 +59,4 @@ PRECOMPILE_SPECIALIZE(SingleParticleALD)
9959
// Other Models
10060
PRECOMPILE_SPECIALIZE(OxideRegrowth)
10161

102-
} // namespace viennaps
103-
104-
// ----------------------------------------------------------------
105-
// Specializations for geometries
106-
// ----------------------------------------------------------------
107-
108-
#include <geometries/psGeometryFactory.hpp>
109-
#include <geometries/psMakeFin.hpp>
110-
#include <geometries/psMakeHole.hpp>
111-
#include <geometries/psMakePlane.hpp>
112-
#include <geometries/psMakeStack.hpp>
113-
#include <geometries/psMakeTrench.hpp>
114-
115-
namespace viennaps {
116-
117-
// Precompile specializations for geometries
118-
PRECOMPILE_SPECIALIZE(GeometryFactory)
119-
PRECOMPILE_SPECIALIZE(MakeFin)
120-
PRECOMPILE_SPECIALIZE(MakeHole)
121-
PRECOMPILE_SPECIALIZE(MakePlane)
122-
PRECOMPILE_SPECIALIZE(MakeStack)
123-
PRECOMPILE_SPECIALIZE(MakeTrench)
124-
12562
} // namespace viennaps

0 commit comments

Comments
 (0)