Skip to content

Commit

Permalink
Fix argument to catch claus was wrong.
Browse files Browse the repository at this point in the history
Add support to compile TinyGLTF with no C++ exception(TINYGLTF_NOEXCEPTION). Fixes #18.
Add initial unit tests.
  • Loading branch information
syoyo committed Jan 5, 2018
1 parent 584f8c0 commit 17cfbcc
Show file tree
Hide file tree
Showing 6 changed files with 10,520 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Use this for strict compilation check(will work on clang 3.8+)
#EXTRA_CXXFLAGS := -fsanitize=address -Wall -Werror -Weverything -Wno-c++11-long-long -DTINYGLTF_APPLY_CLANG_WEVERYTHING
#EXTRA_CXXFLAGS := -fsanitize=address -Wall -Werror -Weverything -Wno-c++11-long-long

all:
clang++ $(EXTRA_CXXFLAGS) -std=c++11 -g -O0 -o loader_example loader_example.cc
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Copy `stb_image.h`, `json.hpp` and `tiny_gltf.h` to your project.
// Define these only in *one* .cc file.
#define TINYGLTF_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
// #define TINYGLTF_NOEXCEPTION // optional. disable exception handling.
#include "tiny_gltf.h"
using namespace tinygltf;
Expand All @@ -95,19 +96,42 @@ if (!ret) {
}
```

## Compile options

* `TINYGLTF_NOEXCEPTION` : Disable C++ exception handling. You can use `-fno-exceptions` or by defining the symbol `JSON_NOEXCEPTION` to fully disable C++ exception codes.
* `TINGLTF_

### Saving gltTF 2.0 model

T.B.W.

## Running tests.

### Setup
### glTF parsing test

#### Setup

Python 2.6 or 2.7 required.
Git clone https://github.com/KhronosGroup/glTF-Sample-Models to your local dir.

### Run test
#### Run parsing test

After building `loader_example`, edit `test_runner.py`, then,

$ python test_runner.py

### Unit tests

```
$ cd tests
$ make
$ ./tester
$ ./tester_noexcept
```

## Third party licenses

* json.hpp : Licensed under the MIT License <http://opensource.org/licenses/MIT>. Copyright (c) 2013-2017 Niels Lohmann <http://nlohmann.me>.
* stb_image : Public domain.
* catch : Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. Distributed under the Boost Software License, Version 1.0.

This comment has been minimized.

Copy link
@Ybalrid

Ybalrid Jan 6, 2018

Contributor

Awesome choice to use catch ;-)

* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 changes: 6 additions & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Use this for strict compilation check(will work on clang 3.8+)
#EXTRA_CXXFLAGS := -fsanitize=address -Wall -Werror -Weverything -Wno-c++11-long-long -DTINYGLTF_APPLY_CLANG_WEVERYTHING

all: ../tiny_gltf.h
clang++ -I../ $(EXTRA_CXXFLAGS) -std=c++11 -g -O0 -o tester tester.cc
clang++ -DTINYGLTF_NOEXCEPTION -I../ $(EXTRA_CXXFLAGS) -std=c++11 -g -O0 -o tester_noexcept tester.cc
Loading

0 comments on commit 17cfbcc

Please sign in to comment.