diff --git a/.github/workflows/build-test-linux-vcpkg.yml b/.github/workflows/build-test-linux-vcpkg.yml index 2d7c4e7313e9..3ee053e0d07a 100644 --- a/.github/workflows/build-test-linux-vcpkg.yml +++ b/.github/workflows/build-test-linux-vcpkg.yml @@ -118,10 +118,7 @@ jobs: git submodule update --init --depth 1 \ thirdparty/imgui \ thirdparty/mrbind-pybind11 \ - thirdparty/mrbind \ - thirdparty/fastmcpp \ - thirdparty/nlohmann-json \ - thirdparty/cpp-httplib + thirdparty/mrbind # mrbind needs deps/cppdecl; recurse only there git -C thirdparty/mrbind submodule update --init --depth 1 deps/cppdecl diff --git a/.github/workflows/build-test-windows.yml b/.github/workflows/build-test-windows.yml index f3c4e983a4fa..2f67dcdd31f5 100644 --- a/.github/workflows/build-test-windows.yml +++ b/.github/workflows/build-test-windows.yml @@ -116,6 +116,11 @@ jobs: aws-region: us-east-1 retry-max-attempts: 5 + - name: Enable VS2019 toolset for vcpkg + if: ${{ matrix.cxx_compiler == 'msvc-2019' }} + run: | + (Get-Content thirdparty\vcpkg\triplets\x64-windows-meshlib.cmake) -Replace '^#vs2019toolset#', '' | Set-Content thirdparty\vcpkg\triplets\x64-windows-meshlib.cmake + - name: Update vcpkg packages run: | .\thirdparty\install.bat --write-s3 --use-s3-asset-provider diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ec5b76b7a73..15aeb57da557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,9 +58,6 @@ option(MESHLIB_BUILD_GENERATED_C_BINDINGS "Build C bindings (assuming they are a option(MESHLIB_BUILD_MRCUDA "Build MRCuda library" ON) option(MESHLIB_EXPERIMENTAL_HIP "(experimental) Use HIP toolkit for MRCuda library" OFF) -IF(MR_EMSCRIPTEN) - set(MESHLIB_BUILD_MCP OFF) -ENDIF() IF(MR_EMSCRIPTEN OR APPLE) set(MESHLIB_BUILD_MRCUDA OFF) ENDIF() @@ -76,6 +73,7 @@ IF(MR_EMSCRIPTEN) set(MESHLIB_PYTHON_SUPPORT OFF) set(MESHLIB_BUILD_PYTHON_MODULES OFF) set(MESHLIB_BUILD_MESHCONV OFF) + set(MESHLIB_BUILD_MCP OFF) ENDIF() # Python modules are incompatible with _ITERATOR_DEBUG_LEVEL=2 because the diff --git a/docker/rockylinux8-vcpkgDockerfile b/docker/rockylinux8-vcpkgDockerfile index b096d6d8f750..3caadf8e3122 100644 --- a/docker/rockylinux8-vcpkgDockerfile +++ b/docker/rockylinux8-vcpkgDockerfile @@ -27,6 +27,11 @@ RUN python3.12 -m venv venv && \ source venv/bin/activate && \ pip install jinja2 +COPY requirements/vcpkg-linux.txt MeshLib/requirements.txt +COPY thirdparty/vcpkg/ports MeshLib/ports +COPY thirdparty/vcpkg/triplets MeshLib/triplets +COPY scripts/retry.sh /usr/local/bin/retry.sh + ARG VCPKG_VERSION ENV VCPKG_VERSION=$VCPKG_VERSION RUN git clone https://github.com/microsoft/vcpkg.git --branch $VCPKG_VERSION --single-branch && \ @@ -40,19 +45,14 @@ RUN sed -i 's|https://ftp.gnu.org/|https://www.mirrorservice.org/sites/ftp.gnu.o sed -i 's|https://ftp.gnu.org/|https://www.mirrorservice.org/sites/ftp.gnu.org/|' ports/gettext/portfile.cmake # build vcpkg packages -COPY requirements/vcpkg-linux.txt MeshLib/requirements.txt -COPY thirdparty/vcpkg/ports MeshLib/ports -COPY thirdparty/vcpkg/triplets MeshLib/triplets -COPY scripts/retry.sh /usr/local/bin/retry.sh - ARG VCPKG_TRIPLET ENV VCPKG_TRIPLET=$VCPKG_TRIPLET RUN source /opt/rh/gcc-toolset-11/enable && \ source /opt/autoconf27/enable && \ source /root/venv/bin/activate && \ $(: network may flake ) \ - retry.sh -- ./vcpkg install --host-triplet=${VCPKG_TRIPLET} --overlay-triplets=MeshLib/triplets --overlay-ports=MeshLib/ports $(cat MeshLib/requirements.txt | tr '\n' ' ') -RUN ./vcpkg export --host-triplet=${VCPKG_TRIPLET} --overlay-triplets=MeshLib/triplets --x-all-installed --raw --output=vcpkg --output-dir=/opt + retry.sh -- ./vcpkg install --host-triplet=${VCPKG_TRIPLET} --overlay-triplets=../MeshLib/triplets --overlay-ports=../MeshLib/ports $(cat ../MeshLib/requirements.txt | tr '\n' ' ') +RUN ./vcpkg export --host-triplet=${VCPKG_TRIPLET} --overlay-triplets=../MeshLib/triplets --x-all-installed --raw --output=vcpkg --output-dir=/opt FROM nvidia/cuda:12.0.1-devel-rockylinux8 AS production diff --git a/docker/rockylinux9-vcpkgDockerfile b/docker/rockylinux9-vcpkgDockerfile index 56b364d4df70..88e4dd42e50e 100644 --- a/docker/rockylinux9-vcpkgDockerfile +++ b/docker/rockylinux9-vcpkgDockerfile @@ -16,6 +16,11 @@ RUN echo "install_weak_deps=false" >> /etc/dnf/dnf.conf && \ WORKDIR /root +COPY requirements/vcpkg-linux.txt MeshLib/requirements.txt +COPY thirdparty/vcpkg/ports MeshLib/ports +COPY thirdparty/vcpkg/triplets MeshLib/triplets +COPY scripts/retry.sh /usr/local/bin/retry.sh + ARG VCPKG_VERSION ENV VCPKG_VERSION=$VCPKG_VERSION RUN git clone https://github.com/microsoft/vcpkg.git --branch $VCPKG_VERSION --single-branch && \ @@ -29,17 +34,12 @@ RUN sed -i 's|https://ftp.gnu.org/|https://www.mirrorservice.org/sites/ftp.gnu.o sed -i 's|https://ftp.gnu.org/|https://www.mirrorservice.org/sites/ftp.gnu.org/|' ports/gettext/portfile.cmake # build vcpkg packages -COPY requirements/vcpkg-linux.txt MeshLib/requirements.txt -COPY thirdparty/vcpkg/ports MeshLib/ports -COPY thirdparty/vcpkg/triplets MeshLib/triplets -COPY scripts/retry.sh /usr/local/bin/retry.sh - ARG VCPKG_TRIPLET ENV VCPKG_TRIPLET=$VCPKG_TRIPLET RUN source /opt/rh/autoconf271/enable && \ $(: network may flake ) \ - retry.sh -- ./vcpkg install --host-triplet=${VCPKG_TRIPLET} --overlay-triplets=MeshLib/triplets --overlay-ports=MeshLib/ports $(cat MeshLib/requirements.txt | tr '\n' ' ') -RUN ./vcpkg export --host-triplet=${VCPKG_TRIPLET} --overlay-triplets=MeshLib/triplets --x-all-installed --raw --output=vcpkg --output-dir=/opt + retry.sh -- ./vcpkg install --host-triplet=${VCPKG_TRIPLET} --overlay-triplets=../MeshLib/triplets --overlay-ports=../MeshLib/ports $(cat ../MeshLib/requirements.txt | tr '\n' ' ') +RUN ./vcpkg export --host-triplet=${VCPKG_TRIPLET} --overlay-triplets=../MeshLib/triplets --x-all-installed --raw --output=vcpkg --output-dir=/opt FROM nvidia/cuda:12.0.1-devel-rockylinux9 AS production diff --git a/requirements/macos.txt b/requirements/macos.txt index 9324a774689d..cf21b3023ee2 100644 --- a/requirements/macos.txt +++ b/requirements/macos.txt @@ -1,5 +1,6 @@ boost cmake +cpp-httplib cpr eigen fmt @@ -14,6 +15,7 @@ libtiff libzip llvm@14 ninja +nlohmann-json opencascade openssl@3 openvdb diff --git a/requirements/vcpkg-linux.txt b/requirements/vcpkg-linux.txt index d590e19fdff1..f5b0a958ec60 100644 --- a/requirements/vcpkg-linux.txt +++ b/requirements/vcpkg-linux.txt @@ -15,6 +15,7 @@ clip cpr dbus eigen3 +fastmcpp freetype gdcm glad diff --git a/requirements/windows.txt b/requirements/windows.txt index 9bd83d7286fc..d51c4340ed60 100644 --- a/requirements/windows.txt +++ b/requirements/windows.txt @@ -14,6 +14,7 @@ boost-url libjpeg-turbo cpr eigen3 +fastmcpp freetype gdcm gtest diff --git a/scripts/build_thirdparty.sh b/scripts/build_thirdparty.sh index 60429c56534e..97ed31d49cc9 100755 --- a/scripts/build_thirdparty.sh +++ b/scripts/build_thirdparty.sh @@ -153,17 +153,8 @@ else # build clip separately CMAKE_OPTIONS="${MR_CMAKE_OPTIONS}" ${SCRIPT_DIR}/thirdparty/clip.sh ${MESHLIB_THIRDPARTY_DIR}/clip - - # Skip this on Mac, we use `add_subdirectory()` for those libraries there. - # This is because we can't use `find_package()` there to find our own libraries, because that breaks Python modules, as documented in the root `CMakeLists.txt`. - if [[ $OSTYPE != 'darwin'* ]]; then - # Build nlohmann-json separately. It is header-only, this just installs it. It is a dependency of fastmcpp. - CMAKE_OPTIONS="${MR_CMAKE_OPTIONS}" ${SCRIPT_DIR}/thirdparty/nlohmann-json.sh "$MESHLIB_THIRDPARTY_DIR/nlohmann-json" - # Build cpp-httplib separately. It is header-only, this just installs it. It is a dependency of fastmcpp. - CMAKE_OPTIONS="${MR_CMAKE_OPTIONS}" ${SCRIPT_DIR}/thirdparty/cpp-httplib.sh "$MESHLIB_THIRDPARTY_DIR/cpp-httplib" - # Build fastmcpp separately. - CMAKE_OPTIONS="${MR_CMAKE_OPTIONS}" ${SCRIPT_DIR}/thirdparty/fastmcpp.sh "$MESHLIB_THIRDPARTY_DIR/fastmcpp" ./fastmcpp_build "${MESHLIB_THIRDPARTY_ROOT_DIR}" - fi + # build fastmcpp separately + CMAKE_OPTIONS="${MR_CMAKE_OPTIONS}" ${SCRIPT_DIR}/thirdparty/fastmcpp.sh ${MESHLIB_THIRDPARTY_DIR}/fastmcpp fi popd diff --git a/scripts/thirdparty/cpp-httplib.sh b/scripts/thirdparty/cpp-httplib.sh deleted file mode 100755 index 918b8a36d005..000000000000 --- a/scripts/thirdparty/cpp-httplib.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -eo pipefail - -SOURCE_DIR="$1" -BUILD_DIR="${2:-./cpp-httplib_build}" - -CMAKE_OPTIONS="${CMAKE_OPTIONS} \ - -D HTTPLIB_TEST=OFF \ - -D HTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF \ - -D HTTPLIB_USE_OPENSSL_IF_AVAILABLE=OFF \ - -D HTTPLIB_USE_ZLIB_IF_AVAILABLE=OFF \ - -D HTTPLIB_USE_ZSTD_IF_AVAILABLE=OFF \ -" - -cmake -S "${SOURCE_DIR}" -B "${BUILD_DIR}" -D CMAKE_C_FLAGS="${CFLAGS}" ${CMAKE_OPTIONS} -cmake --build "${BUILD_DIR}" -j `nproc` -cmake --install "${BUILD_DIR}" diff --git a/scripts/thirdparty/fastmcpp.sh b/scripts/thirdparty/fastmcpp.sh index 7b9e241a1c11..abbc9b1b25fb 100755 --- a/scripts/thirdparty/fastmcpp.sh +++ b/scripts/thirdparty/fastmcpp.sh @@ -1,10 +1,9 @@ #!/bin/bash -set -exo pipefail +set -eo pipefail SOURCE_DIR="$1" BUILD_DIR="${2:-./fastmcpp_build}" -# Sync those flags with `source/fastmcpp/CMakeLists.txt`. CMAKE_OPTIONS="${CMAKE_OPTIONS} \ -D FASTMCPP_BUILD_TESTS=OFF \ -D FASTMCPP_BUILD_EXAMPLES=OFF \ diff --git a/scripts/thirdparty/nlohmann-json.sh b/scripts/thirdparty/nlohmann-json.sh deleted file mode 100755 index 6141c0ef51c5..000000000000 --- a/scripts/thirdparty/nlohmann-json.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -eo pipefail - -SOURCE_DIR="$1" -BUILD_DIR="${2:-./nlohmann-json_build}" - -CMAKE_OPTIONS="${CMAKE_OPTIONS} \ - -D JSON_BuildTests=OFF \ -" - -cmake -S "${SOURCE_DIR}" -B "${BUILD_DIR}" -D CMAKE_C_FLAGS="${CFLAGS}" ${CMAKE_OPTIONS} -cmake --build "${BUILD_DIR}" -j `nproc` -cmake --install "${BUILD_DIR}" diff --git a/source/MRMcp/CMakeLists.txt b/source/MRMcp/CMakeLists.txt index e88278e7e200..8e41fcf79ebc 100644 --- a/source/MRMcp/CMakeLists.txt +++ b/source/MRMcp/CMakeLists.txt @@ -5,29 +5,28 @@ file(GLOB SOURCES "*.cpp") add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS}) +find_package(fastmcpp REQUIRED + HINTS "${MESHLIB_THIRDPARTY_ROOT_DIR}" +) + target_link_libraries(${PROJECT_NAME} PUBLIC MRMesh + PRIVATE + fastmcpp::fastmcpp_core ) - -IF(MR_PCH) - target_precompile_headers(${PROJECT_NAME} REUSE_FROM MRPch) -ENDIF() - -# On Windows, and on Linux+Vcpkg there is no third-party build script, so add fastmcpp as a subdirectory. -IF(MESHLIB_USE_VCPKG OR APPLE) - set(FASTMCPP_DEPS_ADD_SUBDIRECTORY ON) - add_subdirectory(../fastmcpp fastmcpp) - target_link_libraries(${PROJECT_NAME} PRIVATE fastmcpp_core) - target_include_directories(${PROJECT_NAME} PRIVATE - ${MESHLIB_THIRDPARTY_DIR}/fastmcpp/include - ${MESHLIB_THIRDPARTY_DIR}/cpp-httplib - ${MESHLIB_THIRDPARTY_DIR}/nlohmann-json/include +# TODO: why does it affect only Linux+vcpkg? +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND MESHLIB_USE_VCPKG) + # fix missing references to 'getaddrinfo_a' and 'gai_*' functions (required by cpp-httplib) + target_link_libraries(${PROJECT_NAME} PRIVATE anl) +endif() +# inject work-around for Clang libc++ and older Xcode versions' compatibility +if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_precompile_headers(${PROJECT_NAME} + PRIVATE + $<$:"fastmcpp/clang.hpp"> ) -ELSE() - find_package(fastmcpp REQUIRED) - target_link_libraries(${PROJECT_NAME} PUBLIC fastmcpp::fastmcpp_core) -ENDIF() +endif() install( TARGETS ${PROJECT_NAME} diff --git a/source/MRMcp/MRMcp.vcxproj b/source/MRMcp/MRMcp.vcxproj index f612bac12ec6..b39683d8961b 100644 --- a/source/MRMcp/MRMcp.vcxproj +++ b/source/MRMcp/MRMcp.vcxproj @@ -18,9 +18,6 @@ - - {7853aec9-a364-4587-89ae-faa9a463e6ed} - {c7780500-ca0e-4f5f-8423-d7ab06078b14} @@ -66,7 +63,7 @@ MRMcp_EXPORTS;_DEBUG;%(PreprocessorDefinitions) true true - %(AdditionalIncludeDirectories);..\..\thirdparty\fastmcpp\include;..\..\thirdparty\cpp-httplib;..\..\thirdparty\nlohmann-json\include + %(AdditionalIncludeDirectories) 4099;4100;4242;4244;4355;4456;4458;4464;4505;4702;5204;5220;5233;5245;5267;%(DisableSpecificWarnings) @@ -104,4 +101,4 @@ - + \ No newline at end of file diff --git a/source/MRMcp/MRMcpConfig.cmake b/source/MRMcp/MRMcpConfig.cmake index 2ef41d17fded..af6f31d11b5e 100644 --- a/source/MRMcp/MRMcpConfig.cmake +++ b/source/MRMcp/MRMcpConfig.cmake @@ -1,5 +1,3 @@ include(CMakeFindDependencyMacro) -IF(NOT MESHLIB_USE_VCPKG AND NOT APPLE) - find_dependency(fastmcpp) -endif() +find_dependency(fastmcpp) diff --git a/source/MRMcp/exports.h b/source/MRMcp/exports.h index cd31c682c5a6..4210c5eb8831 100644 --- a/source/MRMcp/exports.h +++ b/source/MRMcp/exports.h @@ -1,6 +1,5 @@ #pragma once -// see explanation in MRMesh/MRMeshFwd.h #ifdef _WIN32 # ifdef MRMcp_EXPORTS # define MRMCP_API __declspec(dllexport) diff --git a/source/MRPch/MRPch.h b/source/MRPch/MRPch.h index da3d3b1459dc..794d98476302 100644 --- a/source/MRPch/MRPch.h +++ b/source/MRPch/MRPch.h @@ -1,14 +1,5 @@ #pragma once -// Work around Clang quirk: https://github.com/llvm/llvm-project/issues/86077 -// This quirk causes issues for Fastmcpp on Mac Arm. -// This must be included before `` to work correctly, so effectively before any standard library headers. -#if defined( __APPLE__ ) && defined( __arm64__ ) -#include -#undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION -#define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0 -#endif - #pragma warning(push) #pragma warning(disable: 4820) //#pragma warning: N bytes padding added after data member diff --git a/source/MRViewer/CMakeLists.txt b/source/MRViewer/CMakeLists.txt index 77ad7b31d05f..8be42d6e82d5 100644 --- a/source/MRViewer/CMakeLists.txt +++ b/source/MRViewer/CMakeLists.txt @@ -117,13 +117,6 @@ ENDIF() IF(MESHLIB_BUILD_MCP) target_link_libraries(${PROJECT_NAME} PRIVATE MRMcp) - - # If we're using fastmcpp from a subdirectory, we need to add this explicitly. Not the best way to do this, we should probably find a proper solution. - IF(MESHLIB_USE_VCPKG OR APPLE) - target_include_directories(${PROJECT_NAME} PRIVATE - ${MESHLIB_THIRDPARTY_DIR}/nlohmann-json/include - ) - ENDIF() ELSE() target_compile_definitions(${PROJECT_NAME} PRIVATE MESHLIB_NO_MCP) ENDIF() diff --git a/source/MRViewer/MRViewer.vcxproj b/source/MRViewer/MRViewer.vcxproj index 53c06d96cd79..f23985cf8800 100644 --- a/source/MRViewer/MRViewer.vcxproj +++ b/source/MRViewer/MRViewer.vcxproj @@ -527,7 +527,7 @@ true true $(ProjectDir)..\MRPch\MRPch.h - %(AdditionalIncludeDirectories);$(ProjectDir)..\..\thirdparty;$(ProjectDir)\..\..\thirdparty\imgui\;..\..\thirdparty\fastmcpp\include;..\..\thirdparty\cpp-httplib;..\..\thirdparty\nlohmann-json\include + %(AdditionalIncludeDirectories);$(ProjectDir)..\..\thirdparty;$(ProjectDir)\..\..\thirdparty\imgui\ $(ProjectDir)..\MRPch\MRPch.h $(SolutionDir)TempOutput\MRPch\$(Platform)\$(Configuration)\MRPch.pch @@ -573,4 +573,4 @@ - + \ No newline at end of file diff --git a/source/MRViewer/MRViewer.vcxproj.filters b/source/MRViewer/MRViewer.vcxproj.filters index a8f3bf65112f..80cca03be139 100644 --- a/source/MRViewer/MRViewer.vcxproj.filters +++ b/source/MRViewer/MRViewer.vcxproj.filters @@ -547,8 +547,8 @@ Localization - - AI + + Source Files @@ -1071,9 +1071,6 @@ Localization - - AI - @@ -1294,4 +1291,4 @@ resource\independent_icons\X3 - + \ No newline at end of file diff --git a/source/MeshLib.sln b/source/MeshLib.sln index 967ecf9668d2..bc57957f5dcd 100644 --- a/source/MeshLib.sln +++ b/source/MeshLib.sln @@ -62,8 +62,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MREmbeddedPython", "MREmbed EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MRTestCuda", "MRTestCuda\MRTestCuda.vcxproj", "{FFB8D063-FF1E-4F18-8479-249B36714EF7}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fastmcpp", "fastmcpp\fastmcpp.vcxproj", "{7853AEC9-A364-4587-89AE-FAA9A463E6ED}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MRMcp", "MRMcp\MRMcp.vcxproj", "{C8250F26-E01D-4A63-98CD-68069D818080}" EndProject Global @@ -156,11 +154,7 @@ Global {FFB8D063-FF1E-4F18-8479-249B36714EF7}.Debug|x64.Build.0 = Debug|x64 {FFB8D063-FF1E-4F18-8479-249B36714EF7}.Release|x64.ActiveCfg = Release|x64 {FFB8D063-FF1E-4F18-8479-249B36714EF7}.Release|x64.Build.0 = Release|x64 - {7853AEC9-A364-4587-89AE-FAA9A463E6ED}.Debug|x64.ActiveCfg = Debug|x64 - {7853AEC9-A364-4587-89AE-FAA9A463E6ED}.Debug|x64.Build.0 = Debug|x64 - {7853AEC9-A364-4587-89AE-FAA9A463E6ED}.Release|x64.ActiveCfg = Release|x64 - {7853AEC9-A364-4587-89AE-FAA9A463E6ED}.Release|x64.Build.0 = Release|x64 - {C8250F26-E01D-4A63-98CD-68069D818080}.Debug|x64.ActiveCfg = Debug|x64 + {C8250F26-E01D-4A63-98CD-68069D818080}.Debug|x64.ActiveCfg = Debug|x64 {C8250F26-E01D-4A63-98CD-68069D818080}.Debug|x64.Build.0 = Debug|x64 {C8250F26-E01D-4A63-98CD-68069D818080}.Release|x64.ActiveCfg = Release|x64 {C8250F26-E01D-4A63-98CD-68069D818080}.Release|x64.Build.0 = Release|x64 @@ -190,7 +184,6 @@ Global {5612E480-6980-4242-9039-BE367F4ECBF0} = {DAEF3759-BD96-475D-AA71-96ACC5279E43} {E0202297-EDB2-4CDC-9CD0-8921EFF08DA0} = {AE8B4895-7920-4AD3-B554-C858A08B1680} {FFB8D063-FF1E-4F18-8479-249B36714EF7} = {E0BE85ED-C366-40EF-8BDE-70E1EDC8860F} - {7853AEC9-A364-4587-89AE-FAA9A463E6ED} = {AE8B4895-7920-4AD3-B554-C858A08B1680} {C8250F26-E01D-4A63-98CD-68069D818080} = {AE8B4895-7920-4AD3-B554-C858A08B1680} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/source/fastmcpp/CMakeLists.txt b/source/fastmcpp/CMakeLists.txt deleted file mode 100644 index 2aa0a2e78f0f..000000000000 --- a/source/fastmcpp/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# This file exists so we can tweak some settings for Fastmcpp. -# If we were to `add_subdirectory` it directly from `CMakeLists.txt`, we would have to modify the global CXX flags, which is uncool. - -# Sync those flags with `scripts/build_thirdparty.sh`. - -IF(NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") -ENDIF() - -IF(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4099 /wd4100 /wd4242 /wd4244 /wd4355 /wd4456 /wd4458 /wd4464 /wd4505 /wd4702 /wd5204 /wd5220 /wd5233 /wd5245") -ELSE() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-error") -ENDIF() - -set(FASTMCPP_BUILD_TESTS OFF CACHE BOOL "Build tests") -set(FASTMCPP_BUILD_EXAMPLES OFF CACHE BOOL "Build examples") -set(FASTMCPP_FETCH_CURL OFF CACHE BOOL "Fetch and build libcurl statically for POST streaming") - -add_subdirectory(${MESHLIB_THIRDPARTY_DIR}/fastmcpp fastmcpp) diff --git a/source/fastmcpp/fastmcpp.vcxproj b/source/fastmcpp/fastmcpp.vcxproj deleted file mode 100644 index 88036b6bae6e..000000000000 --- a/source/fastmcpp/fastmcpp.vcxproj +++ /dev/null @@ -1,155 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(IntDir)prompts_manager.obj - - - $(IntDir)resources_manager.obj - - - $(IntDir)tools_manager.obj - - - - 15.0 - {7853AEC9-A364-4587-89AE-FAA9A463E6ED} - Win32Proj - fastmcpp - - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - false - Unicode - - - - - - - - - - - - - - - - - - NotUsing - EnableAllWarnings - Disabled - true - _DEBUG;%(PreprocessorDefinitions) - true - true - %(AdditionalIncludeDirectories);..\..\thirdparty\fastmcpp\include;..\..\thirdparty\cpp-httplib;..\..\thirdparty\nlohmann-json\include - 4099;4100;4242;4244;4355;4456;4458;4464;4505;4702;5204;5220;5233;5245;5267;%(DisableSpecificWarnings) - - - Console - true - %(AdditionalDependencies) - - - - - - - - - NotUsing - EnableAllWarnings - MaxSpeed - true - true - true - NDEBUG;%(PreprocessorDefinitions) - true - true - /bigobj %(AdditionalOptions) - %(AdditionalIncludeDirectories);..\..\thirdparty\fastmcpp\include;..\..\thirdparty\cpp-httplib;..\..\thirdparty\nlohmann-json\include - 4099;4100;4242;4244;4355;4456;4458;4464;4505;4702;5204;5220;5233;5245;5267;%(DisableSpecificWarnings) - - - Console - true - true - true - - - - - - diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index e4734cf29af3..3b65b35a1673 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -74,6 +74,23 @@ IF(NOT APPLE AND NOT MR_EMSCRIPTEN) add_subdirectory(./cpr) ENDIF() + find_package(nlohmann_json) + if(NOT TARGET nlohmann_json::nlohmann_json) + set(JSON_BuildTests OFF) + set(JSON_Install ON) + add_subdirectory(./nlohmann-json) + endif() + + find_package(httplib) + if(NOT TARGET httplib::httplib) + set(HTTPLIB_TEST OFF) + set(HTTPLIB_USE_BROTLI_IF_AVAILABLE OFF) + set(HTTPLIB_USE_OPENSSL_IF_AVAILABLE OFF) + set(HTTPLIB_USE_ZLIB_IF_AVAILABLE OFF) + set(HTTPLIB_USE_ZSTD_IF_AVAILABLE OFF) + add_subdirectory(./cpp-httplib) + endif() + find_package(PkgConfig) IF(PkgConfig_FOUND) pkg_check_modules(tinyxml2 QUIET tinyxml2) diff --git a/thirdparty/fastmcpp b/thirdparty/fastmcpp index be0a7f43f185..d1b3360dc437 160000 --- a/thirdparty/fastmcpp +++ b/thirdparty/fastmcpp @@ -1 +1 @@ -Subproject commit be0a7f43f185102cd488f62bf201eb3f4360663a +Subproject commit d1b3360dc437f2515d496cc4a0fc72c11dd446e2 diff --git a/thirdparty/install.bat b/thirdparty/install.bat index 2adf5f04b5da..bc1ea369eb5b 100644 --- a/thirdparty/install.bat +++ b/thirdparty/install.bat @@ -88,7 +88,7 @@ REM Install vcpkg core dependencies vcpkg install vcpkg-cmake vcpkg-cmake-config --host-triplet %VCPKG_DEFAULT_TRIPLET% --overlay-triplets "%~dp0vcpkg\triplets" --debug --x-abi-tools-use-exact-versions || goto :error REM Install all required dependencies -vcpkg install !packages! --host-triplet %VCPKG_DEFAULT_TRIPLET% --overlay-triplets "%~dp0vcpkg\triplets" --debug --x-abi-tools-use-exact-versions || goto :error +vcpkg install !packages! --host-triplet %VCPKG_DEFAULT_TRIPLET% --overlay-triplets "%~dp0vcpkg\triplets" --overlay-ports "%~dp0vcpkg\ports" --debug --x-abi-tools-use-exact-versions || goto :error endlocal goto :EOF diff --git a/thirdparty/vcpkg/ports/fastmcpp/portfile.cmake b/thirdparty/vcpkg/ports/fastmcpp/portfile.cmake new file mode 100644 index 000000000000..bf9b9e63c9ed --- /dev/null +++ b/thirdparty/vcpkg/ports/fastmcpp/portfile.cmake @@ -0,0 +1,22 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO MeshInspector/fastmcpp + REF 3bacd94474b78488a9a8413e233eebac3d95d4fb + SHA512 b85f5ec857a04f180cca7ec1f3b7a1b34eabdaea9d2a6ec35eded61f773fa14a9236de07a54199ad99b57fc77bc973ce65cd6b066c35334bb5365a9c3b02c83b + HEAD_REF main +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DFASTMCPP_BUILD_TESTS=OFF + -DFASTMCPP_BUILD_EXAMPLES=OFF + -DFASTMCPP_FETCH_CURL=OFF +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup( + PACKAGE_NAME fastmcpp + CONFIG_PATH lib/cmake/fastmcpp +) diff --git a/thirdparty/vcpkg/ports/fastmcpp/vcpkg.json b/thirdparty/vcpkg/ports/fastmcpp/vcpkg.json new file mode 100644 index 000000000000..69accb73460c --- /dev/null +++ b/thirdparty/vcpkg/ports/fastmcpp/vcpkg.json @@ -0,0 +1,20 @@ +{ + "name": "fastmcpp", + "version-string": "3.1.0", + "port-version": 2, + "homepage": "https://github.com/MeshInspector/fastmcpp", + "description": "C++ port of the fastmcp Python library", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "cpp-httplib", + "nlohmann-json" + ] +} diff --git a/thirdparty/vcpkg/triplets/x64-windows-meshlib.cmake b/thirdparty/vcpkg/triplets/x64-windows-meshlib.cmake index 45f29a508239..a99128a4a084 100644 --- a/thirdparty/vcpkg/triplets/x64-windows-meshlib.cmake +++ b/thirdparty/vcpkg/triplets/x64-windows-meshlib.cmake @@ -5,3 +5,6 @@ set(VCPKG_DISABLE_COMPILER_TRACKING ON) set(VCPKG_CXX_FLAGS_DEBUG "${VCPKG_CXX_FLAGS_DEBUG} /D_ITERATOR_DEBUG_LEVEL=0") set(VCPKG_C_FLAGS_DEBUG "${VCPKG_C_FLAGS_DEBUG} /D_ITERATOR_DEBUG_LEVEL=0") +# uncomment this block for building with Visual Studio 2019 platform toolset +#vs2019toolset#set(VCPKG_PLATFORM_TOOLSET "v142") +#vs2019toolset#set(VCPKG_PLATFORM_TOOLSET_VERSION "14.29")