From fca5cab9f094604b71c23ffd13fa7108c142d03b Mon Sep 17 00:00:00 2001 From: Han Hu Date: Wed, 16 Jan 2019 14:05:40 +0800 Subject: [PATCH] Port openmvg, included new ports of coin-or projects, lemon --- ports/clp/CMakeLists.txt | 143 +++++++++++++++++++++++++++++ ports/clp/CONTROL | 4 + ports/clp/Config.cmake.in | 5 + ports/clp/portfile.cmake | 46 ++++++++++ ports/coinutils/CMakeLists.txt | 111 ++++++++++++++++++++++ ports/coinutils/CONTROL | 3 + ports/coinutils/Config.cmake.in | 5 + ports/coinutils/portfile.cmake | 49 ++++++++++ ports/lemon/CONTROL | 3 + ports/lemon/portfile.cmake | 47 ++++++++++ ports/lemon/remove-directory.patch | 21 +++++ ports/openmvg/CONTROL | 4 + ports/openmvg/fixcmake.patch | 119 ++++++++++++++++++++++++ ports/openmvg/portfile.cmake | 101 ++++++++++++++++++++ ports/osi/CMakeLists.txt | 112 ++++++++++++++++++++++ ports/osi/CONTROL | 4 + ports/osi/Config.cmake.in | 5 + ports/osi/portfile.cmake | 45 +++++++++ 18 files changed, 827 insertions(+) create mode 100644 ports/clp/CMakeLists.txt create mode 100644 ports/clp/CONTROL create mode 100644 ports/clp/Config.cmake.in create mode 100644 ports/clp/portfile.cmake create mode 100644 ports/coinutils/CMakeLists.txt create mode 100644 ports/coinutils/CONTROL create mode 100644 ports/coinutils/Config.cmake.in create mode 100644 ports/coinutils/portfile.cmake create mode 100644 ports/lemon/CONTROL create mode 100644 ports/lemon/portfile.cmake create mode 100644 ports/lemon/remove-directory.patch create mode 100644 ports/openmvg/CONTROL create mode 100644 ports/openmvg/fixcmake.patch create mode 100644 ports/openmvg/portfile.cmake create mode 100644 ports/osi/CMakeLists.txt create mode 100644 ports/osi/CONTROL create mode 100644 ports/osi/Config.cmake.in create mode 100644 ports/osi/portfile.cmake diff --git a/ports/clp/CMakeLists.txt b/ports/clp/CMakeLists.txt new file mode 100644 index 0000000000..1fbdb4ab81 --- /dev/null +++ b/ports/clp/CMakeLists.txt @@ -0,0 +1,143 @@ +cmake_minimum_required(VERSION 3.11) + +project(Clp LANGUAGES C CXX) + +set(PROJECT_VERSION 1.16.11) +set(PROJECT_VERSION_MAJOR 1) +set(PROJECT_VERSION_MINOR 16) +set(PROJECT_VERSION_PATCH 11) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake") +if(BUILD_SHARED_LIBS AND MSVC) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif(BUILD_SHARED_LIBS AND MSVC) +if(MSVC) + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} /bigobj /MP /wd4996 /wd4819 /wd4251 /wd4267 /wd4244 /wd4275" + ) +endif(MSVC) +if(APPLE) + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override -Wno-unused-command-line-argument -Wno-unused-result -Wno-exceptions" + ) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" + CACHE STRING "Minimum OS X deployment version") +endif(APPLE) + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +# options +option(BUILD_SHARED_LIBS "" ON) + +# +# 设置用于 install 的变量 +# +# Introduce variables: * CMAKE_INSTALL_LIBDIR * CMAKE_INSTALL_BINDIR +include(GNUInstallDirs) + +# Include module with fuction 'write_basic_package_version_file' +include(CMakePackageConfigHelpers) + +# Layout. This works for all platforms: * /lib*/cmake/ * +# /lib*/ * /include/ +set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +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 "Coin::") + +# Packages +find_package(CoinUtils REQUIRED) +find_package(Osi REQUIRED) + +# Add sources +include_directories(Clp/src/) +include_directories(Clp/src/OsiClp) + +file(GLOB CLP_SOURCES + Clp/src/*.hpp + Clp/src/*.cpp + Clp/src/OsiClp/*.hpp + Clp/src/OsiClp/*.cpp) +file(GLOB CLP_REMOVE + Clp/src/ClpCholeskyMumps.cpp + Clp/src/ClpCholeskyUfl.cpp + Clp/src/ClpCholeskyWssmp.cpp + Clp/src/ClpCholeskyWssmpKKT.cpp + Clp/src/ClpMain.cpp + Clp/src/*Abc*.cpp + Clp/src/ClpCholeskyMumps.hpp + Clp/src/ClpCholeskyUfl.hpp + Clp/src/ClpCholeskyWssmp.hpp + Clp/src/ClpCholeskyWssmpKKT.hpp + Clp/src/ClpMain.hpp + Clp/src/*Abc*.hpp + Clp/src/*Abc*.h) +list(REMOVE_ITEM CLP_SOURCES ${CLP_REMOVE}) + +add_library(${PROJECT_NAME} ${CLP_SOURCES}) + +target_include_directories(${PROJECT_NAME} + PUBLIC $) +target_compile_definitions(${PROJECT_NAME} + PUBLIC + -DHAVE_CMATH + -D_CRT_SECURE_NO_WARNINGS + -DCOIN_HAS_CLP) +target_link_libraries(${PROJECT_NAME} PRIVATE Coin::CoinUtils Coin::Osi) + +install(TARGETS ${PROJECT_NAME} + EXPORT "${TARGETS_EXPORT_NAME}" + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES + DESTINATION include) + +install(DIRECTORY Clp/src/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coin + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp" + PATTERN "config_default.h" + EXCLUDE) + +install(DIRECTORY Clp/src/OsiClp/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coin + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp" + PATTERN "config_default.h" + EXCLUDE) + +# +# Install Libraries +# +# Configure 'ConfigVersion.cmake' Use: * PROJECT_VERSION +write_basic_package_version_file("${version_config}" + COMPATIBILITY SameMajorVersion) + +# Configure 'Config.cmake' Use variables: * TARGETS_EXPORT_NAME * +# PROJECT_NAME +configure_package_config_file("Config.cmake.in" + "${project_config}" + INSTALL_DESTINATION + "${config_install_dir}") + +# Config * /lib/cmake/Foo/FooConfig.cmake * +# /lib/cmake/Foo/FooConfigVersion.cmake +install(FILES "${project_config}" "${version_config}" + DESTINATION "${config_install_dir}") + +# Config * /lib/cmake/Foo/FooTargets.cmake +install(EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${namespace}" + DESTINATION "${config_install_dir}") diff --git a/ports/clp/CONTROL b/ports/clp/CONTROL new file mode 100644 index 0000000000..ac9b4178fa --- /dev/null +++ b/ports/clp/CONTROL @@ -0,0 +1,4 @@ +Source: clp +Version: 1.16.11-0 +Description: Clp (Coin-or linear programming) is an open-source linear programming solver written in C++. It is primarily meant to be used as a callable library, but a basic, stand-alone executable version is also available. +Build-Depends: coinutils, osi diff --git a/ports/clp/Config.cmake.in b/ports/clp/Config.cmake.in new file mode 100644 index 0000000000..ec01d2e5bd --- /dev/null +++ b/ports/clp/Config.cmake.in @@ -0,0 +1,5 @@ + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/ports/clp/portfile.cmake b/ports/clp/portfile.cmake new file mode 100644 index 0000000000..08cf8af72a --- /dev/null +++ b/ports/clp/portfile.cmake @@ -0,0 +1,46 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO coin-or/Clp + REF releases/1.16.11 + SHA512 4291ab6c4985491c100fab265ebeace88623a691f87890ed7b9240b4b1111fb55043be4e0f226cfa0e565f593f4df4c3661c570a39189f17f48b6f710a10fffe +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in DESTINATION ${SOURCE_PATH}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(BUILD_SHARED_LIBS ON) +else() + set(BUILD_SHARED_LIBS OFF) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/Clp") + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/clp RENAME copyright) + +# Post-build test for cmake libraries +# vcpkg_test_cmake(PACKAGE_NAME osi) diff --git a/ports/coinutils/CMakeLists.txt b/ports/coinutils/CMakeLists.txt new file mode 100644 index 0000000000..953ab2b98d --- /dev/null +++ b/ports/coinutils/CMakeLists.txt @@ -0,0 +1,111 @@ +cmake_minimum_required(VERSION 3.11) + +project(CoinUtils LANGUAGES C CXX) + +set(PROJECT_VERSION 2.10.14) +set(PROJECT_VERSION_MAJOR 2) +set(PROJECT_VERSION_MINOR 10) +set(PROJECT_VERSION_PATCH 14) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake") +if(BUILD_SHARED_LIBS AND MSVC) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif(BUILD_SHARED_LIBS AND MSVC) +if(MSVC) + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} /bigobj /MP /wd4996 /wd4819 /wd4251 /wd4267 /wd4244 /wd4275" + ) +endif(MSVC) +if(APPLE) + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override -Wno-unused-command-line-argument -Wno-unused-result -Wno-exceptions" + ) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" + CACHE STRING "Minimum OS X deployment version") +endif(APPLE) + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +# options +option(BUILD_SHARED_LIBS "" ON) + +# +# 设置用于 install 的变量 +# +# Introduce variables: * CMAKE_INSTALL_LIBDIR * CMAKE_INSTALL_BINDIR +include(GNUInstallDirs) + +# Include module with fuction 'write_basic_package_version_file' +include(CMakePackageConfigHelpers) + +# Layout. This works for all platforms: * /lib*/cmake/ * +# /lib*/ * /include/ +set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +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 "Coin::") + +# +# Add sources +# +include_directories(CoinUtils/src) + +file(GLOB UTILS_SOURCES + CoinUtils/src/*.hpp + CoinUtils/src/*.cpp + CoinUtils/src/*.h) +add_library(${PROJECT_NAME} ${UTILS_SOURCES}) + +target_include_directories(${PROJECT_NAME} + PUBLIC $) +target_compile_definitions(${PROJECT_NAME} + PUBLIC + $ + $) + +install(TARGETS ${PROJECT_NAME} + EXPORT "${TARGETS_EXPORT_NAME}" + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES + DESTINATION include) + +install(DIRECTORY CoinUtils/src/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coin + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp") + +# +# Install Libraries +# +# Configure 'ConfigVersion.cmake' Use: * PROJECT_VERSION +write_basic_package_version_file("${version_config}" + COMPATIBILITY SameMajorVersion) + +# Configure 'Config.cmake' Use variables: * TARGETS_EXPORT_NAME * +# PROJECT_NAME +configure_package_config_file("Config.cmake.in" + "${project_config}" + INSTALL_DESTINATION + "${config_install_dir}") + +# Config * /lib/cmake/Foo/FooConfig.cmake * +# /lib/cmake/Foo/FooConfigVersion.cmake +install(FILES "${project_config}" "${version_config}" + DESTINATION "${config_install_dir}") + +# Config * /lib/cmake/Foo/FooTargets.cmake +install(EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${namespace}" + DESTINATION "${config_install_dir}") diff --git a/ports/coinutils/CONTROL b/ports/coinutils/CONTROL new file mode 100644 index 0000000000..64573dfb9c --- /dev/null +++ b/ports/coinutils/CONTROL @@ -0,0 +1,3 @@ +Source: coinutils +Version: 2.10.14-0 +Description: CoinUtils (Coin-or Utilities) is an open-source collection of classes and functions that are generally useful to more than one COIN-OR project diff --git a/ports/coinutils/Config.cmake.in b/ports/coinutils/Config.cmake.in new file mode 100644 index 0000000000..ec01d2e5bd --- /dev/null +++ b/ports/coinutils/Config.cmake.in @@ -0,0 +1,5 @@ + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/ports/coinutils/portfile.cmake b/ports/coinutils/portfile.cmake new file mode 100644 index 0000000000..59582e8002 --- /dev/null +++ b/ports/coinutils/portfile.cmake @@ -0,0 +1,49 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO coin-or/CoinUtils + REF releases/2.10.14 + SHA512 2d5108e096f126cf98750a4892ca4d946d0bad41b65f29001c116c5ad15aa4900c3091d163fa16b6a55f0518344c6681ad95bbc6efa431c77aaaaa751494c48b +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in DESTINATION ${SOURCE_PATH}) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -DBUILD_SHARED_LIBS=OFF + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/CoinUtils") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/coinutils RENAME copyright) + +# Post-build test for cmake libraries +# vcpkg_test_cmake(PACKAGE_NAME coinutils) diff --git a/ports/lemon/CONTROL b/ports/lemon/CONTROL new file mode 100644 index 0000000000..04fec505c7 --- /dev/null +++ b/ports/lemon/CONTROL @@ -0,0 +1,3 @@ +Source: lemon +Version: +Description: diff --git a/ports/lemon/portfile.cmake b/ports/lemon/portfile.cmake new file mode 100644 index 0000000000..a7509bde4e --- /dev/null +++ b/ports/lemon/portfile.cmake @@ -0,0 +1,47 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lemon-1.3.1) +vcpkg_download_distfile(ARCHIVE + URLS "http://lemon.cs.elte.hu/pub/sources/lemon-1.3.1.tar.gz" + FILENAME "lemon-1.3.1.tar.gz" + SHA512 715eb45e790c908e41de4c13e68b7880e1d86c54eca53f896c95b6bc411ded504f3f768bed9d63562ed4adad53167fb3a7828c67456fdea645a5d0a94ae2e038 +) +vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR} remove-directory.patch) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/cmake) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/lemon RENAME copyright) + +# Post-build test for cmake libraries +# vcpkg_test_cmake(PACKAGE_NAME lemon) diff --git a/ports/lemon/remove-directory.patch b/ports/lemon/remove-directory.patch new file mode 100644 index 0000000000..bda2c51ae5 --- /dev/null +++ b/ports/lemon/remove-directory.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 03e1cc7..edbd05f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -256,11 +256,11 @@ ENDIF() + + ADD_SUBDIRECTORY(lemon) + IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) +- ADD_SUBDIRECTORY(contrib) +- ADD_SUBDIRECTORY(demo) +- ADD_SUBDIRECTORY(tools) +- ADD_SUBDIRECTORY(doc) +- ADD_SUBDIRECTORY(test) ++ # ADD_SUBDIRECTORY(contrib) ++ # ADD_SUBDIRECTORY(demo) ++ # ADD_SUBDIRECTORY(tools) ++ # ADD_SUBDIRECTORY(doc) ++ # ADD_SUBDIRECTORY(test) + ENDIF() + + CONFIGURE_FILE( diff --git a/ports/openmvg/CONTROL b/ports/openmvg/CONTROL new file mode 100644 index 0000000000..261fd901fd --- /dev/null +++ b/ports/openmvg/CONTROL @@ -0,0 +1,4 @@ +Source: openmvg +Version: 1.4-0 +Description: open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion. +Build-Depends: coinutils, clp, osi, lemon, flann, eigen3, ceres, cereal, libjpeg-turbo, tiff, libpng, zlib diff --git a/ports/openmvg/fixcmake.patch b/ports/openmvg/fixcmake.patch new file mode 100644 index 0000000000..2ee976dd54 --- /dev/null +++ b/ports/openmvg/fixcmake.patch @@ -0,0 +1,119 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 654bebd..6d1c671 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -39,6 +39,10 @@ option(OpenMVG_USE_OPENCV "Build or not opencv+openMVG samples programs" OFF) + # ============================================================================== + option(OpenMVG_USE_OCVSIFT "Add or not OpenCV SIFT in available features" OFF) + ++if(OpenMVG_BUILD_SHARED AND MSVC) ++ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) ++endif(OpenMVG_BUILD_SHARED AND MSVC) ++ + # ============================================================================== + # OpenMVG version + # ============================================================================== +@@ -88,11 +92,11 @@ endif() + # ============================================================================== + # Check that submodule have been initialized and updated + # ============================================================================== +-if (NOT EXISTS ${PROJECT_SOURCE_DIR}/dependencies/cereal/include) +- message(FATAL_ERROR +- "\n submodule(s) are missing, please update your repository:\n" +- " > git submodule update -i\n") +-endif() ++# if (NOT EXISTS ${PROJECT_SOURCE_DIR}/dependencies/cereal/include) ++# message(FATAL_ERROR ++# "\n submodule(s) are missing, please update your repository:\n" ++# " > git submodule update -i\n") ++# endif() + + # ============================================================================== + # Additional cmake find modules +@@ -184,12 +188,12 @@ if (OpenMVG_BUILD_OPENGL_EXAMPLES) + endif (OpenMVG_BUILD_OPENGL_EXAMPLES) + + # Dependencies install rules +-install( +- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/ +- DESTINATION include/openMVG_dependencies +- COMPONENT headers +- FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" +-) ++# install( ++# DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/ ++# DESTINATION include/openMVG_dependencies ++# COMPONENT headers ++# FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" ++# ) + + # ============================================================================== + # --END-- SUBMODULE CONFIGURATION +diff --git a/src/cmakeFindModules/FindClp.cmake b/src/cmakeFindModules/FindClp.cmake +index c997b87..74c3aae 100644 +--- a/src/cmakeFindModules/FindClp.cmake ++++ b/src/cmakeFindModules/FindClp.cmake +@@ -51,8 +51,8 @@ IF(EXISTS "${CLP_DIR}" AND NOT "${CLP_DIR}" STREQUAL "") + SET(CLP_INCLUDE_DIR ${CLP_DIR}) + + FIND_LIBRARY(CLP_LIBRARY NAMES Clp) +- FIND_LIBRARY(CLPSOLVER_LIBRARY NAMES ClpSolver) +- FIND_LIBRARY(OSICLP_LIBRARY NAMES OsiClp) ++ FIND_LIBRARY(CLPSOLVER_LIBRARY NAMES ClpSolver Clp) ++ FIND_LIBRARY(OSICLP_LIBRARY NAMES OsiClp Clp) + + # locate Clp libraries + IF(DEFINED CLP_LIBRARY AND DEFINED CLPSOLVER_LIBRARY AND DEFINED OSICLP_LIBRARY) +diff --git a/src/openMVG/matching/CMakeLists.txt b/src/openMVG/matching/CMakeLists.txt +index 80b1fe6..cb396c7 100644 +--- a/src/openMVG/matching/CMakeLists.txt ++++ b/src/openMVG/matching/CMakeLists.txt +@@ -38,7 +38,7 @@ target_link_libraries(openMVG_matching + openMVG_features + Threads::Threads + ) +-if (NOT DEFINED OpenMVG_USE_INTERNAL_FLANN) ++if (NOT OpenMVG_USE_INTERNAL_FLANN) + target_link_libraries(openMVG_matching + PUBLIC + ${FLANN_LIBRARIES} +diff --git a/src/third_party/CMakeLists.txt b/src/third_party/CMakeLists.txt +index 816a941..f0b7145 100644 +--- a/src/third_party/CMakeLists.txt ++++ b/src/third_party/CMakeLists.txt +@@ -18,7 +18,7 @@ add_subdirectory(stlplus3) + set(STLPLUS_LIBRARY openMVG_stlplus PARENT_SCOPE) + + # Add graph library +-if(DEFINED OpenMVG_USE_INTERNAL_LEMON) ++if(OpenMVG_USE_INTERNAL_LEMON) + add_subdirectory(lemon) + set_property(TARGET openMVG_lemon PROPERTY FOLDER OpenMVG/3rdParty/lemon) + set_property(TARGET check PROPERTY FOLDER OpenMVG/3rdParty/lemon) +@@ -68,7 +68,7 @@ endif (NOT TIFF_FOUND) + add_subdirectory(vectorGraphics) + + # Add ceres-solver (A Nonlinear Least Squares Minimizer) +-if (DEFINED OpenMVG_USE_INTERNAL_CERES) ++if (OpenMVG_USE_INTERNAL_CERES) + add_subdirectory(cxsparse) + add_subdirectory(ceres-solver) + set_property(TARGET openMVG_cxsparse PROPERTY FOLDER OpenMVG/3rdParty/ceres) +@@ -76,7 +76,7 @@ if (DEFINED OpenMVG_USE_INTERNAL_CERES) + endif() + + # Add an Approximate Nearest Neighbor library +-if (DEFINED OpenMVG_USE_INTERNAL_FLANN) ++if (OpenMVG_USE_INTERNAL_FLANN) + set(FLANN_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/openMVG/third_party/flann/src/cpp) + add_subdirectory(flann) + endif() +@@ -90,7 +90,7 @@ add_subdirectory(fast) + ## + # Install Header only libraries if necessary + ## +-if (DEFINED OpenMVG_USE_INTERNAL_EIGEN) ++if (OpenMVG_USE_INTERNAL_EIGEN) + #Configure Eigen install + set(EIGEN_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/openMVG/third_party/eigen) + add_subdirectory(eigen) diff --git a/ports/openmvg/portfile.cmake b/ports/openmvg/portfile.cmake new file mode 100644 index 0000000000..fd91a237d0 --- /dev/null +++ b/ports/openmvg/portfile.cmake @@ -0,0 +1,101 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO openMVG/openMVG + REF v1.4 + SHA512 949cf3680375c87b06db0f4713c846422c98d1979d49e9db65761f63f6f3212f0fcd8425f23c6112f04fbbb90b241638c2fd9329bb6b8b612c1d073aac55759a +) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR} fixcmake.patch) + + +# remove some deps to prevent conflict +file(REMOVE_RECURSE ${SOURCE_PATH}/src/third_party/ceres-solver) +file(REMOVE_RECURSE ${SOURCE_PATH}/src/third_party/cxsparse) +file(REMOVE_RECURSE ${SOURCE_PATH}/src/third_party/eigen) +file(REMOVE_RECURSE ${SOURCE_PATH}/src/third_party/flann) +file(REMOVE_RECURSE ${SOURCE_PATH}/src/third_party/jpeg) +file(REMOVE_RECURSE ${SOURCE_PATH}/src/third_party/lemon) +file(REMOVE_RECURSE ${SOURCE_PATH}/src/third_party/png) +file(REMOVE_RECURSE ${SOURCE_PATH}/src/third_party/tiff) +file(REMOVE_RECURSE ${SOURCE_PATH}/src/third_party/zlib) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(OpenMVG_BUILD_SHARED ON) +else() + set(OpenMVG_BUILD_SHARED OFF) +endif() + + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH}/src + # PREFER_NINJA # Disable this option if project cannot be built with Ninja + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + OPTIONS + -DOpenMVG_BUILD_SHARED=${OpenMVG_BUILD_SHARED} + -DOpenMVG_BUILD_DOC=OFF + -DOpenMVG_BUILD_EXAMPLES=OFF + -DOpenMVG_BUILD_SOFTWARES=OFF + -DOpenMVG_BUILD_GUI_SOFTWARES=OFF + # TODO, use packgeconfig.cmake file instead + -DEIGEN_INCLUDE_DIR_HINTS=${CURRENT_INSTALLED_DIR}/include/ + -DCERES_DIR_HINTS=${CURRENT_INSTALLED_DIR}/ceres + -DFLANN_INCLUDE_DIR_HINTS=${CURRENT_INSTALLED_DIR}/flann + -DLEMON_INCLUDE_DIR_HINTS=${CURRENT_INSTALLED_DIR}/include/lemon + -DCOINUTILS_INCLUDE_DIR_HINTS=${CURRENT_INSTALLED_DIR}/include/coin + -DCLP_INCLUDE_DIR_HINTS=${CURRENT_INSTALLED_DIR}/include/coin + -DOSI_INCLUDE_DIR_HINTS=${CURRENT_INSTALLED_DIR}/include/coin + -DOpenMVG_USE_INTERNAL_CLP=OFF + -DOpenMVG_USE_INTERNAL_COINUTILS=OFF + -DOpenMVG_USE_INTERNAL_OSI=OFF + -DOpenMVG_USE_INTERNAL_EIGEN=OFF + -DOpenMVG_USE_INTERNAL_CEREAL=OFF + -DOpenMVG_USE_INTERNAL_CERES=OFF + -DOpenMVG_USE_INTERNAL_FLANN=OFF + -DTARGET_ARCHITECTURE=core # disable instruction like avx + # OPTIONS_RELEASE -DOPTIMIZE=1 + OPTIONS_RELEASE + -DFLANN_LIBRARY=${CURRENT_INSTALLED_DIR}/lib/flann_cpp.lib + OPTIONS_DEBUG + -DFLANN_LIBRARY=${CURRENT_INSTALLED_DIR}/debug/lib/flann_cpp-gd.lib +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH "share/openMVG/cmake") +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/openMVG/image/image_test) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/openMVG/exif/image_data) +file(GLOB REMOVE_CMAKE ${CURRENT_PACKAGES_DIR}/lib/*.cmake) +file(REMOVE_RECURSE ${REMOVE_CMAKE}) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +if(OpenMVG_BUILD_SHARED) + # release + file(GLOB DLL_FILES ${CURRENT_PACKAGES_DIR}/lib/*.dll) + file(COPY ${DLL_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE_RECURSE ${DLL_FILES}) + # debug + file(GLOB DLL_FILES ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll) + file(COPY ${DLL_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) + file(REMOVE_RECURSE ${DLL_FILES}) +endif() +vcpkg_copy_pdbs() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openmvg RENAME copyright) + +# Post-build test for cmake libraries +# vcpkg_test_cmake(PACKAGE_NAME openmvg) diff --git a/ports/osi/CMakeLists.txt b/ports/osi/CMakeLists.txt new file mode 100644 index 0000000000..ab061f1697 --- /dev/null +++ b/ports/osi/CMakeLists.txt @@ -0,0 +1,112 @@ +cmake_minimum_required(VERSION 3.11) + +project(Osi LANGUAGES C CXX) + +set(PROJECT_VERSION 0.107.9) +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 107) +set(PROJECT_VERSION_PATCH 9) + +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake") +if(BUILD_SHARED_LIBS AND MSVC) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif(BUILD_SHARED_LIBS AND MSVC) +if(MSVC) + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} /bigobj /MP /wd4996 /wd4819 /wd4251 /wd4267 /wd4244 /wd4275" + ) +endif(MSVC) +if(APPLE) + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override -Wno-unused-command-line-argument -Wno-unused-result -Wno-exceptions" + ) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" + CACHE STRING "Minimum OS X deployment version") +endif(APPLE) + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +# options +option(BUILD_SHARED_LIBS "" ON) + +# +# 设置用于 install 的变量 +# +# Introduce variables: * CMAKE_INSTALL_LIBDIR * CMAKE_INSTALL_BINDIR +include(GNUInstallDirs) + +# Include module with fuction 'write_basic_package_version_file' +include(CMakePackageConfigHelpers) + +# Layout. This works for all platforms: * /lib*/cmake/ * +# /lib*/ * /include/ +set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") +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 "Coin::") + +# Packages +find_package(CoinUtils REQUIRED) + +# Add sources +include_directories(Osi/src/Osi) + +file(GLOB OSI_SOURCES Osi/src/Osi/*.hpp Osi/src/Osi/*.cpp) + +add_library(${PROJECT_NAME} ${OSI_SOURCES}) + +target_include_directories(${PROJECT_NAME} + PUBLIC $) +target_compile_definitions(${PROJECT_NAME} + PUBLIC + $ + $) +target_link_libraries(${PROJECT_NAME} PRIVATE Coin::CoinUtils) + +install(TARGETS ${PROJECT_NAME} + EXPORT "${TARGETS_EXPORT_NAME}" + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES + DESTINATION include) + +install(DIRECTORY Osi/src/Osi/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coin + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp" + PATTERN "config_default.h" EXCLUDE) + +# +# Install Libraries +# +# Configure 'ConfigVersion.cmake' Use: * PROJECT_VERSION +write_basic_package_version_file("${version_config}" + COMPATIBILITY SameMajorVersion) + +# Configure 'Config.cmake' Use variables: * TARGETS_EXPORT_NAME * +# PROJECT_NAME +configure_package_config_file("Config.cmake.in" + "${project_config}" + INSTALL_DESTINATION + "${config_install_dir}") + +# Config * /lib/cmake/Foo/FooConfig.cmake * +# /lib/cmake/Foo/FooConfigVersion.cmake +install(FILES "${project_config}" "${version_config}" + DESTINATION "${config_install_dir}") + +# Config * /lib/cmake/Foo/FooTargets.cmake +install(EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${namespace}" + DESTINATION "${config_install_dir}") diff --git a/ports/osi/CONTROL b/ports/osi/CONTROL new file mode 100644 index 0000000000..457085c68c --- /dev/null +++ b/ports/osi/CONTROL @@ -0,0 +1,4 @@ +Source: osi +Version: 0.107.9-0 +Description: Osi (Open Solver Interface) provides an abstract base class to a generic linear programming (LP) solver, along with derived classes for specific solvers. Many applications may be able to use the Osi to insulate themselves from a specific LP solver. +Build-Depends: coinutils diff --git a/ports/osi/Config.cmake.in b/ports/osi/Config.cmake.in new file mode 100644 index 0000000000..ec01d2e5bd --- /dev/null +++ b/ports/osi/Config.cmake.in @@ -0,0 +1,5 @@ + +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/ports/osi/portfile.cmake b/ports/osi/portfile.cmake new file mode 100644 index 0000000000..6cb2e1217a --- /dev/null +++ b/ports/osi/portfile.cmake @@ -0,0 +1,45 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO coin-or/Osi + REF releases/0.107.9 + SHA512 52501e2fa81ad9ec1412596b5945e11f2d5c5c91bdb148f41dad9efb8e4a033cfc2f76e389b9e546593b89ae6c7f74c32e6c5b78337c967ad0c90cd6a7183a28 +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in DESTINATION ${SOURCE_PATH}) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(BUILD_SHARED_LIBS ON) +else() + set(BUILD_SHARED_LIBS OFF) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/Osi") + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/osi RENAME copyright) + +# Post-build test for cmake libraries +# vcpkg_test_cmake(PACKAGE_NAME osi)