Skip to content
Merged

MCP #5899

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
f1d748a
Refactor the UI test engine to make way for MCP.
adalisk-emikhaylov Apr 8, 2026
2f7e1c6
Some more refactoring.
adalisk-emikhaylov Apr 8, 2026
bd3ee1a
Update VS projects.
adalisk-emikhaylov Apr 8, 2026
b213647
Hopefully fix mac builds.
adalisk-emikhaylov Apr 9, 2026
e471719
Merge remote-tracking branch 'origin/master' into mcp
adalisk-emikhaylov Apr 9, 2026
87778f9
Try again.
adalisk-emikhaylov Apr 9, 2026
a1e2e27
Add missing header.
adalisk-emikhaylov Apr 9, 2026
1a39ed8
Merge remote-tracking branch 'origin/master' into mcp
adalisk-emikhaylov Apr 9, 2026
7538041
Merge remote-tracking branch 'origin/master' into mcp
adalisk-emikhaylov Apr 13, 2026
e4a9a21
Move the MCP server to MeshLib.
adalisk-emikhaylov Apr 13, 2026
68f35e5
Try again.
adalisk-emikhaylov Apr 13, 2026
8e39ecb
Try again.
adalisk-emikhaylov Apr 13, 2026
cd1b76c
Try again.
adalisk-emikhaylov Apr 13, 2026
db8e762
Try again.
adalisk-emikhaylov Apr 13, 2026
13577ba
Try again.
adalisk-emikhaylov Apr 13, 2026
f34dcde
Try again.
adalisk-emikhaylov Apr 13, 2026
4bb88ec
Merge remote-tracking branch 'origin/master' into mcp
adalisk-emikhaylov Apr 13, 2026
826e9b8
Try again.
adalisk-emikhaylov Apr 13, 2026
b0a1935
Try again.
adalisk-emikhaylov Apr 14, 2026
ac7c5d2
Try again.
adalisk-emikhaylov Apr 14, 2026
24d3bda
Try again.
adalisk-emikhaylov Apr 14, 2026
e246fcc
Try again.
adalisk-emikhaylov Apr 14, 2026
1331089
Try again.
adalisk-emikhaylov Apr 14, 2026
8adf23e
Try again.
adalisk-emikhaylov Apr 14, 2026
11bb94e
Try again.
adalisk-emikhaylov Apr 14, 2026
06eaa1b
Merge remote-tracking branch 'origin/master' into mcp
adalisk-emikhaylov Apr 14, 2026
dede838
Forgot to change the header in one place.
adalisk-emikhaylov Apr 14, 2026
03b99b2
Address some PR comments.
adalisk-emikhaylov Apr 15, 2026
c4e3f06
Move the MCP testing guide to a separate file.
adalisk-emikhaylov Apr 15, 2026
c27f5fe
Try again.
adalisk-emikhaylov Apr 15, 2026
0c12532
Address some comments.
adalisk-emikhaylov Apr 15, 2026
037b885
Try again.
adalisk-emikhaylov Apr 16, 2026
68b8d13
More code changes.
adalisk-emikhaylov Apr 16, 2026
4087c37
Try again.
adalisk-emikhaylov Apr 16, 2026
a795633
Try again.
adalisk-emikhaylov Apr 16, 2026
367a4fc
Try again.
adalisk-emikhaylov Apr 16, 2026
1acee2c
Try to fix Mac builds.
adalisk-emikhaylov Apr 16, 2026
2cd21d3
Try again.
adalisk-emikhaylov Apr 16, 2026
929d1f6
Try again.
adalisk-emikhaylov Apr 16, 2026
3bf4efc
Try again.
adalisk-emikhaylov Apr 16, 2026
d8022ef
Try again.
adalisk-emikhaylov Apr 16, 2026
d657351
Try again.
adalisk-emikhaylov Apr 16, 2026
8dc86d2
Again?
adalisk-emikhaylov Apr 16, 2026
c86744e
Wrong file.
adalisk-emikhaylov Apr 16, 2026
54d3a72
Try again.
adalisk-emikhaylov Apr 17, 2026
77c9e71
Again.
adalisk-emikhaylov Apr 17, 2026
aa7f367
Try again.
adalisk-emikhaylov Apr 17, 2026
dab25f9
Try again.
adalisk-emikhaylov Apr 17, 2026
1c67b3e
Merge remote-tracking branch 'origin/master' into mcp
adalisk-emikhaylov Apr 17, 2026
13db44b
Try again.
adalisk-emikhaylov Apr 17, 2026
4ff2cd3
Fix VS builds.
adalisk-emikhaylov Apr 17, 2026
ae3d19d
Merge remote-tracking branch 'origin/master' into mcp
adalisk-emikhaylov Apr 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test-linux-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
# related issue: https://github.com/actions/checkout/issues/1779
export HOME=${RUNNER_TEMP}
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git submodule update --init --recursive --depth 1 thirdparty/imgui thirdparty/mrbind-pybind11 thirdparty/mrbind
git submodule update --init --recursive --depth 1 thirdparty/imgui thirdparty/mrbind-pybind11 thirdparty/mrbind thirdparty/fastmcpp thirdparty/nlohmann-json thirdparty/cpp-httplib
Comment thread
adalisk-emikhaylov marked this conversation as resolved.
Comment thread
adalisk-emikhaylov marked this conversation as resolved.

