You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.1 KiB

  1. #!/bin/bash
  2. echo -e "\n正在编译和安装 LuxCore项目……\n\n"
  3. # 接收参数
  4. TARGET=$1
  5. # 设置编译LuxCore项目的四个模块,分别是luxrays、luxcore、pyluxcore、luxcoreui
  6. LUXCORE_TARGET='luxrays luxcore pyluxcore luxcoreui'
  7. # 设置 将一个通用参数,作为 执行编译LuxCore项目时 的参数。
  8. # LUXCORE_FLAGS=`echo $6 | sed s/'-fvisibility=hidden'//`" -pthread -lrt" # 使用 GCC 编译器 时的编译参数
  9. # LUXCORE_FLAGS="-mtune=generic -mno-ssse3 -mmmx -msse -msse2 -O3 -pipe -fvisibility-inlines-hidden -fno-stack-protector -fPIC -fopenmp=libomp" # 使用 clang++ 编译器 时的编译参数
  10. # 设置链接库的编译方式
  11. # BUILD_LUXCORE_DLL="-D BUILD_LUXCORE_DLL=1" # 动态链接
  12. # BUILD_LUXCORE_DLL='' # 静态链接
  13. PYTHON_LIB=`find $TARGET -name 'libpython*'`
  14. PYTHON_VARIANT=`if $(basename "$PYTHON_LIB" | grep -q 'm') ; then echo 'm' ; fi`
  15. PYTHON_INCLUDE=`find /usr/include -type d -name "${PYTHON_CMD}*${PYTHON_VARIANT}" | awk '{ print length($0) " " $0; }' $file | sort -r -n | cut -d ' ' -f 2- | tail -n1 | sed s/'\n'//`
  16. echo " * 使用Python库路径: $PYTHON_LIB"
  17. echo " * 使用Python头路径: $PYTHON_INCLUDE"
  18. echo
  19. echo -ne "\033]0;LuxCore stage\007"
  20. cd ${SHELLROOT}/LuxCore
  21. echo " * 正在配置 $LUXCORE_TARGET"
  22. if ! cmake -G "Unix Makefiles" $BUILD_LUXCORE_DLL \
  23. -Wno-dev \
  24. -D LUXRAYS_CUSTOM_CONFIG=cmake/SpecializedConfig/Config_Linux-Static.cmake \
  25. -D PYTHON_LIBRARY:FILEPATH="$PYTHON_LIB" \
  26. -D PYTHON_INCLUDE_DIR:PATH="$PYTHON_INCLUDE" \
  27. -D PYTHON_INCLUDE_DIRS:PATH="$PYTHON_INCLUDE" . ; then
  28. echo -e "\n !!! $LUXCORE_TARGET LuxCore项目 配置失败\n"
  29. exit 1
  30. fi
  31. sleep 2
  32. echo " * Compiling $LUXCORE_TARGET"
  33. if cmake --build . -- $MAKEOPTS ; then
  34. echo -e "\n * $LUXCORE_TARGET LuxCore项目,编译和安装成功\n"
  35. else
  36. echo -e "\n !!! $LUXCORE_TARGET LuxCore项目,编译和安装失败\n"
  37. exit 1
  38. fi
  39. mkdir ${TARGET}/LuxCore
  40. if echo "LuxCore" | grep -iq 'pyluxcore' ; then
  41. cp -vf lib/*.so ${TARGET}/LuxCore
  42. sleep 2
  43. cd $SHELLROOT
  44. exit 0
  45. fi
  46. exit 0