Skip to content

Commit 42448ca

Browse files
aschvalbergaothms
authored andcommitted
Add missing exports for ifcopenshell-python when we build shared libs.
1 parent 7e28d19 commit 42448ca

11 files changed

Lines changed: 59 additions & 11 deletions

src/ifcparse/ArgumentType.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "../ifcparse/IfcSchema.h"
2121

22+
#include "ifc_parse_api.h"
23+
2224
#ifndef ARGUMENTTYPE_H
2325
#define ARGUMENTTYPE_H
2426

@@ -51,8 +53,8 @@ namespace IfcUtil {
5153
Argument_UNKNOWN
5254
};
5355

54-
ArgumentType from_parameter_type(const IfcParse::parameter_type*);
55-
ArgumentType make_aggregate(ArgumentType elem_type);
56+
IFC_PARSE_API ArgumentType from_parameter_type(const IfcParse::parameter_type*);
57+
IFC_PARSE_API ArgumentType make_aggregate(ArgumentType elem_type);
5658
}
5759

5860
#endif

src/ifcwrap/IfcPython.i

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
}
7373
}
7474

75+
%include "../serializers/serializers_api.h"
76+
7577
// Include headers for the typemaps to function. This set of includes,
7678
// can probably be reduced, but for now it's identical to the includes
7779
// of the module definition below.

src/serializers/ColladaSerializer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@
4343

4444
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
4545

46+
#include "../serializers/serializers_api.h"
4647
#include "../ifcgeom_schema_agnostic/GeometrySerializer.h"
4748

4849
#include <boost/numeric/ublas/matrix.hpp>
4950
#include <boost/numeric/ublas/io.hpp>
5051

5152

