Merge pull request #533 from google/draco_misc

draco: Mostly CMake updates.
This commit is contained in:
Tom Finegan 2019-06-24 14:01:03 -07:00 committed by GitHub
commit c1255f6315
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 894 additions and 773 deletions

9
.clang-format Normal file
View File

@ -0,0 +1,9 @@
---
Language: Cpp
BasedOnStyle: Google
DerivePointerAlignment: false
PointerAlignment: Right
AllowShortIfStatementsOnASingleLine: false
AllowShortFunctionsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
...

102
.cmake-format.py Normal file
View File

@ -0,0 +1,102 @@
# Generated with cmake-format 0.5.1
# How wide to allow formatted cmake files
line_width = 80
# How many spaces to tab for indent
tab_size = 2
# If arglists are longer than this, break them always
max_subargs_per_line = 10
# If true, separate flow control names from their parentheses with a space
separate_ctrl_name_with_space = False
# If true, separate function names from parentheses with a space
separate_fn_name_with_space = False
# If a statement is wrapped to more than one line, than dangle the closing
# parenthesis on its own line
dangle_parens = False
# What character to use for bulleted lists
bullet_char = '*'
# What character to use as punctuation after numerals in an enumerated list
enum_char = '.'
# What style line endings to use in the output.
line_ending = u'unix'
# Format command names consistently as 'lower' or 'upper' case
command_case = u'lower'
# Format keywords consistently as 'lower' or 'upper' case
keyword_case = u'unchanged'
# Specify structure for custom cmake functions
additional_commands = {
"foo": {
"flags": [
"BAR",
"BAZ"
],
"kwargs": {
"HEADERS": "*",
"DEPENDS": "*",
"SOURCES": "*"
}
}
}
# A list of command names which should always be wrapped
always_wrap = []
# Specify the order of wrapping algorithms during successive reflow attempts
algorithm_order = [0, 1, 2, 3, 4]
# If true, the argument lists which are known to be sortable will be sorted
# lexicographicall
autosort = False
# enable comment markup parsing and reflow
enable_markup = True
# If comment markup is enabled, don't reflow the first comment block in
# eachlistfile. Use this to preserve formatting of your
# copyright/licensestatements.
first_comment_is_literal = False
# If comment markup is enabled, don't reflow any comment block which matchesthis
# (regex) pattern. Default is `None` (disabled).
literal_comment_pattern = None
# Regular expression to match preformat fences in comments
# default=r'^\s*([`~]{3}[`~]*)(.*)$'
fence_pattern = u'^\\s*([`~]{3}[`~]*)(.*)$'
# Regular expression to match rulers in comments
# default=r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'
ruler_pattern = u'^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'
# If true, emit the unicode byte-order mark (BOM) at the start of the file
emit_byteorder_mark = False
# If a comment line starts with at least this many consecutive hash characters,
# then don't lstrip() them off. This allows for lazy hash rulers where the first
# hash char is not separated by space
hashruler_min_length = 10
# If true, then insert a space between the first hash char and remaining hash
# chars in a hash ruler, and normalize its length to fill the column
canonicalize_hashrulers = True
# Specify the encoding of the input file. Defaults to utf-8.
input_encoding = u'utf-8'
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
# only claims to support utf-8 so be careful when using anything else
output_encoding = u'utf-8'
# A dictionary containing any per-command configuration overrides. Currently
# only `command_case` is supported.
per_command = {}

View File

