initial commit-moved from vulkan_guide
This commit is contained in:
16
third_party/fastgltf/cmake/add_source_directory.cmake
vendored
Normal file
16
third_party/fastgltf/cmake/add_source_directory.cmake
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# This will search for all files with .c, .cpp, .h, .hpp extensions in the given folder directory but no subdirectories and add them as
|
||||
# sources to the target.
|
||||
function(fastgltf_add_source_directory)
|
||||
cmake_parse_arguments(PARAM "" "TARGET;FOLDER" "CONDITIONAL" ${ARGN})
|
||||
|
||||
# Generic C/C++/ObjC file extensions
|
||||
file(GLOB TARGET_SOURCES ${PARAM_FOLDER}/*.c ${PARAM_FOLDER}/*.cpp ${PARAM_FOLDER}/*.cc ${PARAM_FOLDER}/*.cxx ${PARAM_FOLDER}/*.m ${PARAM_FOLDER}/*.mm)
|
||||
file(GLOB TARGET_HEADERS ${PARAM_FOLDER}/*.h ${PARAM_FOLDER}/*.hpp ${PARAM_FOLDER}/*.hh)
|
||||
|
||||
foreach(SOURCE ${TARGET_SOURCES})
|
||||
target_sources(${PARAM_TARGET} PRIVATE ${SOURCE})
|
||||
endforeach()
|
||||
foreach(HEADER ${TARGET_HEADERS})
|
||||
target_sources(${PARAM_TARGET} PRIVATE ${HEADER})
|
||||
endforeach()
|
||||
endfunction()
|
||||
31
third_party/fastgltf/cmake/compiler_flags.cmake
vendored
Normal file
31
third_party/fastgltf/cmake/compiler_flags.cmake
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
macro(fastgltf_compiler_flags TARGET)
|
||||
if (NOT ${TARGET} STREQUAL "" AND TARGET ${TARGET})
|
||||
# Note that simdjson automatically figures out which SIMD intrinsics to use at runtime based on
|
||||
# cpuid, meaning no architecture flags or other compile flags need to be passed.
|
||||
# See https://github.com/simdjson/simdjson/blob/master/doc/implementation-selection.md.
|
||||
if (MSVC)
|
||||
target_compile_options(${TARGET} PRIVATE /EHsc /utf-8 $<$<CONFIG:RELEASE>:/O2 /Ob3 /Ot>)
|
||||
if (MSVC_VERSION GREATER 1929)
|
||||
target_compile_options(${TARGET} PRIVATE /external:W0 /external:anglebrackets)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(${TARGET} PRIVATE $<$<CONFIG:RELEASE>:-O3>)
|
||||
|
||||
# Issue with MinGW: https://github.com/simdjson/simdjson/issues/1963
|
||||
target_compile_options(${TARGET} PUBLIC $<$<CONFIG:DEBUG>:-Og>)
|
||||
|
||||
# https://github.com/simdjson/simdjson/blob/master/doc/basics.md#performance-tips
|
||||
target_compile_options(${TARGET} PRIVATE $<$<CONFIG:RELEASE>:-DNDEBUG>)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(fastgltf_enable_debug_inlining TARGET)
|
||||
if (NOT ${TARGET} STREQUAL "" AND TARGET ${TARGET})
|
||||
if (MSVC)
|
||||
target_compile_options(${TARGET} PRIVATE $<$<CONFIG:DEBUG>:/Ob2>)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(${TARGET} PRIVATE $<$<CONFIG:DEBUG>:-finline-functions>)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
Reference in New Issue
Block a user