52-
class ColladaSerializer : public WriteOnlyGeometrySerializer
53+
class SERIALIZERS_API ColladaSerializer : public WriteOnlyGeometrySerializer
5354
{
5455
// TODO The vast amount of implement details of ColladaSerializer could be hidden to the cpp file.
5556
private:

src/serializers/GltfSerializer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222

2323
#ifdef WITH_GLTF
2424

25+
#include "../serializers/serializers_api.h"
2526
#include "../ifcgeom_schema_agnostic/GeometrySerializer.h"
2627

2728
#include <nlohmann/json.hpp>
2829
using json = nlohmann::json;
2930

3031
#include <map>
3132

32-
class GltfSerializer : public WriteOnlyGeometrySerializer {
33+
class SERIALIZERS_API GltfSerializer : public WriteOnlyGeometrySerializer {
3334
private:
3435
std::string filename_, tmp_filename1_, tmp_filename2_;
3536
std::ofstream fstream_, tmp_fstream1_, tmp_fstream2_;

src/serializers/HdfSerializer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828

2929
#include "H5Cpp.h"
3030

31+
#include "../serializers/serializers_api.h"
3132
#include "../ifcgeom_schema_agnostic/GeometrySerializer.h"
3233

3334
#define USE_BINARY
3435

35-
class HdfSerializer : public GeometrySerializer {
36+
class SERIALIZERS_API HdfSerializer : public GeometrySerializer {
3637
private:
3738
const std::string hdf_filename;
3839
unsigned int vcount_total;

src/serializers/OpenCascadeBasedSerializer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
#ifndef OPENCASCADEBASEDSERIALIZER_H
2121
#define OPENCASCADEBASEDSERIALIZER_H
2222

23+
#include "../serializers/serializers_api.h"
2324
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
2425

2526
#include "../ifcgeom_schema_agnostic/GeometrySerializer.h"
2627

27-
class OpenCascadeBasedSerializer : public WriteOnlyGeometrySerializer {
28+
class SERIALIZERS_API OpenCascadeBasedSerializer : public WriteOnlyGeometrySerializer {
2829
OpenCascadeBasedSerializer(const OpenCascadeBasedSerializer&); //N/A
2930
OpenCascadeBasedSerializer& operator =(const OpenCascadeBasedSerializer&); //N/A
3031
protected:

src/serializers/SvgSerializer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define SVGSERIALIZER_H
2424

2525
#include "../ifcgeom_schema_agnostic/GeometrySerializer.h"
26+
#include "../serializers/serializers_api.h"
2627
#include "../serializers/util.h"
2728

2829
#include "../ifcparse/utils.h"
@@ -135,7 +136,7 @@ typedef boost::variant<
135136
Handle(HLRBRep_PolyAlgo)
136137
> hlr_t;
137138

138-
class SvgSerializer : public WriteOnlyGeometrySerializer {
139+
class SERIALIZERS_API SvgSerializer : public WriteOnlyGeometrySerializer {
139140
public:
140141
typedef std::pair<std::string, std::vector<util::string_buffer> > path_object;
141142
typedef std::vector< boost::shared_ptr<util::string_buffer::float_item> > float_item_list;

src/serializers/WavefrontObjSerializer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
#include <string>
2525
#include <fstream>
2626

27+
#include "../serializers/serializers_api.h"
2728
#include "../ifcgeom_schema_agnostic/GeometrySerializer.h"
2829

2930
// http://people.sc.fsu.edu/~jburkardt/txt/obj_format.txt
30-
class WaveFrontOBJSerializer : public WriteOnlyGeometrySerializer {
31+
class SERIALIZERS_API WaveFrontOBJSerializer : public WriteOnlyGeometrySerializer {
3132
private:
3233
stream_or_filename obj_stream;
3334
stream_or_filename mtl_stream;

src/serializers/XmlSerializer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#define SCHEMA_METHOD
22

3+
#include "../serializers/serializers_api.h"
34
#include "../ifcgeom_schema_agnostic/Serializer.h"
45
#include "../ifcparse/IfcFile.h"
56

67
#include <boost/function.hpp>
78

89
#include <map>
910

10-
class XmlSerializer : public Serializer {
11+
class SERIALIZERS_API XmlSerializer : public Serializer {
1112
private:
1213
XmlSerializer* implementation_;
1314

@@ -26,7 +27,7 @@ class XmlSerializer : public Serializer {
2627
void setFile(IfcParse::IfcFile*) { throw IfcParse::IfcException("Should be supplied on construction"); }
2728
};
2829

29-
struct XmlSerializerFactory {
30+
struct SERIALIZERS_API XmlSerializerFactory {
3031
typedef boost::function2<XmlSerializer*, IfcParse::IfcFile*, std::string> fn;
3132

3233
class Factory : public std::map<std::string, fn> {

src/serializers/serializers_api.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/********************************************************************************
2+
* *
3+
* This file is part of IfcOpenShell. *
4+
* *
5+
* IfcOpenShell is free software: you can redistribute it and/or modify *
6+
* it under the terms of the Lesser GNU General Public License as published by *
7+
* the Free Software Foundation, either version 3.0 of the License, or *
8+
* (at your option) any later version. *
9+
* *
10+
* IfcOpenShell is distributed in the hope that it will be useful, *
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13+
* Lesser GNU General Public License for more details. *
14+
* *
15+
* You should have received a copy of the Lesser GNU General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
* *
18+
********************************************************************************/
19+
20+
#ifndef IFC_SERIALIZERS_API_H
21+
#define IFC_SERIALIZERS_API_H
22+
23+
#ifdef IFC_SHARED_BUILD
24+
#ifdef _WIN32
25+
#ifdef Serializers_EXPORTS
26+
#define SERIALIZERS_API __declspec(dllexport)
27+
#else
28+
#define SERIALIZERS_API __declspec(dllimport)
29+
#endif
30+
#else // simply assume *nix + GCC-like compiler
31+
#define SERIALIZERS_API __attribute__((visibility("default")))
32+
#endif
33+
#else
34+
#define SERIALIZERS_API
35+
#endif
36+
37+
#endif

0 commit comments

Comments
 (0)