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

#!/bin/bash
echo -e "\n正在编译和安装 LuxCore项目……\n\n"
# 接收参数
TARGET=$1
# 设置编译LuxCore项目的四个模块,分别是luxrays、luxcore、pyluxcore、luxcoreui
LUXCORE_TARGET='luxrays luxcore pyluxcore luxcoreui'
# 设置 将一个通用参数,作为 执行编译LuxCore项目时 的参数。
# LUXCORE_FLAGS=`echo $6 | sed s/'-fvisibility=hidden'//`" -pthread -lrt" # 使用 GCC 编译器 时的编译参数
# LUXCORE_FLAGS="-mtune=generic -mno-ssse3 -mmmx -msse -msse2 -O3 -pipe -fvisibility-inlines-hidden -fno-stack-protector -fPIC -fopenmp=libomp" # 使用 clang++ 编译器 时的编译参数
# 设置链接库的编译方式
# BUILD_LUXCORE_DLL="-D BUILD_LUXCORE_DLL=1" # 动态链接
# BUILD_LUXCORE_DLL='' # 静态链接
PYTHON_LIB=`find $TARGET -name 'libpython*'`
PYTHON_VARIANT=`if $(basename "$PYTHON_LIB" | grep -q 'm') ; then echo 'm' ; fi`
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'//`
echo " * 使用Python库路径: $PYTHON_LIB"
echo " * 使用Python头路径: $PYTHON_INCLUDE"
echo
echo -ne "\033]0;LuxCore stage\007"
cd ${SHELLROOT}/LuxCore
echo " * 正在配置 $LUXCORE_TARGET"
if ! cmake -G "Unix Makefiles" $BUILD_LUXCORE_DLL \
-Wno-dev \
-D LUXRAYS_CUSTOM_CONFIG=cmake/SpecializedConfig/Config_Linux-Static.cmake \
-D PYTHON_LIBRARY:FILEPATH="$PYTHON_LIB" \
-D PYTHON_INCLUDE_DIR:PATH="$PYTHON_INCLUDE" \
-D PYTHON_INCLUDE_DIRS:PATH="$PYTHON_INCLUDE" . ; then
echo -e "\n !!! $LUXCORE_TARGET LuxCore项目 配置失败\n"
exit 1
fi
sleep 2
echo " * Compiling $LUXCORE_TARGET"
if cmake --build . -- $MAKEOPTS ; then
echo -e "\n * $LUXCORE_TARGET LuxCore项目,编译和安装成功\n"
else
echo -e "\n !!! $LUXCORE_TARGET LuxCore项目,编译和安装失败\n"
exit 1
fi
mkdir ${TARGET}/LuxCore
if echo "LuxCore" | grep -iq 'pyluxcore' ; then
cp -vf lib/*.so ${TARGET}/LuxCore
sleep 2
cd $SHELLROOT
exit 0
fi
exit 0