Updated ozz-animation to version 0.14.1 @35b2efd4

This commit is contained in:
Martin Felis
2023-03-26 13:28:12 +02:00
parent bf3189ff49
commit 15871f349c
194 changed files with 3495 additions and 1957 deletions
@@ -30,33 +30,34 @@ set(cxx_all_flags
# Cross compiler compilation flags
# Requires C++11
set(CMAKE_CXX_STANDARD 11)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Simd math force ref
if(ozz_build_simd_ref)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS OZZ_BUILD_SIMD_REF)
add_compile_definitions(OZZ_BUILD_SIMD_REF)
endif()
# Disables crt secure warnings
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
#--------------------------------------
# Modify default MSVC compilation flags
if(MSVC)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
#---------------------------
# For the common build flags
# Disables crt secure warnings
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
# Adds support for multiple processes builds
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "/MP")
add_compile_options(/MP)
# Set the warning level to W4
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "/W4")
add_compile_options(/W4)
# Set warning as error
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "/WX")
add_compile_options(/WX)
# Select whether to use the DLL version or the static library version of the Visual C++ runtime library.
foreach(flag ${cxx_all_flags})
@@ -68,40 +69,35 @@ if(MSVC)
endforeach()
#--------------------------------------
# else consider the compiler as GCC compatible
# Modify default GCC compilation flags
# else consider the compiler as GCC compatible (inc clang)
else()
# Set the warning level to Wall
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-Wall")
add_compile_options(-Wall)
# Enable extra level of warning
#set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-Wextra")
#add_compile_options(-Wextra)
# Set warning as error
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-Werror")
add_compile_options(-Werror)
# Disables warning: ignored-attributes reports issue when using _m128 as template argument
# ignored-attributes reports issue when using _m128 as template argument
check_cxx_compiler_flag("-Wignored-attributes" W_IGNORED_ATTRIBUTES)
if(W_IGNORED_ATTRIBUTES)
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-Wno-ignored-attributes")
add_compile_options(-Wno-ignored-attributes)
endif()
# Disables c98 retrocompatibility warnings
check_cxx_compiler_flag("-Wc++98-compat-pedantic" W_98_COMPAT_PEDANTIC)
if(W_98_COMPAT_PEDANTIC)
add_compile_options(-Wno-c++98-compat-pedantic)
endif()
# Enables warning: sign comparison warnings
check_cxx_compiler_flag("-Wsign-compare" W_SIGN_COMPARE)
if(W_SIGN_COMPARE)
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-Wsign-compare")
endif()
# Check some more options availability for the targeted compiler
# Check some options availibity for the targetted compiler
check_cxx_compiler_flag("-Wnull-dereference" W_NULL_DEREFERENCE)
check_cxx_compiler_flag("-Wpragma-pack" W_PRAGMA_PACK)
# Enables debug glibcxx if NDebug isn't defined, not supported by APPLE
if(NOT APPLE)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:_GLIBCXX_DEBUG>")
endif()
#----------------------
# Sets emscripten output
if(EMSCRIPTEN)
@@ -157,4 +153,4 @@ if(ozz_build_postfix)
set(CMAKE_RELEASE_POSTFIX "_r")
set(CMAKE_MINSIZEREL_POSTFIX "_rs")
set(CMAKE_RELWITHDEBINFO_POSTFIX "_rd")
endif()
endif()
+8 -1
View File
@@ -9,11 +9,18 @@ function(fuse_target _target_name)
# Get all target sources.
get_property(target_source_files TARGET ${_target_name} PROPERTY SOURCES)
foreach(src_file ${target_source_files})
if(IS_ABSOLUTE ${src_file})
file(RELATIVE_PATH src_file ${CMAKE_CURRENT_LIST_DIR} ${src_file})
endif()
list(APPEND relative_target_source_files ${src_file})
endforeach()
add_custom_command(
OUTPUT ${output_file}
DEPENDS ${target_source_files}
${PROJECT_SOURCE_DIR}/build-utils/cmake/fuse_target_script.cmake
COMMAND ${CMAKE_COMMAND} -Dozz_fuse_output_file="${output_file}" -Dozz_target_source_files="${target_source_files}" -Dozz_fuse_target_dir="${CMAKE_CURRENT_LIST_DIR}" -Dozz_fuse_src_dir="${PROJECT_SOURCE_DIR}" -P "${PROJECT_SOURCE_DIR}/build-utils/cmake/fuse_target_script.cmake")
COMMAND ${CMAKE_COMMAND} -Dozz_fuse_output_file="${output_file}" -Dozz_target_source_files="${relative_target_source_files}" -Dozz_fuse_target_dir="${CMAKE_CURRENT_LIST_DIR}" -Dozz_fuse_src_dir="${PROJECT_SOURCE_DIR}" -P "${PROJECT_SOURCE_DIR}/build-utils/cmake/fuse_target_script.cmake")
add_custom_target(BUILD_FUSE_${_target_name} ALL DEPENDS ${output_file})
set_target_properties(BUILD_FUSE_${_target_name} PROPERTIES FOLDER "ozz/fuse")
@@ -2,18 +2,25 @@
#----------------------------------------------------------
# Start with new content
string(CONCAT output_content "" "// This file is autogenerated. Do not modify it.\n\n")
string(CONCAT output_content "" "// This file is autogenerated. Any modification might be lost.\n\n")
# Patches arguments so that cmake interprate it as a list.
string (REPLACE " " ";" ozz_target_source_files "${ozz_target_source_files}")
# Patches arguments so that cmake take them as a list.
separate_arguments(ozz_target_source_files)
string(REPLACE "\\ " " " ozz_fuse_target_dir "${ozz_fuse_target_dir}")
string(REPLACE "\\ " " " ozz_fuse_src_dir "${ozz_fuse_src_dir}")
string(REPLACE "\\ " " " ozz_fuse_output_file "${ozz_fuse_output_file}")
# Concat all sources to the output.
foreach(src_file ${ozz_target_source_files})
get_filename_component(src_file_ext ${src_file} EXT)
get_filename_component(absolute_src_file ${src_file} ABSOLUTE BASE_DIR ${ozz_fuse_target_dir})
get_filename_component(src_file_ext ${absolute_src_file} EXT)
# Handle source files.
if(src_file_ext STREQUAL ".cc")
file(READ "${ozz_fuse_target_dir}/${src_file}" src_file_content)
file(READ "${absolute_src_file}" src_file_content)
string(CONCAT output_content "${output_content}" "// Including ${src_file} file.\n\n")
string(CONCAT output_content "${output_content}" "${src_file_content}\n")
@@ -28,10 +35,12 @@ foreach(internal_include_line ${internal_include_lines})
STRING(REGEX REPLACE "#include \"([^\"]+)\"" "\\1" internal_include_file "${internal_include_line}" )
file(READ "${ozz_fuse_src_dir}/src/${internal_include_file}" internal_src_file_content)
get_filename_component(internal_src_file src/${internal_include_file} ABSOLUTE BASE_DIR ${ozz_fuse_src_dir})
file(READ "${internal_src_file}" internal_src_file_content)
string(REPLACE "${internal_include_line}" "\n// Includes internal include file ${internal_include_file}\n\n${internal_src_file_content}" output_content "${output_content}")
endforeach()
# Output new file
file(WRITE "${ozz_fuse_output_file}" "${output_content}")
+109 -51
View File
@@ -9,9 +9,15 @@
# FBX_INCLUDE_DIRS - The Fbx SDK include directories
# FBX_LIBRARIES - The libraries needed to use Fbx SDK
# FBX_LIBRARIES_DEBUG - The libraries needed to use debug Fbx SDK
# FBX_SHARED_LIBRARIES - The shared library file (dll, so) to use Fbx
# FBX_SHARED_LIBRARIES_DEBUG - The shared library file (dll, so) to use debug
# Fbx SDK
#
# A cmake target named fbx::sdk is also created. Adding this target to your
# project via target_link_libraries will setup everything automatically.
#
# It accepts the following variables as input:
#
# FBX_SHARED - Optional. Select whether to use the shared version fbx sdk.
# FBX_MSVC_RT_DLL - Optional. Select whether to use the DLL version or the
# static library version of the Visual C++ runtime library.
# Default is ON (aka, DLL version: /MD).
@@ -52,7 +58,7 @@
###############################################################################
# Generic library search function definition
###############################################################################
function(FindFbxLibrariesGeneric _FBX_ROOT_DIR _OUT_FBX_LIBRARIES _OUT_FBX_LIBRARIES_DEBUG)
function(FindFbxLibrariesGeneric _FBX_ROOT_DIR _OUT_FBX_LIBRARIES _OUT_FBX_LIBRARIES_DEBUG _OUT_FBX_SHARED_LIBRARIES _OUT_FBX_SHARED_LIBRARIES_DEBUG)
# Directory structure depends on the platform:
# - Windows: \lib\<compiler_version>\<processor_type>\<build_mode>
# - Mac OSX: \lib\<compiler_version>\ub\<processor_type>\<build_mode>
@@ -61,7 +67,9 @@ function(FindFbxLibrariesGeneric _FBX_ROOT_DIR _OUT_FBX_LIBRARIES _OUT_FBX_LIBRA
# Figures out matching compiler/os directory.
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.20)
set(FBX_CP_PATH "vs2019")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
set(FBX_CP_PATH "vs2017")
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
set(FBX_CP_PATH "vs2015")
@@ -90,19 +98,25 @@ function(FindFbxLibrariesGeneric _FBX_ROOT_DIR _OUT_FBX_LIBRARIES _OUT_FBX_LIBRA
endif()
endif()
# Set libraries names to search, sorted by preference.
set(FBX_SEARCH_LIB_NAMES fbxsdk-static.a libfbxsdk.a fbxsdk.a)
# Select whether to use the DLL version or the static library version of the Visual C++ runtime library.
# Default is "md", aka use the multithread DLL version of the run-time library.
if (NOT DEFINED FBX_MSVC_RT_DLL OR FBX_MSVC_RT_DLL)
set(FBX_SEARCH_LIB_NAMES ${FBX_SEARCH_LIB_NAMES} libfbxsdk-md.lib)
# Select whether to use the DLL version or the static library version of fbx sdk.
if (FBX_SHARED)
# Dynamic libraries
set(FBX_SEARCH_LIB_NAMES ${FBX_SEARCH_LIB_NAMES} libfbxsdk.lib libfbxsdk.dylib libfbxsdk.so)
else()
set(FBX_SEARCH_LIB_NAMES ${FBX_SEARCH_LIB_NAMES} libfbxsdk-mt.lib)
endif()
# static library names
set(FBX_SEARCH_LIB_NAMES ${FBX_SEARCH_LIB_NAMES} libfbxsdk.a libfbxsdk-static.a)
# Select whether to use the DLL version or the static library version of the Visual C++ runtime library.
# Default is "md", aka use the multithread DLL version of the run-time library.
if (NOT DEFINED FBX_MSVC_RT_DLL OR FBX_MSVC_RT_DLL)
set(FBX_SEARCH_LIB_NAMES ${FBX_SEARCH_LIB_NAMES} libfbxsdk-md.lib)
else()
set(FBX_SEARCH_LIB_NAMES ${FBX_SEARCH_LIB_NAMES} libfbxsdk-mt.lib)
endif()
endif()
# Set search path.
set(FBX_SEARCH_LIB_PATH "${_FBX_ROOT_DIR}/lib/${FBX_CP_PATH}/${FBX_PROCESSOR_PATH}")
set(FBX_SEARCH_LIB_PATH "${_FBX_ROOT_DIR}lib/${FBX_CP_PATH}/${FBX_PROCESSOR_PATH}")
find_library(FBX_LIB
${FBX_SEARCH_LIB_NAMES}
@@ -114,21 +128,42 @@ function(FindFbxLibrariesGeneric _FBX_ROOT_DIR _OUT_FBX_LIBRARIES _OUT_FBX_LIBRA
${FBX_SEARCH_LIB_NAMES}
HINTS "${FBX_SEARCH_LIB_PATH}/debug/")
if(UNIX)
if(APPLE) # APPLE requires to link with Carbon framework
find_library(CARBON_FRAMEWORK Carbon)
list(APPEND FBX_LIB ${CARBON_FRAMEWORK})
list(APPEND FBX_LIB_DEBUG ${CARBON_FRAMEWORK})
else()
find_package(Threads)
list(APPEND FBX_LIB ${CMAKE_THREAD_LIBS_INIT} dl)
list(APPEND FBX_LIB_DEBUG ${CMAKE_THREAD_LIBS_INIT} dl)
endif()
# Looks for shared libraries
if (FBX_SHARED)
set(FBX_SEARCH_SHARED_LIB_NAMES libfbxsdk.dll libfbxsdk.so libfbxsdk.dylib)
find_file(FBX_SHARED_LIB
${FBX_SEARCH_SHARED_LIB_NAMES}
HINTS "${FBX_SEARCH_LIB_PATH}/release/")
find_file(FBX_SHARED_LIB_DEBUG
${FBX_SEARCH_SHARED_LIB_NAMES}
HINTS "${FBX_SEARCH_LIB_PATH}/debug/")
set(${_OUT_FBX_SHARED_LIBRARIES} ${FBX_SHARED_LIB} PARENT_SCOPE)
set(${_OUT_FBX_SHARED_LIBRARIES_DEBUG} ${FBX_SHARED_LIB_DEBUG} PARENT_SCOPE)
endif()
# Create a target for a convenient use of the sdk with cmake
if(FBX_SHARED)
add_library(fbx::sdk SHARED IMPORTED GLOBAL)
set_property(TARGET fbx::sdk PROPERTY IMPORTED_LOCATION ${FBX_SHARED_LIB})
set_property(TARGET fbx::sdk PROPERTY IMPORTED_LOCATION_DEBUG ${FBX_SHARED_LIB_DEBUG})
set_property(TARGET fbx::sdk PROPERTY IMPORTED_IMPLIB ${FBX_LIB})
set_property(TARGET fbx::sdk PROPERTY IMPORTED_IMPLIB_DEBUG ${FBX_LIB_DEBUG})
target_compile_definitions(fbx::sdk INTERFACE FBXSDK_SHARED)
else()
add_library(fbx::sdk STATIC IMPORTED GLOBAL)
set_property(TARGET fbx::sdk PROPERTY IMPORTED_LOCATION ${FBX_LIB})
set_property(TARGET fbx::sdk PROPERTY IMPORTED_LOCATION_DEBUG ${FBX_LIB_DEBUG})
endif()
target_include_directories(fbx::sdk INTERFACE "${_FBX_ROOT_DIR}include/")
target_compile_options(fbx::sdk
INTERFACE $<$<BOOL:${W_NULL_DEREFERENCE}>:-Wno-null-dereference>
INTERFACE $<$<BOOL:${W_PRAGMA_PACK}>:-Wno-pragma-pack>)
FindFbxVersion(${FBX_ROOT_DIR} PATH_VERSION)
# 2019 SDK needs to link against bundled libxml and zlib
# 2019+ non-DLL SDK needs to link against bundled libxml and zlib
if(PATH_VERSION GREATER_EQUAL "2019.1")
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
set(ADDITIONAL_LIB_SEARCH_PATH_RELEASE "${FBX_SEARCH_LIB_PATH}/release/")
@@ -150,48 +185,71 @@ function(FindFbxLibrariesGeneric _FBX_ROOT_DIR _OUT_FBX_LIBRARIES _OUT_FBX_LIBRA
find_library(XML_LIB
${XML_SEARCH_LIB_NAMES}
HINTS ${ADDITIONAL_LIB_SEARCH_PATH_RELEASE})
find_library(Z_LIB
${Z_SEARCH_LIB_NAMES}
HINTS ${ADDITIONAL_LIB_SEARCH_PATH_RELEASE})
# Searches debug version also
find_library(XML_LIB_DEBUG
${XML_SEARCH_LIB_NAMES}
HINTS ${ADDITIONAL_LIB_SEARCH_PATH_DEBUG})
find_library(Z_LIB_DEBUG
${Z_SEARCH_LIB_NAMES}
HINTS ${ADDITIONAL_LIB_SEARCH_PATH_DEBUG})
# for whatever reason on apple it will need iconv as well?!
if(APPLE)
find_library(ICONV_LIB
iconv)
# no special debug search here as mac only anyway
if(NOT ICONV_LIB)
message(WARNING "FBX found but required iconv was not found!")
endif()
list(APPEND FBX_LIB ${ICONV_LIB})
list(APPEND FBX_LIB_DEBUG ${ICONV_LIB})
endif()
if(NOT XML_LIB)
if(XML_LIB AND XML_LIB_DEBUG)
target_link_libraries(fbx::sdk INTERFACE optimized ${XML_LIB})
target_link_libraries(fbx::sdk INTERFACE debug ${XML_LIB_DEBUG})
else()
message(WARNING "FBX found but required libxml2 was not found!")
endif()
if(NOT Z_LIB)
find_library(Z_LIB
${Z_SEARCH_LIB_NAMES}
HINTS ${ADDITIONAL_LIB_SEARCH_PATH_RELEASE})
find_library(Z_LIB_DEBUG
${Z_SEARCH_LIB_NAMES}
HINTS ${ADDITIONAL_LIB_SEARCH_PATH_DEBUG})
if(Z_LIB AND Z_LIB_DEBUG)
target_link_libraries(fbx::sdk INTERFACE optimized ${Z_LIB})
target_link_libraries(fbx::sdk INTERFACE debug ${Z_LIB_DEBUG})
else()
message(WARNING "FBX found but required zlib was not found!")
endif()
list(APPEND FBX_LIB ${XML_LIB} ${Z_LIB})
list(APPEND FBX_LIB_DEBUG ${XML_LIB_DEBUG} ${Z_LIB_DEBUG})
endif()
# Other dependencies.
if(APPLE)
find_library(ICONV_LIB iconv)
if(ICONV_LIB)
target_link_libraries(fbx::sdk INTERFACE ${ICONV_LIB})
list(APPEND FBX_LIB ${ICONV_LIB})
list(APPEND FBX_LIB_DEBUG ${ICONV_LIB})
else()
message(WARNING "FBX found but required iconv was not found!")
endif()
find_library(CARBON_FRAMEWORK Carbon)
if(CARBON_FRAMEWORK)
target_link_libraries(fbx::sdk INTERFACE ${CARBON_FRAMEWORK})
list(APPEND FBX_LIB ${CARBON_FRAMEWORK})
list(APPEND FBX_LIB_DEBUG ${CARBON_FRAMEWORK})
else()
message(WARNING "FBX found but required Carbon was not found!")
endif()
endif()
if(UNIX)
find_package(Threads)
target_link_libraries(fbx::sdk INTERFACE ${CMAKE_THREAD_LIBS_INIT} dl)
list(APPEND FBX_LIB ${CMAKE_THREAD_LIBS_INIT} dl)
list(APPEND FBX_LIB_DEBUG ${CMAKE_THREAD_LIBS_INIT} dl)
endif()
set(${_OUT_FBX_LIBRARIES} ${FBX_LIB} PARENT_SCOPE)
set(${_OUT_FBX_LIBRARIES_DEBUG} ${FBX_LIB_DEBUG} PARENT_SCOPE)
else()
message ("A Fbx SDK was found, but doesn't match your compiler settings.")
message("A Fbx installation was found, but couldn't be matched with current compiler settings.")
endif()
# Deduce fbx sdk version
endfunction()
###############################################################################
@@ -257,7 +315,7 @@ if(FBX_INCLUDE_DIR)
set(FBX_INCLUDE_DIRS "${FBX_INCLUDE_DIR}/include")
# Searches libraries according to the current compiler
FindFbxLibrariesGeneric(${FBX_ROOT_DIR} FBX_LIBRARIES FBX_LIBRARIES_DEBUG)
FindFbxLibrariesGeneric(${FBX_ROOT_DIR} FBX_LIBRARIES FBX_LIBRARIES_DEBUG FBX_SHARED_LIBRARIES FBX_SHARED_LIBRARIES_DEBUG)
endif()
# Handles find_package arguments and set FBX_FOUND to TRUE if all listed variables and version are valid.
@@ -0,0 +1,48 @@
# Finds target dependencies on shared libraries so they can
# be copied next to the exe.
#----------------------------------------------------------
# Finds all target dependencies
function(get_link_libraries OUTPUT_LIST _TARGET)
get_target_property(LIBS ${_TARGET} LINK_LIBRARIES)
list(APPEND VISITED_TARGETS ${TARGET})
set(LIB_FILES "")
foreach(LIB ${LIBS})
if (TARGET ${LIB})
list(FIND VISITED_TARGETS ${LIB} VISITED)
if (${VISITED} EQUAL -1)
get_link_libraries(LINK_LIBS ${LIB})
list(APPEND LIB_FILES ${LIB} ${LINK_LIBS})
endif()
endif()
endforeach()
set(VISITED_TARGETS ${VISITED_TARGETS} PARENT_SCOPE)
set(${OUTPUT_LIST} ${LIB_FILES} PARENT_SCOPE)
endfunction()
# Copy dependent shared libraries next to executable target
function(target_copy_shared_libraries _TARGET)
get_link_libraries(LINKED_TARGETS ${_TARGET})
foreach(LINKED_TARGET ${LINKED_TARGETS})
get_target_property(TARGET_TYPE ${LINKED_TARGET} TYPE)
if(TARGET_TYPE STREQUAL "SHARED_LIBRARY")
list(APPEND DLL_TARGETS "$<TARGET_FILE:${LINKED_TARGET}>")
endif()
endforeach()
if(DLL_TARGETS)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_TARGET}_dll_copy"
DEPENDS ${DLL_TARGETS}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DLL_TARGETS} "./"
COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/${_TARGET}_dll_copy"
VERBATIM)
# This allows to create a dependency with the command above, so command is executed again when target is built AND a DLL changed
target_sources(${_TARGET} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/${_TARGET}_dll_copy")
endif()
endfunction()