From 0438f97edf604625e928f5b0f366e6b494c132bf Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Fri, 24 Nov 2017 12:17:19 -0800 Subject: [PATCH 1/4] Fixing Android ArmV8/Clang/LibC++ build --- src/draco/core/options.h | 4 +++- src/draco/io/obj_decoder.cc | 2 +- src/draco/io/ply_decoder.cc | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/draco/core/options.h b/src/draco/core/options.h index 204d825..650f0c9 100644 --- a/src/draco/core/options.h +++ b/src/draco/core/options.h @@ -78,7 +78,9 @@ void Options::SetVector(const std::string &name, const DataTypeT *vec, for (int i = 0; i < num_dims; ++i) { if (i > 0) out += " "; -#ifdef ANDROID + +// GNU STL on android doesn't include a proper std::to_string, but the libc++ version does +#if defined(ANDROID) && !defined(_LIBCPP_VERSION) out += to_string(vec[i]); #else out += std::to_string(vec[i]); diff --git a/src/draco/io/obj_decoder.cc b/src/draco/io/obj_decoder.cc index adf3059..289fa1b 100644 --- a/src/draco/io/obj_decoder.cc +++ b/src/draco/io/obj_decoder.cc @@ -53,7 +53,7 @@ bool ObjDecoder::DecodeFromFile(const std::string &file_name, if (!file) return false; // Read the whole file into a buffer. - int64_t file_size = file.tellg(); + auto file_size = file.tellg(); file.seekg(0, std::ios::end); file_size = file.tellg() - file_size; if (file_size == 0) diff --git a/src/draco/io/ply_decoder.cc b/src/draco/io/ply_decoder.cc index b3f5e4b..55f2759 100644 --- a/src/draco/io/ply_decoder.cc +++ b/src/draco/io/ply_decoder.cc @@ -34,7 +34,7 @@ bool PlyDecoder::DecodeFromFile(const std::string &file_name, if (!file) return false; // Read the whole file into a buffer. - int64_t file_size = file.tellg(); + auto file_size = file.tellg(); file.seekg(0, std::ios::end); file_size = file.tellg() - file_size; if (file_size == 0) From 85cbcbf7b0ea2c9ca40e871d011cf8686eb76388 Mon Sep 17 00:00:00 2001 From: David Scherba Date: Mon, 27 Nov 2017 15:55:50 -0600 Subject: [PATCH 2/4] draco: Fix add_cxx_preproc_definition() behavior/usage to support setting multiple opts - Prev, only last option would take/be appended ... results in needing to run build bunches of times and exploding the CMAKE_CXX_FLAGS variable - We also no longer cache those definitions, keeping them localized - Ref: https://github.com/google/draco/issues/306 for related discussion - Linked fix uses CMake add_definitions() function, but this applies to both C and C++-based compilation --- cmake/compiler_flags.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/compiler_flags.cmake b/cmake/compiler_flags.cmake index c9a25dc..8c2be6e 100644 --- a/cmake/compiler_flags.cmake +++ b/cmake/compiler_flags.cmake @@ -152,8 +152,7 @@ function (add_cxx_preproc_definition preproc_def) string(FIND "${CMAKE_CXX_FLAGS}" "${preproc_def}" PREPROC_DEF_FOUND) if (${PREPROC_DEF_FOUND} EQUAL -1) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${preproc_def}" CACHE STRING "" - FORCE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${preproc_def}" PARENT_SCOPE) endif () endfunction () From ded212793437f3f01f4fbb8e72c09a88c5abbb33 Mon Sep 17 00:00:00 2001 From: FrankGalligan Date: Fri, 22 Dec 2017 13:55:17 -0800 Subject: [PATCH 3/4] Update compiler_flags.cmake Removed the CMake changes. Will update the cmake in another PR. --- cmake/compiler_flags.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/compiler_flags.cmake b/cmake/compiler_flags.cmake index 8c2be6e..388e687 100644 --- a/cmake/compiler_flags.cmake +++ b/cmake/compiler_flags.cmake @@ -152,7 +152,8 @@ function (add_cxx_preproc_definition preproc_def) string(FIND "${CMAKE_CXX_FLAGS}" "${preproc_def}" PREPROC_DEF_FOUND) if (${PREPROC_DEF_FOUND} EQUAL -1) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${preproc_def}" PARENT_SCOPE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${preproc_def}" CACHE STRING "" + FORCE) endif () endfunction () From bdf0416c84021ea55e7480502eecec9fc47d4838 Mon Sep 17 00:00:00 2001 From: FrankGalligan Date: Fri, 22 Dec 2017 13:56:46 -0800 Subject: [PATCH 4/4] Update compiler_flags.cmake CXX --- cmake/compiler_flags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/compiler_flags.cmake b/cmake/compiler_flags.cmake index 388e687..c9a25dc 100644 --- a/cmake/compiler_flags.cmake +++ b/cmake/compiler_flags.cmake @@ -152,7 +152,7 @@ function (add_cxx_preproc_definition preproc_def) string(FIND "${CMAKE_CXX_FLAGS}" "${preproc_def}" PREPROC_DEF_FOUND) if (${PREPROC_DEF_FOUND} EQUAL -1) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${preproc_def}" CACHE STRING "" + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${preproc_def}" CACHE STRING "" FORCE) endif () endfunction ()