mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
CMake: Add support for building against FCollada
This commit is contained in:
parent
3a9353c0ca
commit
b4a532f1d0
80
cmake/modules/FindFCollada.cmake
Normal file
80
cmake/modules/FindFCollada.cmake
Normal file
@ -0,0 +1,80 @@
|
||||
# Filename: FindFCollada.cmake
|
||||
# Author: CFSworks (17 Mar, 2019)
|
||||
#
|
||||
# Usage:
|
||||
# find_package(FCollada [REQUIRED] [QUIET])
|
||||
#
|
||||
# Once done this will define:
|
||||
# FCOLLADA_FOUND - system has FCollada
|
||||
# FCOLLADA_INCLUDE_DIR - the FCollada include directory
|
||||
#
|
||||
# FCOLLADA_RELEASE_LIBRARY - the filepath of the FCollada release library
|
||||
# FCOLLADA_DEBUG_LIBRARY - the filepath of the FCollada debug library
|
||||
#
|
||||
# FCollada::FCollada - The recommended FCollada library to link against
|
||||
#
|
||||
|
||||
# Find the FCollada include files
|
||||
find_path(FCOLLADA_INCLUDE_DIR "FCollada.h" PATH_SUFFIXES "FCollada")
|
||||
|
||||
# Find the library built for release
|
||||
find_library(FCOLLADA_RELEASE_LIBRARY
|
||||
NAMES "FCollada" "libFCollada"
|
||||
"FColladaS" "libFColladaS"
|
||||
"FColladaU" "libFColladaU"
|
||||
"FColladaSU" "libFColladaSU"
|
||||
)
|
||||
|
||||
# Find the library built for debug
|
||||
find_library(FCOLLADA_DEBUG_LIBRARY
|
||||
NAMES "FColladaD" "libFColladaD"
|
||||
"FColladaSD" "libFColladaSD"
|
||||
"FColladaUD" "libFColladaUD"
|
||||
"FColladaSUD" "libFColladaSUD"
|
||||
)
|
||||
|
||||
mark_as_advanced(FCOLLADA_INCLUDE_DIR)
|
||||
mark_as_advanced(FCOLLADA_RELEASE_LIBRARY)
|
||||
mark_as_advanced(FCOLLADA_DEBUG_LIBRARY)
|
||||
|
||||
set(_defines)
|
||||
if(FCOLLADA_RELEASE_LIBRARY MATCHES "FCollada[^/]*U" OR
|
||||
FCOLLADA_DEBUG_LIBRARY MATCHES "FCollada[^/]*U")
|
||||
list(APPEND _defines "UNICODE")
|
||||
endif()
|
||||
if(NOT MSVC AND
|
||||
NOT FCOLLADA_RELEASE_LIBRARY MATCHES "FCollada[^/]*S" AND
|
||||
NOT FCOLLADA_DEBUG_LIBRARY MATCHES "FCollada[^/]*S")
|
||||
list(APPEND _defines "FCOLLADA_DLL")
|
||||
endif()
|
||||
|
||||
foreach(_config RELEASE DEBUG)
|
||||
# Make sure we have lib/includes for this config
|
||||
if(NOT FCOLLADA_${_config}_LIBRARY OR NOT FCOLLADA_INCLUDE_DIR)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
if(NOT _HAS_FCOLLADA_LIBRARY)
|
||||
set(_HAS_FCOLLADA_LIBRARY ON)
|
||||
add_library(FCollada::FCollada UNKNOWN IMPORTED GLOBAL)
|
||||
|
||||
set_target_properties(FCollada::FCollada PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "${_defines}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FCOLLADA_INCLUDE_DIR}")
|
||||
|
||||
endif()
|
||||
|
||||
set_property(TARGET FCollada::FCollada
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS "${_config}")
|
||||
|
||||
set_target_properties(FCollada::FCollada PROPERTIES
|
||||
IMPORTED_LOCATION_${_config} "${FCOLLADA_${_config}_LIBRARY}")
|
||||
|
||||
endforeach(_config)
|
||||
unset(_config)
|
||||
unset(_defines)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(FCollada DEFAULT_MSG FCOLLADA_INCLUDE_DIR _HAS_FCOLLADA_LIBRARY)
|
||||
|
||||
unset(_HAS_FCOLLADA_LIBRARY)
|
@ -171,6 +171,13 @@ package_option(ASSIMP
|
||||
"Build pandatool with support for loading 3D assets supported by Assimp.")
|
||||
package_status(ASSIMP "Assimp")
|
||||
|
||||
# FCollada
|
||||
find_package(FCollada QUIET)
|
||||
package_option(FCOLLADA
|
||||
"Build pandatool with support for loading Collada files using FCollada."
|
||||
IMPORTED_AS FCollada::FCollada)
|
||||
package_status(FCOLLADA "FCollada")
|
||||
|
||||
|
||||
#
|
||||
# ------------ Math libraries ------------
|
||||
|
@ -6,6 +6,8 @@ endif()
|
||||
add_subdirectory(src/assimp)
|
||||
add_subdirectory(src/bam)
|
||||
add_subdirectory(src/converter)
|
||||
add_subdirectory(src/daeegg)
|
||||
add_subdirectory(src/daeprogs)
|
||||
add_subdirectory(src/dxf)
|
||||
add_subdirectory(src/dxfegg)
|
||||
add_subdirectory(src/dxfprogs)
|
||||
|
26
pandatool/src/daeegg/CMakeLists.txt
Normal file
26
pandatool/src/daeegg/CMakeLists.txt
Normal file
@ -0,0 +1,26 @@
|
||||
if(NOT HAVE_EGG OR NOT HAVE_FCOLLADA)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(P3DAEEGG_HEADERS
|
||||
config_daeegg.h
|
||||
daeCharacter.h
|
||||
daeMaterials.h
|
||||
daeToEggConverter.h
|
||||
fcollada_utils.h
|
||||
pre_fcollada_include.h
|
||||
)
|
||||
|
||||
set(P3DAEEGG_SOURCES
|
||||
config_daeegg.cxx
|
||||
daeCharacter.cxx
|
||||
daeMaterials.cxx
|
||||
daeToEggConverter.cxx
|
||||
)
|
||||
|
||||
add_library(p3daeegg STATIC ${P3DAEEGG_HEADERS} ${P3DAEEGG_SOURCES})
|
||||
target_link_libraries(p3daeegg p3eggbase
|
||||
PKG::FCOLLADA)
|
||||
|
||||
# This is only needed for binaries in the pandatool package. It is not useful
|
||||
# for user applications, so it is not installed.
|
11
pandatool/src/daeprogs/CMakeLists.txt
Normal file
11
pandatool/src/daeprogs/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
if(HAVE_EGG AND HAVE_FCOLLADA)
|
||||
|
||||
add_executable(egg2dae eggToDAE.cxx eggToDAE.h)
|
||||
target_link_libraries(egg2dae p3daeegg p3eggbase p3progbase)
|
||||
install(TARGETS egg2dae EXPORT Tools COMPONENT Tools DESTINATION bin)
|
||||
|
||||
add_executable(dae2egg daeToEgg.cxx daeToEgg.h)
|
||||
target_link_libraries(dae2egg p3daeegg p3eggbase p3progbase)
|
||||
install(TARGETS dae2egg EXPORT Tools COMPONENT Tools DESTINATION bin)
|
||||
|
||||
endif()
|
@ -19,4 +19,8 @@ target_link_libraries(p3ptloader PRIVATE
|
||||
p3dxfegg p3fltegg p3lwoegg p3objegg p3vrmlegg p3xfileegg
|
||||
p3converter)
|
||||
|
||||
if(HAVE_FCOLLADA)
|
||||
target_link_libraries(p3ptloader PRIVATE p3daeegg)
|
||||
endif()
|
||||
|
||||
install(TARGETS p3ptloader EXPORT Tools COMPONENT Tools DESTINATION ${MODULE_DESTINATION})
|
||||
|
Loading…
x
Reference in New Issue
Block a user