-
Notifications
You must be signed in to change notification settings - Fork 144
Description
Compilation issue on windows
TLDR:
CMake Error at python/PyAlembic/Tests/CMakeLists.txt:49 (GET_TARGET_PROPERTY):
get_target_property() called with non-existent target
"Imath::PyImath_Python3_9".
How to reproduce
Requierements:
- python 3.9.10
- Boost source code (tested with 1.85.0 and 1.81.0, same behavior)
- Imath Source code (3.1.11)
- Alembic source code (1.8.5)
- CMake
- MSVC 14.39.33519
Compile boost with python binding
You can use b2 or cmake, i have tested with both, but in this example i will detail with cmake, more simple to explain.
So in <Boost_SOURCE_ROOT>/:
cmake -S . -B ./build -DBOOST_ENABLE_PYTHON=ON -DPython_ROOT_DIR=C:/python39 -DCMAKE_INSTALL_PREFIX=E:/compile_alembic/boost-1.85.0/install_prefix
cmake --build .\build\ --config Release --target install Compile IMath
In <IMath_SOURCE_ROOT>/
cmake -S . -B ./build -DPYTHON=ON -DCMAKE_INSTALL_PREFIX=E:/compile_alembic/Imath-3.1.11/install -DCMAKE_BUILD_TYPE=Release -DBoost_ROOT=E:/compile_alembic/boost-1.85.0/install_prefix -DPython_EXECUTABLE=C:/Python39/python.exe -DPython3_EXECUTABLE=C:/Python39/python.exe -DBoost_NO_BOOST_CMAKE=OFF
cmake --build .\build\ --config Release --target install Compile Alembic
cmake -S . -B ./build/ -DImath_ROOT=E:/compile_alembic/Imath-3.1.11/install -DUSE_PYALEMBIC=ON -DCMAKE_INSTALL_PREFIX=E:/compile_alembic/alembic-1.8.5/install -DBoost_INCLUDE_DIR=E:/compile_alembic/boost-1.85.0/install_prefix/includes/boost-1.85.0 -DCMAKE_BUILD_TYPE=ReleaseAnd now you should see this error:
CMake Error at python/PyAlembic/Tests/CMakeLists.txt:49 (GET_TARGET_PROPERTY):
get_target_property() called with non-existent target
"Imath::PyImath_Python3_9".Things tried
- Recompile boost using b2 then recompile imath
- Recompile boost v1.81.0 using b2 then recompile imath
- Recompile boost v1.81.0 using b2 and theses arguments
release link=shared --python=3.9 --build-type=complete --prefix=.\prefix_install --threading=multithen recompile imath - Edit the .cmake file in
<PREFIX_IMATH>/lib/cmake/Imath/ImathTargets-release.cmakeTo check if you have theImath::PyImath_Python3_9target, but we don't. , so i have tried to create-it manually, like this
set_property(TARGET Imath::PyImath_Python3_9 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(Imath::PyImath_Python3_9 PROPERTIES
IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/PyImath_Python3_9-3_1.lib"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/PyImath_Python3_9-3_1.dll"
)Then i also add this in ImathTargets.cmake
...
add_library(Imath::PyImath_Python3_9 INTERFACE IMPORTED)
set_target_properties(Imath::PyImath_Python3_9 PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "IMATH_DLL"
INTERFACE_COMPILE_FEATURES "cxx_std_11"
INTERFACE_COMPILE_OPTIONS "/EHsc"
INTERFACE_INCLUDE_DIRECTORIES "E:/compile_alembic/boost-1.85.0/install_prefix/includes/boost-1.85.0"
INTERFACE_LINK_LIBRARIES "Imath::ImathConfig"
)
...Everything i tried above, didn't work and when i try to compile without python binding it's works...
I don't know if it's normal or not, but i have searched for this Imath::PyImath_Python3_9 target, and i didn't find it in any of targets .cmake file under <PREFIX_IMATH>/lib/cmake/Imath/, that's why i'm posting this issue here instead of on alembic google group.
Maybe i made something wrong, i'm a beginner with all this compilation pipeline stuff, using Imath and alembic, don't hesistate to share with me some feedbacks or idea.
Thank you