- name: Install MRBind
if: ${{ inputs.mrbind || inputs.mrbind_c }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-test-ubuntu-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
run: |
ln -s /usr/local/lib/meshlib-thirdparty-lib/lib ./lib
ln -s /usr/local/lib/meshlib-thirdparty-lib/include ./include
ln -s /usr/local/lib/meshlib-thirdparty-lib/share ./share
- name: Install MRBind
if: ${{ inputs.mrbind || inputs.mrbind_c }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-test-ubuntu-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
run: |
ln -s /usr/local/lib/meshlib-thirdparty-lib/lib ./lib
ln -s /usr/local/lib/meshlib-thirdparty-lib/include ./include
ln -s /usr/local/lib/meshlib-thirdparty-lib/share ./share

- name: Install MRBind
if: ${{ inputs.mrbind || inputs.mrbind_c }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/update-docs-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ jobs:
export HOME=${RUNNER_TEMP}
git config --global --add safe.directory '*'
git submodule update --init --recursive --depth 1 thirdparty/imgui thirdparty/eigen thirdparty/parallel-hashmap thirdparty/mrbind-pybind11 thirdparty/mrbind

- name: Install thirdparty libs
run: |
ln -s /usr/local/lib/meshlib-thirdparty-lib/lib ./lib
ln -s /usr/local/lib/meshlib-thirdparty-lib/include ./include
ln -s /usr/local/lib/meshlib-thirdparty-lib/share ./share

- name: Install mrbind
run: scripts/mrbind/install_mrbind_ubuntu.sh
Expand Down
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,12 @@
[submodule "thirdparty/OpenCTM-git"]
path = thirdparty/OpenCTM-git
url = https://github.com/MeshInspector/OpenCTM.git
[submodule "thirdparty/fastmcpp"]
path = thirdparty/fastmcpp
url = https://github.com/MeshInspector/fastmcpp
[submodule "thirdparty/nlohmann-json"]
path = thirdparty/nlohmann-json
url = https://github.com/nlohmann/json
[submodule "thirdparty/cpp-httplib"]
path = thirdparty/cpp-httplib
url = https://github.com/yhirose/cpp-httplib
1 change: 1 addition & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ tasks:
init: |
ln -s /usr/local/lib/meshlib-thirdparty-lib/lib ./lib
ln -s /usr/local/lib/meshlib-thirdparty-lib/include ./include
ln -s /usr/local/lib/meshlib-thirdparty-lib/share ./share
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ option(MESHLIB_BUILD_MESHCONV "Build meshconv utility" ON)
option(MESHLIB_BUILD_SYMBOLMESH "Build symbol-to-mesh library" ON)
option(MESHLIB_BUILD_VOXELS "Build voxels library" ON)
option(MESHLIB_BUILD_EXTRA_IO_FORMATS "Build extra IO format support library" ON)
option(MESHLIB_BUILD_MCP "Enable MCP server" ON)
option(MESHLIB_BUILD_GENERATED_C_BINDINGS "Build C bindings (assuming they are already generated)" OFF)

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()
Expand Down Expand Up @@ -293,6 +297,10 @@ IF(NOT MR_EMSCRIPTEN AND NOT APPLE)
ENDIF()
ENDIF()

IF(MESHLIB_BUILD_MCP AND NOT MR_EMSCRIPTEN)
add_subdirectory(${PROJECT_SOURCE_DIR}/MRMcp ./MRMcp)
ENDIF()

IF(BUILD_TESTING)
enable_testing()
add_subdirectory(${PROJECT_SOURCE_DIR}/MRTest ./MRTest)
Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/CompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ENDIF()
# Warnings and misc compiler settings.
IF(MSVC)
# C++-specific flags.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DImDrawIdx=unsigned /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING /D_SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING /D_SILENCE_CXX23_DENORM_DEPRECATION_WARNING /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DImDrawIdx=unsigned /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING /D_SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING /D_SILENCE_CXX23_DENORM_DEPRECATION_WARNING /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR")

# Common C/C++ flags:

Expand Down
1 change: 1 addition & 0 deletions docker/ubuntu22Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ COPY scripts/mrbind-pybind11/install_all_python_versions_ubuntu_pkgs.sh scripts/

COPY --from=build /home/MeshLib/lib /usr/local/lib/meshlib-thirdparty-lib/lib
COPY --from=build /home/MeshLib/include /usr/local/lib/meshlib-thirdparty-lib/include
COPY --from=build /home/MeshLib/share /usr/local/lib/meshlib-thirdparty-lib/share

ENV MR_STATE=DOCKER_BUILD

Expand Down
1 change: 1 addition & 0 deletions docker/ubuntu24Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ COPY scripts/mrbind-pybind11/install_all_python_versions_ubuntu_pkgs.sh scripts/

COPY --from=build /home/MeshLib/lib /usr/local/lib/meshlib-thirdparty-lib/lib
COPY --from=build /home/MeshLib/include /usr/local/lib/meshlib-thirdparty-lib/include
COPY --from=build /home/MeshLib/share /usr/local/lib/meshlib-thirdparty-lib/share
COPY --from=cuda /usr/local/cuda-12.6 /usr/local/cuda-12.6

ENV MR_STATE=DOCKER_BUILD
Expand Down
25 changes: 25 additions & 0 deletions docs/testing_mcp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# How to test MCP?

Use "MCP Inspector". Run it with `npx @modelcontextprotocol/inspector`, where `npx` is installed as a part of Node.JS.

Set:
* Transport Type = SSE
* URL = http://localhost:8080/sse
* Connection Type = Via Proxy (Doesn't work for me without proxy now when we're using the Fastmcpp library, but did work with another library; not sure why.)

Press `Connect`.

Press `List Tools` (if grayed out, do `Clear` first).

Click on your tool.

On the right panel, set parameters. For some parameter types, it helps to press `Switch to JSON` on the right, then type them as JSON.

Press `Run Tool`. If you get weird errors, try pressing it again. In some cases, the first press passes stale/empty parameters.

Then check for validation errors, below this button.

If it complains that your output doesn't match the schema you specified, paste both the output and the schema (using the `Copy` button in the top-right corner of the code blocks; that copies JSON properly, unlike Ctrl+C in this case)
into a schema validator, e.g. https://www.jsonschemavalidator.net/

**NOTE:** It doesn't seem to validate the input schema (only output schema). Check it by eye.
40 changes: 40 additions & 0 deletions scripts/ask_emscripten_mode.src
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/false
# This file is supposed to be sourced.

[[ ${MR_EMSCRIPTEN_SINGLETHREAD:=} ]] || export MR_EMSCRIPTEN_SINGLETHREAD=0
[[ ${MR_EMSCRIPTEN_WASM64:=} ]] || export MR_EMSCRIPTEN_WASM64=0

if [[ $OSTYPE == "linux"* && $MR_STATE != "DOCKER_BUILD" ]]; then
if [ ! -n "$MR_EMSCRIPTEN" ]; then
read -t 5 -p "Build with emscripten? Press (y) in 5 seconds to build (y/s/l/N) (s - singlethreaded, l - 64-bit)" -rsn 1
echo;
case $REPLY in
Y|y)
export MR_EMSCRIPTEN="ON";;
S|s)
export MR_EMSCRIPTEN="ON"
export MR_EMSCRIPTEN_SINGLETHREAD=1;;
L|l)
export MR_EMSCRIPTEN="ON"
export MR_EMSCRIPTEN_WASM64=1;;
*)
export MR_EMSCRIPTEN="OFF";;
esac
fi
else
if [ ! -n "$MR_EMSCRIPTEN" ]; then
MR_EMSCRIPTEN="OFF"
fi
fi

