From 3bc4cc846bc34b2470c902414730ffc3a0d21dc1 Mon Sep 17 00:00:00 2001 From: Francisco Facioni Date: Thu, 15 Sep 2022 22:01:04 +0200 Subject: [PATCH] [openfbx] Add port (#26678) * [openfbx] Add port * Set cxx standard to 11 to fix osx build * version * [openfbx] add unofficial namespace * [openfbx] fixes for unofficial-openfbx * [openfbx] more renaming * [openfbx] fix after unofficial renaming * [openfbx] Make it static only as it doesn't export any symbols Co-authored-by: JackBoosY --- ports/openfbx/CMakeLists.txt | 48 +++++++++++++++++++ ports/openfbx/portfile.cmake | 25 ++++++++++ .../openfbx/unofficial-openfbxConfig.cmake.in | 8 ++++ ports/openfbx/vcpkg.json | 18 +++++++ versions/baseline.json | 4 ++ versions/o-/openfbx.json | 9 ++++ 6 files changed, 112 insertions(+) create mode 100644 ports/openfbx/CMakeLists.txt create mode 100644 ports/openfbx/portfile.cmake create mode 100644 ports/openfbx/unofficial-openfbxConfig.cmake.in create mode 100644 ports/openfbx/vcpkg.json create mode 100644 versions/o-/openfbx.json diff --git a/ports/openfbx/CMakeLists.txt b/ports/openfbx/CMakeLists.txt new file mode 100644 index 0000000000..820b4442c2 --- /dev/null +++ b/ports/openfbx/CMakeLists.txt @@ -0,0 +1,48 @@ +cmake_minimum_required(VERSION 3.11) + +project(OpenFBX LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 11) + +include(GNUInstallDirs) + +find_package(miniz REQUIRED) + +add_library(openfbx src/ofbx.cpp) +target_link_libraries(openfbx PRIVATE miniz::miniz) + +target_include_directories(openfbx + PUBLIC + $ + $) + +target_compile_definitions(openfbx PRIVATE _LARGEFILE64_SOURCE) + +install(TARGETS openfbx EXPORT unofficial-openfbxTargets + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include + INCLUDES DESTINATION include) + +include(CMakePackageConfigHelpers) +configure_package_config_file( + unofficial-openfbxConfig.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/unofficial-openfbxConfig.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/unofficial-openfbx" +) + +install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-openfbxConfig.cmake" + DESTINATION "${CMAKE_INSTALL_DATADIR}/unofficial-openfbx" +) + +install(FILES ${CMAKE_SOURCE_DIR}/src/ofbx.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +install( + EXPORT unofficial-openfbxTargets + NAMESPACE unoffical::openfbx:: + DESTINATION ${CMAKE_INSTALL_DATADIR}/unofficial-openfbx +) diff --git a/ports/openfbx/portfile.cmake b/ports/openfbx/portfile.cmake new file mode 100644 index 0000000000..4e1e77b30c --- /dev/null +++ b/ports/openfbx/portfile.cmake @@ -0,0 +1,25 @@ +if (VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO nem0/OpenFBX + REF 6a788af3b19dd6921a64eb7e133a3fa131dfbbd5 + SHA512 c441e15ef0916e412af464c9f318a471cdbdc55225fe4282ff640243cd11dfcac6ff233ae8e60db63d1eaed1511d33ffa8d7ed37743c4580f8bde0724d7b6c47 + HEAD_REF master +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-openfbxConfig.cmake.in" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}") +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-openfbx) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/openfbx/unofficial-openfbxConfig.cmake.in b/ports/openfbx/unofficial-openfbxConfig.cmake.in new file mode 100644 index 0000000000..421787837f --- /dev/null +++ b/ports/openfbx/unofficial-openfbxConfig.cmake.in @@ -0,0 +1,8 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) +find_dependency(miniz) + +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-openfbxTargets.cmake") + +check_required_components(miniz) diff --git a/ports/openfbx/vcpkg.json b/ports/openfbx/vcpkg.json new file mode 100644 index 0000000000..6c59df5187 --- /dev/null +++ b/ports/openfbx/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "openfbx", + "version-date": "2022-07-18", + "description": "Lightweight open source FBX importer", + "homepage": "https://github.com/nem0/OpenFBX", + "license": "MIT", + "dependencies": [ + "miniz", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 5d71f3dbe8..cc4df3513f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5312,6 +5312,10 @@ "baseline": "2.5.8", "port-version": 1 }, + "openfbx": { + "baseline": "2022-07-18", + "port-version": 0 + }, "opengl": { "baseline": "2022-03-14", "port-version": 1 diff --git a/versions/o-/openfbx.json b/versions/o-/openfbx.json new file mode 100644 index 0000000000..f7d6d39552 --- /dev/null +++ b/versions/o-/openfbx.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "2ef566bee77c87c4efa26b8c9905e1fb26117f95", + "version-date": "2022-07-18", + "port-version": 0 + } + ] +}