From c017fe5f0798c33555a0960c9be248b63e717c9d Mon Sep 17 00:00:00 2001 From: Alex Chi Date: Fri, 30 Mar 2018 00:47:25 +0800 Subject: [PATCH] use UNICODE and update the version number --- .gitlab-ci.yml | 8 ++++---- CMakeLists.txt | 8 -------- docs/usage.md | 8 ++++++++ include/libgltf/libgltf.h | 4 ++-- source/libgltf/libgltfpch.h | 4 ++-- source/runtest/runtest.cpp | 4 ++-- tools/batch/glTF_2.0_schema.ini | 2 +- tools/jsonschematoc11/jsonschematoc11.py | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ec7c2e6..e666ceb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f7f8a0..6ed790f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/docs/usage.md b/docs/usage.md index 6ccb4ee..15bb210 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -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 diff --git a/include/libgltf/libgltf.h b/include/libgltf/libgltf.h index fd44663..14f650d 100644 --- a/include/libgltf/libgltf.h +++ b/include/libgltf/libgltf.h @@ -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; diff --git a/source/libgltf/libgltfpch.h b/source/libgltf/libgltfpch.h index acadf5a..9c6f91a 100644 --- a/source/libgltf/libgltfpch.h +++ b/source/libgltf/libgltfpch.h @@ -4,7 +4,7 @@ #include #include -#if defined(LIBGLTF_USE_WCHAR) +#if defined(UNICODE) # define GLTFTEXT(t) L##t #else # define GLTFTEXT(t) t @@ -12,7 +12,7 @@ namespace libgltf { -#if defined(LIBGLTF_USE_WCHAR) +#if defined(UNICODE) typedef rapidjson::UTF16<> GLTFCharType; #else typedef rapidjson::UTF8<> GLTFCharType; diff --git a/source/runtest/runtest.cpp b/source/runtest/runtest.cpp index c4b794f..87879f0 100644 --- a/source/runtest/runtest.cpp +++ b/source/runtest/runtest.cpp @@ -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); @@ -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; diff --git a/tools/batch/glTF_2.0_schema.ini b/tools/batch/glTF_2.0_schema.ini index f1bcdf2..82dc7ef 100644 --- a/tools/batch/glTF_2.0_schema.ini +++ b/tools/batch/glTF_2.0_schema.ini @@ -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 diff --git a/tools/jsonschematoc11/jsonschematoc11.py b/tools/jsonschematoc11/jsonschematoc11.py index 13bdbfb..590b414 100644 --- a/tools/jsonschematoc11/jsonschematoc11.py +++ b/tools/jsonschematoc11/jsonschematoc11.py @@ -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;'))