Skip to content

Commit 51908fb

Browse files
authored
Donot embed earcut.hpp (#313)
* Do not embed mapbox/earcut.hpp. * Fix python binding build. * Fix python binding build on Azure pipeline * Include <array>. Use compiler-specific compile flags in python module build. * format python code.
1 parent db7454c commit 51908fb

File tree

9 files changed

+906
-865
lines changed

9 files changed

+906
-865
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,24 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
22+
23+
----------------------------------
24+
25+
mapbox/earcut.hpp
26+
27+
ISC License
28+
29+
Copyright (c) 2015, Mapbox
30+
31+
Permission to use, copy, modify, and/or distribute this software for any purpose
32+
with or without fee is hereby granted, provided that the above copyright notice
33+
and this permission notice appear in all copies.
34+
35+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
36+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
37+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
39+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
40+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
41+
THIS SOFTWARE.
42+

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ TinyObjLoader triangulate polygons(faces with 4 or more vertices).
251251
Built-in trinagulation code may not work well in some polygon shape.
252252

253253
You can define `TINYOBJLOADER_USE_MAPBOX_EARCUT` for robust triangulation using `mapbox/earcut.hpp`.
254-
This requires C++11 compiler though.
254+
This requires C++11 compiler though. And you need to copy `mapbox/earcut.hpp` to your project.
255+
If you have your own `mapbox/earcut.hpp` file incuded in your project, you can define `TINYOBJLOADER_DONOT_INCLUDE_MAPBOX_EARCUT` so that `mapbox/earcut.hpp` is not included inside of `tiny_obj_loader.h`.
255256

256257
#### Example code (Deprecated API)
257258

azure-pipelines.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
pip3 install cibuildwheel twine
3838
# Make the header files available to the build.
3939
cp *.h python
40+
mkdir python/mapbox
41+
cp mapbox/earcut.hpp python/mapbox/
4042
cd python
4143
4244
# Source dist
@@ -73,6 +75,8 @@ jobs:
7375
pip3 install cibuildwheel
7476
# Make the header files available to the build.
7577
cp *.h python
78+
mkdir python/mapbox
79+
cp mapbox/earcut.hpp python/mapbox/earcut.hpp
7680
cd python
7781
cibuildwheel --output-dir wheelhouse .
7882
- task: CopyFiles@2
@@ -93,6 +97,8 @@ jobs:
9397
pip install cibuildwheel
9498
# Make the header files available to the build.
9599
cp *.h python
100+
mkdir python/mapbox
101+
cp mapbox/earcut.hpp python/mapbox/
96102
cd python
97103
cibuildwheel --output-dir wheelhouse .
98104
- task: CopyFiles@2

loader_example.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,12 @@ static bool TestStreamLoadObj() {
379379
public:
380380
MaterialStringStreamReader(const std::string& matSStream)
381381
: m_matSStream(matSStream) {}
382-
virtual ~MaterialStringStreamReader() {}
382+
virtual ~MaterialStringStreamReader() TINYOBJ_OVERRIDE {}
383383
virtual bool operator()(const std::string& matId,
384384
std::vector<material_t>* materials,
385385
std::map<std::string, int>* matMap,
386386
std::string* warn,
387-
std::string* err) {
387+
std::string* err) TINYOBJ_OVERRIDE {
388388
(void)err;
389389
(void)matId;
390390
LoadMtl(matMap, materials, &m_matSStream, warn, err);

mapbox/LICENSE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ISC License
2+
3+
Copyright (c) 2015, Mapbox
4+
5+
Permission to use, copy, modify, and/or distribute this software for any purpose
6+
with or without fee is hereby granted, provided that the above copyright notice
7+
and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
13+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
14+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
15+
THIS SOFTWARE.

0 commit comments

Comments
 (0)