# Normalize the spelling of some variables.
if [ $MR_EMSCRIPTEN == "ON" ]; then
if [[ $MR_EMSCRIPTEN_SINGLE == "ON" ]]; then
MR_EMSCRIPTEN_SINGLETHREAD=1
fi
if [[ $MR_EMSCRIPTEN_WASM64 == "ON" ]]; then
MR_EMSCRIPTEN_WASM64=1
fi
fi

echo "Emscripten ${MR_EMSCRIPTEN}, singlethread ${MR_EMSCRIPTEN_SINGLETHREAD}, 64-bit ${MR_EMSCRIPTEN_WASM64}"
34 changes: 2 additions & 32 deletions scripts/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,9 @@ logfile="`pwd`/build_source_${dt}.log"
echo "Project build script started."
echo "You could find output in ${logfile}"

MR_EMSCRIPTEN_SINGLETHREAD=0
if [[ $OSTYPE == "linux"* ]]; then
if [ ! -n "$MR_EMSCRIPTEN" ]; then
read -t 5 -p "Build with emscripten? Press (y) in 5 seconds to build (y/s/l/N) (s - singlethreaded, l - 64-bit)" -rsn 1
echo;
case $REPLY in
Y|y)
MR_EMSCRIPTEN="ON";;
S|s)
MR_EMSCRIPTEN="ON"
MR_EMSCRIPTEN_SINGLETHREAD=1;;
L|l)
MR_EMSCRIPTEN="ON"
MR_EMSCRIPTEN_WASM64=1;;
*)
MR_EMSCRIPTEN="OFF";;
esac
fi
else
if [ ! -n "$MR_EMSCRIPTEN" ]; then
MR_EMSCRIPTEN="OFF"
fi
fi
echo "Emscripten ${MR_EMSCRIPTEN}, singlethread ${MR_EMSCRIPTEN_SINGLETHREAD}, 64-bit ${MR_EMSCRIPTEN_WASM64}"
SCRIPT_DIR="$(dirname "$BASH_SOURCE")"

