mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
Findnlohmann_json.cmake
This commit is contained in:
+4
-22
@@ -213,28 +213,10 @@ if(BUILD_IFCGEOM AND WITH_OPENCASCADE)
|
|||||||
list(APPEND GEOMETRY_KERNELS opencascade)
|
list(APPEND GEOMETRY_KERNELS opencascade)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(GLTF_LIBRARIES "")
|
||||||
if(GLTF_SUPPORT)
|
if(GLTF_SUPPORT)
|
||||||
UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR)
|
find_package(nlohmann_json REQUIRED)
|
||||||
if(NOT JSON_INCLUDE_DIR)
|
set(GLTF_LIBRARIES nlohmann_json::nlohmann_json)
|
||||||
find_package(nlohmann_json CONFIG)
|
|
||||||
if(nlohmann_json_DIR)
|
|
||||||
link_libraries(nlohmann_json::nlohmann_json)
|
|
||||||
else()
|
|
||||||
message(STATUS "Unable to find nlohmann_json package, trying to find it as a header-only library.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT nlohmann_json_DIR)
|
|
||||||
find_path(json_header_path "nlohmann/json.hpp" HINTS ${JSON_INCLUDE_DIR})
|
|
||||||
set(JSON_INCLUDE_DIR ${json_header_path})
|
|
||||||
|
|
||||||
if(json_header_path)
|
|
||||||
message(STATUS "JSON for Modern C++ header file found in '${JSON_INCLUDE_DIR}'.")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Unable to find JSON for Modern C++ header file / package, aborting")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_definitions(-DWITH_GLTF)
|
add_definitions(-DWITH_GLTF)
|
||||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_GLTF)
|
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_GLTF)
|
||||||
endif()
|
endif()
|
||||||
@@ -449,7 +431,7 @@ else()
|
|||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
|
||||||
include_directories(${OPENCOLLADA_INCLUDE_DIRS}
|
include_directories(${OPENCOLLADA_INCLUDE_DIRS}
|
||||||
${Boost_INCLUDE_DIRS} ${JSON_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}
|
${Boost_INCLUDE_DIRS} ${HDF5_INCLUDE_DIR}
|
||||||
${USD_INCLUDE_DIR}
|
${USD_INCLUDE_DIR}
|
||||||
${TBB_INCLUDE_DIR}
|
${TBB_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#
|
||||||
|
# Input variables:
|
||||||
|
# - `JSON_INCLUDE_DIR`
|
||||||
|
# If input variables are not specified, try to find nlohmann_json config.
|
||||||
|
# Input variables could also be provided as environment variables.
|
||||||
|
#
|
||||||
|
# Output targets:
|
||||||
|
# - `nlohmann_json::nlohmann_json`
|
||||||
|
|
||||||
|
UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(NOT JSON_INCLUDE_DIR)
|
||||||
|
find_package(nlohmann_json CONFIG)
|
||||||
|
if(nlohmann_json_DIR)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(json_header_path "nlohmann/json.hpp" HINTS "${JSON_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
if(json_header_path)
|
||||||
|
message(STATUS "JSON for Modern C++ header file found in '${json_header_path}'.")
|
||||||
|
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
|
||||||
|
target_include_directories(nlohmann_json::nlohmann_json INTERFACE ${json_header_path})
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(FATAL_ERROR "Unable to find JSON for Modern C++ header file / package, aborting")
|
||||||
@@ -13,7 +13,7 @@ target_link_libraries(IfcConvert
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
IfcGeom IfcParse Serializers
|
IfcGeom IfcParse Serializers
|
||||||
${OpenCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${HDF5_LIBRARIES} ${USD_LIBRARIES}
|
${OpenCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${HDF5_LIBRARIES} ${USD_LIBRARIES}
|
||||||
${CGAL_LIBRARIES}
|
${CGAL_LIBRARIES} ${GLTF_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS IfcConvert)
|
install(TARGETS IfcConvert)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ endif()
|
|||||||
|
|
||||||
target_link_libraries(Serializers
|
target_link_libraries(Serializers
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${SERIALIZER_SCHEMA_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${USD_LIBRARIES}
|
${SERIALIZER_SCHEMA_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${USD_LIBRARIES} ${GLTF_LIBRARIES}
|
||||||
IfcGeom ${OpenCASCADE_LIBRARIES} ${kernel_libraries} IfcParse
|
IfcGeom ${OpenCASCADE_LIBRARIES} ${kernel_libraries} IfcParse
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ foreach(schema ${SCHEMA_VERSIONS})
|
|||||||
add_library(Serializers_ifc${schema} OBJECT ${SERIALIZERS_S_FILES})
|
add_library(Serializers_ifc${schema} OBJECT ${SERIALIZERS_S_FILES})
|
||||||
set(SERIALIZER_SCHEMA_LIBRARIES ${SERIALIZER_SCHEMA_LIBRARIES} Serializers_ifc${schema})
|
set(SERIALIZER_SCHEMA_LIBRARIES ${SERIALIZER_SCHEMA_LIBRARIES} Serializers_ifc${schema})
|
||||||
set_target_properties(Serializers_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
|
set_target_properties(Serializers_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
|
||||||
if(WASM_BUILD)
|
target_link_libraries(Serializers_ifc${schema} ${HDF5_LIBRARIES} ${GLTF_LIBRARIES})
|
||||||
target_link_libraries(Serializers_ifc${schema} ${HDF5_LIBRARIES})
|
if(NOT WASM_BUILD)
|
||||||
else()
|
target_link_libraries(Serializers_ifc${schema} IfcGeom ${OpenCASCADE_LIBRARIES})
|
||||||
target_link_libraries(Serializers_ifc${schema} IfcGeom ${OpenCASCADE_LIBRARIES} ${HDF5_LIBRARIES})
|
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user