sutongkui / UE5TaichiIntegration

11 stars 0 forks source link

Compiling Taichi in UE5 Failed #3

Closed solort closed 1 year ago

solort commented 1 year ago

I have compiled Taichi in UE5, but when I run python setup.py develop, I got a CMake Error .

git clone --recursive https://github.com/taichi-dev/taichi/
git checkout f5a5b28

set TAICHI_CMAKE_ARGS=-DCLANG_EXECUTABLE=G:/Taichi/clang-10.0.0-win/bin/clang++.exe -DLLVM_AS_EXECUTABLE="G:/Taichi/taichi-llvm-10.0.0-msvc2022/llvm-as.exe" -DTI_WITH_VULKAN=ON -DTI_WITH_CUDA=ON -DTI_WITH_C_API=ON -DTI_WITH_LLVM=OFF

# path
E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64
E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\Scripts

# install
python -m pip install  -r requirements_dev.txt
python setup.py develop 
Taichi Version 1.3.0
       Commit f5a5b28cbf596e925ea2357b061b179d9470f2f2
CMAKE_MSVC_RUNTIME_LIBRARY:
CLANG_EXECUTABLE defined: G:/Taichi/clang-10.0.0-win/bin/clang++.exe
G:/Taichi/clang-10.0.0-win/bin/clang++.exe --version: 10.0.0
-- Python: Using E:/UE_5.0/Engine/Binaries/ThirdParty/Python3/Win64/python.exe as the interpreter
    version: 3.9.7
    include: E:/UE_5.0/Engine/Binaries/ThirdParty/Python3/Win64/Include
    library: None
    numpy include: E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\lib\site-packages\numpy\core\include
CMake Error at E:/UE_5.0/Engine/Binaries/ThirdParty/Python3/Win64/Lib/site-packages/pybind11/share/cmake/pybind11/FindPythonLibsNew.cmake:240 (message):
  Python libraries not found
Call Stack (most recent call first):
  E:/UE_5.0/Engine/Binaries/ThirdParty/Python3/Win64/Lib/site-packages/pybind11/share/cmake/pybind11/pybind11Tools.cmake:50 (find_package)
  E:/UE_5.0/Engine/Binaries/ThirdParty/Python3/Win64/Lib/site-packages/pybind11/share/cmake/pybind11/pybind11Common.cmake:180 (include)
  E:/UE_5.0/Engine/Binaries/ThirdParty/Python3/Win64/Lib/site-packages/pybind11/share/cmake/pybind11/pybind11Config.cmake:248 (include)
  cmake/PythonNumpyPybind11.cmake:15 (find_package)
  CMakeLists.txt:123 (include)

An error occurred while configuring with CMake.
  Command:
    cmake 'e:\taichi\taichi' -G Ninja '-DCMAKE_INSTALL_PREFIX:PATH=e:\taichi\taichi\_skbuild\win-amd64-3.9\cmake-install' -DPYTHON_VERSION_STRING:STRING=3.9.7 -DSKBUILD:INTERNAL=TRUE '-DCMAKE_MODULE_PATH:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\lib\site-packages\skbuild\resources\cmake' '-DPYTHON_EXECUTABLE:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\python.exe' '-DPYTHON_INCLUDE_DIR:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\Include' -DPYTHON_LIBRARY:PATH=None '-DPython_EXECUTABLE:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\python.exe' '-DPython_ROOT_DIR:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64' '-DPython_INCLUDE_DIR:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\Include' -DPython_FIND_REGISTRY:STRING=NEVER '-DPython_NumPy_INCLUDE_DIRS:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\lib\site-packages\numpy\core\include' '-DPython3_EXECUTABLE:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\python.exe' '-DPython3_ROOT_DIR:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64' '-DPython3_INCLUDE_DIR:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\Include' -DPython3_FIND_REGISTRY:STRING=NEVER '-DPython3_NumPy_INCLUDE_DIRS:PATH=E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64\lib\site-packages\numpy\core\include' -DCLANG_EXECUTABLE=G:/Taichi/clang-10.0.0-win/bin/clang++.exe -DLLVM_AS_EXECUTABLE=G:/Taichi/taichi-llvm-10.0.0-msvc2022/llvm-as.exe -DTI_WITH_VULKAN=ON -DTI_WITH_CUDA=ON -DTI_WITH_C_API=ON -DTI_WITH_LLVM=OFF -DTI_VERSION_MAJOR=1 -DTI_VERSION_MINOR=3 -DTI_VERSION_PATCH=0 -DCMAKE_BUILD_TYPE:STRING=Release

It seems that python libraries in UE5 can't be found with cmake config '-DPYTHON_LIBRARY:PATH=None'.

solort commented 1 year ago

When I compile Taichi from source in conda environment, one config of cmake is '-DPYTHON_LIBRARY:PATH=C:\Users\666\Anaconda3\envs\taichi-nightly\libs\python38.lib'.But when I compile with pip in UE5, I got '-DPYTHON_LIBRARY:PATH=None'.

Then I found that threre are not 'include' and 'libs' in 'E:\UE_5.0\Engine\Binaries\ThirdParty\Python3\Win64' but in 'E:\UE_5.0\Engine\Source\ThirdParty\Python3\Win64'. So I copy folders,‘include’ and ‘libs’, from 'Source' path into 'Binaries' path, and then I succeed in compiling Taichi.

sutongkui commented 1 year ago

Cool!