@ -3,8 +3,9 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
if(NOT CMAKE_BUILD_TYPE AND NOT IGNORE_EMPTY_BUILD_TYPE)
if(CMAKE_CURRENT_LIST_FILE STREQUAL CMAKE_PARENT_LIST_FILE)
message(INFO "|Draco: ignoring empty build type, forcing release mode.")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Draco overridden build type"
FORCE)
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "Draco overridden build type" FORCE)
endif()
endif()
@ -15,12 +16,11 @@ set(draco_src_root "${draco_root}/src/draco")
set(draco_build_dir "${CMAKE_BINARY_DIR}")
if("${draco_root}" STREQUAL "${draco_build_dir}")
message(FATAL_ERROR
"Building from within the Draco source tree is not supported.\n"
message(
FATAL_ERROR "Building from within the Draco source tree is not supported.\n"
"Hint: Run these commands\n"
"$ rm -rf CMakeCache.txt CMakeFiles\n"
"$ mkdir -p ../draco_build\n"
"$ cd ../draco_build\n"
"$ mkdir -p ../draco_build\n" "$ cd ../draco_build\n"
"And re-run CMake from the draco_build directory.")
endif()
@ -161,9 +161,10 @@ if (GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE}
--git-dir=${draco_git_dir} rev-parse HEAD
OUTPUT_VARIABLE draco_git_hash)
execute_process(
COMMAND ${GIT_EXECUTABLE} --git-dir=${draco_git_dir}/.git describe
OUTPUT_VARIABLE draco_git_desc ERROR_QUIET)
execute_process(COMMAND ${GIT_EXECUTABLE}
--git-dir=${draco_git_dir}/.git describe
OUTPUT_VARIABLE draco_git_desc
ERROR_QUIET)
# Consume newlines from Git output.
string(STRIP "${draco_git_hash}" draco_git_hash)
string(STRIP "${draco_git_desc}" draco_git_desc)
@ -183,7 +184,8 @@ configure_file("${draco_root}/cmake/draco_version.h.cmake"
if(EMSCRIPTEN)
include(FindPythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR
message(
FATAL_ERROR
"Python required for Emscripten builds, but cmake cannot find it.")
endif()
else()
@ -195,10 +197,12 @@ else ()
endif()
# Googletest defaults.
set(GTEST_SOURCE_DIR
"${draco_root}/../googletest" CACHE STRING
"Path to googletest source directory")
set(GTEST_BUILD_DIR
"${draco_build_dir}/googletest" CACHE STRING
"${draco_root}/../googletest"
CACHE STRING "Path to googletest source directory")
set(
GTEST_BUILD_DIR
"${draco_build_dir}/googletest"
CACHE STRING
"Path to directory where googletest will be configured and built.")
# Confirm Googletest is where expected.
@ -207,8 +211,8 @@ else ()
message("Tests disabled: Google test CMakeLists.txt does not exist.")
else()
if(APPLE AND BUILD_SHARED_LIBS)
# Silence an RPATH warning emitted during processing of Googletest
# cmake files.
# Silence an RPATH warning emitted during processing of Googletest cmake
# files.
set(CMAKE_MACOSX_RPATH 1)
endif()
@ -239,7 +243,8 @@ set(draco_attributes_sources
"${draco_src_root}/attributes/point_attribute.cc"
"${draco_src_root}/attributes/point_attribute.h")
set(draco_compression_attributes_dec_sources
set(
draco_compression_attributes_dec_sources
"${draco_src_root}/compression/attributes/attributes_decoder.cc"
"${draco_src_root}/compression/attributes/attributes_decoder.h"
"${draco_src_root}/compression/attributes/kd_tree_attributes_decoder.cc"
@ -257,9 +262,11 @@ set(draco_compression_attributes_dec_sources
"${draco_src_root}/compression/attributes/sequential_normal_attribute_decoder.cc"
"${draco_src_root}/compression/attributes/sequential_normal_attribute_decoder.h"
"${draco_src_root}/compression/attributes/sequential_quantization_attribute_decoder.cc"
"${draco_src_root}/compression/attributes/sequential_quantization_attribute_decoder.h")
"${draco_src_root}/compression/attributes/sequential_quantization_attribute_decoder.h"
)
set(draco_compression_attributes_enc_sources
set(
draco_compression_attributes_enc_sources
"${draco_src_root}/compression/attributes/attributes_encoder.cc"
"${draco_src_root}/compression/attributes/attributes_encoder.h"
"${draco_src_root}/compression/attributes/kd_tree_attributes_encoder.cc"
@ -275,9 +282,11 @@ set(draco_compression_attributes_enc_sources
"${draco_src_root}/compression/attributes/sequential_normal_attribute_encoder.cc"
"${draco_src_root}/compression/attributes/sequential_normal_attribute_encoder.h"
"${draco_src_root}/compression/attributes/sequential_quantization_attribute_encoder.cc"
"${draco_src_root}/compression/attributes/sequential_quantization_attribute_encoder.h")
"${draco_src_root}/compression/attributes/sequential_quantization_attribute_encoder.h"
)
set(draco_compression_attributes_pred_schemes_dec_sources
set(
draco_compression_attributes_pred_schemes_dec_sources
"${draco_src_root}/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h"
"${draco_src_root}/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h"
"${draco_src_root}/compression/attributes/prediction_schemes/mesh_prediction_scheme_data.h"
@ -303,9 +312,11 @@ set(draco_compression_attributes_pred_schemes_dec_sources
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_decoding_transform.h"
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h"
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h"
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h")
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h"
)
set(draco_compression_attributes_pred_schemes_enc_sources
set(
draco_compression_attributes_pred_schemes_enc_sources
"${draco_src_root}/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_encoder.h"
"${draco_src_root}/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h"
"${draco_src_root}/compression/attributes/prediction_schemes/mesh_prediction_scheme_data.h"
@ -332,7 +343,8 @@ set(draco_compression_attributes_pred_schemes_enc_sources
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_encoding_transform.h"
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h"
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_wrap_encoding_transform.h"
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h")
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h"
)
set(draco_compression_bit_coders_sources
"${draco_src_root}/compression/bit_coders/adaptive_rans_bit_coding_shared.h"
@ -366,8 +378,7 @@ set(draco_dec_config_sources
"${draco_src_root}/compression/config/decoder_options.h"
"${draco_src_root}/compression/config/draco_options.h")
set(draco_compression_decode_sources
"${draco_src_root}/compression/decode.cc"
set(draco_compression_decode_sources "${draco_src_root}/compression/decode.cc"
"${draco_src_root}/compression/decode.h")
set(draco_compression_encode_sources
@ -377,15 +388,16 @@ set(draco_compression_encode_sources
"${draco_src_root}/compression/expert_encode.cc"
"${draco_src_root}/compression/expert_encode.h")
set(draco_compression_mesh_traverser_sources
set(
draco_compression_mesh_traverser_sources
"${draco_src_root}/compression/mesh/traverser/depth_first_traverser.h"
"${draco_src_root}/compression/mesh/traverser/max_prediction_degree_traverser.h"
"${draco_src_root}/compression/mesh/traverser/mesh_attribute_indices_encoding_observer.h"
"${draco_src_root}/compression/mesh/traverser/mesh_traversal_sequencer.h"
"${draco_src_root}/compression/mesh/traverser/traverser_base.h")
set(draco_compression_mesh_dec_sources
set(
draco_compression_mesh_dec_sources
"${draco_src_root}/compression/mesh/mesh_decoder.cc"
"${draco_src_root}/compression/mesh/mesh_decoder.h"
"${draco_src_root}/compression/mesh/mesh_decoder_helpers.h"
@ -401,7 +413,8 @@ set(draco_compression_mesh_dec_sources
"${draco_src_root}/compression/mesh/mesh_sequential_decoder.cc"
"${draco_src_root}/compression/mesh/mesh_sequential_decoder.h")
set(draco_compression_mesh_enc_sources
set(
draco_compression_mesh_enc_sources
"${draco_src_root}/compression/mesh/mesh_edgebreaker_encoder.cc"
"${draco_src_root}/compression/mesh/mesh_edgebreaker_encoder.h"
"${draco_src_root}/compression/mesh/mesh_edgebreaker_encoder_impl.cc"
@ -417,7 +430,8 @@ set(draco_compression_mesh_enc_sources
"${draco_src_root}/compression/mesh/mesh_sequential_encoder.cc"
"${draco_src_root}/compression/mesh/mesh_sequential_encoder.h")
set(draco_compression_point_cloud_dec_sources
set(
draco_compression_point_cloud_dec_sources
"${draco_src_root}/compression/point_cloud/point_cloud_decoder.cc"
"${draco_src_root}/compression/point_cloud/point_cloud_decoder.h"
"${draco_src_root}/compression/point_cloud/point_cloud_kd_tree_decoder.cc"
@ -425,7 +439,8 @@ set(draco_compression_point_cloud_dec_sources
"${draco_src_root}/compression/point_cloud/point_cloud_sequential_decoder.cc"
"${draco_src_root}/compression/point_cloud/point_cloud_sequential_decoder.h")
set(draco_compression_point_cloud_enc_sources
set(
draco_compression_point_cloud_enc_sources
"${draco_src_root}/compression/point_cloud/point_cloud_encoder.cc"
"${draco_src_root}/compression/point_cloud/point_cloud_encoder.h"
"${draco_src_root}/compression/point_cloud/point_cloud_kd_tree_encoder.cc"
@ -526,40 +541,41 @@ set(draco_point_cloud_sources
"${draco_src_root}/point_cloud/point_cloud_builder.cc"
"${draco_src_root}/point_cloud/point_cloud_builder.h")
set(draco_points_common_sources
set(
draco_points_common_sources
"${draco_src_root}/compression/point_cloud/algorithms/point_cloud_compression_method.h"
"${draco_src_root}/compression/point_cloud/algorithms/point_cloud_types.h"
"${draco_src_root}/compression/point_cloud/algorithms/quantize_points_3.h"
"${draco_src_root}/compression/point_cloud/algorithms/queuing_policy.h")
set(draco_points_dec_sources
set(
draco_points_dec_sources
"${draco_src_root}/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.cc"
"${draco_src_root}/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.h"
"${draco_src_root}/compression/point_cloud/algorithms/float_points_tree_decoder.cc"
"${draco_src_root}/compression/point_cloud/algorithms/float_points_tree_decoder.h")
"${draco_src_root}/compression/point_cloud/algorithms/float_points_tree_decoder.h"
)
set(draco_points_enc_sources
set(
draco_points_enc_sources
"${draco_src_root}/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.cc"
"${draco_src_root}/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.h"
"${draco_src_root}/compression/point_cloud/algorithms/float_points_tree_encoder.cc"
"${draco_src_root}/compression/point_cloud/algorithms/float_points_tree_encoder.h")
"${draco_src_root}/compression/point_cloud/algorithms/float_points_tree_encoder.h"
)
set(draco_metadata_sources
"${draco_src_root}/metadata/geometry_metadata.cc"
set(draco_metadata_sources "${draco_src_root}/metadata/geometry_metadata.cc"
"${draco_src_root}/metadata/geometry_metadata.h"
"${draco_src_root}/metadata/metadata.cc"
"${draco_src_root}/metadata/metadata.h")
set(draco_metadata_enc_sources
"${draco_src_root}/metadata/metadata_encoder.cc"
set(draco_metadata_enc_sources "${draco_src_root}/metadata/metadata_encoder.cc"
"${draco_src_root}/metadata/metadata_encoder.h")
set(draco_metadata_dec_sources
"${draco_src_root}/metadata/metadata_decoder.cc"
set(draco_metadata_dec_sources "${draco_src_root}/metadata/metadata_decoder.cc"
"${draco_src_root}/metadata/metadata_decoder.h")
set(draco_animation_sources
"${draco_src_root}/animation/keyframe_animation.cc"
set(draco_animation_sources "${draco_src_root}/animation/keyframe_animation.cc"
"${draco_src_root}/animation/keyframe_animation.h")
set(draco_animation_enc_sources
@ -578,15 +594,20 @@ set(draco_js_enc_sources
"${draco_src_root}/javascript/emscripten/draco_encoder_glue_wrapper.cc"
"${draco_src_root}/javascript/emscripten/encoder_webidl_wrapper.cc")
set(draco_animation_js_dec_sources
set(
draco_animation_js_dec_sources
"${draco_src_root}/javascript/emscripten/animation_decoder_webidl_wrapper.cc"
"${draco_src_root}/javascript/emscripten/draco_animation_decoder_glue_wrapper.cc")
"${draco_src_root}/javascript/emscripten/draco_animation_decoder_glue_wrapper.cc"
)
set(draco_animation_js_enc_sources
set(
draco_animation_js_enc_sources
"${draco_src_root}/javascript/emscripten/animation_encoder_webidl_wrapper.cc"
"${draco_src_root}/javascript/emscripten/draco_animation_encoder_glue_wrapper.cc")
"${draco_src_root}/javascript/emscripten/draco_animation_encoder_glue_wrapper.cc"
)
set(draco_test_sources
set(
draco_test_sources
"${draco_src_root}/animation/keyframe_animation_encoding_test.cc"
"${draco_src_root}/animation/keyframe_animation_test.cc"
"${draco_src_root}/attributes/point_attribute_test.cc"
@ -625,16 +646,13 @@ set(draco_test_sources
"${draco_src_root}/point_cloud/point_cloud_builder_test.cc"
"${draco_src_root}/point_cloud/point_cloud_test.cc")
set(draco_version_sources
"${draco_build_dir}/draco_version.cc"
set(draco_version_sources "${draco_build_dir}/draco_version.cc"
"${draco_build_dir}/draco_version.h")
set(draco_unity_plug_sources
"${draco_src_root}/unity/draco_unity_plugin.cc"
set(draco_unity_plug_sources "${draco_src_root}/unity/draco_unity_plugin.cc"
"${draco_src_root}/unity/draco_unity_plugin.h")
set(draco_maya_plug_sources
"${draco_src_root}/maya/draco_maya_plugin.cc"
set(draco_maya_plug_sources "${draco_src_root}/maya/draco_maya_plugin.cc"
"${draco_src_root}/maya/draco_maya_plugin.h")
include_directories("${draco_root}/src" "${draco_build_dir}")
@ -682,16 +700,14 @@ if (EMSCRIPTEN AND ENABLE_JS_GLUE)
# can be added to targets without cmake reporting errors.
execute_process(COMMAND ${PYTHON_EXECUTABLE}
$ENV{EMSCRIPTEN}/tools/webidl_binder.py
${draco_js_dec_idl}
${draco_build_dir}/glue_decoder)
${draco_js_dec_idl} ${draco_build_dir}/glue_decoder)
execute_process(COMMAND ${PYTHON_EXECUTABLE}
$ENV{EMSCRIPTEN}/tools/webidl_binder.py
${draco_js_enc_idl}
${draco_build_dir}/glue_encoder)
${draco_js_enc_idl} ${draco_build_dir}/glue_encoder)
if (NOT EXISTS "${draco_build_dir}/glue_decoder.cpp" OR
NOT EXISTS "${draco_build_dir}/glue_encoder.cpp")
if(NOT EXISTS "${draco_build_dir}/glue_decoder.cpp"
OR NOT EXISTS "${draco_build_dir}/glue_encoder.cpp")
message(FATAL_ERROR "Glue generation failed.")
endif()
@ -704,8 +720,8 @@ if (EMSCRIPTEN AND ENABLE_JS_GLUE)
$ENV{EMSCRIPTEN}/tools/webidl_binder.py
${draco_animation_js_enc_idl}
${draco_build_dir}/glue_animation_encoder)
if (NOT EXISTS "${draco_build_dir}/glue_animation_decoder.cpp" OR
NOT EXISTS "${draco_build_dir}/glue_animation_encoder.cpp")
if(NOT EXISTS "${draco_build_dir}/glue_animation_decoder.cpp"
OR NOT EXISTS "${draco_build_dir}/glue_animation_encoder.cpp")
message(FATAL_ERROR "Animation glue generation failed.")
endif()
endif()
@ -715,8 +731,7 @@ if (EMSCRIPTEN AND ENABLE_JS_GLUE)
add_custom_command(OUTPUT ${draco_build_dir}/glue_decoder.cpp
COMMAND ${PYTHON_EXECUTABLE}
$ENV{EMSCRIPTEN}/tools/webidl_binder.py
${draco_js_dec_idl}
${draco_build_dir}/glue_decoder
${draco_js_dec_idl} ${draco_build_dir}/glue_decoder
DEPENDS ${draco_js_dec_idl}
COMMENT "Generating ${draco_build_dir}/glue_decoder.cpp."
WORKING_DIRECTORY ${draco_build_dir}
@ -725,26 +740,25 @@ if (EMSCRIPTEN AND ENABLE_JS_GLUE)
add_custom_command(OUTPUT ${draco_build_dir}/glue_encoder.cpp
COMMAND ${PYTHON_EXECUTABLE}
$ENV{EMSCRIPTEN}/tools/webidl_binder.py
${draco_js_enc_idl}
${draco_build_dir}/glue_encoder
${draco_js_enc_idl} ${draco_build_dir}/glue_encoder
DEPENDS ${draco_js_enc_idl}
COMMENT "Generating ${draco_build_dir}/glue_encoder.cpp."
WORKING_DIRECTORY ${draco_build_dir}
VERBATIM)
if(BUILD_ANIMATION_ENCODING)
add_custom_command(OUTPUT ${draco_build_dir}/glue_animation_decoder.cpp
COMMAND ${PYTHON_EXECUTABLE}
$ENV{EMSCRIPTEN}/tools/webidl_binder.py
add_custom_command(
OUTPUT ${draco_build_dir}/glue_animation_decoder.cpp
COMMAND ${PYTHON_EXECUTABLE} $ENV{EMSCRIPTEN}/tools/webidl_binder.py
${draco_animation_js_dec_idl}
${draco_build_dir}/glue_animation_decoder
DEPENDS ${draco_animation_js_dec_idl}
COMMENT "Generating ${draco_build_dir}/glue_animation_decoder.cpp."
WORKING_DIRECTORY ${draco_build_dir}
VERBATIM)
add_custom_command(OUTPUT ${draco_build_dir}/glue_animation_encoder.cpp
COMMAND ${PYTHON_EXECUTABLE}
$ENV{EMSCRIPTEN}/tools/webidl_binder.py
add_custom_command(
OUTPUT ${draco_build_dir}/glue_animation_encoder.cpp
COMMAND ${PYTHON_EXECUTABLE} $ENV{EMSCRIPTEN}/tools/webidl_binder.py
${draco_animation_js_enc_idl}
${draco_build_dir}/glue_animation_encoder
DEPENDS ${draco_animation_js_enc_idl}
@ -793,15 +807,11 @@ if (EMSCRIPTEN AND ENABLE_JS_GLUE)
${draco_points_enc_sources}
${draco_version_sources})
add_executable(draco_decoder
${draco_js_dec_sources}
${draco_decoder_src})
add_executable(draco_decoder ${draco_js_dec_sources} ${draco_decoder_src})
append_link_flag_to_target(draco_decoder
"-s EXPORT_NAME=\"'DracoDecoderModule'\"")
add_executable(draco_encoder
${draco_js_enc_sources}
${draco_encoder_src})
add_executable(draco_encoder ${draco_js_enc_sources} ${draco_encoder_src})
append_link_flag_to_target(draco_encoder
"-s EXPORT_NAME=\"'DracoEncoderModule'\"")
@ -817,41 +827,43 @@ if (EMSCRIPTEN AND ENABLE_JS_GLUE)
endif()
# Make $draco_js_sources source files depend on glue_decoder.cpp.
set_property(SOURCE ${draco_js_sources} APPEND PROPERTY OBJECT_DEPENDS
${draco_build_dir}/glue_decoder.cpp)
set_property(SOURCE ${draco_js_sources}
APPEND
PROPERTY OBJECT_DEPENDS ${draco_build_dir}/glue_decoder.cpp)
em_link_pre_js(draco_decoder
"${draco_src_root}/javascript/emscripten/prepareCallbacks.js"
"${draco_src_root}/javascript/emscripten/version.js")
em_link_post_js(draco_decoder
"${draco_build_dir}/glue_decoder.js"
em_link_post_js(draco_decoder "${draco_build_dir}/glue_decoder.js"
"${draco_src_root}/javascript/emscripten/finalize.js")
set_property(SOURCE ${draco_js_enc_sources} APPEND PROPERTY OBJECT_DEPENDS
${draco_build_dir}/glue_encoder.cpp)
set_property(SOURCE ${draco_js_enc_sources}
APPEND
PROPERTY OBJECT_DEPENDS ${draco_build_dir}/glue_encoder.cpp)
em_link_pre_js(draco_encoder
"${draco_src_root}/javascript/emscripten/prepareCallbacks.js"
"${draco_src_root}/javascript/emscripten/version.js")
em_link_post_js(draco_encoder
"${draco_build_dir}/glue_encoder.js"
em_link_post_js(draco_encoder "${draco_build_dir}/glue_encoder.js"
"${draco_src_root}/javascript/emscripten/finalize.js")
if(BUILD_ANIMATION_ENCODING)
add_executable(draco_animation_decoder
${draco_animation_dec_sources}
add_executable(draco_animation_decoder ${draco_animation_dec_sources}
${draco_animation_js_dec_sources}
${draco_animation_sources}
${draco_decoder_src})
add_executable(draco_animation_encoder
${draco_animation_enc_sources}
add_executable(draco_animation_encoder ${draco_animation_enc_sources}
${draco_animation_js_enc_sources}
${draco_animation_sources}
${draco_encoder_src})
append_link_flag_to_target(draco_animation_decoder
append_link_flag_to_target(
draco_animation_decoder
"-s EXPORT_NAME=\"'DracoAnimationDecoderModule'\"")
append_link_flag_to_target(draco_animation_encoder
append_link_flag_to_target(
draco_animation_encoder
"-s EXPORT_NAME=\"'DracoAnimationEncoderModule'\"")
set_property(SOURCE ${draco_js_sources} APPEND PROPERTY OBJECT_DEPENDS
set_property(SOURCE ${draco_js_sources}
APPEND
PROPERTY OBJECT_DEPENDS
${draco_build_dir}/glue_animation_decoder.cpp)
em_link_pre_js(draco_animation_decoder
"${draco_src_root}/javascript/emscripten/prepareCallbacks.js"
@ -860,7 +872,9 @@ if (EMSCRIPTEN AND ENABLE_JS_GLUE)
"${draco_build_dir}/glue_animation_decoder.js"
"${draco_src_root}/javascript/emscripten/finalize.js")
set_property(SOURCE ${draco_js_enc_sources} APPEND PROPERTY OBJECT_DEPENDS
set_property(SOURCE ${draco_js_enc_sources}
APPEND
PROPERTY OBJECT_DEPENDS
${draco_build_dir}/glue_animation_encoder.cpp)
em_link_pre_js(draco_animation_encoder
"${draco_src_root}/javascript/emscripten/prepareCallbacks.js"
@ -870,42 +884,40 @@ if (EMSCRIPTEN AND ENABLE_JS_GLUE)
"${draco_src_root}/javascript/emscripten/finalize.js")
endif()
else()
# Standard Draco libs, encoder and decoder.
# Object collections that mirror the Draco directory structure.
# Standard Draco libs, encoder and decoder. Object collections that mirror the
# Draco directory structure.
if(BUILD_SHARED_LIBS)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
add_library(draco_attributes OBJECT ${draco_attributes_sources})
add_library(draco_compression_attributes_dec OBJECT
${draco_compression_attributes_dec_sources})
add_library(draco_compression_attributes_enc OBJECT
${draco_compression_attributes_enc_sources})
add_library(draco_compression_attributes_pred_schemes_dec OBJECT
${draco_compression_attributes_pred_schemes_dec_sources})
add_library(draco_compression_attributes_pred_schemes_enc OBJECT
${draco_compression_attributes_pred_schemes_enc_sources})
add_library(draco_compression_bit_coders OBJECT
${draco_compression_bit_coders_sources})
add_library(draco_enc_config OBJECT
${draco_enc_config_sources})
add_library(draco_dec_config OBJECT
${draco_dec_config_sources})
add_library(draco_compression_attributes_dec
OBJECT ${draco_compression_attributes_dec_sources})
add_library(draco_compression_attributes_enc
OBJECT ${draco_compression_attributes_enc_sources})
add_library(draco_compression_attributes_pred_schemes_dec
OBJECT ${draco_compression_attributes_pred_schemes_dec_sources})
add_library(draco_compression_attributes_pred_schemes_enc
OBJECT ${draco_compression_attributes_pred_schemes_enc_sources})
add_library(draco_compression_bit_coders
OBJECT ${draco_compression_bit_coders_sources})
add_library(draco_enc_config OBJECT ${draco_enc_config_sources})
add_library(draco_dec_config OBJECT ${draco_dec_config_sources})
add_library(draco_compression_decode OBJECT
${draco_compression_decode_sources})
add_library(draco_compression_encode OBJECT
${draco_compression_encode_sources})
add_library(draco_compression_entropy OBJECT
${draco_compression_entropy_sources})
add_library(draco_compression_mesh_traverser OBJECT
${draco_compression_mesh_traverser_sources})
add_library(draco_compression_mesh_traverser
OBJECT ${draco_compression_mesh_traverser_sources})
add_library(draco_compression_mesh_dec OBJECT
${draco_compression_mesh_dec_sources})
add_library(draco_compression_mesh_enc OBJECT
${draco_compression_mesh_enc_sources})
add_library(draco_compression_point_cloud_dec OBJECT
${draco_compression_point_cloud_dec_sources})
add_library(draco_compression_point_cloud_enc OBJECT
${draco_compression_point_cloud_enc_sources})
add_library(draco_compression_point_cloud_dec
OBJECT ${draco_compression_point_cloud_dec_sources})
add_library(draco_compression_point_cloud_enc
OBJECT ${draco_compression_point_cloud_enc_sources})
add_library(draco_core OBJECT ${draco_core_sources})
add_library(draco_io OBJECT ${draco_io_sources})
add_library(draco_mesh OBJECT ${draco_mesh_sources})
@ -916,21 +928,17 @@ else ()
add_library(draco_animation_enc OBJECT ${draco_animation_enc_sources})
add_library(draco_animation OBJECT ${draco_animation_sources})
add_library(draco_point_cloud OBJECT ${draco_point_cloud_sources})
add_library(draco_points_dec OBJECT
${draco_points_common_sources}
add_library(draco_points_dec OBJECT ${draco_points_common_sources}
${draco_points_dec_sources})
add_library(draco_points_enc OBJECT
${draco_points_common_sources}
add_library(draco_points_enc OBJECT ${draco_points_common_sources}
${draco_points_enc_sources})
if(BUILD_UNITY_PLUGIN)
add_library(draco_unity_plugin OBJECT
${draco_unity_plug_sources})
add_library(draco_unity_plugin OBJECT ${draco_unity_plug_sources})
endif()
if(BUILD_MAYA_PLUGIN)
add_library(draco_maya_plugin OBJECT
${draco_maya_plug_sources})
add_library(draco_maya_plugin OBJECT ${draco_maya_plug_sources})
endif()
# Library targets that consume the object collections.
@ -1002,8 +1010,7 @@ else ()
$<TARGET_OBJECTS:draco_points_dec>
$<TARGET_OBJECTS:draco_points_enc>)
if(BUILD_UNITY_PLUGIN)
add_library(dracodec_unity
MODULE
add_library(dracodec_unity MODULE
${draco_version_sources}
$<TARGET_OBJECTS:draco_attributes>
$<TARGET_OBJECTS:draco_compression_attributes_dec>
@ -1028,8 +1035,7 @@ else ()
endif()
if(BUILD_MAYA_PLUGIN)
add_library(draco_maya_wrapper
MODULE
add_library(draco_maya_wrapper MODULE
${draco_version_sources}
$<TARGET_OBJECTS:draco_attributes>
$<TARGET_OBJECTS:draco_compression_attributes_dec>
@ -1061,11 +1067,9 @@ else ()
endif()
endif()
set(draco_header_only_targets
draco_compression_attributes_pred_schemes_dec
set(draco_header_only_targets draco_compression_attributes_pred_schemes_dec
draco_compression_mesh_traverser
draco_dec_config
draco_enc_config)
draco_dec_config draco_enc_config)
# For now, enable deduplication for both encoder and decoder.
# TODO(ostava): Support for disabling attribute deduplication for the C++
@ -1108,8 +1112,7 @@ else ()
# Draco app targets.
add_executable(draco_decoder "${draco_src_root}/tools/draco_decoder.cc")
target_link_libraries(draco_decoder PRIVATE dracodec)
add_executable(draco_encoder
"${draco_src_root}/tools/draco_encoder.cc")
add_executable(draco_encoder "${draco_src_root}/tools/draco_encoder.cc")
target_link_libraries(draco_encoder PRIVATE draco)
if(ENABLE_TESTS)
@ -1124,8 +1127,9 @@ else ()
file(GLOB_RECURSE draco_headers RELATIVE ${draco_root}/src/draco "*.h")
foreach(filename ${draco_headers})
get_filename_component(file_directory ${filename} DIRECTORY)
install(FILES src/draco/${filename} DESTINATION
"${CMAKE_INSTALL_PREFIX}/include/draco/${file_directory}")
install(
FILES src/draco/${filename}
DESTINATION "${CMAKE_INSTALL_PREFIX}/include/draco/${file_directory}")
endforeach()
install(FILES "${draco_build_dir}/draco/draco_features.h"
@ -1138,15 +1142,14 @@ else ()
endif()
# Add install rules for lib and executable targets.
install(TARGETS dracodec dracoenc draco
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS dracodec dracoenc draco DESTINATION
"${CMAKE_INSTALL_PREFIX}/lib")
if(BUILD_UNITY_PLUGIN)
install(TARGETS dracodec_unity
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS dracodec_unity DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
endif()
if(BUILD_MAYA_PLUGIN)
install(TARGETS draco_maya_wrapper
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(
TARGETS draco_maya_wrapper DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
endif()
install(TARGETS draco_decoder draco_encoder DESTINATION
@ -1160,14 +1163,13 @@ else ()
set(draco_config_in_file "${draco_root}/cmake/DracoConfig.cmake")
set(draco_config_out_file "${draco_build_dir}/DracoConfig.cmake")
configure_package_config_file(
"${draco_config_in_file}"
configure_package_config_file("${draco_config_in_file}"
"${draco_config_out_file}"
NO_CHECK_REQUIRED_COMPONENTS_MACRO
INSTALL_DESTINATION "${draco_lib_install_dir}/draco/cmake"
PATH_VARS draco_include_install_dir draco_lib_install_dir)
write_basic_package_version_file(
"${draco_build_dir}/DracoConfigVersion.cmake"
INSTALL_DESTINATION
"${draco_lib_install_dir}/draco/cmake" PATH_VARS
draco_include_install_dir draco_lib_install_dir)
write_basic_package_version_file("${draco_build_dir}/DracoConfigVersion.cmake"
VERSION ${draco_version}
COMPATIBILITY SameMajorVersion)
@ -1180,8 +1182,7 @@ else ()
endforeach()
# Add install rules for CMake helper scripts.
set(draco_cmake_helper_scripts
"${draco_root}/cmake/FindDraco.cmake"
set(draco_cmake_helper_scripts "${draco_root}/cmake/FindDraco.cmake"
"${draco_build_dir}/DracoConfig.cmake"
"${draco_build_dir}/DracoConfigVersion.cmake")
install(FILES ${draco_cmake_helper_scripts}

View File

@ -2,10 +2,7 @@
#
# Locates draco and sets the following variables:
#
# draco_FOUND
# draco_INCLUDE_DIRS
# draco_LIBARY_DIRS
# draco_LIBRARIES
# draco_FOUND draco_INCLUDE_DIRS draco_LIBARY_DIRS draco_LIBRARIES
# draco_VERSION_STRING
#
# draco_FOUND is set to YES only when all other variables are successfully
@ -32,8 +29,7 @@ find_path(draco_INCLUDE_DIRS NAMES "${draco_version_file_no_prefix}")
if(draco_INCLUDE_DIRS)
set(draco_version_file
"${draco_INCLUDE_DIRS}/draco/src/draco/core/draco_version.h")
file(STRINGS "${draco_version_file}" draco_version
REGEX "kdracoVersion")
file(STRINGS "${draco_version_file}" draco_version REGEX "kdracoVersion")
list(GET draco_version 0 draco_version)
string(REPLACE "static const char kdracoVersion[] = " "" draco_version
"${draco_version}")
@ -52,7 +48,9 @@ endif ()
# Store path to library.
get_filename_component(draco_LIBRARY_DIRS ${draco_LIBRARIES} DIRECTORY)
if (draco_INCLUDE_DIRS AND draco_LIBRARY_DIRS AND draco_LIBRARIES AND
draco_VERSION_STRING)
if(draco_INCLUDE_DIRS
AND draco_LIBRARY_DIRS
AND draco_LIBRARIES
AND draco_VERSION_STRING)
set(draco_FOUND YES)
endif()

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_COMPILER_FLAGS_CMAKE_)
if(DRACO_CMAKE_COMPILER_FLAGS_CMAKE_)
return()
endif()
set(DRACO_CMAKE_COMPILER_FLAGS_CMAKE_ 1)
include(CheckCCompilerFlag)
@ -25,8 +27,9 @@ macro (add_c_flag_if_supported c_flag)
if(${C_FLAG_SUPPORTED})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${c_flag}" CACHE STRING "")
else()
set(DRACO_FAILED_C_FLAGS "${DRACO_FAILED_C_FLAGS} ${c_flag}" CACHE STRING
"" FORCE)
set(DRACO_FAILED_C_FLAGS
"${DRACO_FAILED_C_FLAGS} ${c_flag}"
CACHE STRING "" FORCE)
endif()
endif()
endmacro()
@ -47,8 +50,9 @@ macro (add_cxx_flag_if_supported cxx_flag)
if(${CXX_FLAG_SUPPORTED})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_flag}" CACHE STRING "")
else()
set(DRACO_FAILED_CXX_FLAGS "${DRACO_FAILED_CXX_FLAGS} ${cxx_flag}" CACHE
STRING "" FORCE)
set(DRACO_FAILED_CXX_FLAGS
"${DRACO_FAILED_CXX_FLAGS} ${cxx_flag}"
CACHE STRING "" FORCE)
endif()
endif()
endmacro()
@ -71,8 +75,8 @@ macro (require_c_flag c_flag update_c_flags)
message("Checking C compiler flag support for: " ${c_flag})
check_c_compiler_flag("${c_flag}" HAVE_C_FLAG)
if(NOT ${HAVE_C_FLAG})
message(FATAL_ERROR
"${PROJECT_NAME} requires support for C flag: ${c_flag}.")
message(
FATAL_ERROR "${PROJECT_NAME} requires support for C flag: ${c_flag}.")
endif()
if(${update_c_flags})
set(CMAKE_C_FLAGS "${c_flag} ${CMAKE_C_FLAGS}" CACHE STRING "" FORCE)
@ -91,12 +95,14 @@ macro (require_cxx_flag cxx_flag update_cxx_flags)
message("Checking CXX compiler flag support for: " ${cxx_flag})
check_cxx_compiler_flag("${cxx_flag}" HAVE_CXX_FLAG)
if(NOT ${HAVE_CXX_FLAG})
message(FATAL_ERROR
message(
FATAL_ERROR
"${PROJECT_NAME} requires support for CXX flag: ${cxx_flag}.")
endif()
if(${update_cxx_flags})
set(CMAKE_CXX_FLAGS "${cxx_flag} ${CMAKE_CXX_FLAGS}" CACHE STRING ""
FORCE)
set(CMAKE_CXX_FLAGS
"${cxx_flag} ${CMAKE_CXX_FLAGS}"
CACHE STRING "" FORCE)
endif()
endif()
endmacro()
@ -212,5 +218,3 @@ macro (require_linker_flag flag)
message(FATAL_ERROR "Linker flag test for ${flag} failed.")
endif()
endmacro()
endif () # DRACO_CMAKE_COMPILER_FLAGS_CMAKE_

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_COMPILER_TESTS_CMAKE_)
if(DRACO_CMAKE_COMPILER_TESTS_CMAKE_)
return()
endif()
set(DRACO_CMAKE_COMPILER_TESTS_CMAKE_ 1)
include(CheckCSourceCompiles)
@ -26,9 +28,9 @@ endmacro ()
# Confirms $test_source compiles and stores $test_name in one of
# $DRACO_C_PASSED_TESTS or $DRACO_C_FAILED_TESTS depending on out come. When the
# test passes $result_var is set to 1. When it fails $result_var is unset.
# The test is not run if the test name is found in either of the passed or
# failed test variables.
# test passes $result_var is set to 1. When it fails $result_var is unset. The
# test is not run if the test name is found in either of the passed or failed
# test variables.
macro(draco_check_c_compiles test_name test_source result_var)
unset(C_TEST_PASSED CACHE)
unset(C_TEST_FAILED CACHE)
@ -85,10 +87,9 @@ endmacro ()
# Convenience macro that confirms $test_source compiles as C and C++.
# $result_var is set to 1 when both tests are successful, and 0 when one or both
# tests fail.
# Note: This macro is intended to be used to write to result variables that
# are expanded via configure_file(). $result_var is set to 1 or 0 to allow
# direct usage of the value in generated source files.
# tests fail. Note: This macro is intended to be used to write to result
# variables that are expanded via configure_file(). $result_var is set to 1 or 0
# to allow direct usage of the value in generated source files.
macro(draco_check_source_compiles test_name test_source result_var)
unset(C_PASSED)
unset(CXX_PASSED)
@ -100,5 +101,3 @@ macro(draco_check_source_compiles test_name test_source result_var)
set(${result_var} 0)
endif()
endmacro()
endif () # DRACO_CMAKE_COMPILER_TESTS_CMAKE_

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_DRACO_FEATURES_CMAKE_)
if(DRACO_CMAKE_DRACO_FEATURES_CMAKE_)
return()
endif()
set(DRACO_CMAKE_DRACO_FEATURES_CMAKE_ 1)
set(draco_features_file_name "${draco_build_dir}/draco/draco_features.h")
@ -7,9 +9,9 @@ set(draco_features_list)
# Macro that handles tracking of Draco preprocessor symbols for the purpose of
# producing draco_features.h.
#
# draco_enable_feature(FEATURE <feature_name> [TARGETS <target_name>])
# FEATURE is required. It should be a Draco preprocessor symbol.
# TARGETS is optional. It can be one or more draco targets.
# draco_enable_feature(FEATURE <feature_name> [TARGETS <target_name>]) FEATURE
# is required. It should be a Draco preprocessor symbol. TARGETS is optional. It
# can be one or more draco targets.
#
# When the TARGETS argument is not present the preproc symbol is added to
# draco_features.h. When it is draco_features.h is unchanged, and
@ -43,8 +45,7 @@ endmacro ()
# Function for generating draco_features.h.
function(draco_generate_features_h)
file(WRITE "${draco_features_file_name}"
"// GENERATED FILE -- DO NOT EDIT\n\n"
"#ifndef DRACO_FEATURES_H_\n"
"// GENERATED FILE -- DO NOT EDIT\n\n" "#ifndef DRACO_FEATURES_H_\n"
"#define DRACO_FEATURES_H_\n\n")
foreach(feature ${draco_features_list})
@ -53,5 +54,3 @@ function (draco_generate_features_h)
file(APPEND "${draco_features_file_name}" "\n#endif // DRACO_FEATURES_H_")
endfunction()
endif () # DRACO_CMAKE_DRACO_FEATURES_CMAKE_

View File

@ -3,9 +3,9 @@ cmake_minimum_required(VERSION 3.2)
if(MSVC)
# Use statically linked versions of the MS standard libraries.
if(NOT "${MSVC_RUNTIME}" STREQUAL "dll")
foreach (flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_SANITIZERS_CMAKE_)
if(DRACO_CMAKE_SANITIZERS_CMAKE_)
return()
endif()
set(DRACO_CMAKE_SANITIZERS_CMAKE_ 1)
if(MSVC OR NOT SANITIZE)
@ -15,5 +17,3 @@ require_compiler_flag("-fsanitize=${SANITIZE}" YES)
# Make callstacks accurate.
require_compiler_flag("-fno-omit-frame-pointer -fno-optimize-sibling-calls" YES)
endif() # DRACO_CMAKE_SANITIZERS_CMAKE_

View File

@ -0,0 +1,11 @@
if(DRACO_CMAKE_TOOLCHAINS_ANDROID_NDK_COMMON_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_ANDROID_NDK_COMMON_CMAKE_ 1)
include("${CMAKE_CURRENT_LIST_DIR}/../util.cmake")
require_variable(CMAKE_ANDROID_NDK)
set(CMAKE_SYSTEM_NAME Android)
set_variable_if_unset(CMAKE_ANDROID_STL_TYPE c++_static)
set_variable_if_unset(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARM_IOS_COMMON_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_ARM_IOS_COMMON_CMAKE_)
return()
endif()
set(DRACO_CMAKE_ARM_IOS_COMMON_CMAKE_ 1)
set(CMAKE_SYSTEM_NAME "Darwin")
@ -9,5 +11,3 @@ set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_COMPILER_ARG1 "-arch ${CMAKE_SYSTEM_PROCESSOR}")
# TODO(tomfinegan): Handle bit code embedding.
endif () # DRACO_CMAKE_TOOLCHAINS_ARM_IOS_COMMON_CMAKE_

View File

@ -1,12 +1,10 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARM64_ANDROID_NDK_LIBCPP_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_ARM64_ANDROID_NDK_LIBCPP_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_ARM64_ANDROID_NDK_LIBCPP_CMAKE_ 1)
include("${CMAKE_CURRENT_LIST_DIR}/../util.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/android-ndk-common.cmake")
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
require_variable(CMAKE_ANDROID_NDK)
set_variable_if_unset(CMAKE_SYSTEM_VERSION 21)
set_variable_if_unset(CMAKE_ANDROID_STL_TYPE c++_static)
endif () # DRACO_CMAKE_TOOLCHAINS_ARM64_ANDROID_NDK_LIBCPP_CMAKE_

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARM64_IOS_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_ARM64_IOS_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_ARM64_IOS_CMAKE_ 1)
if(XCODE)
@ -10,5 +12,3 @@ set(CMAKE_SYSTEM_PROCESSOR "arm64")
set(CMAKE_OSX_ARCHITECTURES "arm64")
include("${CMAKE_CURRENT_LIST_DIR}/arm-ios-common.cmake")
endif () # DRACO_CMAKE_TOOLCHAINS_ARM64_IOS_CMAKE_

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARM64_LINUX_GCC_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_ARM64_LINUX_GCC_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_ARM64_LINUX_GCC_CMAKE_ 1)
set(CMAKE_SYSTEM_NAME "Linux")
@ -14,5 +16,3 @@ set(AS_EXECUTABLE ${CROSS}as)
set(CMAKE_C_COMPILER_ARG1 "-march=armv8-a")
set(CMAKE_CXX_COMPILER_ARG1 "-march=armv8-a")
set(CMAKE_SYSTEM_PROCESSOR "arm64")
endif () # DRACO_CMAKE_TOOLCHAINS_ARM64_LINUX_GCC_CMAKE_

View File

@ -1,12 +1,10 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARMV7_ANDROID_NDK_LIBCPP_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_ARMV7_ANDROID_NDK_LIBCPP_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_ARMV7_ANDROID_NDK_LIBCPP_CMAKE_ 1)
include("${CMAKE_CURRENT_LIST_DIR}/../util.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/android-ndk-common.cmake")
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_ANDROID_ARCH_ABI armeabi-v7a)
require_variable(CMAKE_ANDROID_NDK)
set_variable_if_unset(CMAKE_SYSTEM_VERSION 18)
set_variable_if_unset(CMAKE_ANDROID_STL_TYPE c++_static)
endif () # DRACO_CMAKE_TOOLCHAINS_ARMV7_ANDROID_NDK_LIBCPP_CMAKE_

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARMV7_IOS_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_ARMV7_IOS_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_ARMV7_IOS_CMAKE_ 1)
if(XCODE)
@ -10,5 +12,3 @@ set(CMAKE_SYSTEM_PROCESSOR "armv7")
set(CMAKE_OSX_ARCHITECTURES "armv7")
include("${CMAKE_CURRENT_LIST_DIR}/arm-ios-common.cmake")
endif () # DRACO_CMAKE_TOOLCHAINS_ARMV7_IOS_CMAKE_

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARMV7_LINUX_GCC_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_ARMV7_LINUX_GCC_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_ARMV7_LINUX_GCC_CMAKE_ 1)
set(CMAKE_SYSTEM_NAME "Linux")
@ -20,5 +22,3 @@ set(CMAKE_C_COMPILER_ARG1
set(CMAKE_CXX_COMPILER_ARG1
"-march=armv7-a -mfpu=neon ${DRACO_EXTRA_TOOLCHAIN_FLAGS}")
set(CMAKE_SYSTEM_PROCESSOR "armv7")
endif () # DRACO_CMAKE_TOOLCHAINS_ARMV7_LINUX_GCC_CMAKE_

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARMV7S_IOS_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_ARMV7S_IOS_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_ARMV7S_IOS_CMAKE_ 1)
if(XCODE)
@ -10,5 +12,3 @@ set(CMAKE_SYSTEM_PROCESSOR "armv7s")
set(CMAKE_OSX_ARCHITECTURES "armv7s")
include("${CMAKE_CURRENT_LIST_DIR}/arm-ios-common.cmake")
endif () # DRACO_CMAKE_TOOLCHAINS_ARMV7S_IOS_CMAKE_

View File

@ -0,0 +1,7 @@
if(DRACO_CMAKE_TOOLCHAINS_DEFAULT_ANDROID_NDK_LIBCPP_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_DEFAULT_ANDROID_NDK_LIBCPP_CMAKE_ 1)
include("${CMAKE_CURRENT_LIST_DIR}/../util.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/android-ndk-common.cmake")

View File

@ -1,12 +1,10 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_X86_ANDROID_NDK_LIBCPP_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_X86_ANDROID_NDK_LIBCPP_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_X86_ANDROID_NDK_LIBCPP_CMAKE_ 1)
include("${CMAKE_CURRENT_LIST_DIR}/../util.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/android-ndk-common.cmake")
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_ANDROID_ARCH_ABI x86)
require_variable(CMAKE_ANDROID_NDK)
set_variable_if_unset(CMAKE_SYSTEM_VERSION 18)
set_variable_if_unset(CMAKE_ANDROID_STL_TYPE c++_static)
endif () # DRACO_CMAKE_TOOLCHAINS_X86_ANDROID_NDK_LIBCPP_CMAKE_

View File

@ -1,12 +1,10 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_X86_64_ANDROID_NDK_LIBCPP_CMAKE_)
if(DRACO_CMAKE_TOOLCHAINS_X86_64_ANDROID_NDK_LIBCPP_CMAKE_)
return()
endif()
set(DRACO_CMAKE_TOOLCHAINS_X86_64_ANDROID_NDK_LIBCPP_CMAKE_ 1)
include("${CMAKE_CURRENT_LIST_DIR}/../util.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/android-ndk-common.cmake")
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_ANDROID_ARCH_ABI x86_64)
require_variable(CMAKE_ANDROID_NDK)
set_variable_if_unset(CMAKE_SYSTEM_VERSION 21)
set_variable_if_unset(CMAKE_ANDROID_STL_TYPE c++_static)
endif () # DRACO_CMAKE_TOOLCHAINS_X86_64_ANDROID_NDK_LIBCPP_CMAKE_

View File

@ -1,4 +1,6 @@
if (NOT DRACO_CMAKE_UTIL_CMAKE_)
if(DRACO_CMAKE_UTIL_CMAKE_)
return()
endif()
set(DRACO_CMAKE_UTIL_CMAKE_ 1)
# Creates dummy source file in $draco_build_dir named $basename.$extension and
@ -22,8 +24,8 @@ function (add_dummy_source_file_to_target target_name extension)
endfunction()
# Extracts the version number from $version_file and returns it to the user via
# $version_string_out_var. This is achieved by finding the first instance of
# the kDracoVersion variable and then removing everything but the string literal
# $version_string_out_var. This is achieved by finding the first instance of the
# kDracoVersion variable and then removing everything but the string literal
# assigned to the variable. Quotes and semicolon are stripped from the returned
# string.
function(extract_version_string version_file version_string_out_var)
@ -46,8 +48,8 @@ function (set_compiler_launcher launcher_flag launcher_name)
set(CMAKE_CXX_COMPILER_LAUNCHER "${launcher_path}" PARENT_SCOPE)
message("--- Using ${launcher_name} as compiler launcher.")
else()
message(WARNING
"--- Cannot find ${launcher_name}, ${launcher_flag} ignored.")
message(
WARNING "--- Cannot find ${launcher_name}, ${launcher_flag} ignored.")
endif()
endfunction()
@ -61,14 +63,11 @@ macro(require_variable var_name)
set_variable_if_unset(${var_name} "")
endmacro()
# Sets $var_name to $default_value if not already set in the environment.
# Sets $var_name to $default_value if not already set.
macro(set_variable_if_unset var_name default_value)
if(NOT "$ENV{${var_name}}" STREQUAL "")
set(${var_name} $ENV{${var_name}})
else ()
elseif(NOT ${var_name})
set(${var_name} ${default_value})
endif()
endmacro()
endif() # DRACO_CMAKE_UTIL_CMAKE_