if [ $MR_EMSCRIPTEN == "ON" ]; then
if [[ $MR_EMSCRIPTEN_SINGLE == "ON" ]]; then
MR_EMSCRIPTEN_SINGLETHREAD=1
fi
if [[ $MR_EMSCRIPTEN_WASM64 == "ON" ]]; then
MR_EMSCRIPTEN_WASM64=1
fi
fi
. "$SCRIPT_DIR/ask_emscripten_mode.src"
Comment thread
adalisk-emikhaylov marked this conversation as resolved.

if [ ! -n "$MESHLIB_BUILD_RELEASE" ]; then
read -t 5 -p "Build MeshLib Release? Press (n) in 5 seconds to cancel (Y/n)" -rsn 1
Expand Down
43 changes: 13 additions & 30 deletions scripts/build_thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,10 @@ else
echo "Host system: ${OSTYPE}"
fi

MR_EMSCRIPTEN_SINGLETHREAD=0
if [[ $OSTYPE == "linux"* ]] && [ "${MR_STATE}" != "DOCKER_BUILD" ]; then
if [ ! -n "$MR_EMSCRIPTEN" ]; then
read -t 5 -p "Build with emscripten? Press (y) in 5 seconds to build (y/s/l/N) (s - singlethreaded, l - 64-bit)" -rsn 1
echo;
case $REPLY in
Y|y)
MR_EMSCRIPTEN="ON";;
S|s)
MR_EMSCRIPTEN="ON"
MR_EMSCRIPTEN_SINGLETHREAD=1;;
L|l)
MR_EMSCRIPTEN="ON"
MR_EMSCRIPTEN_WASM64=1;;
*)
MR_EMSCRIPTEN="OFF";;
esac
fi
else
if [ ! -n "$MR_EMSCRIPTEN" ]; then
MR_EMSCRIPTEN="OFF"
fi
fi
echo "Emscripten ${MR_EMSCRIPTEN}, singlethread ${MR_EMSCRIPTEN_SINGLETHREAD}, 64-bit ${MR_EMSCRIPTEN_WASM64}"
. "$SCRIPT_DIR/ask_emscripten_mode.src"

