Fixes to build on openSUSE/Packman. (#67)

- Support different BINDIR, INCLUDEDIR and LIBDIR on install
- Take right python dir on x86_64 arch
- Fix build against Boost >= 1.58
- Make it possible to build libIfcGeom shared to reduce size of dependent binaries
- Fix INSTALL_RPATH
- Fix some more compiler warnings
This commit is contained in:
Johannes Obermayr
2016-05-15 15:47:21 +02:00
committed by Thomas Krijnen
parent 414d7bb810
commit 42188904af
13 changed files with 97 additions and 38 deletions
+6 -2
View File
@@ -18,9 +18,13 @@
################################################################################
ADD_EXECUTABLE(IfcParseExamples IfcParseExamples.cpp)
TARGET_LINK_LIBRARIES(IfcParseExamples IfcParse)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(IfcParseExamples ${IFCLIBS})
ELSE()
TARGET_LINK_LIBRARIES(IfcParseExamples IfcParse)
ENDIF()
set_target_properties(IfcParseExamples PROPERTIES FOLDER Examples)
ADD_EXECUTABLE(IfcOpenHouse IfcOpenHouse.cpp)
TARGET_LINK_LIBRARIES(IfcOpenHouse IfcParse IfcGeom ${OPENCASCADE_LIBRARIES})
TARGET_LINK_LIBRARIES(IfcOpenHouse ${IFCLIBS} ${OPENCASCADE_LIBRARIES})
set_target_properties(IfcOpenHouse PROPERTIES FOLDER Examples)
+4 -4
View File
@@ -106,8 +106,8 @@ private:
public:
explicit ColladaMaterials(COLLADASW::StreamWriter& stream, ColladaSerializer *_serializer)
: COLLADASW::LibraryMaterials(&stream)
, effects(stream)
, serializer(_serializer)
, serializer(_serializer)
, effects(stream)
{}
void add(const IfcGeom::Material& material);
bool contains(const IfcGeom::Material& material);
@@ -152,10 +152,10 @@ private:
ColladaExporter(const std::string& scene_name, const std::string& fn, ColladaSerializer *_serializer)
: filename(fn)
, stream(filename, sizeof(real_t) == sizeof(double)) // utilise Collada stream's double precision feature
, geometries(stream, _serializer)
, scene(scene_name, stream, _serializer)
, materials(stream, _serializer)
, serializer(_serializer)
, geometries(stream, _serializer)
, serializer(_serializer)
{
}
ColladaMaterials materials;
+1 -1
View File
@@ -47,8 +47,8 @@ public:
: GeometrySerializer(settings)
, svg_file(out_filename.c_str())
, xmin(+std::numeric_limits<double>::infinity())
, xmax(-std::numeric_limits<double>::infinity())
, ymin(+std::numeric_limits<double>::infinity())
, xmax(-std::numeric_limits<double>::infinity())
, ymax(-std::numeric_limits<double>::infinity())
, rescale(false)
, file(0)
+1 -1
View File
@@ -37,8 +37,8 @@ private:
public:
WaveFrontOBJSerializer(const std::string& obj_filename, const std::string& mtl_filename, const IfcGeom::IteratorSettings &settings)
: GeometrySerializer(settings)
, obj_stream(obj_filename.c_str())
, mtl_filename(mtl_filename)
, obj_stream(obj_filename.c_str())
, mtl_stream(mtl_filename.c_str())
, vcount_total(1)
{}
+1 -1
View File
@@ -58,7 +58,7 @@ namespace IfcGeom {
this->name = sstr.str();
}
SurfaceStyle(const std::string& name) : name(name), original_name_(name) {}
SurfaceStyle(int id, const std::string& name) : id(id), original_name_(name)
SurfaceStyle(int id, const std::string& name) : original_name_(name), id(id)
{
std::stringstream sstr;
std::string sanitized = name;
+1 -1
View File
@@ -58,7 +58,7 @@ std::string sread(std::istream& s) {
buf[len] = 0;
while (len++ % 4) s.get();
std::string str(buf);
delete buf;
delete[] buf;
return str;
}
+2 -2
View File
@@ -28,7 +28,7 @@ LINK_DIRECTORIES(${LINK_DIRECTORIES} ${IfcOpenShell_BINARY_DIR} ${OCC_LIBRARY_DI
ADD_LIBRARY(IfcMax SHARED IfcMax.h IfcMax.cpp)
TARGET_LINK_LIBRARIES(IfcMax IfcParse IfcGeom Comctl32.lib zlibdll.lib bmm.lib core.lib CustDlg.lib edmodel.lib expr.lib
TARGET_LINK_LIBRARIES(IfcMax ${IFCLIBS} Comctl32.lib zlibdll.lib bmm.lib core.lib CustDlg.lib edmodel.lib expr.lib
flt.lib geom.lib gfx.lib gup.lib imageViewers.lib ManipSys.lib maxnet.lib Maxscrpt.lib
maxutil.lib MenuMan.lib menus.lib mesh.lib MNMath.lib Paramblk2.lib particle.lib Poly.lib RenderUtil.lib
tessint.lib viewfile.lib ${OPENCASCADE_LIBRARIES}
@@ -36,4 +36,4 @@ TARGET_LINK_LIBRARIES(IfcMax IfcParse IfcGeom Comctl32.lib zlibdll.lib bmm.lib c
SET_TARGET_PROPERTIES(IfcMax PROPERTIES SUFFIX ".dli")
INSTALL(TARGETS IfcMax RUNTIME DESTINATION bin)
INSTALL(TARGETS IfcMax RUNTIME DESTINATION ${BINDIR})
+4 -9
View File
@@ -320,7 +320,6 @@ Token IfcSpfLexer::Next() {
int len = 0;
char p = 0;
while ( ! stream->eof ) {
// Read character and increment pointer if not starting a new token
@@ -331,8 +330,6 @@ Token IfcSpfLexer::Next() {
// If a string is encountered defer processing to the IfcCharacterDecoder
if ( c == '\'' ) decoder->dryRun();
p = c;
}
if ( len ) return TokenPtr(this,pos);
else return TokenPtr();
@@ -348,7 +345,6 @@ std::string IfcSpfLexer::TokenString(unsigned int offset) {
stream->Seek(offset);
std::string buffer;
buffer.reserve(128);
char p = 0;
while ( ! stream->eof ) {
char c = stream->Peek();
if ( buffer.size() && (c == '(' || c == ')' || c == '=' || c == ',' || c == ';' || c == '/') ) break;
@@ -356,7 +352,6 @@ std::string IfcSpfLexer::TokenString(unsigned int offset) {
if ( c == ' ' || c == '\r' || c == '\n' || c == '\t' ) continue;
else if ( c == '\'' ) return *decoder;
else buffer.push_back(c);
p = c;
}
if ( was_eof ) stream->eof = true;
else stream->Seek(old_offset);
@@ -790,7 +785,7 @@ EntityArgument::~EntityArgument() { delete entity; }
//
// Reads an Entity from the list of Tokens
//
Entity::Entity(unsigned int i, IfcFile* f) : _id(i), args(0) {
Entity::Entity(unsigned int i, IfcFile* f) : args(0), _id(i) {
file = f;
Token datatype = f->tokens->Next();
if ( ! TokenFunc::isKeyword(datatype)) throw IfcException("Unexpected token while parsing entity");
@@ -904,10 +899,10 @@ IfcWrite::IfcWritableEntity* Entity::isWritable() {
IfcFile::IfcFile(bool create_latebound_entities)
: _create_latebound_entities(create_latebound_entities)
, stream(0)
, lastId(0)
, tokens(0)
, MaxId(0)
, tokens(0)
, stream(0)
{
setDefaultHeaderValues();
}
@@ -1542,4 +1537,4 @@ std::pair<IfcSchema::IfcNamedUnit*, double> IfcFile::getUnit(IfcSchema::IfcUnitE
}
}
return return_value;
}
}
+2 -2
View File
@@ -34,7 +34,7 @@ private:
HeaderEntity& operator =(const HeaderEntity&); //N/A
protected:
HeaderEntity(const char * const datatype, IfcSpfLexer* lexer)
: _datatype(datatype), _list(0)
: _list(0), _datatype(datatype)
{
std::vector<unsigned int> ids;
_list = new ArgumentList();
@@ -193,4 +193,4 @@ public:
}
#endif
#endif
+3 -2
View File
@@ -52,14 +52,15 @@ ENDIF()
SET_SOURCE_FILES_PROPERTIES(IfcPython.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_MODULE(ifcopenshell_wrapper python IfcPython.i)
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper IfcParse IfcGeom ${PYTHON_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${ICU_LIBRARIES})
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper ${IFCLIBS} ${PYTHON_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${ICU_LIBRARIES})
SET_INSTALL_RPATHS(${SWIG_MODULE_ifcopenshell_wrapper_REAL_NAME} "${IFCDIRS};${OCC_LIBRARY_DIR};${ICU_LIBRARY_DIR}")
# Try to find the Python interpreter to get the site-packages
# directory in which the wrapper can be installed.
FIND_PACKAGE(PythonInterp)
IF(PYTHONINTERP_FOUND)
EXECUTE_PROCESS(
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib())"
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib(1))"
OUTPUT_VARIABLE python_package_dir
)
+1
View File
@@ -387,6 +387,7 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
throw IfcParse::IfcException("Invalid additional representation specified");
}
}
return boost::variant<IfcGeom::Element<double>*, IfcGeom::Representation::Representation*>();
}
%}
+1 -1
View File
@@ -52,4 +52,4 @@ QT_WRAP_CPP(QTviewer QTviewer_SRCS ${QTviewer_MOC_SRCS})
ADD_EXECUTABLE( QTviewer ${QTviewer_SRCS} ${QTviewer_MOC_SRCS})
#http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake
TARGET_LINK_libRARIES (QTviewer IfcParse IfcGeom ${QT_LIBRARIES} ${OPENCASCADE_LIBRARIES})
TARGET_LINK_LIBRARIES (QTviewer ${IFCLIBS} ${QT_LIBRARIES} ${OPENCASCADE_LIBRARIES})