mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
update assimp lib
This commit is contained in:
parent
03a348deb7
commit
d3f8fee74e
1725 changed files with 196314 additions and 62009 deletions
|
|
@ -1,3 +0,0 @@
|
|||
@PACKAGE_INIT@
|
||||
set_and_check(draco_INCLUDE_DIR "@PACKAGE_draco_include_install_dir@")
|
||||
set_and_check(draco_LIBRARY_DIR "@PACKAGE_draco_lib_install_dir@")
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
# Finddraco
|
||||
#
|
||||
# Locates draco and sets the following variables:
|
||||
#
|
||||
# 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
|
||||
# configured.
|
||||
|
||||
unset(draco_FOUND)
|
||||
unset(draco_INCLUDE_DIRS)
|
||||
unset(draco_LIBRARY_DIRS)
|
||||
unset(draco_LIBRARIES)
|
||||
unset(draco_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(draco_FOUND)
|
||||
mark_as_advanced(draco_INCLUDE_DIRS)
|
||||
mark_as_advanced(draco_LIBRARY_DIRS)
|
||||
mark_as_advanced(draco_LIBRARIES)
|
||||
mark_as_advanced(draco_VERSION_STRING)
|
||||
|
||||
set(draco_version_file_no_prefix "draco/src/draco/core/draco_version.h")
|
||||
|
||||
# Set draco_INCLUDE_DIRS
|
||||
find_path(draco_INCLUDE_DIRS NAMES "${draco_version_file_no_prefix}")
|
||||
|
||||
# Extract the version string from draco_version.h.
|
||||
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")
|
||||
list(GET draco_version 0 draco_version)
|
||||
string(REPLACE "static const char kdracoVersion[] = " "" draco_version
|
||||
"${draco_version}")
|
||||
string(REPLACE ";" "" draco_version "${draco_version}")
|
||||
string(REPLACE "\"" "" draco_version "${draco_version}")
|
||||
set(draco_VERSION_STRING ${draco_version})
|
||||
endif()
|
||||
|
||||
# Find the library.
|
||||
if(BUILD_SHARED_LIBS)
|
||||
find_library(draco_LIBRARIES NAMES draco.dll libdraco.dylib libdraco.so)
|
||||
else()
|
||||
find_library(draco_LIBRARIES NAMES draco.lib libdraco.a)
|
||||
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)
|
||||
set(draco_FOUND YES)
|
||||
endif()
|
||||
|
|
@ -1,220 +0,0 @@
|
|||
if(DRACO_CMAKE_COMPILER_FLAGS_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(DRACO_CMAKE_COMPILER_FLAGS_CMAKE_ 1)
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include("${draco_root}/cmake/compiler_tests.cmake")
|
||||
|
||||
# Strings used to cache failed C/CXX flags.
|
||||
set(DRACO_FAILED_C_FLAGS)
|
||||
set(DRACO_FAILED_CXX_FLAGS)
|
||||
|
||||
# Checks C compiler for support of $c_flag. Adds $c_flag to $CMAKE_C_FLAGS when
|
||||
# the compile test passes. Caches $c_flag in $DRACO_FAILED_C_FLAGS when the test
|
||||
# fails.
|
||||
macro(add_c_flag_if_supported c_flag)
|
||||
unset(C_FLAG_FOUND CACHE)
|
||||
string(FIND "${CMAKE_C_FLAGS}" "${c_flag}" C_FLAG_FOUND)
|
||||
unset(C_FLAG_FAILED CACHE)
|
||||
string(FIND "${DRACO_FAILED_C_FLAGS}" "${c_flag}" C_FLAG_FAILED)
|
||||
|
||||
if(${C_FLAG_FOUND} EQUAL -1 AND ${C_FLAG_FAILED} EQUAL -1)
|
||||
unset(C_FLAG_SUPPORTED CACHE)
|
||||
message("Checking C compiler flag support for: " ${c_flag})
|
||||
check_c_compiler_flag("${c_flag}" C_FLAG_SUPPORTED)
|
||||
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)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Checks C++ compiler for support of $cxx_flag. Adds $cxx_flag to
|
||||
# $CMAKE_CXX_FLAGS when the compile test passes. Caches $c_flag in
|
||||
# $DRACO_FAILED_CXX_FLAGS when the test fails.
|
||||
macro(add_cxx_flag_if_supported cxx_flag)
|
||||
unset(CXX_FLAG_FOUND CACHE)
|
||||
string(FIND "${CMAKE_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FOUND)
|
||||
unset(CXX_FLAG_FAILED CACHE)
|
||||
string(FIND "${DRACO_FAILED_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FAILED)
|
||||
|
||||
if(${CXX_FLAG_FOUND} EQUAL -1 AND ${CXX_FLAG_FAILED} EQUAL -1)
|
||||
unset(CXX_FLAG_SUPPORTED CACHE)
|
||||
message("Checking CXX compiler flag support for: " ${cxx_flag})
|
||||
check_cxx_compiler_flag("${cxx_flag}" CXX_FLAG_SUPPORTED)
|
||||
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)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Convenience method for adding a flag to both the C and C++ compiler command
|
||||
# lines.
|
||||
macro(add_compiler_flag_if_supported flag)
|
||||
add_c_flag_if_supported(${flag})
|
||||
add_cxx_flag_if_supported(${flag})
|
||||
endmacro()
|
||||
|
||||
# Checks C compiler for support of $c_flag and terminates generation when
|
||||
# support is not present.
|
||||
macro(require_c_flag c_flag update_c_flags)
|
||||
unset(C_FLAG_FOUND CACHE)
|
||||
string(FIND "${CMAKE_C_FLAGS}" "${c_flag}" C_FLAG_FOUND)
|
||||
|
||||
if(${C_FLAG_FOUND} EQUAL -1)
|
||||
unset(HAVE_C_FLAG CACHE)
|
||||
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}.")
|
||||
endif()
|
||||
if(${update_c_flags})
|
||||
set(CMAKE_C_FLAGS "${c_flag} ${CMAKE_C_FLAGS}" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Checks CXX compiler for support of $cxx_flag and terminates generation when
|
||||
# support is not present.
|
||||
macro(require_cxx_flag cxx_flag update_cxx_flags)
|
||||
unset(CXX_FLAG_FOUND CACHE)
|
||||
string(FIND "${CMAKE_CXX_FLAGS}" "${cxx_flag}" CXX_FLAG_FOUND)
|
||||
|
||||
if(${CXX_FLAG_FOUND} EQUAL -1)
|
||||
unset(HAVE_CXX_FLAG CACHE)
|
||||
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
|
||||
"${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)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Checks for support of $flag by both the C and CXX compilers. Terminates
|
||||
# generation when support is not present in both compilers.
|
||||
macro(require_compiler_flag flag update_cmake_flags)
|
||||
require_c_flag(${flag} ${update_cmake_flags})
|
||||
require_cxx_flag(${flag} ${update_cmake_flags})
|
||||
endmacro()
|
||||
|
||||
# Checks only non-MSVC targets for support of $c_flag and terminates generation
|
||||
# when support is not present.
|
||||
macro(require_c_flag_nomsvc c_flag update_c_flags)
|
||||
if(NOT MSVC)
|
||||
require_c_flag(${c_flag} ${update_c_flags})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Checks only non-MSVC targets for support of $cxx_flag and terminates
|
||||
# generation when support is not present.
|
||||
macro(require_cxx_flag_nomsvc cxx_flag update_cxx_flags)
|
||||
if(NOT MSVC)
|
||||
require_cxx_flag(${cxx_flag} ${update_cxx_flags})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Checks only non-MSVC targets for support of $flag by both the C and CXX
|
||||
# compilers. Terminates generation when support is not present in both
|
||||
# compilers.
|
||||
macro(require_compiler_flag_nomsvc flag update_cmake_flags)
|
||||
require_c_flag_nomsvc(${flag} ${update_cmake_flags})
|
||||
require_cxx_flag_nomsvc(${flag} ${update_cmake_flags})
|
||||
endmacro()
|
||||
|
||||
# Adds $flag to assembler command line.
|
||||
macro(append_as_flag flag)
|
||||
unset(AS_FLAG_FOUND CACHE)
|
||||
string(FIND "${DRACO_AS_FLAGS}" "${flag}" AS_FLAG_FOUND)
|
||||
|
||||
if(${AS_FLAG_FOUND} EQUAL -1)
|
||||
set(DRACO_AS_FLAGS "${DRACO_AS_FLAGS} ${flag}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Adds $flag to the C compiler command line.
|
||||
macro(append_c_flag flag)
|
||||
unset(C_FLAG_FOUND CACHE)
|
||||
string(FIND "${CMAKE_C_FLAGS}" "${flag}" C_FLAG_FOUND)
|
||||
|
||||
if(${C_FLAG_FOUND} EQUAL -1)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Adds $flag to the CXX compiler command line.
|
||||
macro(append_cxx_flag flag)
|
||||
unset(CXX_FLAG_FOUND CACHE)
|
||||
string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" CXX_FLAG_FOUND)
|
||||
|
||||
if(${CXX_FLAG_FOUND} EQUAL -1)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Adds $flag to the C and CXX compiler command lines.
|
||||
macro(append_compiler_flag flag)
|
||||
append_c_flag(${flag})
|
||||
append_cxx_flag(${flag})
|
||||
endmacro()
|
||||
|
||||
# Adds $flag to the executable linker command line.
|
||||
macro(append_exe_linker_flag flag)
|
||||
unset(LINKER_FLAG_FOUND CACHE)
|
||||
string(FIND "${CMAKE_EXE_LINKER_FLAGS}" "${flag}" LINKER_FLAG_FOUND)
|
||||
|
||||
if(${LINKER_FLAG_FOUND} EQUAL -1)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Adds $flag to the link flags for $target.
|
||||
function(append_link_flag_to_target target flags)
|
||||
unset(target_link_flags)
|
||||
get_target_property(target_link_flags ${target} LINK_FLAGS)
|
||||
|
||||
if(target_link_flags)
|
||||
unset(link_flag_found)
|
||||
string(FIND "${target_link_flags}" "${flags}" link_flag_found)
|
||||
|
||||
if(NOT ${link_flag_found} EQUAL -1)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(target_link_flags "${target_link_flags} ${flags}")
|
||||
else()
|
||||
set(target_link_flags "${flags}")
|
||||
endif()
|
||||
|
||||
set_target_properties(${target} PROPERTIES LINK_FLAGS ${target_link_flags})
|
||||
endfunction()
|
||||
|
||||
# Adds $flag to executable linker flags, and makes sure C/CXX builds still work.
|
||||
macro(require_linker_flag flag)
|
||||
append_exe_linker_flag(${flag})
|
||||
|
||||
unset(c_passed)
|
||||
draco_check_c_compiles("LINKER_FLAG_C_TEST(${flag})" "" c_passed)
|
||||
unset(cxx_passed)
|
||||
draco_check_cxx_compiles("LINKER_FLAG_CXX_TEST(${flag})" "" cxx_passed)
|
||||
|
||||
if(NOT c_passed OR NOT cxx_passed)
|
||||
message(FATAL_ERROR "Linker flag test for ${flag} failed.")
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
if(DRACO_CMAKE_COMPILER_TESTS_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(DRACO_CMAKE_COMPILER_TESTS_CMAKE_ 1)
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
# The basic main() macro used in all compile tests.
|
||||
set(DRACO_C_MAIN "\nint main(void) { return 0; }")
|
||||
set(DRACO_CXX_MAIN "\nint main() { return 0; }")
|
||||
|
||||
# Strings containing the names of passed and failed tests.
|
||||
set(DRACO_C_PASSED_TESTS)
|
||||
set(DRACO_C_FAILED_TESTS)
|
||||
set(DRACO_CXX_PASSED_TESTS)
|
||||
set(DRACO_CXX_FAILED_TESTS)
|
||||
|
||||
macro(draco_push_var var new_value)
|
||||
set(SAVED_${var} ${var})
|
||||
set(${var} ${new_value})
|
||||
endmacro()
|
||||
|
||||
macro(draco_pop_var var)
|
||||
set(var ${SAVED_${var}})
|
||||
unset(SAVED_${var})
|
||||
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.
|
||||
macro(draco_check_c_compiles test_name test_source result_var)
|
||||
unset(C_TEST_PASSED CACHE)
|
||||
unset(C_TEST_FAILED CACHE)
|
||||
string(FIND "${DRACO_C_PASSED_TESTS}" "${test_name}" C_TEST_PASSED)
|
||||
string(FIND "${DRACO_C_FAILED_TESTS}" "${test_name}" C_TEST_FAILED)
|
||||
if(${C_TEST_PASSED} EQUAL -1 AND ${C_TEST_FAILED} EQUAL -1)
|
||||
unset(C_TEST_COMPILED CACHE)
|
||||
message("Running C compiler test: ${test_name}")
|
||||
check_c_source_compiles("${test_source} ${DRACO_C_MAIN}" C_TEST_COMPILED)
|
||||
set(${result_var} ${C_TEST_COMPILED})
|
||||
|
||||
if(${C_TEST_COMPILED})
|
||||
set(DRACO_C_PASSED_TESTS "${DRACO_C_PASSED_TESTS} ${test_name}")
|
||||
else()
|
||||
set(DRACO_C_FAILED_TESTS "${DRACO_C_FAILED_TESTS} ${test_name}")
|
||||
message("C Compiler test ${test_name} failed.")
|
||||
endif()
|
||||
elseif(NOT ${C_TEST_PASSED} EQUAL -1)
|
||||
set(${result_var} 1)
|
||||
else() # ${C_TEST_FAILED} NOT EQUAL -1
|
||||
unset(${result_var})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Confirms $test_source compiles and stores $test_name in one of
|
||||
# $DRACO_CXX_PASSED_TESTS or $DRACO_CXX_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.
|
||||
macro(draco_check_cxx_compiles test_name test_source result_var)
|
||||
unset(CXX_TEST_PASSED CACHE)
|
||||
unset(CXX_TEST_FAILED CACHE)
|
||||
string(FIND "${DRACO_CXX_PASSED_TESTS}" "${test_name}" CXX_TEST_PASSED)
|
||||
string(FIND "${DRACO_CXX_FAILED_TESTS}" "${test_name}" CXX_TEST_FAILED)
|
||||
if(${CXX_TEST_PASSED} EQUAL -1 AND ${CXX_TEST_FAILED} EQUAL -1)
|
||||
unset(CXX_TEST_COMPILED CACHE)
|
||||
message("Running CXX compiler test: ${test_name}")
|
||||
check_cxx_source_compiles("${test_source} ${DRACO_CXX_MAIN}"
|
||||
CXX_TEST_COMPILED)
|
||||
set(${result_var} ${CXX_TEST_COMPILED})
|
||||
|
||||
if(${CXX_TEST_COMPILED})
|
||||
set(DRACO_CXX_PASSED_TESTS "${DRACO_CXX_PASSED_TESTS} ${test_name}")
|
||||
else()
|
||||
set(DRACO_CXX_FAILED_TESTS "${DRACO_CXX_FAILED_TESTS} ${test_name}")
|
||||
message("CXX Compiler test ${test_name} failed.")
|
||||
endif()
|
||||
elseif(NOT ${CXX_TEST_PASSED} EQUAL -1)
|
||||
set(${result_var} 1)
|
||||
else() # ${CXX_TEST_FAILED} NOT EQUAL -1
|
||||
unset(${result_var})
|
||||
endif()
|
||||
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.
|
||||
macro(draco_check_source_compiles test_name test_source result_var)
|
||||
unset(C_PASSED)
|
||||
unset(CXX_PASSED)
|
||||
draco_check_c_compiles(${test_name} ${test_source} C_PASSED)
|
||||
draco_check_cxx_compiles(${test_name} ${test_source} CXX_PASSED)
|
||||
if(${C_PASSED} AND ${CXX_PASSED})
|
||||
set(${result_var} 1)
|
||||
else()
|
||||
set(${result_var} 0)
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
set(DRACO_INCLUDE_DIRS "@DRACO_INCLUDE_DIRS@")
|
||||
set(DRACO_LIBRARIES "draco")
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/draco-targets.cmake")
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: Draco geometry de(com)pression library.
|
||||
Version: @DRACO_VERSION@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -ldraco
|
||||
Cflags: -I@includes_path@
|
||||
Libs: -L@libs_path@ -ldraco
|
||||
Libs.private: @CMAKE_THREAD_LIBS_INIT@
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_BUILD_DEFINITIONS_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_BUILD_DEFINITIONS_CMAKE_
|
||||
|
|
@ -17,10 +31,6 @@ macro(set_draco_target)
|
|||
endif()
|
||||
set(draco_plugin_dependency draco_static)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Configures flags and sets build system globals.
|
||||
|
|
@ -36,23 +46,37 @@ macro(draco_set_build_definitions)
|
|||
endif()
|
||||
|
||||
draco_load_version_info()
|
||||
set(DRACO_SOVERSION 1)
|
||||
|
||||
# Library version info. See the libtool docs for updating the values:
|
||||
# https://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
|
||||
#
|
||||
# c=<current>, r=<revision>, a=<age>
|
||||
#
|
||||
# libtool generates a .so file as .so.[c-a].a.r, while -version-info c:r:a is
|
||||
# passed to libtool.
|
||||
#
|
||||
# We set DRACO_SOVERSION = [c-a].a.r
|
||||
set(LT_CURRENT 8)
|
||||
set(LT_REVISION 0)
|
||||
set(LT_AGE 0)
|
||||
math(EXPR DRACO_SOVERSION_MAJOR "${LT_CURRENT} - ${LT_AGE}")
|
||||
set(DRACO_SOVERSION "${DRACO_SOVERSION_MAJOR}.${LT_AGE}.${LT_REVISION}")
|
||||
unset(LT_CURRENT)
|
||||
unset(LT_REVISION)
|
||||
unset(LT_AGE)
|
||||
|
||||
list(APPEND draco_include_paths "${draco_root}" "${draco_root}/src"
|
||||
"${draco_build}")
|
||||
|
||||
if(DRACO_ABSL)
|
||||
list(APPEND draco_include_path "${draco_root}/third_party/abseil-cpp")
|
||||
if(DRACO_TRANSCODER_SUPPORTED)
|
||||
draco_setup_eigen()
|
||||
draco_setup_filesystem()
|
||||
draco_setup_tinygltf()
|
||||
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
list(APPEND draco_gtest_include_paths
|
||||
"${draco_root}/../googletest/googlemock/include"
|
||||
"${draco_root}/../googletest/googlemock"
|
||||
"${draco_root}/../googletest/googletest/include"
|
||||
"${draco_root}/../googletest/googletest")
|
||||
list(APPEND draco_test_include_paths ${draco_include_paths}
|
||||
${draco_gtest_include_paths})
|
||||
list(APPEND draco_defines "DRACO_CMAKE=1"
|
||||
"DRACO_FLAGS_SRCDIR=\"${draco_root}\""
|
||||
"DRACO_FLAGS_TMPDIR=\"/tmp\"")
|
||||
|
|
@ -63,11 +87,22 @@ macro(draco_set_build_definitions)
|
|||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
||||
endif()
|
||||
else()
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
# Ensure 64-bit platforms can support large files.
|
||||
list(APPEND draco_defines "_LARGEFILE_SOURCE" "_FILE_OFFSET_BITS=64")
|
||||
endif()
|
||||
|
||||
if(NOT DRACO_DEBUG_COMPILER_WARNINGS)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
list(APPEND draco_clang_cxx_flags
|
||||
"-Wno-implicit-const-int-float-conversion")
|
||||
else()
|
||||
list(APPEND draco_base_cxx_flags "-Wno-deprecated-declarations")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
|
|
@ -102,13 +137,9 @@ macro(draco_set_build_definitions)
|
|||
set(draco_neon_source_file_suffix "neon.cc")
|
||||
set(draco_sse4_source_file_suffix "sse4.cc")
|
||||
|
||||
if((${CMAKE_CXX_COMPILER_ID}
|
||||
STREQUAL
|
||||
"GNU"
|
||||
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 5)
|
||||
OR (${CMAKE_CXX_COMPILER_ID}
|
||||
STREQUAL
|
||||
"Clang"
|
||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION}
|
||||
VERSION_LESS 5)
|
||||
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"
|
||||
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4))
|
||||
message(
|
||||
WARNING "GNU/GCC < v5 or Clang/LLVM < v4, ENABLING COMPATIBILITY MODE.")
|
||||
|
|
@ -117,7 +148,9 @@ macro(draco_set_build_definitions)
|
|||
|
||||
if(EMSCRIPTEN)
|
||||
draco_check_emscripten_environment()
|
||||
draco_get_required_emscripten_flags(FLAG_LIST_VAR draco_base_cxx_flags)
|
||||
draco_get_required_emscripten_flags(
|
||||
FLAG_LIST_VAR_COMPILER draco_base_cxx_flags
|
||||
FLAG_LIST_VAR_LINKER draco_base_exe_linker_flags)
|
||||
endif()
|
||||
|
||||
draco_configure_sanitizer()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_CPU_DETECTION_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_CPU_DETECTION_CMAKE_
|
||||
|
|
|
|||
136
Engine/lib/assimp/contrib/draco/cmake/draco_dependencies.cmake
Normal file
136
Engine/lib/assimp/contrib/draco/cmake/draco_dependencies.cmake
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
# Copyright 2022 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_DEPENDENCIES_CMAKE)
|
||||
return()
|
||||
endif()
|
||||
set(DRACO_CMAKE_DRACO_DEPENDENCIES_CMAKE 1)
|
||||
|
||||
include("${draco_root}/cmake/draco_variables.cmake")
|
||||
|
||||
# Each variable holds a user specified custom path to a local copy of the
|
||||
# sources that belong to each project that Draco depends on. When paths are
|
||||
# empty the build will be generated pointing to the Draco git submodules.
|
||||
# Otherwise the paths specified by the user will be used in the build
|
||||
# configuration.
|
||||
|
||||
# Path to the Eigen. The path must contain the Eigen directory.
|
||||
set(DRACO_EIGEN_PATH)
|
||||
draco_track_configuration_variable(DRACO_EIGEN_PATH)
|
||||
|
||||
# Path to the gulrak/filesystem installation. The path specified must contain
|
||||
# the ghc subdirectory that houses the filesystem includes.
|
||||
set(DRACO_FILESYSTEM_PATH)
|
||||
draco_track_configuration_variable(DRACO_FILESYSTEM_PATH)
|
||||
|
||||
# Path to the googletest installation. The path must be to the root of the
|
||||
# Googletest project directory.
|
||||
set(DRACO_GOOGLETEST_PATH)
|
||||
draco_track_configuration_variable(DRACO_GOOGLETEST_PATH)
|
||||
|
||||
# Path to the syoyo/tinygltf installation. The path must be to the root of the
|
||||
# project directory.
|
||||
set(DRACO_TINYGLTF_PATH)
|
||||
draco_track_configuration_variable(DRACO_TINYGLTF_PATH)
|
||||
|
||||
# Utility macro for killing the build due to a missing submodule directory.
|
||||
macro(draco_die_missing_submodule dir)
|
||||
message(FATAL_ERROR "${dir} missing, run git submodule update --init")
|
||||
endmacro()
|
||||
|
||||
# Determines the Eigen location and updates the build configuration accordingly.
|
||||
macro(draco_setup_eigen)
|
||||
if(DRACO_EIGEN_PATH)
|
||||
set(eigen_path "${DRACO_EIGEN_PATH}")
|
||||
|
||||
if(NOT IS_DIRECTORY "${eigen_path}")
|
||||
message(FATAL_ERROR "DRACO_EIGEN_PATH does not exist.")
|
||||
endif()
|
||||
else()
|
||||
set(eigen_path "${draco_root}/third_party/eigen")
|
||||
|
||||
if(NOT IS_DIRECTORY "${eigen_path}")
|
||||
draco_die_missing_submodule("${eigen_path}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(eigen_include_path "${eigen_path}/Eigen")
|
||||
|
||||
if(NOT EXISTS "${eigen_path}/Eigen")
|
||||
message(FATAL_ERROR "The eigen path does not contain an Eigen directory.")
|
||||
endif()
|
||||
|
||||
list(APPEND draco_include_paths "${eigen_path}")
|
||||
endmacro()
|
||||
|
||||
# Determines the gulrak/filesystem location and updates the build configuration
|
||||
# accordingly.
|
||||
macro(draco_setup_filesystem)
|
||||
if(DRACO_FILESYSTEM_PATH)
|
||||
set(fs_path "${DRACO_FILESYSTEM_PATH}")
|
||||
|
||||
if(NOT IS_DIRECTORY "${fs_path}")
|
||||
message(FATAL_ERROR "DRACO_FILESYSTEM_PATH does not exist.")
|
||||
endif()
|
||||
else()
|
||||
set(fs_path "${draco_root}/third_party/filesystem/include")
|
||||
|
||||
if(NOT IS_DIRECTORY "${fs_path}")
|
||||
draco_die_missing_submodule("${fs_path}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND draco_include_paths "${fs_path}")
|
||||
endmacro()
|
||||
|
||||
# Determines the Googletest location and sets up include and source list vars
|
||||
# for the draco_tests build.
|
||||
macro(draco_setup_googletest)
|
||||
if(DRACO_GOOGLETEST_PATH)
|
||||
set(gtest_path "${DRACO_GOOGLETEST_PATH}")
|
||||
if(NOT IS_DIRECTORY "${gtest_path}")
|
||||
message(FATAL_ERROR "DRACO_GOOGLETEST_PATH does not exist.")
|
||||
endif()
|
||||
else()
|
||||
set(gtest_path "${draco_root}/third_party/googletest")
|
||||
endif()
|
||||
|
||||
list(APPEND draco_test_include_paths ${draco_include_paths}
|
||||
"${gtest_path}/include" "${gtest_path}/googlemock"
|
||||
"${gtest_path}/googletest/include" "${gtest_path}/googletest")
|
||||
|
||||
list(APPEND draco_gtest_all "${gtest_path}/googletest/src/gtest-all.cc")
|
||||
list(APPEND draco_gtest_main "${gtest_path}/googletest/src/gtest_main.cc")
|
||||
endmacro()
|
||||
|
||||
|
||||
# Determines the location of TinyGLTF and updates the build configuration
|
||||
# accordingly.
|
||||
macro(draco_setup_tinygltf)
|
||||
if(DRACO_TINYGLTF_PATH)
|
||||
set(tinygltf_path "${DRACO_TINYGLTF_PATH}")
|
||||
|
||||
if(NOT IS_DIRECTORY "${tinygltf_path}")
|
||||
message(FATAL_ERROR "DRACO_TINYGLTF_PATH does not exist.")
|
||||
endif()
|
||||
else()
|
||||
set(tinygltf_path "${draco_root}/third_party/tinygltf")
|
||||
|
||||
if(NOT IS_DIRECTORY "${tinygltf_path}")
|
||||
draco_die_missing_submodule("${tinygltf_path}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND draco_include_paths "${tinygltf_path}")
|
||||
endmacro()
|
||||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_EMSCRIPTEN_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_EMSCRIPTEN_CMAKE_
|
||||
|
|
@ -18,39 +32,64 @@ endmacro()
|
|||
|
||||
# Obtains the required Emscripten flags for Draco targets.
|
||||
macro(draco_get_required_emscripten_flags)
|
||||
set(em_FLAG_LIST_VAR)
|
||||
set(em_FLAG_LIST_VAR_COMPILER)
|
||||
set(em_FLAG_LIST_VAR_LINKER)
|
||||
set(em_flags)
|
||||
set(em_single_arg_opts FLAG_LIST_VAR)
|
||||
set(em_single_arg_opts FLAG_LIST_VAR_COMPILER FLAG_LIST_VAR_LINKER)
|
||||
set(em_multi_arg_opts)
|
||||
cmake_parse_arguments(em "${em_flags}" "${em_single_arg_opts}"
|
||||
"${em_multi_arg_opts}" ${ARGN})
|
||||
if(NOT em_FLAG_LIST_VAR)
|
||||
message(FATAL "draco_get_required_emscripten_flags: FLAG_LIST_VAR required")
|
||||
if(NOT em_FLAG_LIST_VAR_COMPILER)
|
||||
message(
|
||||
FATAL
|
||||
"draco_get_required_emscripten_flags: FLAG_LIST_VAR_COMPILER required")
|
||||
endif()
|
||||
|
||||
if(NOT em_FLAG_LIST_VAR_LINKER)
|
||||
message(
|
||||
FATAL
|
||||
"draco_get_required_emscripten_flags: FLAG_LIST_VAR_LINKER required")
|
||||
endif()
|
||||
|
||||
if(DRACO_JS_GLUE)
|
||||
unset(required_flags)
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sALLOW_MEMORY_GROWTH=1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-Wno-almost-asm")
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "--memory-init-file" "0")
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-fno-omit-frame-pointer")
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sMODULARIZE=1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sNO_FILESYSTEM=1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sEXPORTED_RUNTIME_METHODS=[]")
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sPRECISE_F32=1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sNODEJS_CATCH_EXIT=0")
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sNODEJS_CATCH_REJECTION=0")
|
||||
# TODO(tomfinegan): Revisit splitting of compile/link flags for Emscripten,
|
||||
# and drop -Wno-unused-command-line-argument. Emscripten complains about
|
||||
# what are supposedly link-only flags sent with compile commands, but then
|
||||
# proceeds to produce broken code if the warnings are heeded.
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER}
|
||||
"-Wno-unused-command-line-argument")
|
||||
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-Wno-almost-asm")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "--memory-init-file" "0")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-fno-omit-frame-pointer")
|
||||
|
||||
# According to Emscripten the following flags are linker only, but sending
|
||||
# these flags (en masse) to only the linker results in a broken Emscripten
|
||||
# build with an empty DracoDecoderModule.
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-sALLOW_MEMORY_GROWTH=1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-sMODULARIZE=1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-sFILESYSTEM=0")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER}
|
||||
"-sEXPORTED_FUNCTIONS=[\"_free\",\"_malloc\"]")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-sPRECISE_F32=1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-sNODEJS_CATCH_EXIT=0")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-sNODEJS_CATCH_REJECTION=0")
|
||||
|
||||
if(DRACO_FAST)
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "--llvm-lto" "1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "--llvm-lto" "1")
|
||||
endif()
|
||||
|
||||
# The WASM flag is reported as linker only.
|
||||
if(DRACO_WASM)
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sWASM=1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-sWASM=1")
|
||||
else()
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sWASM=0")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-sWASM=0")
|
||||
endif()
|
||||
|
||||
# The LEGACY_VM_SUPPORT flag is reported as linker only.
|
||||
if(DRACO_IE_COMPATIBLE)
|
||||
list(APPEND ${em_FLAG_LIST_VAR} "-sLEGACY_VM_SUPPORT=1")
|
||||
list(APPEND ${em_FLAG_LIST_VAR_COMPILER} "-sLEGACY_VM_SUPPORT=1")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
@ -66,10 +105,11 @@ macro(draco_generate_emscripten_glue)
|
|||
"${glue_multi_arg_opts}" ${ARGN})
|
||||
|
||||
if(DRACO_VERBOSE GREATER 1)
|
||||
message("--------- draco_generate_emscripten_glue -----------\n"
|
||||
"glue_INPUT_IDL=${glue_INPUT_IDL}\n"
|
||||
"glue_OUTPUT_PATH=${glue_OUTPUT_PATH}\n" ]
|
||||
"----------------------------------------------------\n")
|
||||
message(
|
||||
"--------- draco_generate_emscripten_glue -----------\n"
|
||||
"glue_INPUT_IDL=${glue_INPUT_IDL}\n"
|
||||
"glue_OUTPUT_PATH=${glue_OUTPUT_PATH}\n"
|
||||
"----------------------------------------------------\n")
|
||||
endif()
|
||||
|
||||
if(NOT glue_INPUT_IDL OR NOT glue_OUTPUT_PATH)
|
||||
|
|
@ -79,22 +119,22 @@ macro(draco_generate_emscripten_glue)
|
|||
endif()
|
||||
|
||||
# Generate the glue source.
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE}
|
||||
$ENV{EMSCRIPTEN}/tools/webidl_binder.py
|
||||
${glue_INPUT_IDL} ${glue_OUTPUT_PATH})
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} $ENV{EMSCRIPTEN}/tools/webidl_binder.py
|
||||
${glue_INPUT_IDL} ${glue_OUTPUT_PATH})
|
||||
if(NOT EXISTS "${glue_OUTPUT_PATH}.cpp")
|
||||
message(FATAL_ERROR "JS glue generation failed for ${glue_INPUT_IDL}.")
|
||||
endif()
|
||||
|
||||
# Create a dependency so that it regenerated on edits.
|
||||
add_custom_command(OUTPUT "${glue_OUTPUT_PATH}.cpp"
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
$ENV{EMSCRIPTEN}/tools/webidl_binder.py
|
||||
${glue_INPUT_IDL} ${glue_OUTPUT_PATH}
|
||||
DEPENDS ${draco_js_dec_idl}
|
||||
COMMENT "Generating ${glue_OUTPUT_PATH}.cpp."
|
||||
WORKING_DIRECTORY ${draco_build}
|
||||
VERBATIM)
|
||||
add_custom_command(
|
||||
OUTPUT "${glue_OUTPUT_PATH}.cpp"
|
||||
COMMAND ${PYTHON_EXECUTABLE} $ENV{EMSCRIPTEN}/tools/webidl_binder.py
|
||||
${glue_INPUT_IDL} ${glue_OUTPUT_PATH}
|
||||
DEPENDS ${draco_js_dec_idl}
|
||||
COMMENT "Generating ${glue_OUTPUT_PATH}.cpp."
|
||||
WORKING_DIRECTORY ${draco_build}
|
||||
VERBATIM)
|
||||
endmacro()
|
||||
|
||||
# Wrapper for draco_add_executable() that handles the extra work necessary for
|
||||
|
|
@ -120,8 +160,14 @@ macro(draco_add_emscripten_executable)
|
|||
unset(emexe_LINK_FLAGS)
|
||||
set(optional_args)
|
||||
set(single_value_args NAME GLUE_PATH)
|
||||
set(multi_value_args SOURCES DEFINES FEATURES INCLUDES LINK_FLAGS
|
||||
PRE_LINK_JS_SOURCES POST_LINK_JS_SOURCES)
|
||||
set(multi_value_args
|
||||
SOURCES
|
||||
DEFINES
|
||||
FEATURES
|
||||
INCLUDES
|
||||
LINK_FLAGS
|
||||
PRE_LINK_JS_SOURCES
|
||||
POST_LINK_JS_SOURCES)
|
||||
|
||||
cmake_parse_arguments(emexe "${optional_args}" "${single_value_args}"
|
||||
"${multi_value_args}" ${ARGN})
|
||||
|
|
@ -136,49 +182,50 @@ macro(draco_add_emscripten_executable)
|
|||
endif()
|
||||
|
||||
if(DRACO_VERBOSE GREATER 1)
|
||||
message("--------- draco_add_emscripten_executable ---------\n"
|
||||
"emexe_NAME=${emexe_NAME}\n"
|
||||
"emexe_SOURCES=${emexe_SOURCES}\n"
|
||||
"emexe_DEFINES=${emexe_DEFINES}\n"
|
||||
"emexe_INCLUDES=${emexe_INCLUDES}\n"
|
||||
"emexe_LINK_FLAGS=${emexe_LINK_FLAGS}\n"
|
||||
"emexe_GLUE_PATH=${emexe_GLUE_PATH}\n"
|
||||
"emexe_FEATURES=${emexe_FEATURES}\n"
|
||||
"emexe_PRE_LINK_JS_SOURCES=${emexe_PRE_LINK_JS_SOURCES}\n"
|
||||
"emexe_POST_LINK_JS_SOURCES=${emexe_POST_LINK_JS_SOURCES}\n"
|
||||
"----------------------------------------------------\n")
|
||||
message(
|
||||
"--------- draco_add_emscripten_executable ---------\n"
|
||||
"emexe_NAME=${emexe_NAME}\n"
|
||||
"emexe_SOURCES=${emexe_SOURCES}\n"
|
||||
"emexe_DEFINES=${emexe_DEFINES}\n"
|
||||
"emexe_INCLUDES=${emexe_INCLUDES}\n"
|
||||
"emexe_LINK_FLAGS=${emexe_LINK_FLAGS}\n"
|
||||
"emexe_GLUE_PATH=${emexe_GLUE_PATH}\n"
|
||||
"emexe_FEATURES=${emexe_FEATURES}\n"
|
||||
"emexe_PRE_LINK_JS_SOURCES=${emexe_PRE_LINK_JS_SOURCES}\n"
|
||||
"emexe_POST_LINK_JS_SOURCES=${emexe_POST_LINK_JS_SOURCES}\n"
|
||||
"----------------------------------------------------\n")
|
||||
endif()
|
||||
|
||||
# The Emscripten linker needs the C++ flags in addition to whatever has been
|
||||
# passed in with the target.
|
||||
list(APPEND emexe_LINK_FLAGS ${DRACO_CXX_FLAGS})
|
||||
|
||||
if(DRACO_GLTF)
|
||||
draco_add_executable(NAME
|
||||
${emexe_NAME}
|
||||
OUTPUT_NAME
|
||||
${emexe_NAME}_gltf
|
||||
SOURCES
|
||||
${emexe_SOURCES}
|
||||
DEFINES
|
||||
${emexe_DEFINES}
|
||||
INCLUDES
|
||||
${emexe_INCLUDES}
|
||||
LINK_FLAGS
|
||||
${emexe_LINK_FLAGS})
|
||||
if(DRACO_GLTF_BITSTREAM)
|
||||
# Add "_gltf" suffix to target output name.
|
||||
draco_add_executable(
|
||||
NAME ${emexe_NAME}
|
||||
OUTPUT_NAME ${emexe_NAME}_gltf
|
||||
SOURCES ${emexe_SOURCES}
|
||||
DEFINES ${emexe_DEFINES}
|
||||
INCLUDES ${emexe_INCLUDES}
|
||||
LINK_FLAGS ${emexe_LINK_FLAGS})
|
||||
else()
|
||||
draco_add_executable(NAME ${emexe_NAME} SOURCES ${emexe_SOURCES} DEFINES
|
||||
${emexe_DEFINES} INCLUDES ${emexe_INCLUDES} LINK_FLAGS
|
||||
${emexe_LINK_FLAGS})
|
||||
draco_add_executable(
|
||||
NAME ${emexe_NAME}
|
||||
SOURCES ${emexe_SOURCES}
|
||||
DEFINES ${emexe_DEFINES}
|
||||
INCLUDES ${emexe_INCLUDES}
|
||||
LINK_FLAGS ${emexe_LINK_FLAGS})
|
||||
endif()
|
||||
|
||||
foreach(feature ${emexe_FEATURES})
|
||||
draco_enable_feature(FEATURE ${feature} TARGETS ${emexe_NAME})
|
||||
endforeach()
|
||||
|
||||
set_property(SOURCE ${emexe_SOURCES}
|
||||
APPEND
|
||||
PROPERTY OBJECT_DEPENDS "${emexe_GLUE_PATH}.cpp")
|
||||
set_property(
|
||||
SOURCE ${emexe_SOURCES}
|
||||
APPEND
|
||||
PROPERTY OBJECT_DEPENDS "${emexe_GLUE_PATH}.cpp")
|
||||
em_link_pre_js(${emexe_NAME} ${emexe_PRE_LINK_JS_SOURCES})
|
||||
em_link_post_js(${emexe_NAME} "${emexe_GLUE_PATH}.js"
|
||||
${emexe_POST_LINK_JS_SOURCES})
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_FLAGS_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_FLAGS_CMAKE_
|
||||
|
|
@ -24,7 +38,7 @@ macro(draco_set_compiler_flags_for_sources)
|
|||
endif()
|
||||
|
||||
set_source_files_properties(${compiler_SOURCES} PROPERTIES COMPILE_FLAGS
|
||||
${compiler_FLAGS})
|
||||
${compiler_FLAGS})
|
||||
|
||||
if(DRACO_VERBOSE GREATER 1)
|
||||
foreach(source ${compiler_SOURCES})
|
||||
|
|
@ -85,8 +99,8 @@ macro(draco_test_cxx_flag)
|
|||
# are passed as a list it will remove the list separators, and attempt to run
|
||||
# a compile command using list entries concatenated together as a single
|
||||
# argument. Avoid the problem by forcing the argument to be a string.
|
||||
draco_set_and_stringify(SOURCE_VARS all_cxx_flags DEST all_cxx_flags)
|
||||
check_cxx_compiler_flag("${all_cxx_flags}" draco_all_cxx_flags_pass)
|
||||
draco_set_and_stringify(SOURCE_VARS all_cxx_flags DEST all_cxx_flags_string)
|
||||
check_cxx_compiler_flag("${all_cxx_flags_string}" draco_all_cxx_flags_pass)
|
||||
|
||||
if(cxx_test_FLAG_REQUIRED AND NOT draco_all_cxx_flags_pass)
|
||||
draco_die("Flag test failed for required flag(s): "
|
||||
|
|
@ -245,3 +259,34 @@ macro(draco_set_cxx_flags)
|
|||
draco_test_cxx_flag(FLAG_LIST_VAR_NAMES ${cxx_flag_lists})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Collects Draco built-in and user-specified linker flags and tests them. Halts
|
||||
# configuration and reports the error when any flags cause the build to fail.
|
||||
#
|
||||
# Note: draco_test_exe_linker_flag() does the real work of setting the flags and
|
||||
# running the test compile commands.
|
||||
macro(draco_set_exe_linker_flags)
|
||||
unset(linker_flag_lists)
|
||||
|
||||
if(DRACO_VERBOSE)
|
||||
message("draco_set_exe_linker_flags: "
|
||||
"draco_base_exe_linker_flags=${draco_base_exe_linker_flags}")
|
||||
endif()
|
||||
|
||||
if(draco_base_exe_linker_flags)
|
||||
list(APPEND linker_flag_lists draco_base_exe_linker_flags)
|
||||
endif()
|
||||
|
||||
if(linker_flag_lists)
|
||||
unset(test_linker_flags)
|
||||
|
||||
if(DRACO_VERBOSE)
|
||||
message("draco_set_exe_linker_flags: "
|
||||
"linker_flag_lists=${linker_flag_lists}")
|
||||
endif()
|
||||
|
||||
draco_set_and_stringify(DEST test_linker_flags SOURCE_VARS
|
||||
${linker_flag_lists})
|
||||
draco_test_exe_linker_flag(FLAG_LIST_VAR_NAME test_linker_flags)
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_HELPERS_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_HELPERS_CMAKE_
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_INSTALL_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_INSTALL_CMAKE_
|
||||
set(DRACO_CMAKE_DRACO_INSTALL_CMAKE_ 1)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Sets up the draco install targets. Must be called after the static library
|
||||
# target is created.
|
||||
macro(draco_setup_install_target)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# pkg-config: draco.pc
|
||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set(exec_prefix "\${prefix}")
|
||||
set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(draco_lib_name "draco")
|
||||
|
||||
configure_file("${draco_root}/cmake/draco.pc.template"
|
||||
"${draco_build}/draco.pc" @ONLY NEWLINE_STYLE UNIX)
|
||||
install(FILES "${draco_build}/draco.pc"
|
||||
DESTINATION "${prefix}/${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
# CMake config: draco-config.cmake
|
||||
set(DRACO_INCLUDE_DIRS "${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
configure_file("${draco_root}/cmake/draco-config.cmake.template"
|
||||
"${draco_build}/draco-config.cmake" @ONLY NEWLINE_STYLE UNIX)
|
||||
install(
|
||||
FILES "${draco_build}/draco-config.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/cmake")
|
||||
set(bin_path "${CMAKE_INSTALL_BINDIR}")
|
||||
set(data_path "${CMAKE_INSTALL_DATAROOTDIR}")
|
||||
set(includes_path "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(libs_path "${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
foreach(file ${draco_sources})
|
||||
if(file MATCHES "h$")
|
||||
|
|
@ -34,46 +34,88 @@ macro(draco_setup_install_target)
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES draco_api_includes)
|
||||
|
||||
# Strip $draco_src_root from the file paths: we need to install relative to
|
||||
# $include_directory.
|
||||
list(TRANSFORM draco_api_includes REPLACE "${draco_src_root}/" "")
|
||||
set(include_directory "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
foreach(draco_api_include ${draco_api_includes})
|
||||
get_filename_component(file_directory ${draco_api_include} DIRECTORY)
|
||||
set(target_directory "${include_directory}/draco/${file_directory}")
|
||||
set(target_directory "${includes_path}/draco/${file_directory}")
|
||||
install(FILES ${draco_src_root}/${draco_api_include}
|
||||
DESTINATION "${target_directory}")
|
||||
endforeach()
|
||||
|
||||
install(
|
||||
FILES "${draco_build}/draco/draco_features.h"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/draco/")
|
||||
install(FILES "${draco_build}/draco/draco_features.h"
|
||||
DESTINATION "${includes_path}/draco/")
|
||||
|
||||
install(TARGETS draco_decoder DESTINATION
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
|
||||
install(TARGETS draco_encoder DESTINATION
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
|
||||
install(TARGETS draco_decoder DESTINATION "${bin_path}")
|
||||
install(TARGETS draco_encoder DESTINATION "${bin_path}")
|
||||
|
||||
if(DRACO_TRANSCODER_SUPPORTED)
|
||||
install(TARGETS draco_transcoder DESTINATION "${bin_path}")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
install(TARGETS draco DESTINATION
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
install(
|
||||
TARGETS draco
|
||||
EXPORT dracoExport
|
||||
RUNTIME DESTINATION "${bin_path}"
|
||||
ARCHIVE DESTINATION "${libs_path}"
|
||||
LIBRARY DESTINATION "${libs_path}")
|
||||
else()
|
||||
install(TARGETS draco_static DESTINATION
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
install(
|
||||
TARGETS draco_static
|
||||
EXPORT dracoExport
|
||||
DESTINATION "${libs_path}")
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS draco_shared DESTINATION
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
install(
|
||||
TARGETS draco_shared
|
||||
EXPORT dracoExport
|
||||
RUNTIME DESTINATION "${bin_path}"
|
||||
ARCHIVE DESTINATION "${libs_path}"
|
||||
LIBRARY DESTINATION "${libs_path}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DRACO_UNITY_PLUGIN)
|
||||
install(TARGETS dracodec_unity DESTINATION
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
if(DRACO_MAYA_PLUGIN)
|
||||
install(TARGETS draco_maya_wrapper DESTINATION
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
install(TARGETS dracodec_unity DESTINATION "${libs_path}")
|
||||
endif()
|
||||
|
||||
if(DRACO_MAYA_PLUGIN)
|
||||
install(TARGETS draco_maya_wrapper DESTINATION "${libs_path}")
|
||||
endif()
|
||||
|
||||
# pkg-config: draco.pc
|
||||
configure_file("${draco_root}/cmake/draco.pc.template"
|
||||
"${draco_build}/draco.pc" @ONLY NEWLINE_STYLE UNIX)
|
||||
install(FILES "${draco_build}/draco.pc" DESTINATION "${libs_path}/pkgconfig")
|
||||
|
||||
# CMake config: draco-config.cmake
|
||||
configure_package_config_file(
|
||||
"${draco_root}/cmake/draco-config.cmake.template"
|
||||
"${draco_build}/draco-config.cmake"
|
||||
INSTALL_DESTINATION "${data_path}/cmake/draco")
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${draco_build}/draco-config-version.cmake"
|
||||
VERSION ${DRACO_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
export(
|
||||
EXPORT dracoExport
|
||||
NAMESPACE draco::
|
||||
FILE "${draco_build}/draco-targets.cmake")
|
||||
|
||||
install(
|
||||
EXPORT dracoExport
|
||||
NAMESPACE draco::
|
||||
FILE draco-targets.cmake
|
||||
DESTINATION "${data_path}/cmake/draco")
|
||||
|
||||
install(FILES "${draco_build}/draco-config.cmake"
|
||||
"${draco_build}/draco-config-version.cmake"
|
||||
DESTINATION "${data_path}/cmake/draco")
|
||||
endmacro()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_INTRINSICS_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_INTRINSICS_CMAKE_
|
||||
|
|
@ -61,17 +75,15 @@ macro(draco_process_intrinsics_sources)
|
|||
unset(sse4_sources)
|
||||
list(APPEND sse4_sources ${arg_SOURCES})
|
||||
|
||||
list(FILTER sse4_sources INCLUDE REGEX
|
||||
"${draco_sse4_source_file_suffix}$")
|
||||
list(FILTER sse4_sources INCLUDE REGEX "${draco_sse4_source_file_suffix}$")
|
||||
|
||||
if(sse4_sources)
|
||||
unset(sse4_flags)
|
||||
draco_get_intrinsics_flag_for_suffix(SUFFIX
|
||||
${draco_sse4_source_file_suffix}
|
||||
VARIABLE sse4_flags)
|
||||
draco_get_intrinsics_flag_for_suffix(
|
||||
SUFFIX ${draco_sse4_source_file_suffix} VARIABLE sse4_flags)
|
||||
if(sse4_flags)
|
||||
draco_set_compiler_flags_for_sources(SOURCES ${sse4_sources} FLAGS
|
||||
${sse4_flags})
|
||||
${sse4_flags})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -79,17 +91,15 @@ macro(draco_process_intrinsics_sources)
|
|||
if(DRACO_ENABLE_NEON AND draco_have_neon)
|
||||
unset(neon_sources)
|
||||
list(APPEND neon_sources ${arg_SOURCES})
|
||||
list(FILTER neon_sources INCLUDE REGEX
|
||||
"${draco_neon_source_file_suffix}$")
|
||||
list(FILTER neon_sources INCLUDE REGEX "${draco_neon_source_file_suffix}$")
|
||||
|
||||
if(neon_sources AND DRACO_NEON_INTRINSICS_FLAG)
|
||||
unset(neon_flags)
|
||||
draco_get_intrinsics_flag_for_suffix(SUFFIX
|
||||
${draco_neon_source_file_suffix}
|
||||
VARIABLE neon_flags)
|
||||
draco_get_intrinsics_flag_for_suffix(
|
||||
SUFFIX ${draco_neon_source_file_suffix} VARIABLE neon_flags)
|
||||
if(neon_flags)
|
||||
draco_set_compiler_flags_for_sources(SOURCES ${neon_sources} FLAGS
|
||||
${neon_flags})
|
||||
${neon_flags})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_OPTIONS_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_OPTIONS_CMAKE_
|
||||
|
|
@ -18,17 +32,22 @@ macro(draco_option)
|
|||
cmake_parse_arguments(option "${optional_args}" "${single_value_args}"
|
||||
"${multi_value_args}" ${ARGN})
|
||||
|
||||
if(NOT (option_NAME AND option_HELPSTRING AND DEFINED option_VALUE))
|
||||
if(NOT
|
||||
(option_NAME
|
||||
AND option_HELPSTRING
|
||||
AND DEFINED option_VALUE))
|
||||
message(FATAL_ERROR "draco_option: NAME HELPSTRING and VALUE required.")
|
||||
endif()
|
||||
|
||||
option(${option_NAME} ${option_HELPSTRING} ${option_VALUE})
|
||||
|
||||
if(DRACO_VERBOSE GREATER 2)
|
||||
message("--------- draco_option ---------\n" "option_NAME=${option_NAME}\n"
|
||||
"option_HELPSTRING=${option_HELPSTRING}\n"
|
||||
"option_VALUE=${option_VALUE}\n"
|
||||
"------------------------------------------\n")
|
||||
message(
|
||||
"--------- draco_option ---------\n"
|
||||
"option_NAME=${option_NAME}\n"
|
||||
"option_HELPSTRING=${option_HELPSTRING}\n"
|
||||
"option_VALUE=${option_VALUE}\n"
|
||||
"------------------------------------------\n")
|
||||
endif()
|
||||
|
||||
list(APPEND draco_options ${option_NAME})
|
||||
|
|
@ -44,33 +63,74 @@ endmacro()
|
|||
|
||||
# Set default options.
|
||||
macro(draco_set_default_options)
|
||||
draco_option(NAME DRACO_FAST HELPSTRING "Try to build faster libs." VALUE OFF)
|
||||
draco_option(NAME DRACO_JS_GLUE HELPSTRING
|
||||
"Enable JS Glue and JS targets when using Emscripten." VALUE ON)
|
||||
draco_option(NAME DRACO_IE_COMPATIBLE HELPSTRING
|
||||
"Enable support for older IE builds when using Emscripten." VALUE
|
||||
OFF)
|
||||
draco_option(NAME DRACO_MESH_COMPRESSION HELPSTRING "Enable mesh compression."
|
||||
VALUE ON)
|
||||
draco_option(NAME DRACO_POINT_CLOUD_COMPRESSION HELPSTRING
|
||||
"Enable point cloud compression." VALUE ON)
|
||||
draco_option(NAME DRACO_PREDICTIVE_EDGEBREAKER HELPSTRING
|
||||
"Enable predictive edgebreaker." VALUE ON)
|
||||
draco_option(NAME DRACO_STANDARD_EDGEBREAKER HELPSTRING
|
||||
"Enable stand edgebreaker." VALUE ON)
|
||||
draco_option(NAME DRACO_BACKWARDS_COMPATIBILITY HELPSTRING
|
||||
"Enable backwards compatibility." VALUE ON)
|
||||
draco_option(NAME DRACO_DECODER_ATTRIBUTE_DEDUPLICATION HELPSTRING
|
||||
"Enable attribute deduping." VALUE OFF)
|
||||
draco_option(NAME DRACO_TESTS HELPSTRING "Enables tests." VALUE OFF)
|
||||
draco_option(NAME DRACO_WASM HELPSTRING "Enables WASM support." VALUE OFF)
|
||||
draco_option(NAME DRACO_UNITY_PLUGIN HELPSTRING
|
||||
"Build plugin library for Unity." VALUE OFF)
|
||||
draco_option(NAME DRACO_ANIMATION_ENCODING HELPSTRING "Enable animation."
|
||||
VALUE OFF)
|
||||
draco_option(NAME DRACO_GLTF HELPSTRING "Support GLTF." VALUE OFF)
|
||||
draco_option(NAME DRACO_MAYA_PLUGIN HELPSTRING
|
||||
"Build plugin library for Maya." VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_FAST
|
||||
HELPSTRING "Try to build faster libs."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_JS_GLUE
|
||||
HELPSTRING "Enable JS Glue and JS targets when using Emscripten."
|
||||
VALUE ON)
|
||||
draco_option(
|
||||
NAME DRACO_IE_COMPATIBLE
|
||||
HELPSTRING "Enable support for older IE builds when using Emscripten."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_MESH_COMPRESSION
|
||||
HELPSTRING "Enable mesh compression."
|
||||
VALUE ON)
|
||||
draco_option(
|
||||
NAME DRACO_POINT_CLOUD_COMPRESSION
|
||||
HELPSTRING "Enable point cloud compression."
|
||||
VALUE ON)
|
||||
draco_option(
|
||||
NAME DRACO_PREDICTIVE_EDGEBREAKER
|
||||
HELPSTRING "Enable predictive edgebreaker."
|
||||
VALUE ON)
|
||||
draco_option(
|
||||
NAME DRACO_STANDARD_EDGEBREAKER
|
||||
HELPSTRING "Enable stand edgebreaker."
|
||||
VALUE ON)
|
||||
draco_option(
|
||||
NAME DRACO_BACKWARDS_COMPATIBILITY
|
||||
HELPSTRING "Enable backwards compatibility."
|
||||
VALUE ON)
|
||||
draco_option(
|
||||
NAME DRACO_DECODER_ATTRIBUTE_DEDUPLICATION
|
||||
HELPSTRING "Enable attribute deduping."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_TESTS
|
||||
HELPSTRING "Enables tests."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_WASM
|
||||
HELPSTRING "Enables WASM support."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_UNITY_PLUGIN
|
||||
HELPSTRING "Build plugin library for Unity."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_ANIMATION_ENCODING
|
||||
HELPSTRING "Enable animation."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_GLTF_BITSTREAM
|
||||
HELPSTRING "Draco GLTF extension bitstream specified features only."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_MAYA_PLUGIN
|
||||
HELPSTRING "Build plugin library for Maya."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_TRANSCODER_SUPPORTED
|
||||
HELPSTRING "Enable the Draco transcoder."
|
||||
VALUE OFF)
|
||||
draco_option(
|
||||
NAME DRACO_DEBUG_COMPILER_WARNINGS
|
||||
HELPSTRING "Turn on more warnings."
|
||||
VALUE OFF)
|
||||
draco_check_deprecated_options()
|
||||
endmacro()
|
||||
|
||||
|
|
@ -117,14 +177,16 @@ macro(draco_check_deprecated_options)
|
|||
DRACO_MAYA_PLUGIN)
|
||||
draco_handle_deprecated_option(OLDNAME BUILD_USD_PLUGIN NEWNAME
|
||||
BUILD_SHARED_LIBS)
|
||||
draco_handle_deprecated_option(OLDNAME DRACO_GLTF NEWNAME
|
||||
DRACO_GLTF_BITSTREAM)
|
||||
|
||||
endmacro()
|
||||
|
||||
# Macro for setting Draco features based on user configuration. Features enabled
|
||||
# by this macro are Draco global.
|
||||
macro(draco_set_optional_features)
|
||||
if(DRACO_GLTF)
|
||||
# Override settings when building for GLTF.
|
||||
if(DRACO_GLTF_BITSTREAM)
|
||||
# Enable only the features included in the Draco GLTF bitstream spec.
|
||||
draco_enable_feature(FEATURE "DRACO_MESH_COMPRESSION_SUPPORTED")
|
||||
draco_enable_feature(FEATURE "DRACO_NORMAL_ENCODING_SUPPORTED")
|
||||
draco_enable_feature(FEATURE "DRACO_STANDARD_EDGEBREAKER_SUPPORTED")
|
||||
|
|
@ -170,6 +232,11 @@ macro(draco_set_optional_features)
|
|||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
if(DRACO_TRANSCODER_SUPPORTED)
|
||||
draco_enable_feature(FEATURE "DRACO_TRANSCODER_SUPPORTED")
|
||||
endif()
|
||||
|
||||
|
||||
endmacro()
|
||||
|
||||
# Macro that handles tracking of Draco preprocessor symbols for the purpose of
|
||||
|
|
@ -221,8 +288,56 @@ function(draco_generate_features_h)
|
|||
file(APPEND "${draco_features_file_name}.new" "#define ${feature}\n")
|
||||
endforeach()
|
||||
|
||||
if(MSVC)
|
||||
if(NOT DRACO_DEBUG_COMPILER_WARNINGS)
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"// Enable DRACO_DEBUG_COMPILER_WARNINGS at CMake generation \n"
|
||||
"// time to remove these pragmas.\n")
|
||||
|
||||
# warning C4018: '<operator>': signed/unsigned mismatch.
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"#pragma warning(disable:4018)\n")
|
||||
|
||||
# warning C4146: unary minus operator applied to unsigned type, result
|
||||
# still unsigned
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"#pragma warning(disable:4146)\n")
|
||||
|
||||
# warning C4244: 'return': conversion from '<type>' to '<type>', possible
|
||||
# loss of data.
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"#pragma warning(disable:4244)\n")
|
||||
|
||||
# warning C4267: 'initializing' conversion from '<type>' to '<type>',
|
||||
# possible loss of data.
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"#pragma warning(disable:4267)\n")
|
||||
|
||||
# warning C4305: 'context' : truncation from 'type1' to 'type2'.
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"#pragma warning(disable:4305)\n")
|
||||
|
||||
# warning C4661: 'identifier' : no suitable definition provided for
|
||||
# explicit template instantiation request.
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"#pragma warning(disable:4661)\n")
|
||||
|
||||
# warning C4800: Implicit conversion from 'type' to bool. Possible
|
||||
# information loss.
|
||||
# Also, in older MSVC releases:
|
||||
# warning C4800: 'type' : forcing value to bool 'true' or 'false'
|
||||
# (performance warning).
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"#pragma warning(disable:4800)\n")
|
||||
|
||||
# warning C4804: '<operator>': unsafe use of type '<type>' in operation.
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"#pragma warning(disable:4804)\n")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(APPEND "${draco_features_file_name}.new"
|
||||
"\n#endif // DRACO_FEATURES_H_")
|
||||
"\n#endif // DRACO_FEATURES_H_\n")
|
||||
|
||||
# Will replace ${draco_features_file_name} only if the file content has
|
||||
# changed. This prevents forced Draco rebuilds after CMake runs.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_SANITIZER_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_SANITIZER_CMAKE_
|
||||
|
|
@ -5,7 +19,9 @@ set(DRACO_CMAKE_DRACO_SANITIZER_CMAKE_ 1)
|
|||
|
||||
# Handles the details of enabling sanitizers.
|
||||
macro(draco_configure_sanitizer)
|
||||
if(DRACO_SANITIZE AND NOT EMSCRIPTEN AND NOT MSVC)
|
||||
if(DRACO_SANITIZE
|
||||
AND NOT EMSCRIPTEN
|
||||
AND NOT MSVC)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(DRACO_SANITIZE MATCHES "cfi")
|
||||
list(APPEND SAN_CXX_FLAGS "-flto" "-fno-sanitize-trap=cfi")
|
||||
|
|
@ -13,8 +29,8 @@ macro(draco_configure_sanitizer)
|
|||
"-fuse-ld=gold")
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SIZEOF_VOID_P} EQUAL 4
|
||||
AND DRACO_SANITIZE MATCHES "integer|undefined")
|
||||
if(${CMAKE_SIZEOF_VOID_P} EQUAL 4 AND DRACO_SANITIZE MATCHES
|
||||
"integer|undefined")
|
||||
list(APPEND SAN_LINKER_FLAGS "--rtlib=compiler-rt" "-lgcc_s")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_TARGETS_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_TARGETS_CMAKE_
|
||||
|
|
@ -51,26 +65,33 @@ macro(draco_add_executable)
|
|||
unset(exe_LIB_DEPS)
|
||||
set(optional_args TEST)
|
||||
set(single_value_args NAME OUTPUT_NAME)
|
||||
set(multi_value_args SOURCES DEFINES INCLUDES COMPILE_FLAGS LINK_FLAGS
|
||||
OBJLIB_DEPS LIB_DEPS)
|
||||
set(multi_value_args
|
||||
SOURCES
|
||||
DEFINES
|
||||
INCLUDES
|
||||
COMPILE_FLAGS
|
||||
LINK_FLAGS
|
||||
OBJLIB_DEPS
|
||||
LIB_DEPS)
|
||||
|
||||
cmake_parse_arguments(exe "${optional_args}" "${single_value_args}"
|
||||
"${multi_value_args}" ${ARGN})
|
||||
|
||||
if(DRACO_VERBOSE GREATER 1)
|
||||
message("--------- draco_add_executable ---------\n"
|
||||
"exe_TEST=${exe_TEST}\n"
|
||||
"exe_TEST_DEFINES_MAIN=${exe_TEST_DEFINES_MAIN}\n"
|
||||
"exe_NAME=${exe_NAME}\n"
|
||||
"exe_OUTPUT_NAME=${exe_OUTPUT_NAME}\n"
|
||||
"exe_SOURCES=${exe_SOURCES}\n"
|
||||
"exe_DEFINES=${exe_DEFINES}\n"
|
||||
"exe_INCLUDES=${exe_INCLUDES}\n"
|
||||
"exe_COMPILE_FLAGS=${exe_COMPILE_FLAGS}\n"
|
||||
"exe_LINK_FLAGS=${exe_LINK_FLAGS}\n"
|
||||
"exe_OBJLIB_DEPS=${exe_OBJLIB_DEPS}\n"
|
||||
"exe_LIB_DEPS=${exe_LIB_DEPS}\n"
|
||||
"------------------------------------------\n")
|
||||
message(
|
||||
"--------- draco_add_executable ---------\n"
|
||||
"exe_TEST=${exe_TEST}\n"
|
||||
"exe_TEST_DEFINES_MAIN=${exe_TEST_DEFINES_MAIN}\n"
|
||||
"exe_NAME=${exe_NAME}\n"
|
||||
"exe_OUTPUT_NAME=${exe_OUTPUT_NAME}\n"
|
||||
"exe_SOURCES=${exe_SOURCES}\n"
|
||||
"exe_DEFINES=${exe_DEFINES}\n"
|
||||
"exe_INCLUDES=${exe_INCLUDES}\n"
|
||||
"exe_COMPILE_FLAGS=${exe_COMPILE_FLAGS}\n"
|
||||
"exe_LINK_FLAGS=${exe_LINK_FLAGS}\n"
|
||||
"exe_OBJLIB_DEPS=${exe_OBJLIB_DEPS}\n"
|
||||
"exe_LIB_DEPS=${exe_LIB_DEPS}\n"
|
||||
"------------------------------------------\n")
|
||||
endif()
|
||||
|
||||
if(NOT (exe_NAME AND exe_SOURCES))
|
||||
|
|
@ -87,7 +108,12 @@ macro(draco_add_executable)
|
|||
endif()
|
||||
|
||||
add_executable(${exe_NAME} ${exe_SOURCES})
|
||||
set_target_properties(${exe_NAME} PROPERTIES VERSION ${DRACO_VERSION})
|
||||
|
||||
target_compile_features(${exe_NAME} PUBLIC cxx_std_11)
|
||||
|
||||
if(NOT EMSCRIPTEN)
|
||||
set_target_properties(${exe_NAME} PROPERTIES VERSION ${DRACO_VERSION})
|
||||
endif()
|
||||
|
||||
if(exe_OUTPUT_NAME)
|
||||
set_target_properties(${exe_NAME} PROPERTIES OUTPUT_NAME ${exe_OUTPUT_NAME})
|
||||
|
|
@ -104,8 +130,8 @@ macro(draco_add_executable)
|
|||
endif()
|
||||
|
||||
if(exe_COMPILE_FLAGS OR DRACO_CXX_FLAGS)
|
||||
target_compile_options(${exe_NAME}
|
||||
PRIVATE ${exe_COMPILE_FLAGS} ${DRACO_CXX_FLAGS})
|
||||
target_compile_options(${exe_NAME} PRIVATE ${exe_COMPILE_FLAGS}
|
||||
${DRACO_CXX_FLAGS})
|
||||
endif()
|
||||
|
||||
if(exe_LINK_FLAGS OR DRACO_EXE_LINKER_FLAGS)
|
||||
|
|
@ -113,8 +139,8 @@ macro(draco_add_executable)
|
|||
list(APPEND exe_LINK_FLAGS "${DRACO_EXE_LINKER_FLAGS}")
|
||||
# LINK_FLAGS is managed as a string.
|
||||
draco_set_and_stringify(SOURCE "${exe_LINK_FLAGS}" DEST exe_LINK_FLAGS)
|
||||
set_target_properties(${exe_NAME}
|
||||
PROPERTIES LINK_FLAGS "${exe_LINK_FLAGS}")
|
||||
set_target_properties(${exe_NAME} PROPERTIES LINK_FLAGS
|
||||
"${exe_LINK_FLAGS}")
|
||||
else()
|
||||
target_link_options(${exe_NAME} PRIVATE ${exe_LINK_FLAGS}
|
||||
${DRACO_EXE_LINKER_FLAGS})
|
||||
|
|
@ -136,12 +162,7 @@ macro(draco_add_executable)
|
|||
endif()
|
||||
|
||||
if(exe_LIB_DEPS)
|
||||
unset(exe_static)
|
||||
if("${CMAKE_EXE_LINKER_FLAGS} ${DRACO_EXE_LINKER_FLAGS}" MATCHES "static")
|
||||
set(exe_static ON)
|
||||
endif()
|
||||
|
||||
if(exe_static AND CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "^Clang|^GNU")
|
||||
# Third party dependencies can introduce dependencies on system and test
|
||||
# libraries. Since the target created here is an executable, and CMake
|
||||
# does not provide a method of controlling order of link dependencies,
|
||||
|
|
@ -149,6 +170,10 @@ macro(draco_add_executable)
|
|||
# ensure that dependencies of third party targets can be resolved when
|
||||
# those dependencies happen to be resolved by dependencies of the current
|
||||
# target.
|
||||
# TODO(tomfinegan): For portability use LINK_GROUP with RESCAN instead of
|
||||
# directly (ab)using compiler/linker specific flags once CMake v3.24 is in
|
||||
# wider use. See:
|
||||
# https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:LINK_GROUP
|
||||
list(INSERT exe_LIB_DEPS 0 -Wl,--start-group)
|
||||
list(APPEND exe_LIB_DEPS -Wl,--end-group)
|
||||
endif()
|
||||
|
|
@ -209,27 +234,36 @@ macro(draco_add_library)
|
|||
unset(lib_TARGET_PROPERTIES)
|
||||
set(optional_args TEST)
|
||||
set(single_value_args NAME OUTPUT_NAME TYPE)
|
||||
set(multi_value_args SOURCES DEFINES INCLUDES COMPILE_FLAGS LINK_FLAGS
|
||||
OBJLIB_DEPS LIB_DEPS PUBLIC_INCLUDES TARGET_PROPERTIES)
|
||||
set(multi_value_args
|
||||
SOURCES
|
||||
DEFINES
|
||||
INCLUDES
|
||||
COMPILE_FLAGS
|
||||
LINK_FLAGS
|
||||
OBJLIB_DEPS
|
||||
LIB_DEPS
|
||||
PUBLIC_INCLUDES
|
||||
TARGET_PROPERTIES)
|
||||
|
||||
cmake_parse_arguments(lib "${optional_args}" "${single_value_args}"
|
||||
"${multi_value_args}" ${ARGN})
|
||||
|
||||
if(DRACO_VERBOSE GREATER 1)
|
||||
message("--------- draco_add_library ---------\n"
|
||||
"lib_TEST=${lib_TEST}\n"
|
||||
"lib_NAME=${lib_NAME}\n"
|
||||
"lib_OUTPUT_NAME=${lib_OUTPUT_NAME}\n"
|
||||
"lib_TYPE=${lib_TYPE}\n"
|
||||
"lib_SOURCES=${lib_SOURCES}\n"
|
||||
"lib_DEFINES=${lib_DEFINES}\n"
|
||||
"lib_INCLUDES=${lib_INCLUDES}\n"
|
||||
"lib_COMPILE_FLAGS=${lib_COMPILE_FLAGS}\n"
|
||||
"lib_LINK_FLAGS=${lib_LINK_FLAGS}\n"
|
||||
"lib_OBJLIB_DEPS=${lib_OBJLIB_DEPS}\n"
|
||||
"lib_LIB_DEPS=${lib_LIB_DEPS}\n"
|
||||
"lib_PUBLIC_INCLUDES=${lib_PUBLIC_INCLUDES}\n"
|
||||
"---------------------------------------\n")
|
||||
message(
|
||||
"--------- draco_add_library ---------\n"
|
||||
"lib_TEST=${lib_TEST}\n"
|
||||
"lib_NAME=${lib_NAME}\n"
|
||||
"lib_OUTPUT_NAME=${lib_OUTPUT_NAME}\n"
|
||||
"lib_TYPE=${lib_TYPE}\n"
|
||||
"lib_SOURCES=${lib_SOURCES}\n"
|
||||
"lib_DEFINES=${lib_DEFINES}\n"
|
||||
"lib_INCLUDES=${lib_INCLUDES}\n"
|
||||
"lib_COMPILE_FLAGS=${lib_COMPILE_FLAGS}\n"
|
||||
"lib_LINK_FLAGS=${lib_LINK_FLAGS}\n"
|
||||
"lib_OBJLIB_DEPS=${lib_OBJLIB_DEPS}\n"
|
||||
"lib_LIB_DEPS=${lib_LIB_DEPS}\n"
|
||||
"lib_PUBLIC_INCLUDES=${lib_PUBLIC_INCLUDES}\n"
|
||||
"---------------------------------------\n")
|
||||
endif()
|
||||
|
||||
if(NOT (lib_NAME AND lib_TYPE))
|
||||
|
|
@ -256,14 +290,24 @@ macro(draco_add_library)
|
|||
endif()
|
||||
|
||||
add_library(${lib_NAME} ${lib_TYPE} ${lib_SOURCES})
|
||||
|
||||
target_compile_features(${lib_NAME} PUBLIC cxx_std_11)
|
||||
|
||||
target_include_directories(${lib_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
# Enable PIC for all targets in shared configurations.
|
||||
set_target_properties(${lib_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
endif()
|
||||
|
||||
if(lib_SOURCES)
|
||||
draco_process_intrinsics_sources(TARGET ${lib_NAME} SOURCES ${lib_SOURCES})
|
||||
endif()
|
||||
|
||||
if(lib_OUTPUT_NAME)
|
||||
if(NOT (BUILD_SHARED_LIBS AND MSVC))
|
||||
set_target_properties(${lib_NAME}
|
||||
PROPERTIES OUTPUT_NAME ${lib_OUTPUT_NAME})
|
||||
set_target_properties(${lib_NAME} PROPERTIES OUTPUT_NAME
|
||||
${lib_OUTPUT_NAME})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
@ -280,8 +324,8 @@ macro(draco_add_library)
|
|||
endif()
|
||||
|
||||
if(lib_COMPILE_FLAGS OR DRACO_CXX_FLAGS)
|
||||
target_compile_options(${lib_NAME}
|
||||
PRIVATE ${lib_COMPILE_FLAGS} ${DRACO_CXX_FLAGS})
|
||||
target_compile_options(${lib_NAME} PRIVATE ${lib_COMPILE_FLAGS}
|
||||
${DRACO_CXX_FLAGS})
|
||||
endif()
|
||||
|
||||
if(lib_LINK_FLAGS)
|
||||
|
|
@ -320,11 +364,12 @@ macro(draco_add_library)
|
|||
set_target_properties(${lib_NAME} PROPERTIES PREFIX "")
|
||||
endif()
|
||||
|
||||
# VERSION and SOVERSION as necessary
|
||||
if(NOT lib_TYPE STREQUAL STATIC AND NOT lib_TYPE STREQUAL MODULE)
|
||||
set_target_properties(${lib_NAME} PROPERTIES VERSION ${DRACO_VERSION})
|
||||
if(NOT MSVC)
|
||||
set_target_properties(${lib_NAME} PROPERTIES SOVERSION ${DRACO_SOVERSION})
|
||||
if(NOT EMSCRIPTEN)
|
||||
# VERSION and SOVERSION as necessary
|
||||
if((lib_TYPE STREQUAL BUNDLE OR lib_TYPE STREQUAL SHARED) AND NOT MSVC)
|
||||
set_target_properties(
|
||||
${lib_NAME} PROPERTIES VERSION ${DRACO_SOVERSION}
|
||||
SOVERSION ${DRACO_SOVERSION_MAJOR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
// Copyright 2021 The Draco Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef DRACO_TESTING_DRACO_TEST_CONFIG_H_
|
||||
#define DRACO_TESTING_DRACO_TEST_CONFIG_H_
|
||||
|
||||
|
|
@ -9,5 +23,6 @@
|
|||
|
||||
#define DRACO_TEST_DATA_DIR "${DRACO_TEST_DATA_DIR}"
|
||||
#define DRACO_TEST_TEMP_DIR "${DRACO_TEST_TEMP_DIR}"
|
||||
#define DRACO_TEST_ROOT_DIR "${DRACO_TEST_ROOT_DIR}"
|
||||
|
||||
#endif // DRACO_TESTING_DRACO_TEST_CONFIG_H_
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_TESTS_CMAKE)
|
||||
return()
|
||||
endif()
|
||||
|
|
@ -10,6 +24,13 @@ set(draco_factory_test_sources
|
|||
"${draco_src_root}/io/file_reader_factory_test.cc"
|
||||
"${draco_src_root}/io/file_writer_factory_test.cc")
|
||||
|
||||
list(
|
||||
APPEND draco_test_common_sources
|
||||
"${draco_src_root}/core/draco_test_base.h"
|
||||
"${draco_src_root}/core/draco_test_utils.cc"
|
||||
"${draco_src_root}/core/draco_test_utils.h"
|
||||
"${draco_src_root}/core/status.cc")
|
||||
|
||||
list(
|
||||
APPEND
|
||||
draco_test_sources
|
||||
|
|
@ -30,22 +51,23 @@ list(
|
|||
"${draco_src_root}/compression/point_cloud/point_cloud_kd_tree_encoding_test.cc"
|
||||
"${draco_src_root}/compression/point_cloud/point_cloud_sequential_encoding_test.cc"
|
||||
"${draco_src_root}/core/buffer_bit_coding_test.cc"
|
||||
"${draco_src_root}/core/draco_test_base.h"
|
||||
"${draco_src_root}/core/draco_test_utils.cc"
|
||||
"${draco_src_root}/core/draco_test_utils.h"
|
||||
"${draco_src_root}/core/math_utils_test.cc"
|
||||
"${draco_src_root}/core/quantization_utils_test.cc"
|
||||
"${draco_src_root}/core/status_test.cc"
|
||||
"${draco_src_root}/core/vector_d_test.cc"
|
||||
"${draco_src_root}/io/file_reader_test_common.h"
|
||||
"${draco_src_root}/io/file_utils_test.cc"
|
||||
"${draco_src_root}/io/file_writer_utils_test.cc"
|
||||
"${draco_src_root}/io/stdio_file_reader_test.cc"
|
||||
"${draco_src_root}/io/stdio_file_writer_test.cc"
|
||||
"${draco_src_root}/io/obj_decoder_test.cc"
|
||||
"${draco_src_root}/io/obj_encoder_test.cc"
|
||||
"${draco_src_root}/io/ply_decoder_test.cc"
|
||||
"${draco_src_root}/io/ply_reader_test.cc"
|
||||
"${draco_src_root}/io/stl_decoder_test.cc"
|
||||
"${draco_src_root}/io/stl_encoder_test.cc"
|
||||
"${draco_src_root}/io/point_cloud_io_test.cc"
|
||||
"${draco_src_root}/mesh/corner_table_test.cc"
|
||||
"${draco_src_root}/mesh/mesh_are_equivalent_test.cc"
|
||||
"${draco_src_root}/mesh/mesh_cleanup_test.cc"
|
||||
"${draco_src_root}/mesh/triangle_soup_mesh_builder_test.cc"
|
||||
|
|
@ -54,47 +76,71 @@ list(
|
|||
"${draco_src_root}/point_cloud/point_cloud_builder_test.cc"
|
||||
"${draco_src_root}/point_cloud/point_cloud_test.cc")
|
||||
|
||||
list(APPEND draco_gtest_all
|
||||
"${draco_root}/../googletest/googletest/src/gtest-all.cc")
|
||||
list(APPEND draco_gtest_main
|
||||
"${draco_root}/../googletest/googletest/src/gtest_main.cc")
|
||||
if(DRACO_TRANSCODER_SUPPORTED)
|
||||
list(
|
||||
APPEND draco_test_sources
|
||||
"${draco_src_root}/animation/animation_test.cc"
|
||||
"${draco_src_root}/io/gltf_decoder_test.cc"
|
||||
"${draco_src_root}/io/gltf_encoder_test.cc"
|
||||
"${draco_src_root}/io/gltf_utils_test.cc"
|
||||
"${draco_src_root}/io/gltf_test_helper.cc"
|
||||
"${draco_src_root}/io/gltf_test_helper.h"
|
||||
"${draco_src_root}/io/scene_io_test.cc"
|
||||
"${draco_src_root}/io/texture_io_test.cc"
|
||||
"${draco_src_root}/material/material_library_test.cc"
|
||||
"${draco_src_root}/material/material_test.cc"
|
||||
"${draco_src_root}/metadata/property_table_test.cc"
|
||||
"${draco_src_root}/metadata/structural_metadata_test.cc"
|
||||
"${draco_src_root}/scene/instance_array_test.cc"
|
||||
"${draco_src_root}/scene/light_test.cc"
|
||||
"${draco_src_root}/scene/mesh_group_test.cc"
|
||||
"${draco_src_root}/scene/scene_test.cc"
|
||||
"${draco_src_root}/scene/scene_are_equivalent_test.cc"
|
||||
"${draco_src_root}/scene/scene_utils_test.cc"
|
||||
"${draco_src_root}/scene/trs_matrix_test.cc"
|
||||
"${draco_src_root}/texture/texture_library_test.cc"
|
||||
"${draco_src_root}/texture/texture_map_test.cc"
|
||||
"${draco_src_root}/texture/texture_transform_test.cc")
|
||||
|
||||
endif()
|
||||
|
||||
macro(draco_setup_test_targets)
|
||||
if(DRACO_TESTS)
|
||||
draco_setup_googletest()
|
||||
|
||||
if(NOT (EXISTS ${draco_gtest_all} AND EXISTS ${draco_gtest_main}))
|
||||
message(FATAL "googletest must be a sibling directory of ${draco_root}.")
|
||||
message(FATAL_ERROR "googletest missing, run git submodule update --init")
|
||||
endif()
|
||||
|
||||
list(APPEND draco_test_defines GTEST_HAS_PTHREAD=0)
|
||||
|
||||
draco_add_library(TEST
|
||||
NAME
|
||||
draco_gtest
|
||||
TYPE
|
||||
STATIC
|
||||
SOURCES
|
||||
${draco_gtest_all}
|
||||
DEFINES
|
||||
${draco_defines}
|
||||
${draco_test_defines}
|
||||
INCLUDES
|
||||
${draco_test_include_paths})
|
||||
draco_add_library(
|
||||
TEST
|
||||
NAME draco_test_common
|
||||
TYPE STATIC
|
||||
SOURCES ${draco_test_common_sources}
|
||||
DEFINES ${draco_defines} ${draco_test_defines}
|
||||
INCLUDES ${draco_test_include_paths})
|
||||
|
||||
draco_add_library(TEST
|
||||
NAME
|
||||
draco_gtest_main
|
||||
TYPE
|
||||
STATIC
|
||||
SOURCES
|
||||
${draco_gtest_main}
|
||||
DEFINES
|
||||
${draco_defines}
|
||||
${draco_test_defines}
|
||||
INCLUDES
|
||||
${draco_test_include_paths})
|
||||
draco_add_library(
|
||||
TEST
|
||||
NAME draco_gtest
|
||||
TYPE STATIC
|
||||
SOURCES ${draco_gtest_all}
|
||||
DEFINES ${draco_defines} ${draco_test_defines}
|
||||
INCLUDES ${draco_test_include_paths})
|
||||
|
||||
draco_add_library(
|
||||
TEST
|
||||
NAME draco_gtest_main
|
||||
TYPE STATIC
|
||||
SOURCES ${draco_gtest_main}
|
||||
DEFINES ${draco_defines} ${draco_test_defines}
|
||||
INCLUDES ${draco_test_include_paths})
|
||||
|
||||
set(DRACO_TEST_DATA_DIR "${draco_root}/testdata")
|
||||
set(DRACO_TEST_TEMP_DIR "${draco_build}/draco_test_temp")
|
||||
set(DRACO_TEST_ROOT_DIR "${draco_root}")
|
||||
file(MAKE_DIRECTORY "${DRACO_TEST_TEMP_DIR}")
|
||||
|
||||
# Sets DRACO_TEST_DATA_DIR and DRACO_TEST_TEMP_DIR.
|
||||
|
|
@ -102,32 +148,24 @@ macro(draco_setup_test_targets)
|
|||
"${draco_build}/testing/draco_test_config.h")
|
||||
|
||||
# Create the test targets.
|
||||
draco_add_executable(NAME
|
||||
draco_tests
|
||||
SOURCES
|
||||
${draco_test_sources}
|
||||
DEFINES
|
||||
${draco_defines}
|
||||
${draco_test_defines}
|
||||
INCLUDES
|
||||
${draco_test_include_paths}
|
||||
LIB_DEPS
|
||||
draco_static
|
||||
draco_gtest
|
||||
draco_gtest_main)
|
||||
draco_add_executable(
|
||||
TEST
|
||||
NAME draco_tests
|
||||
SOURCES ${draco_test_sources}
|
||||
DEFINES ${draco_defines} ${draco_test_defines}
|
||||
INCLUDES ${draco_test_include_paths}
|
||||
LIB_DEPS ${draco_dependency} draco_gtest draco_gtest_main
|
||||
draco_test_common)
|
||||
|
||||
draco_add_executable(
|
||||
TEST
|
||||
NAME draco_factory_tests
|
||||
SOURCES ${draco_factory_test_sources}
|
||||
DEFINES ${draco_defines} ${draco_test_defines}
|
||||
INCLUDES ${draco_test_include_paths}
|
||||
LIB_DEPS ${draco_dependency} draco_gtest draco_gtest_main
|
||||
draco_test_common)
|
||||
|
||||
|
||||
draco_add_executable(NAME
|
||||
draco_factory_tests
|
||||
SOURCES
|
||||
${draco_factory_test_sources}
|
||||
DEFINES
|
||||
${draco_defines}
|
||||
${draco_test_defines}
|
||||
INCLUDES
|
||||
${draco_test_include_paths}
|
||||
LIB_DEPS
|
||||
draco_static
|
||||
draco_gtest
|
||||
draco_gtest_main)
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_DRACO_VARIABLES_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_DRACO_VARIABLES_CMAKE_
|
||||
|
|
@ -14,8 +28,7 @@ macro(draco_variable_must_be_directory variable_name)
|
|||
|
||||
if("${${variable_name}}" STREQUAL "")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Empty variable ${variable_name} is required to build draco.")
|
||||
FATAL_ERROR "Empty variable ${variable_name} is required to build draco.")
|
||||
endif()
|
||||
|
||||
if(NOT IS_DIRECTORY "${${variable_name}}")
|
||||
|
|
@ -44,11 +57,13 @@ macro(draco_dump_cmake_flag_variables)
|
|||
list(APPEND flag_variables "CMAKE_CXX_FLAGS_INIT" "CMAKE_CXX_FLAGS"
|
||||
"CMAKE_EXE_LINKER_FLAGS_INIT" "CMAKE_EXE_LINKER_FLAGS")
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
list(APPEND flag_variables "CMAKE_BUILD_TYPE"
|
||||
"CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}_INIT"
|
||||
"CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}"
|
||||
"CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE}_INIT"
|
||||
"CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE}")
|
||||
list(
|
||||
APPEND flag_variables
|
||||
"CMAKE_BUILD_TYPE"
|
||||
"CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}_INIT"
|
||||
"CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}"
|
||||
"CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE}_INIT"
|
||||
"CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
foreach(flag_variable ${flag_variables})
|
||||
message("${flag_variable}:${${flag_variable}}")
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
if(DRACO_CMAKE_SANITIZERS_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(DRACO_CMAKE_SANITIZERS_CMAKE_ 1)
|
||||
|
||||
if(MSVC OR NOT SANITIZE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include("${draco_root}/cmake/compiler_flags.cmake")
|
||||
|
||||
string(TOLOWER ${SANITIZE} SANITIZE)
|
||||
|
||||
# Require the sanitizer requested.
|
||||
require_linker_flag("-fsanitize=${SANITIZE}")
|
||||
require_compiler_flag("-fsanitize=${SANITIZE}" YES)
|
||||
|
||||
# Make callstacks accurate.
|
||||
require_compiler_flag("-fno-omit-frame-pointer -fno-optimize-sibling-calls" YES)
|
||||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_AARCH64_LINUX_GNU_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_TOOLCHAINS_AARCH64_LINUX_GNU_CMAKE_
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ANDROID_NDK_COMMON_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ANDROID_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_TOOLCHAINS_ANDROID_CMAKE_
|
||||
|
|
@ -16,9 +30,9 @@ if(NOT ANDROID_ABI)
|
|||
set(ANDROID_ABI arm64-v8a)
|
||||
endif()
|
||||
|
||||
# Force arm mode for 32-bit targets (instead of the default thumb) to improve
|
||||
# performance.
|
||||
if(NOT ANDROID_ARM_MODE)
|
||||
# Force arm mode for 32-bit arm targets (instead of the default thumb) to
|
||||
# improve performance.
|
||||
if(ANDROID_ABI MATCHES "^armeabi" AND NOT ANDROID_ARM_MODE)
|
||||
set(ANDROID_ARM_MODE arm)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ARM_IOS_COMMON_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
|
|
@ -13,5 +27,3 @@ set(CMAKE_C_COMPILER clang)
|
|||
set(CMAKE_C_COMPILER_ARG1 "-arch ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CMAKE_CXX_COMPILER clang++)
|
||||
set(CMAKE_CXX_COMPILER_ARG1 "-arch ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
# TODO(tomfinegan): Handle bit code embedding.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ARM_LINUX_GNUEABIHF_CMAKE_)
|
||||
return()
|
||||
endif() # DRACO_CMAKE_TOOLCHAINS_ARM_LINUX_GNUEABIHF_CMAKE_
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ARM64_ANDROID_NDK_LIBCPP_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,23 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ARM64_IOS_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(DRACO_CMAKE_TOOLCHAINS_ARM64_IOS_CMAKE_ 1)
|
||||
|
||||
if(XCODE)
|
||||
# TODO(tomfinegan): Handle arm builds in Xcode.
|
||||
message(FATAL_ERROR "This toolchain does not support Xcode.")
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ARM64_LINUX_GCC_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ARMV7_ANDROID_NDK_LIBCPP_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,23 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ARMV7_IOS_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(DRACO_CMAKE_TOOLCHAINS_ARMV7_IOS_CMAKE_ 1)
|
||||
|
||||
if(XCODE)
|
||||
# TODO(tomfinegan): Handle arm builds in Xcode.
|
||||
message(FATAL_ERROR "This toolchain does not support Xcode.")
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ARMV7_LINUX_GCC_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,23 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_ARMV7S_IOS_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(DRACO_CMAKE_TOOLCHAINS_ARMV7S_IOS_CMAKE_ 1)
|
||||
|
||||
if(XCODE)
|
||||
# TODO(tomfinegan): Handle arm builds in Xcode.
|
||||
message(FATAL_ERROR "This toolchain does not support Xcode.")
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,23 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_i386_IOS_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(DRACO_CMAKE_TOOLCHAINS_i386_IOS_CMAKE_ 1)
|
||||
|
||||
if(XCODE)
|
||||
# TODO(tomfinegan): Handle arm builds in Xcode.
|
||||
message(FATAL_ERROR "This toolchain does not support Xcode.")
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_X86_ANDROID_NDK_LIBCPP_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_X86_64_ANDROID_NDK_LIBCPP_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,23 @@
|
|||
# Copyright 2021 The Draco Authors
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
if(DRACO_CMAKE_TOOLCHAINS_X86_64_IOS_CMAKE_)
|
||||
return()
|
||||
endif()
|
||||
set(DRACO_CMAKE_TOOLCHAINS_X86_64_IOS_CMAKE_ 1)
|
||||
|
||||
if(XCODE)
|
||||
# TODO(tomfinegan): Handle arm builds in Xcode.
|
||||
message(FATAL_ERROR "This toolchain does not support Xcode.")
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,79 +0,0 @@
|
|||
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
|
||||
# returns the full path to the dummy source file via the $out_file_path
|
||||
# parameter.
|
||||
function(create_dummy_source_file basename extension out_file_path)
|
||||
set(dummy_source_file "${draco_build_dir}/${basename}.${extension}")
|
||||
file(WRITE "${dummy_source_file}.new"
|
||||
"// Generated file. DO NOT EDIT!\n"
|
||||
"// ${target_name} needs a ${extension} file to force link language, \n"
|
||||
"// or to silence a harmless CMake warning: Ignore me.\n"
|
||||
"void ${target_name}_dummy_function(void) {}\n")
|
||||
|
||||
# Will replace ${dummy_source_file} only if the file content has changed.
|
||||
# This prevents forced Draco rebuilds after CMake runs.
|
||||
configure_file("${dummy_source_file}.new" "${dummy_source_file}")
|
||||
file(REMOVE "${dummy_source_file}.new")
|
||||
|
||||
set(${out_file_path} ${dummy_source_file} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Convenience function for adding a dummy source file to $target_name using
|
||||
# $extension as the file extension. Wraps create_dummy_source_file().
|
||||
function(add_dummy_source_file_to_target target_name extension)
|
||||
create_dummy_source_file("${target_name}" "${extension}" "dummy_source_file")
|
||||
target_sources(${target_name} PRIVATE ${dummy_source_file})
|
||||
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
|
||||
# assigned to the variable. Quotes and semicolon are stripped from the returned
|
||||
# string.
|
||||
function(extract_version_string version_file version_string_out_var)
|
||||
file(STRINGS "${version_file}" draco_version REGEX "kDracoVersion")
|
||||
list(GET draco_version 0 draco_version)
|
||||
string(REPLACE "static const char kDracoVersion[] = " "" draco_version
|
||||
"${draco_version}")
|
||||
string(REPLACE ";" "" draco_version "${draco_version}")
|
||||
string(REPLACE "\"" "" draco_version "${draco_version}")
|
||||
set("${version_string_out_var}" "${draco_version}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Sets CMake compiler launcher to $launcher_name when $launcher_name is found in
|
||||
# $PATH. Warns user about ignoring build flag $launcher_flag when $launcher_name
|
||||
# is not found in $PATH.
|
||||
function(set_compiler_launcher launcher_flag launcher_name)
|
||||
find_program(launcher_path "${launcher_name}")
|
||||
if(launcher_path)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${launcher_path}" PARENT_SCOPE)
|
||||
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.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Terminates CMake execution when $var_name is unset in the environment. Sets
|
||||
# CMake variable to the value of the environment variable when the variable is
|
||||
# present in the environment.
|
||||
macro(require_variable var_name)
|
||||
if("$ENV{${var_name}}" STREQUAL "")
|
||||
message(FATAL_ERROR "${var_name} must be set in environment.")
|
||||
endif()
|
||||
set_variable_if_unset(${var_name} "")
|
||||
endmacro()
|
||||
|
||||
# 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}})
|
||||
elseif(NOT ${var_name})
|
||||
set(${var_name} ${default_value})
|
||||
endif()
|
||||
endmacro()
|
||||
Loading…
Add table
Add a link
Reference in a new issue