Skip to content

Commit

Permalink
use UNICODE and update the version number
Browse files Browse the repository at this point in the history
  • Loading branch information
alexchicn committed Mar 29, 2018
1 parent 9283818 commit c017fe5
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ build_win32_ue4:
- 'if exist output rmdir /s /q output'
- 'mkdir build'
- 'cd build'
- 'cmake -DLIBGLTF_BUILD_FOR_UE4=True -G "Visual Studio 14 2015" ../'
- 'cmake -G "Visual Studio 14 2015" ../'
- 'msbuild ./source/libgltf/libgltf.vcxproj /t:Rebuild /p:Configuration="Release" /p:Platform="Win32"'
- 'cd ../'
artifacts:
Expand All @@ -138,7 +138,7 @@ build_win64_ue4:
- 'if exist output rmdir /s /q output'
- 'mkdir build'
- 'cd build'
- 'cmake -DLIBGLTF_BUILD_FOR_UE4=True -G "Visual Studio 14 2015 Win64" ../'
- 'cmake -G "Visual Studio 14 2015 Win64" ../'
- 'msbuild ./source/libgltf/libgltf.vcxproj /t:Rebuild /p:Configuration="Release" /p:Platform="x64"'
- 'cd ../'
artifacts:
Expand All @@ -159,7 +159,7 @@ build_linux_ue4:
script:
- 'mkdir build'
- 'cd build'
- 'cmake -DLIBGLTF_BUILD_FOR_UE4=True -G "Unix Makefiles" ../'
- 'cmake -G "Unix Makefiles" ../'
- 'make libgltf'
- 'cd ../'
artifacts:
Expand All @@ -180,7 +180,7 @@ build_macos_ue4:
script:
- 'mkdir build'
- 'cd build'
- 'cmake -DLIBGLTF_BUILD_FOR_UE4=True -G "Unix Makefiles" ../'
- 'cmake -G "Unix Makefiles" ../'
- 'make libgltf'
- 'cd ../'
artifacts:
Expand Down
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,12 @@ set(LIBGLTF_PLATFORM_LINUX FALSE)
set(LIBGLTF_PLATFORM_MACOS FALSE)

option(LIBGLTF_COVERAGE_GCOV "Coverage gcov (debug, Linux builds only)" OFF)
option(LIBGLTF_BUILD_FOR_UE4 "Build for UE4" OFF)

if(LIBGLTF_BUILD_FOR_UE4)
add_definitions(-DLIBGLTF_USE_WCHAR)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(LIBGLTF_PLATFORM_WINDOWS TRUE)
add_definitions(-DLIBGLTF_PLATFORM_WINDOWS)
set(DYNAMIC_LIBRARY_EXTENSION ".dll")
set(STATIC_LIBRARY_EXTENSION ".lib")
if(LIBGLTF_BUILD_FOR_UE4)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MD")
endif()
if((CMAKE_EXE_LINKER_FLAGS STREQUAL "/machine:X86") OR (CMAKE_EXE_LINKER_FLAGS STREQUAL " /machine:X86"))
set(TARGET_ARCHITECTURES_X86 TRUE)
set(PLATFORM_NAME "win32")
Expand Down
8 changes: 8 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ Generate the `makefile` or `vs project` by [CMake].

For now, just build to a static library - `libgltf.(lib/a/dylib)`.

## Advance

> You can update the c++11 source code by `jsonschematoc11`.
Generate the c++11 code:

1. Run `tools/batch/update_parser_by_scheme.bat` or `tools/batch/update_parser_by_scheme.sh`

[CMake]: https://cmake.org
4 changes: 2 additions & 2 deletions include/libgltf/libgltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

#define LIBGLTF_MAJOR_VERSION 0
#define LIBGLTF_MINOR_VERSION 1
#define LIBGLTF_PATCH_VERSION 0
#define LIBGLTF_PATCH_VERSION 1

#if defined(LIBGLTF_USE_WCHAR)
#if defined(UNICODE)
typedef std::wstring GLTFString;
#else
typedef std::string GLTFString;
Expand Down
4 changes: 2 additions & 2 deletions source/libgltf/libgltfpch.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>

#if defined(LIBGLTF_USE_WCHAR)
#if defined(UNICODE)
# define GLTFTEXT(t) L##t
#else
# define GLTFTEXT(t) t
#endif

namespace libgltf
{
#if defined(LIBGLTF_USE_WCHAR)
#if defined(UNICODE)
typedef rapidjson::UTF16<> GLTFCharType;
#else
typedef rapidjson::UTF8<> GLTFCharType;
Expand Down
4 changes: 2 additions & 2 deletions source/runtest/runtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int _iArgc, char* _pcArgv[])
return error_code;
}

#if defined(LIBGLTF_USE_WCHAR)
#if defined(UNICODE)
std::wstringstream input_content;
{
std::wifstream input_file(input_file_path.c_str(), std::ios::in | std::ios::binary);
Expand Down Expand Up @@ -69,7 +69,7 @@ int main(int _iArgc, char* _pcArgv[])
return error_code;
}

#if defined(LIBGLTF_USE_WCHAR)
#if defined(UNICODE)
std::wstring output_content;
#else
std::string output_content;
Expand Down
2 changes: 1 addition & 1 deletion tools/batch/glTF_2.0_schema.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extensions_schema_directories=
%(CD)s/../../external/glTF/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/schema
major_version=0
minor_version=1
patch_version=0
patch_version=1

[code.headers]
extension.schema.json=%(CD)s/codes/extension.schema.json.h
Expand Down
2 changes: 1 addition & 1 deletion tools/jsonschematoc11/jsonschematoc11.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def generate(self, codeFileName, outputHeaderPath=None, outputSourcePath=None, n
if code_version_parser_line:
header_file.write(u'\n')

header_file.write(u'#if defined(LIBGLTF_USE_WCHAR)\n')
header_file.write(u'#if defined(UNICODE)\n')
header_file.write(u'%s%s\n' % (begin_space, u'typedef std::wstring GLTFString;'))
header_file.write(u'#else\n')
header_file.write(u'%s%s\n' % (begin_space, u'typedef std::string GLTFString;'))
Expand Down

0 comments on commit c017fe5

Please sign in to comment.