From 589511040be4a9726345917d3517f847157c9a43 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Wed, 16 Apr 2025 10:08:35 +0200 Subject: [PATCH 01/10] Custom vcpkg files --- vcpkg-configuration.json | 22 ++++ vcpkg.json | 88 +++++++++++++++ .../liblemon/cpp-20-adaptors.patch | 13 +++ .../liblemon/cpp-20-arraymap.patch | 106 ++++++++++++++++++ vcpkg/overlay_ports/liblemon/fix-cmake.patch | 78 +++++++++++++ vcpkg/overlay_ports/liblemon/portfile.cmake | 45 ++++++++ vcpkg/overlay_ports/liblemon/vcpkg.json | 18 +++ vcpkg/ports/vcpkg-tool-swig/portfile.cmake | 30 +++++ vcpkg/ports/vcpkg-tool-swig/vcpkg.json | 20 ++++ vcpkg/versions/baseline.json | 8 ++ vcpkg/versions/v-/vcpkg-tool-swig.json | 9 ++ 11 files changed, 437 insertions(+) create mode 100644 vcpkg-configuration.json create mode 100644 vcpkg.json create mode 100644 vcpkg/overlay_ports/liblemon/cpp-20-adaptors.patch create mode 100644 vcpkg/overlay_ports/liblemon/cpp-20-arraymap.patch create mode 100644 vcpkg/overlay_ports/liblemon/fix-cmake.patch create mode 100644 vcpkg/overlay_ports/liblemon/portfile.cmake create mode 100644 vcpkg/overlay_ports/liblemon/vcpkg.json create mode 100644 vcpkg/ports/vcpkg-tool-swig/portfile.cmake create mode 100644 vcpkg/ports/vcpkg-tool-swig/vcpkg.json create mode 100644 vcpkg/versions/baseline.json create mode 100644 vcpkg/versions/v-/vcpkg-tool-swig.json diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000000..fee071f240 --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,22 @@ +{ + "default-registry": { + "kind": "git", + "baseline": "d5182f703b51d7b258f83f94d936ac03488dcdbe", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + }, + { + "kind": "filesystem", + "path": "./vcpkg", + "packages": ["vcpkg-tool-swig"] + } + ], + "overlay-ports": [ + "vcpkg/overlay_ports" + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000000..7c51b526f3 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,88 @@ +{ + "dependencies": [ + "boost-algorithm", + "boost-accumulators", + "boost-atomic", + "boost-container", + "boost-date-time", + "boost-exception", + "boost-geometry", + "boost-graph", + "boost-json", + "boost-log", + "boost-program-options", + "boost-property-tree", + "boost-ptr-container", + "boost-regex", + "boost-serialization", + "boost-system", + "boost-test", + "boost-thread", + "boost-timer", + "boost-format", + "libe57format", + "assimp", + "openexr", + "alembic", + "geogram", + "eigen3", + "expat", + "flann", + "nanoflann", + "onnxruntime-gpu", + "openmesh", + "tbb", + "cuda", + "liblemon", + "clp", + "coinutils", + "osi", + { + "name":"openimageio", + "features": ["opencolorio","libraw","gif","openjpeg"] + }, + { + "name":"ceres", + "features": ["suitesparse"] + }, + { + "name": "opencv", + "features": ["eigen", "ffmpeg", "contrib", "nonfree", "cuda"], + "default-features": false + } + ], + "overrides": [ + { + "name": "openimageio", + "version": "2.5.16.0" + }, + { + "name": "suitesparse", + "version": "5.8.0" + }, + { + "name": "opencv", + "version": "4.10.0#0" + }, + { + "name": "liblemon", + "version": "2019-06-13#10" + }, + { + "name": "clp", + "version": "1.17.6#1" + }, + { + "name": "osi", + "version": "0.108.6#1" + }, + { + "name": "coinutils", + "version": "2.11.4#1" + }, + { + "name": "ceres", + "version": "2.2.0#0" + } + ] +} diff --git a/vcpkg/overlay_ports/liblemon/cpp-20-adaptors.patch b/vcpkg/overlay_ports/liblemon/cpp-20-adaptors.patch new file mode 100644 index 0000000000..22f630b4bd --- /dev/null +++ b/vcpkg/overlay_ports/liblemon/cpp-20-adaptors.patch @@ -0,0 +1,13 @@ +diff --git a/lemon/adaptors.h b/lemon/adaptors.h +index 1a40f8e..ffeb12d 100644 +--- a/lemon/adaptors.h ++++ b/lemon/adaptors.h +@@ -37,7 +37,7 @@ + + namespace lemon { + +-#ifdef _MSC_VER ++#if defined _MSC_VER and __cplusplus < 202002L + #define LEMON_SCOPE_FIX(OUTER, NESTED) OUTER::NESTED + #else + #define LEMON_SCOPE_FIX(OUTER, NESTED) typename OUTER::template NESTED diff --git a/vcpkg/overlay_ports/liblemon/cpp-20-arraymap.patch b/vcpkg/overlay_ports/liblemon/cpp-20-arraymap.patch new file mode 100644 index 0000000000..8c640a7c5b --- /dev/null +++ b/vcpkg/overlay_ports/liblemon/cpp-20-arraymap.patch @@ -0,0 +1,106 @@ +diff --git a/lemon/bits/array_map.h b/lemon/bits/array_map.h +index 355ee00..c3992cf 100644 +--- a/lemon/bits/array_map.h ++++ b/lemon/bits/array_map.h +@@ -88,7 +88,7 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; +- allocator.construct(&(values[id]), Value()); ++ std::allocator_traits::construct(allocator, &(values[id]), Value()); + } + } + +@@ -102,7 +102,7 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; +- allocator.construct(&(values[id]), value); ++ std::allocator_traits::construct(allocator, &(values[id]), value); + } + } + +@@ -121,7 +121,7 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; +- allocator.construct(&(values[id]), copy.values[id]); ++ std::allocator_traits::construct(allocator, &(values[id]), copy.values[id]); + } + } + +@@ -218,15 +218,15 @@ namespace lemon { + for (nf->first(it); it != INVALID; nf->next(it)) { + int jd = nf->id(it);; + if (id != jd) { +- allocator.construct(&(new_values[jd]), values[jd]); +- allocator.destroy(&(values[jd])); ++ std::allocator_traits::construct(allocator, &(new_values[jd]), values[jd]); ++ std::allocator_traits::destroy(allocator, &(values[jd])); + } + } + if (capacity != 0) allocator.deallocate(values, capacity); + values = new_values; + capacity = new_capacity; + } +- allocator.construct(&(values[id]), Value()); ++ std::allocator_traits::construct(allocator, &(values[id]), Value()); + } + + // \brief Adds more new keys to the map. +@@ -260,8 +260,8 @@ namespace lemon { + } + } + if (found) continue; +- allocator.construct(&(new_values[id]), values[id]); +- allocator.destroy(&(values[id])); ++ std::allocator_traits::construct(allocator, &(new_values[id]), values[id]); ++ std::allocator_traits::destroy(allocator, &(values[id])); + } + if (capacity != 0) allocator.deallocate(values, capacity); + values = new_values; +@@ -269,7 +269,7 @@ namespace lemon { + } + for (int i = 0; i < int(keys.size()); ++i) { + int id = nf->id(keys[i]); +- allocator.construct(&(values[id]), Value()); ++ std::allocator_traits::construct(allocator, &(values[id]), Value()); + } + } + +@@ -279,7 +279,7 @@ namespace lemon { + // and it overrides the erase() member function of the observer base. + virtual void erase(const Key& key) { + int id = Parent::notifier()->id(key); +- allocator.destroy(&(values[id])); ++ std::allocator_traits::destroy(allocator, &(values[id])); + } + + // \brief Erase more keys from the map. +@@ -289,7 +289,7 @@ namespace lemon { + virtual void erase(const std::vector& keys) { + for (int i = 0; i < int(keys.size()); ++i) { + int id = Parent::notifier()->id(keys[i]); +- allocator.destroy(&(values[id])); ++ std::allocator_traits::destroy(allocator, &(values[id])); + } + } + +@@ -303,7 +303,7 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; +- allocator.construct(&(values[id]), Value()); ++ std::allocator_traits::construct(allocator, &(values[id]), Value()); + } + } + +@@ -317,7 +317,7 @@ namespace lemon { + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it); +- allocator.destroy(&(values[id])); ++ std::allocator_traits::destroy(allocator, &(values[id])); + } + allocator.deallocate(values, capacity); + capacity = 0; diff --git a/vcpkg/overlay_ports/liblemon/fix-cmake.patch b/vcpkg/overlay_ports/liblemon/fix-cmake.patch new file mode 100644 index 0000000000..17717295b7 --- /dev/null +++ b/vcpkg/overlay_ports/liblemon/fix-cmake.patch @@ -0,0 +1,78 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4406bc2..5717680 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -295,7 +295,7 @@ CONFIGURE_FILE( + ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + @ONLY + ) +-IF(UNIX) ++IF(UNIX OR TRUE) + INSTALL( + FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + DESTINATION share/lemon/cmake +@@ -307,6 +307,13 @@ ELSEIF(WIN32) + ) + ENDIF() + ++install( ++ EXPORT lemon-targets ++ FILE lemon-targets.cmake ++ NAMESPACE unofficial::lemon:: ++ DESTINATION share/lemon/cmake ++) ++ + CONFIGURE_FILE( + ${PROJECT_SOURCE_DIR}/cmake/version.cmake.in + ${PROJECT_BINARY_DIR}/cmake/version.cmake +diff --git a/cmake/LEMONConfig.cmake.in b/cmake/LEMONConfig.cmake.in +index b0d2d8b..6bb662a 100644 +--- a/cmake/LEMONConfig.cmake.in ++++ b/cmake/LEMONConfig.cmake.in +@@ -1,4 +1,4 @@ +-SET(LEMON_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" CACHE PATH "LEMON include directory") ++SET(LEMON_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../include" CACHE PATH "LEMON include directory") + SET(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}") + + IF(UNIX) +@@ -7,7 +7,12 @@ ELSEIF(WIN32) + SET(LEMON_LIB_NAME "lemon.lib") + ENDIF(UNIX) + +-SET(LEMON_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" CACHE FILEPATH "LEMON library") ++SET(LEMON_LIBRARY ++ optimized "${CMAKE_CURRENT_LIST_DIR}/../../lib/${LEMON_LIB_NAME}" ++ debug "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib/${LEMON_LIB_NAME}" ++ CACHE FILEPATH "LEMON library") + SET(LEMON_LIBRARIES "${LEMON_LIBRARY}") + + MARK_AS_ADVANCED(LEMON_LIBRARY LEMON_INCLUDE_DIR) ++ ++INCLUDE(${CMAKE_CURRENT_LIST_DIR}/lemon-targets.cmake) +diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt +index 4e6567e..ad6f5bf 100644 +--- a/lemon/CMakeLists.txt ++++ b/lemon/CMakeLists.txt +@@ -56,6 +56,10 @@ ENDIF() + + ADD_LIBRARY(lemon ${LEMON_SOURCES}) + ++INCLUDE(GNUInstallDirs) ++ ++TARGET_INCLUDE_DIRECTORIES(lemon PUBLIC $) ++ + TARGET_LINK_LIBRARIES(lemon + ${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES} + ) +@@ -71,6 +75,11 @@ INSTALL( + COMPONENT library + ) + ++install(TARGETS lemon EXPORT lemon-targets ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++) ++ + INSTALL( + DIRECTORY . bits concepts + DESTINATION include/lemon diff --git a/vcpkg/overlay_ports/liblemon/portfile.cmake b/vcpkg/overlay_ports/liblemon/portfile.cmake new file mode 100644 index 0000000000..9b47d0e9f0 --- /dev/null +++ b/vcpkg/overlay_ports/liblemon/portfile.cmake @@ -0,0 +1,45 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +set(VERSION ed2c21cbd6ef) + +vcpkg_download_distfile(ARCHIVE + URLS "http://lemon.cs.elte.hu/hg/lemon/archive/${VERSION}.zip" + FILENAME "lemon-${VERSION}.zip" + SHA512 029640e4f791a18068cb2e2b4e794d09822d9d56fb957eb3e2cceae3a30065c0041a31c465637cfcadf7b2473564070b34adc88513439cdf9046831854e2aa70 +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE "${ARCHIVE}" + SOURCE_BASE "${VERSION}" + PATCHES + fix-cmake.patch + cpp-20-arraymap.patch + cpp-20-adaptors.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DLEMON_ENABLE_GLPK=OFF + -DLEMON_ENABLE_ILOG=OFF + -DLEMON_ENABLE_COIN=OFF + -DLEMON_ENABLE_SOPLEX=OFF +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup(CONFIG_PATH share/lemon/cmake PACKAGE_NAME lemon) + +vcpkg_fixup_pkgconfig() + +file(GLOB EXE "${CURRENT_PACKAGES_DIR}/bin/*.exe") +file(COPY ${EXE} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/liblemon/") +vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/liblemon") + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/doc") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/overlay_ports/liblemon/vcpkg.json b/vcpkg/overlay_ports/liblemon/vcpkg.json new file mode 100644 index 0000000000..02b40ba099 --- /dev/null +++ b/vcpkg/overlay_ports/liblemon/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "liblemon", + "version-date": "2019-06-13", + "port-version": 10, + "description": "Library for Efficient Modeling and Optimization in Networks", + "homepage": "https://lemon.cs.elte.hu/trac/lemon", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/vcpkg/ports/vcpkg-tool-swig/portfile.cmake b/vcpkg/ports/vcpkg-tool-swig/portfile.cmake new file mode 100644 index 0000000000..e0292c7e83 --- /dev/null +++ b/vcpkg/ports/vcpkg-tool-swig/portfile.cmake @@ -0,0 +1,30 @@ +set(VCPKG_BUILD_TYPE "release") +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO swig/swig + REF "v${VERSION}" + SHA512 0a9bdcc4a28f1374f9e564fdb372f684bd277bf7b590491218c3538c230bcacd8de32365717a37cf5d7d02165dec9f3955e1bb1207181885fb5b7fbc7476ff04 + HEAD_REF master +) + +vcpkg_find_acquire_program(BISON) +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DBISON_EXECUTABLE=${BISON}" +) + +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() + +vcpkg_copy_tools( + TOOL_NAMES swig + DESTINATION "${CURRENT_PACKAGES_DIR}/tools/swig" +) + +file(COPY "${CURRENT_PACKAGES_DIR}/bin/" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/swig") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/ports/vcpkg-tool-swig/vcpkg.json b/vcpkg/ports/vcpkg-tool-swig/vcpkg.json new file mode 100644 index 0000000000..b2e7b226c0 --- /dev/null +++ b/vcpkg/ports/vcpkg-tool-swig/vcpkg.json @@ -0,0 +1,20 @@ +{ + "name": "vcpkg-tool-swig", + "version": "4.3.0", + "port-version": 0, + "description": "A software development tool that connects programs written in C and C++ with a variety of high-level programming languages.", + "homepage": "https://www.swig.org/", + "license": "GPL-3.0-only", + "supports": "!uwp", + "dependencies": [ + "pcre2", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/vcpkg/versions/baseline.json b/vcpkg/versions/baseline.json new file mode 100644 index 0000000000..837d28c4f3 --- /dev/null +++ b/vcpkg/versions/baseline.json @@ -0,0 +1,8 @@ +{ + "default": { + "vcpkg-tool-swig": { + "baseline": "4.3.0", + "port-version": 0 + } + } +} diff --git a/vcpkg/versions/v-/vcpkg-tool-swig.json b/vcpkg/versions/v-/vcpkg-tool-swig.json new file mode 100644 index 0000000000..264e15c14c --- /dev/null +++ b/vcpkg/versions/v-/vcpkg-tool-swig.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "version": "4.3.0", + "port-version": 0, + "path": "$/ports/vcpkg-tool-swig" + } + ] +} From af0246715ea159e3809cd0001ab848171ab0a380 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Tue, 22 Apr 2025 16:29:07 +0200 Subject: [PATCH 02/10] enable swig in vcpkg --- .gitignore | 3 +++ vcpkg.json | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index ab4a5fc213..28a0ac85c1 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,6 @@ Production **/.vscode **/.vs + +#vcpkg +vcpkg_installed \ No newline at end of file diff --git a/vcpkg.json b/vcpkg.json index 7c51b526f3..836c63581f 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -37,6 +37,8 @@ "clp", "coinutils", "osi", + "vcpkg-tool-swig", + "python3", { "name":"openimageio", "features": ["opencolorio","libraw","gif","openjpeg"] From c0a571aa470874c68a11494ba60a27b81c8512a7 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Fri, 25 Apr 2025 13:56:44 +0200 Subject: [PATCH 03/10] Python is removed --- vcpkg.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vcpkg.json b/vcpkg.json index 836c63581f..06ed73cd70 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -38,7 +38,6 @@ "coinutils", "osi", "vcpkg-tool-swig", - "python3", { "name":"openimageio", "features": ["opencolorio","libraw","gif","openjpeg"] @@ -51,7 +50,7 @@ "name": "opencv", "features": ["eigen", "ffmpeg", "contrib", "nonfree", "cuda"], "default-features": false - } + } ], "overrides": [ { From 6fb0a10b7c22450d9d65da6175bc4f25d968f1de Mon Sep 17 00:00:00 2001 From: fabien servant Date: Fri, 25 Apr 2025 14:31:40 +0200 Subject: [PATCH 04/10] Updating vcpkg doc --- INSTALL.md | 65 +++++++++++++----------------------------------------- 1 file changed, 15 insertions(+), 50 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 4c47b0f709..3b59a676ca 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -70,68 +70,33 @@ In the scope of AliceVision, vcpkg has only been tested on Windows. 1. Install vcpkg -See the reference [installation guide](https://github.com/alicevision/vcpkg/blob/alicevision_master/README.md#quick-start-windows) to setup vcpkg. -We recommend to use our vcpkg fork, where dependencies have been validated by the AliceVision development team and where some ports may have some custom changes. ```bash -git clone https://github.com/alicevision/vcpkg --branch alicevision_master +git clone https://github.com/microsoft/vcpkg cd vcpkg .\bootstrap-vcpkg.bat ``` -2. Build the required dependencies -```bash -cd -set VCPKG_ROOT=%cd% - -vcpkg install ^ - boost-algorithm boost-accumulators boost-atomic boost-container boost-date-time boost-exception ^ - boost-geometry boost-graph boost-json boost-log boost-program-options boost-property-tree ^ - boost-ptr-container boost-regex boost-serialization boost-system boost-test boost-thread boost-timer ^ - boost-format ^ - lz4 ^ - liblemon ^ - openexr ^ - alembic ^ - geogram ^ - eigen3 ^ - expat ^ - flann nanoflann ^ - onnxruntime-gpu ^ - opencv[eigen,ffmpeg,webp,contrib,nonfree,cuda] ^ - openimageio[opencolorio,pybind11,libraw,ffmpeg,freetype,opencv,gif,openjpeg,webp] ^ - openmesh ^ - ceres[suitesparse,cxsparse] ^ - cuda ^ - tbb ^ - assimp ^ - pcl ^ - clp ^ - libe57format ^ - vcpkg-tool-swig ^ - --triplet x64-windows - -%VCPKG_ROOT%/installed/x64-windows/tools/python3/python -m ensurepip --upgrade -%VCPKG_ROOT%/installed/x64-windows/tools/python3/python -m pip install numpy -``` +2. Build -3. Build AliceVision -```bash -# With VCPKG_ROOT being the path to the root of vcpkg installation -cd /path/to/aliceVision/ -mkdir build && cd build +* Open "x64 Native Tools command Prompt for VS 2022" shipped with Visual studio 2022 +* Move to the aliceVision root directory +* Build the dependencies and generate the solution for building (This command may take a long time the first time as it is building and installing all the required dependencies from sources.) -# Windows: Visual 2022 + Powershell -cmake .. -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT"\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -G "Visual Studio 17 2022" -A x64 -T host=x64 +```bash +cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=c:\path_to_vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_INSTALL_PREFIX=c:\path_to_install -DVCPKG_TARGET_TRIPLET=x64-windows-release -G "Visual Studio 17 2022" -A x64 -T host=x64 -DALICEVISION_BUILD_SWIG_BINDING=ON -DALICEVISION_USE_OPENCV=OFF -DPython3_EXECUTABLE=c:\path_to_python\python.exe +``` -# Windows: Visual 2022 -cmake .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -G "Visual Studio 17 2022" -A x64 -T host=x64 +* Effectively build AliceVision and install it to `c:\path_to_install` -# Windows: Visual 2017 -cmake .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -G "Visual Studio 15 2017" -A x64 -T host=x64 +```bash +cmake --build build --config Release -t INSTALL ``` -This generates a "aliceVision.sln" solution inside the build folder that you can open in Visual Studio to launch the build. Do not forget to switch the build type to "Release". +* Generate the bundle with all the dependencies in the same directory +```bash +cmake --build build --config Release -t bundle +``` Building the project with embedded dependencies (recommended on linux) ----------------------------------------------- From d0312610928e6d85c41cf577761c04e9ed3e7491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 28 Apr 2025 19:18:16 +0200 Subject: [PATCH 05/10] [ci] Update Windows workflow to rely on vcpkg manifest --- .github/workflows/continuous-integration.yml | 32 +++++--------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7b95cd3e20..117d16704a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -182,7 +182,7 @@ jobs: # Uses a specific version of vcpkg run: | cd .. - git clone https://github.com/alicevision/vcpkg.git + git clone https://github.com/microsoft/vcpkg.git cd vcpkg cd ${{ github.workspace }} @@ -190,26 +190,6 @@ jobs: run: | ${{ env.vcpkgDir }}\bootstrap-vcpkg.bat - - name: vcpkg - Download zip file with prebuilt binaries - uses: suisei-cn/actions-download-file@v1.3.0 - id: vcpkgDownload - with: - url: "https://github.com/alicevision/vcpkg/releases/download/2025.03.11/aliceVisionDeps-2025.03.11.zip" - target: "${{ env.vcpkgDir }}" - filename: installed.zip - - - name: vcpkg - Unzip prebuilt binaries - run: | - tar -xvzf "${{ env.vcpkgArchive }}" -C "${{ env.vcpkgDir }}" - - - name: vcpkg - Display installed packages - run: | - ${{ env.vcpkgDir }}\vcpkg list - - - name: vcpkg - Remove zip file with prebuilt binaries - run: | - rm ${{ env.vcpkgArchive }} - - name: Get CUDA Toolkit uses: Jimver/cuda-toolkit@v0.2.21 id: cuda-toolkit @@ -223,13 +203,17 @@ jobs: nvcc -V echo ${{ env.CUDA_PATH }} - # Install latest CMake. - - uses: lukka/get-cmake@latest + # # Install latest CMake. + # - uses: lukka/get-cmake@latest - name: Display remaining disk space (16 Go max) run: | Get-CimInstance -Class Win32_logicaldisk + - name: vcpkg install + run: | + ${{ env.VCPKG_ROOT }}\vcpkg install --triplet x64-windows-release + - name: Build uses: lukka/run-cmake@v3 with: @@ -238,7 +222,7 @@ jobs: buildDirectory: ${{ env.buildDir }} buildWithCMakeArgs: '--config Release --target install' cmakeAppendedArgs: -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}\scripts\buildsystems\vcpkg.cmake - -DVCPKG_TARGET_TRIPLET=x64-windows + -DVCPKG_TARGET_TRIPLET=x64-windows-release -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -A x64 -T host=x64 -DBUILD_SHARED_LIBS=ON From 31b15158dc4f0f336ddb7653ab9181a0382e0901 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Tue, 29 Apr 2025 08:41:31 +0200 Subject: [PATCH 06/10] Add lemon patch --- .../liblemon/fix-cmake-version.patch | 19 +++++++++++++++++++ vcpkg/overlay_ports/liblemon/portfile.cmake | 1 + 2 files changed, 20 insertions(+) create mode 100644 vcpkg/overlay_ports/liblemon/fix-cmake-version.patch diff --git a/vcpkg/overlay_ports/liblemon/fix-cmake-version.patch b/vcpkg/overlay_ports/liblemon/fix-cmake-version.patch new file mode 100644 index 0000000000..f9d7b3fdaa --- /dev/null +++ b/vcpkg/overlay_ports/liblemon/fix-cmake-version.patch @@ -0,0 +1,19 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4406bc2..d89120b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,13 +1,4 @@ +-CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +- +-IF(POLICY CMP0048) +- CMAKE_POLICY(SET CMP0048 OLD) +-ENDIF(POLICY CMP0048) +- +-IF(POLICY CMP0026) +- #This is for copying the dll's needed by glpk (in lp_test and mip_test) +- CMAKE_POLICY(SET CMP0026 OLD) +-ENDIF(POLICY CMP0026) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.10) + + SET(PROJECT_NAME "LEMON") + PROJECT(${PROJECT_NAME}) diff --git a/vcpkg/overlay_ports/liblemon/portfile.cmake b/vcpkg/overlay_ports/liblemon/portfile.cmake index 9b47d0e9f0..aabea98314 100644 --- a/vcpkg/overlay_ports/liblemon/portfile.cmake +++ b/vcpkg/overlay_ports/liblemon/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_extract_source_archive( SOURCE_BASE "${VERSION}" PATCHES fix-cmake.patch + fix-cmake-version.patch cpp-20-arraymap.patch cpp-20-adaptors.patch ) From 0a00ed52937d02c5c0ce89ba461e8bd04a229c2a Mon Sep 17 00:00:00 2001 From: fabien servant Date: Tue, 29 Apr 2025 10:52:26 +0200 Subject: [PATCH 07/10] remove numpy --- src/CMakeLists.txt | 2 +- src/aliceVision/CMakeLists.txt | 1 - src/aliceVision/camera/CMakeLists.txt | 1 - src/aliceVision/geometry/CMakeLists.txt | 1 - src/aliceVision/hdr/CMakeLists.txt | 1 - src/aliceVision/numeric/CMakeLists.txt | 1 - src/aliceVision/sensorDB/CMakeLists.txt | 1 - src/aliceVision/sfmData/CMakeLists.txt | 1 - src/aliceVision/sfmDataIO/CMakeLists.txt | 1 - src/aliceVision/stl/CMakeLists.txt | 1 - 10 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9d01fb82ed..de6c557a00 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -781,7 +781,7 @@ if (ALICEVISION_BUILD_SWIG_BINDING) message(SEND_ERROR "Failed to find SWIG.") endif() - find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module NumPy) # Python dependencies + find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) # Python dependencies endif() diff --git a/src/aliceVision/CMakeLists.txt b/src/aliceVision/CMakeLists.txt index 52fd0b8e46..009fe33d4d 100644 --- a/src/aliceVision/CMakeLists.txt +++ b/src/aliceVision/CMakeLists.txt @@ -90,7 +90,6 @@ if (ALICEVISION_BUILD_SWIG_BINDING) ../include ${ALICEVISION_ROOT}/include ${Python3_INCLUDE_DIRS} - ${Python3_NumPy_INCLUDE_DIRS} ) endif() diff --git a/src/aliceVision/camera/CMakeLists.txt b/src/aliceVision/camera/CMakeLists.txt index 7638d53d8c..7e1252b288 100644 --- a/src/aliceVision/camera/CMakeLists.txt +++ b/src/aliceVision/camera/CMakeLists.txt @@ -70,6 +70,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING) ../include ${ALICEVISION_ROOT}/include ${Python3_INCLUDE_DIRS} - ${Python3_NumPy_INCLUDE_DIRS} ) endif() \ No newline at end of file diff --git a/src/aliceVision/geometry/CMakeLists.txt b/src/aliceVision/geometry/CMakeLists.txt index 237be837f8..db14315638 100644 --- a/src/aliceVision/geometry/CMakeLists.txt +++ b/src/aliceVision/geometry/CMakeLists.txt @@ -47,6 +47,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING) ../include ${ALICEVISION_ROOT}/include ${Python3_INCLUDE_DIRS} - ${Python3_NumPy_INCLUDE_DIRS} ) endif() \ No newline at end of file diff --git a/src/aliceVision/hdr/CMakeLists.txt b/src/aliceVision/hdr/CMakeLists.txt index ca6ebc354e..e6d3e54835 100644 --- a/src/aliceVision/hdr/CMakeLists.txt +++ b/src/aliceVision/hdr/CMakeLists.txt @@ -67,6 +67,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING) ../include ${ALICEVISION_ROOT}/include ${Python3_INCLUDE_DIRS} - ${Python3_NumPy_INCLUDE_DIRS} ) endif() \ No newline at end of file diff --git a/src/aliceVision/numeric/CMakeLists.txt b/src/aliceVision/numeric/CMakeLists.txt index c9829e8c71..b54869f3fe 100644 --- a/src/aliceVision/numeric/CMakeLists.txt +++ b/src/aliceVision/numeric/CMakeLists.txt @@ -61,6 +61,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING) ../include ${ALICEVISION_ROOT}/include ${Python3_INCLUDE_DIRS} - ${Python3_NumPy_INCLUDE_DIRS} ) endif() diff --git a/src/aliceVision/sensorDB/CMakeLists.txt b/src/aliceVision/sensorDB/CMakeLists.txt index 4352860ce7..46d70f6ebc 100644 --- a/src/aliceVision/sensorDB/CMakeLists.txt +++ b/src/aliceVision/sensorDB/CMakeLists.txt @@ -38,6 +38,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING) ../include ${ALICEVISION_ROOT}/include ${Python3_INCLUDE_DIRS} - ${Python3_NumPy_INCLUDE_DIRS} ) endif() diff --git a/src/aliceVision/sfmData/CMakeLists.txt b/src/aliceVision/sfmData/CMakeLists.txt index 37096ff57a..9fb987c09c 100644 --- a/src/aliceVision/sfmData/CMakeLists.txt +++ b/src/aliceVision/sfmData/CMakeLists.txt @@ -66,6 +66,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING) ../include ${ALICEVISION_ROOT}/include ${Python3_INCLUDE_DIRS} - ${Python3_NumPy_INCLUDE_DIRS} ) endif() diff --git a/src/aliceVision/sfmDataIO/CMakeLists.txt b/src/aliceVision/sfmDataIO/CMakeLists.txt index 07cd600a24..886c69ed50 100644 --- a/src/aliceVision/sfmDataIO/CMakeLists.txt +++ b/src/aliceVision/sfmDataIO/CMakeLists.txt @@ -121,6 +121,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING) ../include ${ALICEVISION_ROOT}/include ${Python3_INCLUDE_DIRS} - ${Python3_NumPy_INCLUDE_DIRS} ) endif() diff --git a/src/aliceVision/stl/CMakeLists.txt b/src/aliceVision/stl/CMakeLists.txt index 9487a240f1..cc6df8f60a 100644 --- a/src/aliceVision/stl/CMakeLists.txt +++ b/src/aliceVision/stl/CMakeLists.txt @@ -30,6 +30,5 @@ if (ALICEVISION_BUILD_SWIG_BINDING) ../include ${ALICEVISION_ROOT}/include ${Python3_INCLUDE_DIRS} - ${Python3_NumPy_INCLUDE_DIRS} ) endif() From a40d09a24d4c0126d894a29c0f07890980d04478 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Tue, 29 Apr 2025 15:24:40 +0200 Subject: [PATCH 08/10] remove ffmpeg --- vcpkg.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vcpkg.json b/vcpkg.json index 06ed73cd70..a765133d8b 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -40,7 +40,8 @@ "vcpkg-tool-swig", { "name":"openimageio", - "features": ["opencolorio","libraw","gif","openjpeg"] + "features": ["opencolorio","libraw","gif","openjpeg"], + "default-features": false }, { "name":"ceres", @@ -48,7 +49,7 @@ }, { "name": "opencv", - "features": ["eigen", "ffmpeg", "contrib", "nonfree", "cuda"], + "features": ["eigen", "contrib", "nonfree", "cuda"], "default-features": false } ], From 3aeb7b3037e92dd2a1aca693bd96bb651924f8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Wed, 30 Apr 2025 10:11:42 +0200 Subject: [PATCH 09/10] [ci] Windows: Install pytest with the system's Python instead of vcpkg's --- .github/workflows/continuous-integration.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 117d16704a..dde718eae9 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -203,9 +203,6 @@ jobs: nvcc -V echo ${{ env.CUDA_PATH }} - # # Install latest CMake. - # - uses: lukka/get-cmake@latest - - name: Display remaining disk space (16 Go max) run: | Get-CimInstance -Class Win32_logicaldisk @@ -257,7 +254,9 @@ jobs: - name: Python Binding - Unit Tests run: | - ${{ env.VCPKG_ROOT }}\installed\x64-windows\tools\python3\python -m pytest ./pyTests + set PYTHONPATH=${{ env.ALICEVISION_ROOT }}/install/bundle/bin + pip install pytest + pytest ./pyTests - name: Unit Tests uses: lukka/run-cmake@v3 From 12fb0326ec17d7e37352a6c846cbd2c7166ee33e Mon Sep 17 00:00:00 2001 From: Fabien Servant <100348063+servantftransperfect@users.noreply.github.com> Date: Thu, 1 May 2025 12:29:09 +0200 Subject: [PATCH 10/10] Update continuous-integration.yml --- .github/workflows/continuous-integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index dde718eae9..25dee8d32c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -255,6 +255,7 @@ jobs: - name: Python Binding - Unit Tests run: | set PYTHONPATH=${{ env.ALICEVISION_ROOT }}/install/bundle/bin + set PATH=${{ env.ALICEVISION_ROOT }}/install/bundle/bin;${{ env.PATH }} pip install pytest pytest ./pyTests