Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 4 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ IF(MESHLIB_PYTHON_SUPPORT AND NOT MR_EMSCRIPTEN)
ENDIF()
ENDIF()

IF(APPLE)
set(Python_ROOT_DIR "${HOMEBREW_PREFIX}/opt/python@${MESHLIB_PYTHON_VERSION}")
ENDIF()

IF(DEFINED MESHLIB_PYTHON_VERSION)
find_package(Python ${MESHLIB_PYTHON_VERSION} EXACT REQUIRED COMPONENTS Interpreter Development)
ELSE()
Expand Down Expand Up @@ -295,19 +299,6 @@ IF(NOT MR_EMSCRIPTEN)
ENDIF()
ENDIF()

IF(MESHLIB_PYTHON_SUPPORT)
set(PYBIND11_NONLIMITEDAPI_PYTHON_MIN_VERSION_HEX 0x030800f0 CACHE STRING "") # Python 3.8
set(PYBIND11_NONLIMITEDAPI_SUFFIX "${MESHLIB_PYBIND11_LIB_SUFFIX}" CACHE STRING "")
set(PYBIND11_NONLIMITEDAPI_LIBRARY_OUTPUT_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/meshlib" CACHE PATH "")
set(PYBIND11_NONLIMITEDAPI_INSTALL_LIBDIR_STUBS "${MR_MAIN_LIB_DIR}" CACHE PATH "")
set(PYBIND11_NONLIMITEDAPI_INSTALL_LIBDIR_SHIMS "${MR_PY_LIB_DIR}" CACHE PATH "")
# We want to always build stubs here because we want to set `PYBIND11_COMPILER_TYPE`, `PYBIND11_BUILD_ABI` for them, and accessing them in `thirdparty/CMakeLists.txt` gets weird.
# If not for that, we'd build them here only on Windows (because there we don't have a thirdparty build script).
option(PYBIND11_NONLIMITEDAPI_BUILD_STUBS "" ON)
option(PYBIND11_NONLIMITEDAPI_INSTALL_EXPORTS "" ON)
add_subdirectory(${MESHLIB_THIRDPARTY_DIR}/mrbind-pybind11/source/non_limited_api ./meshlib)
ENDIF()

IF(NOT MR_EMSCRIPTEN)
IF(MESHLIB_BUILD_MESHCONV)
add_subdirectory(${PROJECT_SOURCE_DIR}/meshconv ./meshconv)
Expand Down
29 changes: 0 additions & 29 deletions cmake/Modules/CompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,35 +125,6 @@ IF(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes")
ENDIF()

# This allows us to share bindings for C++ types across compilers (across GCC and Clang). Otherwise Pybind refuses
# to share them because the compiler name and the ABI version number are different, even when there's no actual ABI incompatibility in practice.
# We allow customizing those so that our clients can prevent their modules from talking to ours, e.g. to provide their own simplified bindings
# for our classes, to avoid having our modules as dependencies.
# Pass empty strings to those to avoid customizing them at all.
set(MESHLIB_PYBIND11_COMPILER_TYPE_STRING "_meshlib" CACHE STRING "")
set(MESHLIB_PYBIND11_BUILD_ABI_STRING "_meshlib" CACHE STRING "")
IF(NOT "${MESHLIB_PYBIND11_COMPILER_TYPE_STRING}" STREQUAL "")
add_compile_definitions(PYBIND11_COMPILER_TYPE=\"${MESHLIB_PYBIND11_COMPILER_TYPE_STRING}\")
ENDIF()
IF(NOT "${MESHLIB_PYBIND11_BUILD_ABI_STRING}" STREQUAL "")
add_compile_definitions(PYBIND11_BUILD_ABI=\"${MESHLIB_PYBIND11_BUILD_ABI_STRING}\")
ENDIF()

# Things for our patched pybind: --- [

# It's a good idea to have this match `PYTHON_MIN_VERSION` in `scripts/mrbind/generate.mk`.
# Here `0x030800f0` corresponds to 3.8 (ignore the `f0` suffix at the end, it just means a release version as opposed to alpha/beta/etc).
add_compile_definitions(Py_LIMITED_API=0x030800f0)

# It's a good idea to have this match the value specified in `scripts/mrbind/generate.mk`. See that file for the explanation.
add_compile_definitions(PYBIND11_INTERNALS_VERSION=5)

# This affects the naming of our pybind shims.
set(MESHLIB_PYBIND11_LIB_SUFFIX "meshlib" CACHE STRING "")
add_compile_definitions(PYBIND11_NONLIMITEDAPI_LIB_SUFFIX_FOR_MODULE=\"${MESHLIB_PYBIND11_LIB_SUFFIX}\")

# ] --- end things for our patched pybind

# Warn about ABI incompatibilities.
# GCC 12 fixed a bug, and this fix affects the ABI: https://github.com/gcc-mirror/gcc/commit/a37e8ce3b66325f0c6de55c80d50ac1664c3d0eb
# Because of this fix GCC 11 and older are incompatible with GCC 12+, and also with Clang that we use the build the Python bindings.
Expand Down
1 change: 1 addition & 0 deletions requirements/vcpkg-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ libe57format
libharu
libjpeg-turbo
libzip
mrbind-pybind11
opencascade-minimal
openctm
openvdb
Expand Down
1 change: 1 addition & 0 deletions requirements/windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ libe57format
libharu
libzip
mimalloc[override]
mrbind-pybind11
opencascade-minimal
openctm
openvdb
Expand Down
5 changes: 5 additions & 0 deletions scripts/build_thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ MR_CMAKE_OPTIONS="\
-D CMAKE_BUILD_TYPE=Release \
"

# Which Python version the mrbind-pybind11 stubs and shim are built against.
if [ -n "${MESHLIB_PYTHON_VERSION}" ] ; then
MR_CMAKE_OPTIONS="${MR_CMAKE_OPTIONS} -D PYBIND11_NONLIMITEDAPI_PYTHON_HEADERS_VERSION=${MESHLIB_PYTHON_VERSION}"
fi

if [ "${MR_EMSCRIPTEN}" != "ON" ] ; then
CMAKE_C_COMPILER="${CMAKE_C_COMPILER:-${CC}}"
if [ -n "${CMAKE_C_COMPILER}" ] ; then
Expand Down
2 changes: 0 additions & 2 deletions scripts/install_brew_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ fi
brew untap aws/tap 2>/dev/null || true

brew install --quiet $(echo "$MESHLIB_BREW_REQUIREMENTS" | tr '\n' ' ')
# FIXME: build w/o pybind11
brew install --quiet pybind11
4 changes: 3 additions & 1 deletion source/MREmbeddedPython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})

# TODO: find Python independently

find_package(pybind11nonlimitedapi REQUIRED HINTS "${MESHLIB_THIRDPARTY_ROOT_DIR}/lib/cmake/pybind11nonlimitedapi")

target_link_libraries(${PROJECT_NAME} PRIVATE
MRMesh
MRPython
pybind11nonlimitedapi_stubs
pybind11nonlimitedapi::pybind11nonlimitedapi_stubs
${CMAKE_DL_LIBS}
)

Expand Down
7 changes: 2 additions & 5 deletions source/MREmbeddedPython/MREmbeddedPython.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\thirdparty\pybind11nonlimitedapi_stubs.vcxproj">
<Project>{cb6d82fb-e91d-4d62-b82e-be644244e30a}</Project>
</ProjectReference>
<ProjectReference Include="..\MRMesh\MRMesh.vcxproj">
<Project>{c7780500-ca0e-4f5f-8423-d7ab06078b14}</Project>
</ProjectReference>
Expand Down Expand Up @@ -90,7 +87,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;fmtd.lib;spdlogd.lib;%(AdditionalDependencies);$(PythonLibPath)</AdditionalDependencies>
<AdditionalDependencies>ws2_32.lib;fmtd.lib;spdlogd.lib;%(AdditionalDependencies);$(PythonLibPath);$(Pybind11StubsLibPath)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
Expand Down Expand Up @@ -120,7 +117,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;fmt.lib;spdlog.lib;%(AdditionalDependencies);$(PythonLibPath)</AdditionalDependencies>
<AdditionalDependencies>ws2_32.lib;fmt.lib;spdlog.lib;%(AdditionalDependencies);$(PythonLibPath);$(Pybind11StubsLibPath)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
Expand Down
22 changes: 15 additions & 7 deletions source/MRPython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,30 @@ add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})

# TODO: find Python independently

target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${MESHLIB_THIRDPARTY_DIR}/mrbind-pybind11/include>
)
find_package(pybind11nonlimitedapi REQUIRED HINTS "${MESHLIB_THIRDPARTY_ROOT_DIR}/lib/cmake/pybind11nonlimitedapi")

