diff --git a/ports/geogram/CONTROL b/ports/geogram/CONTROL new file mode 100644 index 0000000000..95690395b3 --- /dev/null +++ b/ports/geogram/CONTROL @@ -0,0 +1,4 @@ +Source: geogram +Version: 1.4.9 +Description: Geogram is a programming library of geometric algorithms. +Build-Depends: glfw3, openblas, clapack diff --git a/ports/geogram/Config.cmake.in b/ports/geogram/Config.cmake.in new file mode 100644 index 0000000000..72808723e4 --- /dev/null +++ b/ports/geogram/Config.cmake.in @@ -0,0 +1,4 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") +check_required_components("@PROJECT_NAME@") \ No newline at end of file diff --git a/ports/geogram/fix-cmake-config-and-install.patch b/ports/geogram/fix-cmake-config-and-install.patch new file mode 100644 index 0000000000..b5490fdc18 --- /dev/null +++ b/ports/geogram/fix-cmake-config-and-install.patch @@ -0,0 +1,208 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 17dc02e..e489d75 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -42,7 +42,7 @@ set(VORPALINE_VERSION_MINOR 4) + set(VORPALINE_VERSION_PATCH 9) + set(VORPALINE_VERSION ${VORPALINE_VERSION_MAJOR}.${VORPALINE_VERSION_MINOR}.${VORPALINE_VERSION_PATCH}) + +-set(VORPALINE_INCLUDE_SUBPATH geogram${VORPALINE_VERSION_MAJOR}) ++set(VORPALINE_INCLUDE_SUBPATH ./) + + # Determine the current Build-OS (Build-platform without the compiler info) + string(REGEX REPLACE "-[^-]+$" "" VORPALINE_OS ${VORPALINE_PLATFORM}) +@@ -106,6 +106,11 @@ if(GEOGRAM_WITH_VORPALINE) + add_subdirectory(src/lib/vorpalib) + endif() + ++# find this library in the outside scope ++if(GEOGRAM_WITH_GRAPHICS) ++ find_package(GLFW3 REQUIRED) ++endif(GEOGRAM_WITH_GRAPHICS) ++ + add_subdirectory(src/lib/third_party) + + if(GEOGRAM_WITH_GRAPHICS) +@@ -138,8 +143,44 @@ file(REMOVE ${CMAKE_BINARY_DIR}/doc/LICENSE.txt) + + + # FindGeogram.cmake ++# This installation is not suitable for vcpkg ++# install(FILES cmake/FindGeogram.cmake DESTINATION lib/cmake/modules COMPONENT devkit) ++ ++set(config_install_dir "share/geogram") ++set(include_install_dir "include") ++set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated") ++ ++# Configuration ++set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake") ++set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake") ++set(targets_export_name "${PROJECT_NAME}Targets") ++set(namespace "${PROJECT_NAME}::") ++ ++# Include module with fuction 'write_basic_package_version_file' ++include(CMakePackageConfigHelpers) ++ ++write_basic_package_version_file( ++ "${version_config}" COMPATIBILITY SameMajorVersion VERSION ${VORPALINE_VERSION} ++) ++ ++configure_package_config_file( ++ "cmake/Config.cmake.in" ++ "${project_config}" ++ INSTALL_DESTINATION "${config_install_dir}" ++) + +-install(FILES cmake/FindGeogram.cmake DESTINATION lib/cmake/modules COMPONENT devkit) ++# Config ++install( ++ FILES "${project_config}" "${version_config}" ++ DESTINATION "${config_install_dir}" ++) ++ ++# Config ++install( ++ EXPORT "${targets_export_name}" ++ NAMESPACE "${namespace}" ++ DESTINATION "${config_install_dir}" ++) + + # Configure CPack + +diff --git a/src/lib/geogram/CMakeLists.txt b/src/lib/geogram/CMakeLists.txt +index d90bc48..927f857 100644 +--- a/src/lib/geogram/CMakeLists.txt ++++ b/src/lib/geogram/CMakeLists.txt +@@ -47,7 +47,14 @@ if(WIN32) + endif() + + # Install the library +-install_devkit_targets(geogram) ++install( ++ TARGETS geogram ++ EXPORT "${PROJECT_NAME}Targets" ++ LIBRARY DESTINATION "lib" ++ ARCHIVE DESTINATION "lib" ++ RUNTIME DESTINATION "bin" ++ INCLUDES DESTINATION "include" ++) + + # Install include files for the standard devkit + install( +diff --git a/src/lib/geogram_gfx/CMakeLists.txt b/src/lib/geogram_gfx/CMakeLists.txt +index f319b93..e24039d 100644 +--- a/src/lib/geogram_gfx/CMakeLists.txt ++++ b/src/lib/geogram_gfx/CMakeLists.txt +@@ -33,14 +33,21 @@ if(VORPALINE_BUILD_DYNAMIC) + endif() + + # Install the library +-install_devkit_targets(geogram_gfx) ++install( ++ TARGETS geogram_gfx ++ EXPORT "${PROJECT_NAME}Targets" ++ LIBRARY DESTINATION "lib" ++ ARCHIVE DESTINATION "lib" ++ RUNTIME DESTINATION "bin" ++ INCLUDES DESTINATION "include" ++) + + # Install include files for the standard devkit + install( + DIRECTORY . + DESTINATION include/${VORPALINE_INCLUDE_SUBPATH}/geogram_gfx + COMPONENT devkit +- FILES_MATCHING PATTERN *.h ++ FILES_MATCHING PATTERN *.h PATTERN *.xpm # xpm is the colrbar file + ) + + # Install include files for the full devkit +@@ -48,7 +55,7 @@ install( + DIRECTORY . + DESTINATION include/${VORPALINE_INCLUDE_SUBPATH}/geogram_gfx + COMPONENT devkit-full +- FILES_MATCHING PATTERN *.h ++ FILES_MATCHING PATTERN *.h PATTERN *.xpm # xpm is the colrbar file + ) + + install( +diff --git a/src/lib/third_party/numerics/CMakeLists.txt b/src/lib/third_party/numerics/CMakeLists.txt +index 5789cd2..e4262e3 100644 +--- a/src/lib/third_party/numerics/CMakeLists.txt ++++ b/src/lib/third_party/numerics/CMakeLists.txt +@@ -10,16 +10,18 @@ endif() + + include_directories(${GEOGRAM_SOURCE_DIR}/src/lib/third_party/numerics/INCLUDE) + ++find_package(BLAS REQUIRED) ++find_package(LAPACK REQUIRED) + aux_source_directories(SOURCES "Source Files" .) + aux_source_directories(SOURCES "Source Files\\LIBF2C" LIBF2C) +-aux_source_directories(SOURCES "Source Files\\CBLAS" CBLAS) +-aux_source_directories(SOURCES "Source Files\\CLAPACK" CLAPACK) ++# aux_source_directories(SOURCES "Source Files\\CBLAS" CBLAS) ++# aux_source_directories(SOURCES "Source Files\\CLAPACK" CLAPACK) + aux_source_directories(SOURCES "Source Files\\SUPERLU" SUPERLU) + aux_source_directories(SOURCES "Source Files\\ARPACK" ARPACK) + aux_source_directories(SOURCES "Source Files\\ARPACK_UTIL" ARPACK_UTIL) + + add_library(geogram_num_3rdparty ${SOURCES}) +- ++target_link_libraries(geogram_num_3rdparty ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) + if(UNIX) + target_link_libraries(geogram_num_3rdparty m) + endif() +diff --git a/src/lib/third_party/numerics/LIBF2C/getarg_.c b/src/lib/third_party/numerics/LIBF2C/getarg_.c +index 2b69a1e..a504538 100644 +--- a/src/lib/third_party/numerics/LIBF2C/getarg_.c ++++ b/src/lib/third_party/numerics/LIBF2C/getarg_.c +@@ -17,20 +17,20 @@ VOID getarg_(n, s, ls) ftnint *n; char *s; ftnlen ls; + void getarg_(ftnint *n, char *s, ftnlen ls) + #endif + { +- extern int xargc; +- extern char **xargv; +- Const char *t; +- int i; ++ // extern int xargc; ++ // extern char **xargv; ++ // Const char *t; ++ // int i; + +- if(*n>=0 && *n=0 && *n +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/geogram_1.4.9) +vcpkg_download_distfile(ARCHIVE + URLS "https://gforge.inria.fr/frs/download.php/file/36914/geogram_1.4.9.zip" + FILENAME "geogram-1.4.9.zip" + SHA512 de8a93abca90885c3ce1ad6b828442daa1eeaf016594fe707f25c8d4077c6b6cec0958a0662c0aed4ff015a994a55d7ebc7521cbb39b9adcf4373c44c957715e +) +vcpkg_extract_source_archive(${ARCHIVE}) +file(COPY ${CURRENT_PORT_DIR}/Config.cmake.in DESTINATION ${SOURCE_PATH}/cmake) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-cmake-config-and-install.patch +) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + # PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -DVORPALINE_BUILD_DYNAMIC=FALSE + -DGEOGRAM_WITH_GRAPHICS=ON + -DGEOGRAM_LIB_ONLY=ON + -DGEOGRAM_USE_SYSTEM_GLFW3=ON + -DVORPALINE_PLATFORM=Win-vs-generic + -DGEOGRAM_WITH_VORPALINE=OFF + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 + ) +else() + vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + # PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -DVORPALINE_BUILD_DYNAMIC=TRUE + -DGEOGRAM_LIB_ONLY=ON + -DGEOGRAM_USE_SYSTEM_GLFW3=ON + -DVORPALINE_PLATFORM=Win-vs-dynamic-generic + -DGEOGRAM_WITH_VORPALINE=OFF + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 + ) +endif() +vcpkg_install_cmake() +vcpkg_copy_pdbs() +vcpkg_fixup_cmake_targets(CONFIG_PATH "share/geogram") + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/doc) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/doc) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/doc/devkit/license.dox DESTINATION ${CURRENT_PACKAGES_DIR}/share/geogram) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/geogram/license.dox ${CURRENT_PACKAGES_DIR}/share/geogram/copyright)