Skip to content

Commit 44f785c

Browse files
committed
Merge branch 'master' into dynamic_lib_fixes
# Conflicts: # cmake/CMakeLists.txt
2 parents dbc59fe + 8e998ec commit 44f785c

File tree

3 files changed

+48
-10
lines changed

3 files changed

+48
-10
lines changed

cmake/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ IF(UNICODE_SUPPORT)
195195
MESSAGE(STATUS "ICU libraries found")
196196
# NOTE icudata appears to be icudt on Windows/MSVC and icudata on others
197197
# dl is included to resolve dlopen and friends symbols
198-
IF(MSVC)
198+
IF(MSVC OR MINGW)
199199
SET(ICU_LIBRARIES icuuc icudt)
200200
ADD_DEBUG_VARIANTS(ICU_LIBRARIES "${ICU_LIBRARIES}" "d")
201201
ADD_DEFINITIONS(-DU_STATIC_IMPLEMENTATION) # required for static ICU
@@ -328,7 +328,12 @@ IF(MSVC)
328328
ENDIF()
329329
ENDFOREACH()
330330
ElSE()
331-
ADD_DEFINITIONS(-fPIC -Wno-non-virtual-dtor -Wall -Wextra)
331+
IF(WIN32)
332+
# -fPIC is not relevant on Windows and create pointless warnings
333+
ADD_DEFINITIONS(-Wno-non-virtual-dtor -Wall -Wextra)
334+
ELSE()
335+
ADD_DEFINITIONS(-fPIC -Wno-non-virtual-dtor -Wall -Wextra)
336+
ENDIF()
332337
ENDIF()
333338

334339
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS}

src/ifcgeomserver/IfcGeomServer.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@
2727
#include <iostream>
2828
#include <boost/cstdint.hpp>
2929

30-
#if defined(_WIN32) && !defined(__CYGWIN__)
30+
// NB: Streams are only re-opened as binary when compiled with MSVC currently.
31+
// It is unclear what the correct behaviour would be compiled with e.g MinGW
32+
#if defined(_MSC_VER)
3133
#define SET_BINARY_STREAMS
3234
#endif
35+
3336
#ifdef SET_BINARY_STREAMS
3437
#include <io.h>
3538
#include <fcntl.h>
@@ -217,7 +220,7 @@ class Entity : public Command {
217220
std::vector<int32_t> indices;
218221
const std::vector<int>& faces = geom->geometry().faces();
219222
indices.reserve(faces.size());
220-
for (std::vector<int>::const_iterator it = indices.begin(); it != indices.end(); ++it) {
223+
for (std::vector<int>::const_iterator it = faces.begin(); it != faces.end(); ++it) {
221224
indices.push_back(*it);
222225
}
223226
swrite(s, std::string((char*) indices.data(), indices.size() * sizeof(int32_t)));
@@ -269,7 +272,7 @@ class Entity : public Command {
269272
swrite(s, std::string((char*) material_indices.data(), material_indices.size() * sizeof(int32_t))); }
270273
}
271274
public:
272-
Entity(const IfcGeom::TriangulationElement<float>* geom) : Command(ENTITY), geom(geom), append_line_data(true) {};
275+
Entity(const IfcGeom::TriangulationElement<float>* geom) : Command(ENTITY), geom(geom), append_line_data(false) {};
273276
};
274277

275278
class Next : public Command {
@@ -359,7 +362,7 @@ int main () {
359362
settings.set(IfcGeom::IteratorSettings::USE_WORLD_COORDS, false);
360363
settings.set(IfcGeom::IteratorSettings::WELD_VERTICES, false);
361364
settings.set(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS, true);
362-
settings.set(IfcGeom::IteratorSettings::INCLUDE_CURVES, true);
365+
// settings.set(IfcGeom::IteratorSettings::INCLUDE_CURVES, true);
363366

364367
std::vector< std::pair<uint32_t, uint32_t> >::const_iterator it = setting_pairs.begin();
365368
for (; it != setting_pairs.end(); ++it) {

src/ifcparse/IfcParse.cpp

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,53 @@ using namespace IfcParse;
4747
// strtod_l() is used and a reference to the "C" locale is obtained here. The alternative is
4848
// to use std::istringstream::imbue(std::locale::classic()), but there are subtleties in
4949
// parsing in MSVC2010 and it appears to be much slower.
50-
#ifdef _MSC_VER
50+
#if defined(_MSC_VER)
51+
5152
static _locale_t locale = (_locale_t) 0;
5253
void init_locale() {
5354
if (locale == (_locale_t) 0) {
5455
locale = _create_locale(LC_NUMERIC, "C");
5556
}
5657
}
58+
5759
#else
60+
61+
#if defined(__MINGW64__) || defined(__MINGW32__)
62+
#include <locale>
63+
#include <sstream>
64+
65+
typedef void* locale_t;
66+
static locale_t locale = (locale_t)0;
67+
68+
void init_locale() {}
69+
70+
double strtod_l(const char* start, char** end, locale_t loc) {
71+
double d;
72+
std::stringstream ss;
73+
ss.imbue(std::locale::classic());
74+
ss << start;
75+
ss >> d;
76+
size_t nread = ss.tellg();
77+
*end = const_cast<char*>(start) + nread;
78+
return d;
79+
}
80+
81+
#else
82+
5883
#ifdef __APPLE__
5984
#include <xlocale.h>
6085
#endif
61-
static locale_t locale = (locale_t) 0;
86+
#include <locale.h>
87+
88+
static locale_t locale = (locale_t)0;
6289
void init_locale() {
63-
if (locale == (locale_t) 0) {
64-
locale = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
90+
if (locale == (locale_t)0) {
91+
locale = newlocale(LC_NUMERIC_MASK, "C", (locale_t)0);
6592
}
6693
}
94+
95+
#endif
96+
6797
#endif
6898

6999
//

0 commit comments

Comments
 (0)