diff --git a/packages/o/octomap/patches/1.10.0/cmake.patch b/packages/o/octomap/patches/1.10.0/cmake.patch new file mode 100644 index 000000000..e87a48c61 --- /dev/null +++ b/packages/o/octomap/patches/1.10.0/cmake.patch @@ -0,0 +1,131 @@ +diff --git a/dynamicEDT3D/src/CMakeLists.txt b/dynamicEDT3D/src/CMakeLists.txt +index 0b9357c..bbef680 100644 +--- a/dynamicEDT3D/src/CMakeLists.txt ++++ b/dynamicEDT3D/src/CMakeLists.txt +@@ -2,35 +2,29 @@ SET( dynamicEDT3D_SRCS + dynamicEDT3D.cpp + ) + +-add_library(dynamicedt3d SHARED ${dynamicEDT3D_SRCS}) ++add_library(dynamicedt3d ${dynamicEDT3D_SRCS}) + set_target_properties(dynamicedt3d PROPERTIES + VERSION ${DYNAMICEDT3D_VERSION} + SOVERSION ${DYNAMICEDT3D_SOVERSION} + ) + target_link_libraries(dynamicedt3d ${OCTOMAP_LIBRARIES}) + +-add_library(dynamicedt3d-static STATIC ${dynamicEDT3D_SRCS}) +-target_link_libraries(dynamicedt3d-static ${OCTOMAP_LIBRARIES}) +- +-SET_TARGET_PROPERTIES(dynamicedt3d-static PROPERTIES OUTPUT_NAME "dynamicedt3d") +- + if(NOT EXISTS "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/dynamicEDT3D") + file(MAKE_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/dynamicEDT3D") + endif() + +-export(TARGETS dynamicedt3d dynamicedt3d-static ++export(TARGETS dynamicedt3d + FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/dynamicEDT3D/dynamicEDT3DTargets.cmake") + + # directly depend on the octomap library target when building the + # complete distribution, so it it recompiled as needed + if (CMAKE_PROJECT_NAME STREQUAL "octomap-distribution") +- ADD_DEPENDENCIES(dynamicedt3d-static octomap-static) + ADD_DEPENDENCIES(dynamicedt3d octomap) + endif() + +-ADD_SUBDIRECTORY(examples) + +-install(TARGETS dynamicedt3d dynamicedt3d-static ++ ++install(TARGETS dynamicedt3d + EXPORT dynamicEDT3DTargets + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ${INSTALL_TARGETS_DEFAULT_ARGS} +diff --git a/octomap/CMakeLists.txt b/octomap/CMakeLists.txt +index 87a78e9..edae7f1 100644 +--- a/octomap/CMakeLists.txt ++++ b/octomap/CMakeLists.txt +@@ -161,7 +161,7 @@ install_pkg_config_file(octomap + VERSION ${OCTOMAP_VERSION}) + + # Documentation +-FIND_PACKAGE(Doxygen) ++ + IF(DOXYGEN_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/octomap.dox.in ${CMAKE_CURRENT_BINARY_DIR}/octomap.dox @ONLY) + ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/octomap.dox +diff --git a/octomap/src/CMakeLists.txt b/octomap/src/CMakeLists.txt +index 45b384f..837fee8 100644 +--- a/octomap/src/CMakeLists.txt ++++ b/octomap/src/CMakeLists.txt +@@ -11,14 +11,11 @@ SET (octomap_SRCS + ) + + # dynamic and static libs, see CMake FAQ: +-ADD_LIBRARY( octomap SHARED ${octomap_SRCS}) ++ADD_LIBRARY( octomap ${octomap_SRCS}) + set_target_properties( octomap PROPERTIES + VERSION ${OCTOMAP_VERSION} + SOVERSION ${OCTOMAP_SOVERSION} + ) +-ADD_LIBRARY( octomap-static STATIC ${octomap_SRCS}) +-SET_TARGET_PROPERTIES(octomap-static PROPERTIES OUTPUT_NAME "octomap") +-add_dependencies(octomap-static octomath-static) + + TARGET_LINK_LIBRARIES(octomap octomath) + +@@ -26,10 +23,10 @@ if(NOT EXISTS "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap") + file(MAKE_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap") + endif() + +-export(TARGETS octomap octomap-static ++export(TARGETS octomap + APPEND FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap/octomap-targets.cmake") + +-ADD_SUBDIRECTORY( testing ) ++ + + ADD_EXECUTABLE(graph2tree graph2tree.cpp) + TARGET_LINK_LIBRARIES(graph2tree octomap) +@@ -67,7 +64,7 @@ TARGET_LINK_LIBRARIES(intersection_example octomap) + ADD_EXECUTABLE(octree2pointcloud octree2pointcloud.cpp) + TARGET_LINK_LIBRARIES(octree2pointcloud octomap) + +-install(TARGETS octomap octomap-static ++install(TARGETS octomap + EXPORT octomap-targets + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ${INSTALL_TARGETS_DEFAULT_ARGS} +diff --git a/octomap/src/math/CMakeLists.txt b/octomap/src/math/CMakeLists.txt +index 3b47ec4..9a26c46 100644 +--- a/octomap/src/math/CMakeLists.txt ++++ b/octomap/src/math/CMakeLists.txt +@@ -5,24 +5,21 @@ SET (octomath_SRCS + ) + + +-ADD_LIBRARY( octomath SHARED ${octomath_SRCS}) ++ADD_LIBRARY( octomath ${octomath_SRCS}) + + SET_TARGET_PROPERTIES( octomath PROPERTIES + VERSION ${OCTOMAP_VERSION} + SOVERSION ${OCTOMAP_SOVERSION} + ) + +-ADD_LIBRARY( octomath-static STATIC ${octomath_SRCS}) +-SET_TARGET_PROPERTIES(octomath-static PROPERTIES OUTPUT_NAME "octomath") +- + if(NOT EXISTS "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap") + file(MAKE_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap") + endif() + +-export(TARGETS octomath octomath-static ++export(TARGETS octomath + APPEND FILE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cmake/octomap/octomap-targets.cmake") + +-install(TARGETS octomath octomath-static ++install(TARGETS octomath + EXPORT octomap-targets + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ${INSTALL_TARGETS_DEFAULT_ARGS} diff --git a/packages/o/octomap/xmake.lua b/packages/o/octomap/xmake.lua index ac2a5b315..720f535b2 100644 --- a/packages/o/octomap/xmake.lua +++ b/packages/o/octomap/xmake.lua @@ -1,27 +1,44 @@ package("octomap") - set_homepage("https://octomap.github.io/") set_description("An Efficient Probabilistic 3D Mapping Framework Based on Octrees") set_license("BSD-3-Clause") add_urls("https://github.com/OctoMap/octomap/archive/refs/tags/$(version).tar.gz", "https://github.com/OctoMap/octomap.git") + + add_versions("v1.10.0", "8da2576ec6a0993e8900db7f91083be8682d8397a7be0752c85d1b7dd1b8e992") add_versions("v1.9.7", "3e9ac020686ceb4e17e161bffc5a0dafd9cccab33adeb9adee59a61c418ea1c1") add_versions("v1.9.8", "417af6da4e855e9a83b93458aa98b01a2c88f880088baad2b59d323ce162586e") + add_patches("1.10.0", path.join(os.scriptdir(), "patches", "1.10.0", "cmake.patch"), "5ad89543331054698ee9ca409e4b6745c7f5a386adb957398686a2dc14092477") add_patches("1.9.x", path.join(os.scriptdir(), "patches", "1.9.7", "build.patch"), "396b7b28c754f876c8552da93abf463f31bd65e327f454e75b8a5c10bb62ded4") + add_configs("octovis", {description = "Build octovis", default = false, type = "boolean", readonly = true}) + add_configs("dynamicedt3d", {description = "Build dynamicEDT3D", default = false, type = "boolean"}) + if is_plat("windows") then add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) end add_deps("cmake") + on_install("windows", "macosx", "linux", function (package) local configs = {} - table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DBUILD_OCTOVIS_SUBPROJECT=" .. (package:config("octovis") and "ON" or "OFF")) + table.insert(configs, "-DBUILD_DYNAMICETD3D_SUBPROJECT=" .. (package:config("dynamicedt3d") and "ON" or "OFF")) + + if package:is_plat("windows") and package:version():eq("1.10.0") then + io.replace("octomap/src/compare_octrees.cpp", + "#ifdef _MSC_VER // fix missing isnan for VC++", + "#if defined(_MSVC_LANG) && _MSVC_LANG < 201103L", {plain = true}) + end import("package.tools.cmake").install(package, configs) - package:addenv("PATH", "bin") + + if is_host("windows") then + package:addenv("PATH", "bin") + end end) on_test(function (package)