target_link_libraries(${PROJECT_NAME}
PUBLIC
MRMesh
pybind11nonlimitedapi_stubs
pybind11nonlimitedapi::pybind11nonlimitedapi_stubs
PRIVATE
${CMAKE_DL_LIBS}
)

# Put the prebuilt shim next to the modules, where our patched pybind looks for it at runtime.
if(NOT "${pybind11nonlimitedapi_SHIM_PYTHON_VERSION}" STREQUAL "${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}")
message(FATAL_ERROR "The prebuilt pybind shim targets Python ${pybind11nonlimitedapi_SHIM_PYTHON_VERSION}, but this build uses ${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}. Rebuild the thirdparty against this Python version.")
endif()
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/meshlib"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:${pybind11nonlimitedapi_SHIM_TARGET}>" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/meshlib/"
)
install(
FILES "$<TARGET_FILE:${pybind11nonlimitedapi_SHIM_TARGET}>"
DESTINATION "${MR_PY_LIB_DIR}"
)

IF(APPLE)
find_package(pybind11 REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC pybind11::module)
target_link_options(${PROJECT_NAME} PRIVATE -undefined dynamic_lookup)
ENDIF()

Expand Down
22 changes: 17 additions & 5 deletions source/MRPython/MRPython.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\thirdparty\pybind11nonlimitedapi_stubs.vcxproj">
<Project>{cb6d82fb-e91d-4d62-b82e-be644244e30a}</Project>
</ProjectReference>
<ProjectReference Include="..\MRMesh\MRMesh.vcxproj">
<Project>{c7780500-ca0e-4f5f-8423-d7ab06078b14}</Project>
</ProjectReference>
Expand Down Expand Up @@ -85,7 +82,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;fmtd.lib;spdlogd.lib;%(AdditionalDependencies);$(PythonLibPath)</AdditionalDependencies>
<AdditionalDependencies>ws2_32.lib;fmtd.lib;spdlogd.lib;%(AdditionalDependencies);$(PythonLibPath);$(Pybind11StubsLibPath)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
Expand All @@ -95,10 +92,13 @@
<!-- which now wraps zlib-ng's compat mode). In Release builds applocal carries it in via the consumer chain, but -->
<!-- Debug builds only ask for the Debug zlib (`zd.dll` / `zlib-ngd2.dll`), so `z.dll` never lands next to the -->
<!-- Release `python3XY.dll` we just deployed. Copy it explicitly so `Py_Initialize` doesn't fail silently in MRTest.exe. -->
<!-- The vcpkg-built pybind shim is dlopened by name from `meshlib\`, never imported, so applocal won't deploy it. -->
<Command>copy $(PythonDllPath) $(TargetDir)python$(PythonVersion).dll
copy $(PythonStableDllPath) $(TargetDir)python3.dll
if exist "$(VcpkgCurrentInstalledDir)\bin\z.dll" copy "$(VcpkgCurrentInstalledDir)\bin\z.dll" "$(TargetDir)z.dll"
if exist "$(VcpkgCurrentInstalledDir)\bin\zlib1.dll" copy "$(VcpkgCurrentInstalledDir)\bin\zlib1.dll" "$(TargetDir)zlib1.dll"
if not exist $(TargetDir)meshlib mkdir $(TargetDir)meshlib
copy "$(Pybind11ShimDllPath)" $(TargetDir)meshlib\
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
Expand All @@ -121,10 +121,22 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;fmt.lib;spdlog.lib;%(AdditionalDependencies);$(PythonLibPath)</AdditionalDependencies>
<AdditionalDependencies>ws2_32.lib;fmt.lib;spdlog.lib;%(AdditionalDependencies);$(PythonLibPath);$(Pybind11StubsLibPath)</AdditionalDependencies>
<DelayLoadDLLs>
</DelayLoadDLLs>
</Link>
<PostBuildEvent>
<!-- Here we copy both python3.dll and python3XY.dll. The former seems to be just a tiny shim for the latter. -->
<!-- python3XY.dll is reached only through python3.dll's export forwarders, which applocal's import scan doesn't -->
<!-- see, so nothing else deploys it. Without it every python3.dll consumer (e.g. MRTest.exe) dies at load with -->
<!-- STATUS_DLL_NOT_FOUND. -->
<!-- The vcpkg-built pybind shim is dlopened by name from `meshlib\`, never imported, so applocal won't deploy it. -->
<Command>copy $(PythonDllPath) $(TargetDir)python$(PythonVersion).dll
copy $(PythonStableDllPath) $(TargetDir)python3.dll
if not exist $(TargetDir)meshlib mkdir $(TargetDir)meshlib
copy "$(Pybind11ShimDllPath)" $(TargetDir)meshlib\
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
1 change: 1 addition & 0 deletions source/MRPython/MRPythonConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include(CMakeFindDependencyMacro)
find_dependency(pybind11nonlimitedapi)
include("${CMAKE_CURRENT_LIST_DIR}/MRPythonTargets.cmake")
3 changes: 0 additions & 3 deletions source/MRTest/MRTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@
<ClCompile Include="MRMimallocRedirectTests.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\thirdparty\pybind11nonlimitedapi_stubs.vcxproj">
<Project>{cb6d82fb-e91d-4d62-b82e-be644244e30a}</Project>
</ProjectReference>
<ProjectReference Include="..\MREmbeddedPython\MREmbeddedPython.vcxproj">
<Project>{e0202297-edb2-4cdc-9cd0-8921eff08da0}</Project>
</ProjectReference>
Expand Down
17 changes: 0 additions & 17 deletions source/MeshLib.sln
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MRIOExtras", "MRIOExtras\MRIOExtras.vcxproj", "{99EB9674-ABBF-47CD-A8D5-EE122EB5DA0C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MRPython", "MRPython\MRPython.vcxproj", "{90BC6971-76CA-4ECD-92E0-585FE3BD6672}"
ProjectSection(ProjectDependencies) = postProject
{5612E480-6980-4242-9039-BE367F4ECBF0} = {5612E480-6980-4242-9039-BE367F4ECBF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pybind11nonlimitedapi_stubs", "..\thirdparty\pybind11nonlimitedapi_stubs.vcxproj", "{CB6D82FB-E91D-4D62-B82E-BE644244E30A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pybind11nonlimitedapi_meshlib", "..\thirdparty\pybind11nonlimitedapi.vcxproj", "{5612E480-6980-4242-9039-BE367F4ECBF0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MREmbeddedPython", "MREmbeddedPython\MREmbeddedPython.vcxproj", "{E0202297-EDB2-4CDC-9CD0-8921EFF08DA0}"
EndProject
Expand Down Expand Up @@ -128,14 +121,6 @@ Global
{90BC6971-76CA-4ECD-92E0-585FE3BD6672}.Debug|x64.Build.0 = Debug|x64
{90BC6971-76CA-4ECD-92E0-585FE3BD6672}.Release|x64.ActiveCfg = Release|x64
{90BC6971-76CA-4ECD-92E0-585FE3BD6672}.Release|x64.Build.0 = Release|x64
{CB6D82FB-E91D-4D62-B82E-BE644244E30A}.Debug|x64.ActiveCfg = Debug|x64
{CB6D82FB-E91D-4D62-B82E-BE644244E30A}.Debug|x64.Build.0 = Debug|x64
{CB6D82FB-E91D-4D62-B82E-BE644244E30A}.Release|x64.ActiveCfg = Release|x64
{CB6D82FB-E91D-4D62-B82E-BE644244E30A}.Release|x64.Build.0 = Release|x64
{5612E480-6980-4242-9039-BE367F4ECBF0}.Debug|x64.ActiveCfg = Debug|x64
{5612E480-6980-4242-9039-BE367F4ECBF0}.Debug|x64.Build.0 = Debug|x64
{5612E480-6980-4242-9039-BE367F4ECBF0}.Release|x64.ActiveCfg = Release|x64
{5612E480-6980-4242-9039-BE367F4ECBF0}.Release|x64.Build.0 = Release|x64
{E0202297-EDB2-4CDC-9CD0-8921EFF08DA0}.Debug|x64.ActiveCfg = Debug|x64
{E0202297-EDB2-4CDC-9CD0-8921EFF08DA0}.Debug|x64.Build.0 = Debug|x64
{E0202297-EDB2-4CDC-9CD0-8921EFF08DA0}.Release|x64.ActiveCfg = Release|x64
Expand Down Expand Up @@ -172,8 +157,6 @@ Global
{7CC4F0FE-ACE6-4441-9DD7-296066B6D69F} = {AE8B4895-7920-4AD3-B554-C858A08B1680}
{99EB9674-ABBF-47CD-A8D5-EE122EB5DA0C} = {AE8B4895-7920-4AD3-B554-C858A08B1680}
{90BC6971-76CA-4ECD-92E0-585FE3BD6672} = {AE8B4895-7920-4AD3-B554-C858A08B1680}
{CB6D82FB-E91D-4D62-B82E-BE644244E30A} = {DAEF3759-BD96-475D-AA71-96ACC5279E43}
{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}
{C8250F26-E01D-4A63-98CD-68069D818080} = {AE8B4895-7920-4AD3-B554-C858A08B1680}
Expand Down
13 changes: 10 additions & 3 deletions source/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
<PythonLibPath>$(VcpkgCurrentInstalledDir)\lib\python3.lib</PythonLibPath>
<PythonDllPath>$(VcpkgCurrentInstalledDir)\bin\python$(PythonVersion).dll</PythonDllPath>
<PythonStableDllPath>$(VcpkgCurrentInstalledDir)\bin\python3.dll</PythonStableDllPath>
<!-- The vcpkg installed tree for the current configuration (debug artifacts live in the `debug` subtree). -->
<VcpkgCurrentInstalledConfigDir>$(VcpkgCurrentInstalledDir)</VcpkgCurrentInstalledConfigDir>
<VcpkgCurrentInstalledConfigDir Condition="'$(Configuration)'=='Debug'">$(VcpkgCurrentInstalledDir)\debug</VcpkgCurrentInstalledConfigDir>
<!-- The pybind stubs and the shim come prebuilt from the `mrbind-pybind11` vcpkg port.
The stubs .lib is spelled out for the projects that set VcpkgAutoLink=false. -->
<Pybind11StubsLibPath>$(VcpkgCurrentInstalledConfigDir)\lib\pybind11nonlimitedapi_stubs.lib</Pybind11StubsLibPath>
<Pybind11ShimDllPath>$(VcpkgCurrentInstalledConfigDir)\bin\pybind11nonlimitedapi_meshlib_3.$(PythonVersionMinor).dll</Pybind11ShimDllPath>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
Expand All @@ -59,13 +66,13 @@
<!-- /utf-8 to resolve https://github.com/MeshInspector/MeshLib/issues/2780 -->
<AdditionalOptions>/bigobj /utf-8 %(AdditionalOptions)</AdditionalOptions>
<!-- _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR to avoid breaking changes in Visual Studio 2022 making binaries incompatible with older msvc.dlls -->
<!-- Following is needed for our patched pybind: PYBIND11_NONLIMITEDAPI_LIB_SUFFIX_FOR_MODULE="meshlib";Py_LIMITED_API=0x030800f0; -->
<!-- Following is needed for our patched pybind: PYBIND11_NONLIMITEDAPI_LIB_SUFFIX_FOR_MODULE="meshlib";Py_LIMITED_API=0x030800f0;PYBIND11_COMPILER_TYPE="_meshlib";PYBIND11_BUILD_ABI="_meshlib"; -->
<!-- !! NOTE: Sync ONLY MSVC-specific parts of this (i.e. the macros prefixed with `_`) with `CompilerOptions.cmake`. !! -->
<PreprocessorDefinitions>MR_PROJECT_NAME="$(MeshLibProjectName)";IMGUI_USER_CONFIG="imgui/MRCustomImGuiConfig.h";NOMINMAX;_CRT_SECURE_NO_DEPRECATE;ImDrawIdx=unsigned;SPDLOG_COMPILED_LIB;SPDLOG_SHARED_LIB;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING;_SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING;_SILENCE_CXX23_DENORM_DEPRECATION_WARNING;IMGUI_ENABLE_FREETYPE;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR;MRIOEXTRAS_OPENCASCADE_USE_XDE;PYBIND11_NONLIMITEDAPI_LIB_SUFFIX_FOR_MODULE="meshlib";Py_LIMITED_API=0x030800f0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>MR_PROJECT_NAME="$(MeshLibProjectName)";IMGUI_USER_CONFIG="imgui/MRCustomImGuiConfig.h";NOMINMAX;_CRT_SECURE_NO_DEPRECATE;ImDrawIdx=unsigned;SPDLOG_COMPILED_LIB;SPDLOG_SHARED_LIB;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING;_SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING;_SILENCE_CXX23_DENORM_DEPRECATION_WARNING;IMGUI_ENABLE_FREETYPE;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR;MRIOEXTRAS_OPENCASCADE_USE_XDE;PYBIND11_NONLIMITEDAPI_LIB_SUFFIX_FOR_MODULE="meshlib";Py_LIMITED_API=0x030800f0;PYBIND11_COMPILER_TYPE="_meshlib";PYBIND11_BUILD_ABI="_meshlib";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- Adding frequently used MeshLib headers to the PCH speeds up clean (CI) builds but slows local
iterative development, so it is off by default and enabled only in CI via -p:MR_PCH_USE_EXTRA_HEADERS=ON -->
<PreprocessorDefinitions Condition="'$(MR_PCH_USE_EXTRA_HEADERS)'=='ON'">MR_PCH_USE_EXTRA_HEADERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MeshLibSourceDir);$(PythonIncludePath);$(MeshLibDir)thirdparty\parallel-hashmap\;$(MeshLibDir)thirdparty\mrbind-pybind11\include\;$(VcpkgCurrentInstalledDir)\include\suitesparse\;$(VcpkgCurrentInstalledDir)\include\eigen3;$(MeshLibDir)thirdparty\imgui\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(MeshLibSourceDir);$(PythonIncludePath);$(MeshLibDir)thirdparty\parallel-hashmap\;$(VcpkgCurrentInstalledDir)\include\suitesparse\;$(VcpkgCurrentInstalledDir)\include\eigen3;$(MeshLibDir)thirdparty\imgui\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
Expand Down
1 change: 1 addition & 0 deletions source/mrmeshnumpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ENDIF()

IF(APPLE)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
target_link_options(${PROJECT_NAME} PRIVATE -undefined dynamic_lookup)
ENDIF()

target_link_libraries(${PROJECT_NAME}
Expand Down
3 changes: 0 additions & 3 deletions source/mrmeshnumpy/mrmeshnumpy.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
<None Include="..\.editorconfig" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\thirdparty\pybind11nonlimitedapi_stubs.vcxproj">
<Project>{cb6d82fb-e91d-4d62-b82e-be644244e30a}</Project>
</ProjectReference>
<ProjectReference Include="..\MRMesh\MRMesh.vcxproj">
<Project>{c7780500-ca0e-4f5f-8423-d7ab06078b14}</Project>
</ProjectReference>
Expand Down
1 change: 1 addition & 0 deletions source/mrviewerpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ENDIF()

IF(APPLE)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
target_link_options(${PROJECT_NAME} PRIVATE -undefined dynamic_lookup)
ENDIF()

target_link_libraries(${PROJECT_NAME}
Expand Down
Loading
Loading