if [ $MR_EMSCRIPTEN == "ON" ]; then
if [[ $MR_EMSCRIPTEN_SINGLE == "ON" ]]; then
MR_EMSCRIPTEN_SINGLETHREAD=1
fi
if [[ $MR_EMSCRIPTEN_WASM64 == "ON" ]]; then
MR_EMSCRIPTEN_WASM64=1
fi
true # Nothing.
elif [ -n "${INSTALL_REQUIREMENTS}" ]; then
echo "Check requirements. Running ${INSTALL_REQUIREMENTS} ..."
${SCRIPT_DIR}/$INSTALL_REQUIREMENTS
Expand Down Expand Up @@ -165,6 +137,17 @@ 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
fi
popd

Expand Down
17 changes: 17 additions & 0 deletions scripts/thirdparty/cpp-httplib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/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}"
17 changes: 17 additions & 0 deletions scripts/thirdparty/fastmcpp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -exo 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 \
-D FASTMCPP_FETCH_CURL=OFF \
-D CMAKE_CXX_FLAGS=-fPIC \
"

cmake -S "${SOURCE_DIR}" -B "${BUILD_DIR}" -D CMAKE_C_FLAGS="${CFLAGS}" ${CMAKE_OPTIONS}
cmake --build "${BUILD_DIR}" -j `nproc`
cmake --install "${BUILD_DIR}"
13 changes: 13 additions & 0 deletions scripts/thirdparty/nlohmann-json.sh
Comment thread
adalisk-emikhaylov marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/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}"
55 changes: 55 additions & 0 deletions source/MRMcp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
project(MRMcp CXX)

file(GLOB HEADERS "*.h" "*.ipp")
file(GLOB SOURCES "*.cpp")

add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})

target_link_libraries(${PROJECT_NAME}
PUBLIC
MRMesh
)

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
)
ELSE()
find_package(fastmcpp REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC fastmcpp::fastmcpp_core)
ENDIF()

install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION "${MR_MAIN_LIB_DIR}"
ARCHIVE DESTINATION "${MR_MAIN_LIB_DIR}"
RUNTIME DESTINATION "${MR_BIN_DIR}"
)

install(
FILES ${HEADERS}
DESTINATION "${MR_INCLUDE_DIR}/${PROJECT_NAME}"
)

install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake
DESTINATION ${MR_CONFIG_DIR}
)

install(
EXPORT ${PROJECT_NAME}
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE MeshLib::
DESTINATION ${MR_CONFIG_DIR}
)
Loading
Loading