mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0032739: Configuration, scripts - handle ABI list within macOS building script adm/scripts/macos_build.sh
This commit is contained in:
parent
90eac74988
commit
302ad26bff
@ -20,11 +20,13 @@ export aRapidJson=
|
|||||||
export aDraco=
|
export aDraco=
|
||||||
|
|
||||||
# build stages to perform
|
# build stages to perform
|
||||||
|
export isStatic=0
|
||||||
export toCMake=1
|
export toCMake=1
|
||||||
export toClean=1
|
export toClean=1
|
||||||
export toMake=1
|
export toMake=1
|
||||||
export toInstall=1
|
export toInstall=1
|
||||||
export toPack=0
|
export toPack=0
|
||||||
|
export toPackFat=0
|
||||||
export toDebug=0
|
export toDebug=0
|
||||||
|
|
||||||
export BUILD_ModelingData=ON
|
export BUILD_ModelingData=ON
|
||||||
@ -34,72 +36,92 @@ export BUILD_ApplicationFramework=ON
|
|||||||
export BUILD_DataExchange=ON
|
export BUILD_DataExchange=ON
|
||||||
export BUILD_Draw=ON
|
export BUILD_Draw=ON
|
||||||
|
|
||||||
|
export USE_FREETYPE=ON
|
||||||
export USE_FREEIMAGE=ON
|
export USE_FREEIMAGE=ON
|
||||||
export USE_RAPIDJSON=OFF
|
export USE_RAPIDJSON=OFF
|
||||||
export USE_DRACO=OFF
|
export USE_DRACO=OFF
|
||||||
|
|
||||||
export MACOSX_DEPLOYMENT_TARGET=10.10
|
export MACOSX_DEPLOYMENT_TARGET=10.10
|
||||||
#export anAbi=arm64
|
#export anAbiList="arm64 x86_64"
|
||||||
export anAbi=x86_64
|
export anAbiList="x86_64"
|
||||||
|
aPlatform="macos"
|
||||||
|
|
||||||
if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then
|
if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then
|
||||||
source "${aScriptDir}/macos_custom.sh"
|
source "${aScriptDir}/macos_custom.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||||
|
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||||
|
aGitBranch=`git symbolic-ref --short HEAD`
|
||||||
|
|
||||||
|
YEAR=$(date +"%Y")
|
||||||
|
MONTH=$(date +"%m")
|
||||||
|
DAY=$(date +"%d")
|
||||||
|
aRevision=-${YEAR}-${MONTH}-${DAY}
|
||||||
|
#aRevision=-${aGitBranch}
|
||||||
|
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
aBuildType="Release"
|
aBuildType="Release"
|
||||||
aBuildTypePrefix=
|
aBuildTypePrefix=
|
||||||
if [[ $toDebug == 1 ]]; then
|
if [[ $toDebug == 1 ]]; then
|
||||||
aBuildType="Debug"
|
aBuildType="Debug"
|
||||||
aBuildTypePrefix="-debug"
|
aBuildTypePrefix="-debug"
|
||||||
fi
|
fi
|
||||||
aPlatformAndCompiler=mac-${anAbi}${aBuildTypePrefix}-clang
|
aLibType="Shared"
|
||||||
|
aLibExt="dylib"
|
||||||
|
if [[ $isStatic == 1 ]]; then
|
||||||
|
aLibType="Static"
|
||||||
|
aLibExt="a"
|
||||||
|
fi
|
||||||
|
|
||||||
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
|
function buildArch {
|
||||||
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
|
anAbi=$1
|
||||||
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
|
|
||||||
|
|
||||||
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
|
aPlatformAndCompiler=${aPlatform}-${anAbi}${aBuildTypePrefix}-clang
|
||||||
|
|
||||||
|
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
|
||||||
|
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
|
||||||
|
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
|
||||||
|
|
||||||
|
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
|
||||||
rm -r -f "$aWorkDir"
|
rm -r -f "$aWorkDir"
|
||||||
rm -r -f "$aDestDir"
|
rm -r -f "$aDestDir"
|
||||||
fi
|
fi
|
||||||
mkdir -p "$aWorkDir"
|
mkdir -p "$aWorkDir"
|
||||||
mkdir -p "$aDestDir"
|
mkdir -p "$aDestDir"
|
||||||
rm -f "$aLogFile"
|
rm -f "$aLogFile"
|
||||||
|
|
||||||
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
# include some information about OCCT into archive
|
||||||
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
echo \<pre\>> "${aWorkDir}/VERSION.html"
|
||||||
aGitBranch=`git symbolic-ref --short HEAD`
|
git status >> "${aWorkDir}/VERSION.html"
|
||||||
|
git log -n 100 >> "${aWorkDir}/VERSION.html"
|
||||||
|
echo \</pre\>>> "${aWorkDir}/VERSION.html"
|
||||||
|
|
||||||
# include some information about OCCT into archive
|
pushd "$aWorkDir"
|
||||||
echo \<pre\>> "${aWorkDir}/VERSION.html"
|
|
||||||
git status >> "${aWorkDir}/VERSION.html"
|
|
||||||
git log -n 100 >> "${aWorkDir}/VERSION.html"
|
|
||||||
echo \</pre\>>> "${aWorkDir}/VERSION.html"
|
|
||||||
|
|
||||||
pushd "$aWorkDir"
|
aTimeZERO=$SECONDS
|
||||||
|
|
||||||
aTimeZERO=$SECONDS
|
function logDuration {
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
function logDuration {
|
|
||||||
if [[ $1 == 1 ]]; then
|
if [[ $1 == 1 ]]; then
|
||||||
aDur=$(($4 - $3))
|
aDur=$(($4 - $3))
|
||||||
echo $2 time: $aDur sec>> "$aLogFile"
|
echo $2 time: $aDur sec>> "$aLogFile"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# (re)generate Make files
|
# (re)generate Make files
|
||||||
if [[ $toCMake == 1 ]]; then
|
if [[ $toCMake == 1 ]]; then
|
||||||
echo Configuring OCCT for macOS...
|
echo Configuring OCCT for macOS...
|
||||||
cmake -G "Unix Makefiles" \
|
cmake -G "Unix Makefiles" \
|
||||||
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
|
|
||||||
-D BUILD_LIBRARY_TYPE:STRING="Shared" \
|
|
||||||
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
|
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
|
||||||
|
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
|
||||||
|
-D BUILD_LIBRARY_TYPE:STRING="$aLibType" \
|
||||||
-D INSTALL_DIR:PATH="$aDestDir" \
|
-D INSTALL_DIR:PATH="$aDestDir" \
|
||||||
-D INSTALL_DIR_INCLUDE:STRING="inc" \
|
-D INSTALL_DIR_INCLUDE:STRING="inc" \
|
||||||
-D INSTALL_DIR_LIB:STRING="lib" \
|
-D INSTALL_DIR_LIB:STRING="lib" \
|
||||||
-D INSTALL_DIR_RESOURCE:STRING="src" \
|
-D INSTALL_DIR_RESOURCE:STRING="src" \
|
||||||
-D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \
|
-D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \
|
||||||
|
-D USE_FREETYPE:BOOL="$USE_FREETYPE" \
|
||||||
-D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
|
-D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
|
||||||
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
|
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
|
||||||
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
|
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
|
||||||
@ -127,55 +149,120 @@ if [[ $toCMake == 1 ]]; then
|
|||||||
-D BUILD_DOC_Overview:BOOL="OFF" \
|
-D BUILD_DOC_Overview:BOOL="OFF" \
|
||||||
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
|
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
|
||||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||||
fi
|
fi
|
||||||
aTimeGEN=$SECONDS
|
aTimeGEN=$SECONDS
|
||||||
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
|
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
|
||||||
|
|
||||||
# clean up from previous build
|
# clean up from previous build
|
||||||
if [[ $toClean == 1 ]]; then
|
if [[ $toClean == 1 ]]; then
|
||||||
make clean
|
make clean
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# build the project
|
# build the project
|
||||||
if [[ $toMake == 1 ]]; then
|
if [[ $toMake == 1 ]]; then
|
||||||
echo Building OCCT...
|
echo Building OCCT...
|
||||||
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
|
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
|
||||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||||
fi
|
fi
|
||||||
aTimeBUILD=$SECONDS
|
aTimeBUILD=$SECONDS
|
||||||
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
|
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
|
||||||
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
|
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
|
||||||
|
|
||||||
# install the project
|
# install the project
|
||||||
if [[ $toInstall == 1 ]]; then
|
if [[ $toInstall == 1 ]]; then
|
||||||
echo Installing OCCT into $aDestDir...
|
echo Installing OCCT into $aDestDir...
|
||||||
make install 2>&1 | tee -a "$aLogFile"
|
make install 2>&1 | tee -a "$aLogFile"
|
||||||
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
|
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
|
||||||
fi
|
echo Platform: macOS ABI: ${anAbi} Build: ${aBuildType} MACOSX_DEPLOYMENT_TARGET: ${MACOSX_DEPLOYMENT_TARGET} > "$aDestDir/build_target.txt"
|
||||||
aTimeINSTALL=$SECONDS
|
fi
|
||||||
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
|
aTimeINSTALL=$SECONDS
|
||||||
|
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
|
||||||
# create an archive
|
|
||||||
if [[ $toPack == 1 ]]; then
|
|
||||||
YEAR=$(date +"%Y")
|
|
||||||
MONTH=$(date +"%m")
|
|
||||||
DAY=$(date +"%d")
|
|
||||||
aRevision=-${YEAR}-${MONTH}-${DAY}
|
|
||||||
#aRevision=-${aGitBranch}
|
|
||||||
|
|
||||||
|
# create an archive
|
||||||
|
if [[ $toPack == 1 ]]; then
|
||||||
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
|
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
|
||||||
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
|
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
|
||||||
rm ${aDestDir}/../${anArchName} &>/dev/null
|
rm ${aDestDir}/../${anArchName} &>/dev/null
|
||||||
pushd "$aDestDir"
|
pushd "$aDestDir"
|
||||||
tar -jcf ${aDestDir}/../${anArchName} *
|
tar -jcf ${aDestDir}/../${anArchName} *
|
||||||
popd
|
popd
|
||||||
|
fi
|
||||||
|
aTimePACK=$SECONDS
|
||||||
|
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
|
||||||
|
|
||||||
|
# finished
|
||||||
|
DURATION=$(($aTimePACK - $aTimeZERO))
|
||||||
|
echo Total time: $DURATION sec
|
||||||
|
logDuration 1 "Total" $aTimeZERO $aTimePACK
|
||||||
|
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
for anArchIter in $anAbiList
|
||||||
|
do
|
||||||
|
echo Platform: macOS ABI: ${anArchIter} Build: ${aBuildType}
|
||||||
|
buildArch $anArchIter
|
||||||
|
done
|
||||||
|
|
||||||
|
# create a FAT archive
|
||||||
|
if [[ $toPackFat == 1 ]]; then
|
||||||
|
aSuffixFat=${aPlatform}${aBuildTypePrefix}-clang
|
||||||
|
aFatDir="${aCasSrc}/${aBuildRoot}/${aSuffixFat}"
|
||||||
|
|
||||||
|
# merge per-arch builds into fat builds
|
||||||
|
hasPlatform=0
|
||||||
|
for anArchIter in $anAbiList
|
||||||
|
do
|
||||||
|
aSuffixThin=${aPlatform}-${anArchIter}${aBuildTypePrefix}-clang
|
||||||
|
anArchDir="${aCasSrc}/${aBuildRoot}/${aSuffixThin}"
|
||||||
|
if [[ $hasPlatform == 0 ]]; then
|
||||||
|
hasPlatform=1
|
||||||
|
echo Packing FAT archive
|
||||||
|
rm -r -f "$aFatDir"
|
||||||
|
mkdir -p "$aFatDir"
|
||||||
|
if [[ $isStatic == 1 ]]; then
|
||||||
|
rsync -r -l --exclude '*.a' "$anArchDir/" "$aFatDir"
|
||||||
|
else
|
||||||
|
rsync -r -l --exclude '*.dylib' "$anArchDir/" "$aFatDir"
|
||||||
|
fi
|
||||||
|
rm -f "$aFatDir/build_target.txt"
|
||||||
|
|
||||||
|
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
|
||||||
|
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
|
||||||
|
rm $aFatDir/bin/$aDrawExe
|
||||||
|
lipo "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
|
||||||
|
fi
|
||||||
|
|
||||||
|
for aLibIter in $anArchDir/lib/*.$aLibExt; do
|
||||||
|
aLibName=`basename $aLibIter`
|
||||||
|
if [[ -L "$anArchDir/lib/$aLibName" ]]; then
|
||||||
|
cp -a "$anArchDir/lib/$aLibName" "$aFatDir/lib/"
|
||||||
|
else
|
||||||
|
lipo "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
|
||||||
|
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
|
||||||
|
lipo "$aFatDir/bin/$aDrawExe" "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
|
||||||
|
fi
|
||||||
|
|
||||||
|
for aLibIter in $aFatDir/lib/*.$aLibExt; do
|
||||||
|
aLibName=`basename $aLibIter`
|
||||||
|
if [[ ! -L "$anArchDir/lib/$aLibName" ]]; then
|
||||||
|
lipo "$aFatDir/lib/$aLibName" "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
|
||||||
|
#lipo -info "$aFatDir/lib/$aLibName"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
cat "$anArchDir/build_target.txt" >> "$aFatDir/build_target.txt"
|
||||||
|
done
|
||||||
|
|
||||||
|
# create an archive
|
||||||
|
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aSuffixFat}.tar.bz2
|
||||||
|
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
|
||||||
|
rm ${aFatDir}/../${anArchName} &>/dev/null
|
||||||
|
pushd "$aFatDir"
|
||||||
|
tar -jcf ${aFatDir}/../${anArchName} *
|
||||||
|
popd
|
||||||
fi
|
fi
|
||||||
aTimePACK=$SECONDS
|
|
||||||
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
|
|
||||||
|
|
||||||
# finished
|
|
||||||
DURATION=$(($aTimePACK - $aTimeZERO))
|
|
||||||
echo Total time: $DURATION sec
|
|
||||||
logDuration 1 "Total" $aTimeZERO $aTimePACK
|
|
||||||
|
|
||||||
popd
|
|
||||||
|
@ -12,6 +12,7 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
|
|||||||
#export toMake=1
|
#export toMake=1
|
||||||
#export toInstall=1
|
#export toInstall=1
|
||||||
#export toPack=1
|
#export toPack=1
|
||||||
|
#export toPackFat=1
|
||||||
|
|
||||||
#export BUILD_ModelingData=ON
|
#export BUILD_ModelingData=ON
|
||||||
#export BUILD_ModelingAlgorithms=ON
|
#export BUILD_ModelingAlgorithms=ON
|
||||||
@ -25,5 +26,6 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
|
|||||||
#export USE_FREEIMAGE=ON
|
#export USE_FREEIMAGE=ON
|
||||||
|
|
||||||
#export MACOSX_DEPLOYMENT_TARGET=10.10
|
#export MACOSX_DEPLOYMENT_TARGET=10.10
|
||||||
#export anAbi=arm64
|
#export anAbiList=arm64
|
||||||
#export anAbi=x86_64
|
#export anAbiList=x86_64
|
||||||
|
#export anAbiList="arm64 x86_64"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user