Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 6c96bc22 authored by ADILI Robin's avatar ADILI Robin
Browse files

platform specific library options

parent e6a85585
Branches
No related tags found
No related merge requests found
File moved
File moved
pushd %~dp0
SET "CURRENTDIR=%cd%"
SET "BUILDDIR=%CURRENTDIR%\build"
SET "BUILDTOOLSDIR=%BUILDDIR%\buildtools"
SET "VCVARSBAT=%BUILDTOOLSDIR%\VC\Auxiliary\Build\vcvars64.bat"
SET "SIPDIR=%BUILDDIR%\sip-4.19.3"
SET "SIPINSTALLDIR=%BUILDDIR%\sipinstall"
SET "vs_buildtoolsexe=%BUILDDIR%\vs_buildtools.exe"
SET "FBXSDKDIR=%BUILDDIR%\fbxsdk"
SET "FBXSDKPYTHONDIR=%BUILDDIR%\fbxpy"
:: PYTHONVERSION=$(python -c [...]) #lol
for /f %%i in ('python -c "import sys; print(''.join(sys.version.split(' ')[0].split('.')[:2]))"') do set PYTHONVERSION=%%i
SET "FBXDIR=%CURRENTDIR%\fbxsdkpy-cp%PYTHONVERSION%-win_x64"
mkdir "%BUILDDIR%"
mkdir "%BUILDTOOLSDIR%"
mkdir "%SIPINSTALLDIR%"
mkdir "%FBXSDKDIR%"
mkdir "%FBXSDKPYTHONDIR%"
mkdir "%FBXDIR%"
echo "Download and install Visual Studio Build Tools (nmake, MSVC, link, etc.)"
curl -L -o %vs_buildtoolsexe% https://aka.ms/vs/16/release/vs_buildtools.exe
%vs_buildtoolsexe% --quiet --wait --norestart --nocache --installPath "%BUILDTOOLSDIR%" --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 --remove Microsoft.VisualStudio.Component.Windows81SDK --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK|| IF "%ERRORLEVEL%"=="3010" EXIT 0
echo "Load environment variables to use Build Tools from this script"
call %VCVARSBAT%
for /F "tokens=1,2 delims=;" %%i in (reqs_win.txt) do (
curl -L -o "%BUILDDIR%\%%i.exe" %%j
"%BUILDDIR%\%%i.exe" /S /D=%BUILDDIR%\%%i
)
::curl -L -O "https://gitlab.inria.fr/radili/fbxsdk_python/uploads/12002ae82d20e4d6b60107dacb5abe4b/sip-4.19.3.tar.gz"
tar xvf sip-4.19.3.tar.gz -C "%BUILDDIR%"
cd "%BUILDDIR%"\sip-*
python "configure.py" -b "%SIPINSTALLDIR%" -d "%SIPINSTALLDIR%" -e "%SIPINSTALLDIR%" --pyidir="%SIPINSTALLDIR%" --sip-module="fbxsip"
nmake
nmake install
cd %CURRENTDIR%
copy "PythonBindings.py" "%FBXSDKPYTHONDIR%\PythonBindings.py"
SET "FBXSDK_ROOT=%FBXSDKDIR%"
SET "SIP_ROOT=%SIPDIR%"
python "%FBXSDKPYTHONDIR%"\PythonBindings.py Python3_x64
copy "%FBXSDKPYTHONDIR%\build\Distrib\site-packages\fbx\*" "%FBXDIR%"
copy "%SIPINSTALLDIR%\fbxsip.pyd" "%FBXDIR%"
%vs_buildtoolsexe% uninstall --quiet --wait --norestart --nocache --installPath "%BUILDTOOLSDIR%" --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 --remove Microsoft.VisualStudio.Component.Windows81SDK --remove Microsoft.VisualStudio.Workload.VCTools --remove Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --remove Microsoft.VisualStudio.Component.Windows10SDK || IF "%ERRORLEVEL%"=="3010" EXIT 0
popd
pause
#!/bin/bash
set -x
which python
python --version
origdir=$(pwd)
scdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
builddir="$scdir"/build
fbxsdkdir="$builddir"/fbxsdk
fbxpydir="$builddir"/fbxpy
reqsfile="${scdir}"/reqs.txt
[ -d "$builddir" ] || mkdir "$builddir"
# download fbxsdk
if [ ! -d "$fbxsdkdir" ]
then
mkdir "$fbxsdkdir"
url=$(grep 'fbx.*fbxsdk' $reqsfile)
file=${url##*/}
tar="${fbxsdkdir}/${file}"
curl -L -o "$tar" $url
tar -xvzf "$tar" -C "$fbxsdkdir"
printf "yes\nn\n" |"$fbxsdkdir"/fbx*fbxsdk_linux "$fbxsdkdir"
# patch libfbxsdk.so because it is not linked against libxml2 and libz for some reason
patchelf --add-needed libz.so.1 ${fbxsdkdir}/lib/gcc/x64/release/libfbxsdk.so
patchelf --add-needed libxml2.so.2 ${fbxsdkdir}/lib/gcc/x64/release/libfbxsdk.so
else
echo "Skipping installation of fbxsdk because "$fbxsdkdir" exists"
fi
# download fbxsdk python bindings
if [ ! -d "$fbxpydir" ]
then
mkdir "$fbxpydir"
url=$(grep 'fbx.*fbxpythonbindings_linux' $reqsfile)
file=${url##*/}
tar="${fbxpydir}/${file}"
curl -L -o "$tar" $url
tar -xvzf "$tar" -C "$fbxpydir"
printf "yes\nn\n"|"$fbxpydir"/fbx*fbxpythonbindings_linux "$fbxpydir"
# patch sip files and library headers so that they compile with sip5
patch -N -p0 < patch
else
echo "Skipping installation of fbx python bindings because "$fbxpydir" exists"
fi
sip-wheel --verbose
LD_LIBRARY_PATH=${fbxsdkdir}/lib/gcc/x64/release/:$LD_LIBRARY_PATH auditwheel -v repair $(ls -1t fbx*.whl|head -1)
import os
import sys
from sipbuild import Option, Project
class FBXSDKPyProject(Project):
""" A project that adds an additional configuration options to specify
the locations of the fib header file and library.
"""
def get_options(self):
""" Return the sequence of configurable options. """
# Get the standard options.
options = super().get_options()
# Add our new options.
win_libs_option = Option('win_libraries',
help="a list of libraries needed on the windows platform for Python >=3.7", option_type=list, metavar="LIST")
options.append(win_libs_option)
win_py36_libs_option = Option('win36_libraries',
help="a list of libraries needed on the windows platform for Python <=3.6", option_type=list, metavar="LIST")
options.append(win_py36_libs_option)
linux_libs_option = Option('linux_libraries',
help="a list of libraries needed on the linuxdows platform", option_type=list, metavar="LIST")
options.append(linux_libs_option)
return options
def update(self, tool):
""" Update the project configuration. """
# Get the fib bindings object.
fbx_bindings = self.bindings['fbx_module']
libraries = []
if sys.platform == "win32":
if sys.version_info.major == 3 and sys.version_info.minor < 7:
libraries = self.win_libs_option
else:
libraries = self.win_py36_libs_option
elif sys.platform == "linux":
libraries = self.linux_libs_option
else:
raise Exception("Your platform "+sys.platform+" is not supported")
fbx_bindings.libraries.extend(libraries)
......@@ -13,7 +13,10 @@ version = "2020.1"
headers = ["fbxsdk.h"]
include-dirs = ["build/fbxsdk/include"]
libraries = ["fbxsdk"]
library-dirs = ["build/fbxsdk/lib/gcc/x64/release"]
library-dirs = ["build/fbxsdk/lib/all/x64/release"]
win-libraries = ["libfbxsdk-md", "zlib-md", "libxml2-md", "Advapi32", "Wininet"]
win-py36-libraries = ["libfbxsdk-mt", "zlib-mt", "libxml2-mt", "Advapi32", "Wininet"]
linux-libraries = ["build/fbxsdk/lib/all/x64/release"]
[tool.sip.project]
sip-files-dir = "build/fbxpy/sip"
......
https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-1-1/fbx202011_fbxsdk_linux.tar.gz
https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-1-1/fbx202011_fbxpythonbindings_linux.tar.gz
fbxsdk;https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-1-1/fbx202011_fbxsdk_linux.tar.gz
fbxpy;https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-1-1/fbx202011_fbxpythonbindings_linux.tar.gz
fbxsdk;https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-1/fbx20201_fbxsdk_vs2017_win.exe
fbxpy;https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-1/fbx20201_fbxpythonbindings_win.exe
fbxsdk;https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-1/fbx20201_fbxsdk_vs2017_win.exe
fbxsdkpy;https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-1/fbx20201_fbxpythonbindings_win.exe
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment