From 80d5397e251d8e12c8cd77efcacc54b9f7de3f0b Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 18 Nov 2016 16:53:17 +0100 Subject: Add automated Windows build scripts --- README.md | 31 +++++---- README.txt | 30 +++++---- build/msvc/build_clean.bat | 12 ++++ build/msvc/build_env.bat | 16 +++++ build/msvc/build_matlab.bat | 14 ++++ build/msvc/build_python27.bat | 28 ++++++++ build/msvc/build_python35.bat | 27 ++++++++ build/msvc/build_release.bat | 145 ++++++++++++++++++++++++++++++++++++++++++ build/msvc/build_setup.bat | 37 +++++++++++ 9 files changed, 318 insertions(+), 22 deletions(-) create mode 100644 build/msvc/build_clean.bat create mode 100644 build/msvc/build_env.bat create mode 100644 build/msvc/build_matlab.bat create mode 100644 build/msvc/build_python27.bat create mode 100644 build/msvc/build_python35.bat create mode 100644 build/msvc/build_release.bat create mode 100644 build/msvc/build_setup.bat diff --git a/README.md b/README.md index 6691d5f..43d92b4 100644 --- a/README.md +++ b/README.md @@ -70,21 +70,30 @@ make install This will install Astra into your current Python environment. -### Windows, from source using Visual Studio 2008 +### Windows, from source using Visual Studio 2015 -Requirements: Visual Studio 2008, boost, CUDA (driver+toolkit), matlab. -Note that a .zip with all required (and precompiled) boost files is - available from our website. +Requirements: Visual Studio 2015 (full or community), boost (recent), CUDA 8.0, + Matlab (R2012a or higher) and/or WinPython 2.7/3.x. + +Using the Visual Studio IDE: Set the environment variable MATLAB_ROOT to your matlab install location. -Open astra_vc08.sln in Visual Studio. -Select the appropriate solution configuration. - (typically Release_CUDA|win32 or Release_CUDA|x64) +Copy boost headers to lib\include\boost, and boost libraries to bin\x64. +Open astra_vc14.sln in Visual Studio. +Select the appropriate solution configuration (typically Release_CUDA|x64). Build the solution. -Install by copying AstraCuda32.dll or AstraCuda64.dll from bin/ and - all .mexw32 or .mexw64 files from bin/Release_CUDA or bin/Debug_CUDA - and the entire matlab/tools directory to a directory to be added to - your matlab path. +Install by copying AstraCuda64.dll and all .mexw64 files from + bin\x64\Release_CUDA and the entire matlab/tools directory to a directory + to be added to your matlab path. + + +Using .bat scripts in build\msvc: + +Edit build_env.bat and set up the correct directories. +Run build_setup.bat to automatically copy the boost headers and libraries. +For matlab: Run build_matlab.bat. The .dll and .mexw64 files will be in bin\x64\Release_Cuda. +For python 2.7/3.5: Run build_python27.bat or build_python35.bat. Astra will be directly installed into site-packages. + ## References diff --git a/README.txt b/README.txt index aec5282..1aa69e3 100644 --- a/README.txt +++ b/README.txt @@ -97,22 +97,30 @@ This will install Astra into your current Python environment. -Windows, from source using Visual Studio 2008: +Windows, from source using Visual Studio 2015: ----------------------------------------------- -Requirements: Visual Studio 2008, boost, CUDA (driver+toolkit), matlab. -Note that a .zip with all required (and precompiled) boost files is - available from our website. +Requirements: Visual Studio 2015 (full or community), boost (recent), CUDA 8.0, + Matlab (R2012a or higher) and/or WinPython 2.7/3.x. + +Using the Visual Studio IDE: Set the environment variable MATLAB_ROOT to your matlab install location. -Open astra_vc08.sln in Visual Studio. -Select the appropriate solution configuration. - (typically Release_CUDA|win32 or Release_CUDA|x64) +Copy boost headers to lib\include\boost, and boost libraries to bin\x64. +Open astra_vc14.sln in Visual Studio. +Select the appropriate solution configuration (typically Release_CUDA|x64). Build the solution. -Install by copying AstraCuda32.dll or AstraCuda64.dll from bin/ and - all .mexw32 or .mexw64 files from bin/Release_CUDA or bin/Debug_CUDA - and the entire matlab/tools directory to a directory to be added to - your matlab path. +Install by copying AstraCuda64.dll and all .mexw64 files from + bin\x64\Release_CUDA and the entire matlab/tools directory to a directory + to be added to your matlab path. + + +Using .bat scripts in build\msvc: + +Edit build_env.bat and set up the correct directories. +Run build_setup.bat to automatically copy the boost headers and libraries. +For matlab: Run build_matlab.bat. The .dll and .mexw64 files will be in bin\x64\Release_Cuda. +For python 2.7/3.5: Run build_python27.bat or build_python35.bat. Astra will be directly installed into site-packages. References: diff --git a/build/msvc/build_clean.bat b/build/msvc/build_clean.bat new file mode 100644 index 0000000..4525529 --- /dev/null +++ b/build/msvc/build_clean.bat @@ -0,0 +1,12 @@ +@echo off + +set MATLAB_ROOT=C:\Program Files\MATLAB\R2015a + +call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" + +cd %~dp0 +cd ..\.. + +msbuild astra_vc14.sln /p:Configuration=Release_CUDA /p:Platform=x64 /t:clean + +pause diff --git a/build/msvc/build_env.bat b/build/msvc/build_env.bat new file mode 100644 index 0000000..458209a --- /dev/null +++ b/build/msvc/build_env.bat @@ -0,0 +1,16 @@ +set B_WP27=2.7.10.3 +set B_WP35=3.5.2.3 +set B_WINPYTHON27=D:\wjp\WinPython-64bit-%B_WP27% +set B_WINPYTHON35=D:\wjp\WinPython-64bit-%B_WP35% +set B_MATLAB_ROOT=C:\Program Files\MATLAB\R2015a +set B_VC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64 +set B_BV=1_62 +set B_BOOST=D:\wjp\boost_%B_BV%_0 + +set B_VCREDIST=D:\wjp\vs2015u3_redist\vc_redist.x64.exe + +set B_README_WP27=C:\WinPython-64bit-%B_WP27%\python-%B_WP27:~0,-2%.amd64\Lib\site-packages +set B_README_WP35=C:\WinPython-64bit-%B_WP35%\python-%B_WP35:~0,-2%.amd64\Lib\site-packages + +set B_RELEASE_TAG=v1.7.1 +set B_RELEASE=1.7.1beta diff --git a/build/msvc/build_matlab.bat b/build/msvc/build_matlab.bat new file mode 100644 index 0000000..7a2ef79 --- /dev/null +++ b/build/msvc/build_matlab.bat @@ -0,0 +1,14 @@ +@echo off + +call "%~dp0build_env.bat" + +call "%B_VC%\vcvars64.bat" + +cd /D %~dp0 +cd ..\.. + +set MATLAB_ROOT=%B_MATLAB_ROOT% + +msbuild astra_vc14.sln /p:Configuration=Release_CUDA /p:Platform=x64 + +pause diff --git a/build/msvc/build_python27.bat b/build/msvc/build_python27.bat new file mode 100644 index 0000000..a9495f0 --- /dev/null +++ b/build/msvc/build_python27.bat @@ -0,0 +1,28 @@ +@echo off + +cd /D %~dp0 +cd ..\.. +set R=%CD% + +call "%~dp0build_env.bat" + +call "%B_WINPYTHON27%\scripts\env.bat" +call "%B_VC%\vcvars64.bat" + +cd /D %R% + +msbuild astra_vc14.sln /p:Configuration=Release_CUDA /p:Platform=x64 /t:astra_vc14 + +cd python + +rd /s /q build +rd /s /q "%WINPYDIR%\lib\site-packages\astra" + +set VS90COMNTOOLS=%VS140COMNTOOLS% +set CL=/DASTRA_CUDA /DASTRA_PYTHON /EHsc +set INCLUDE=%R%\include;%R%\lib\include;%CUDA_PATH%\include +copy ..\bin\x64\Release_CUDA\AstraCuda64.lib astra.lib +python builder.py build_ext --compiler=msvc install +copy ..\bin\x64\Release_CUDA\AstraCuda64.dll "%WINPYDIR%\lib\site-packages\astra" + +pause diff --git a/build/msvc/build_python35.bat b/build/msvc/build_python35.bat new file mode 100644 index 0000000..72c6ec4 --- /dev/null +++ b/build/msvc/build_python35.bat @@ -0,0 +1,27 @@ +@echo off + +cd /D %~dp0 +cd ..\.. +set R=%CD% + +call "%~dp0build_env.bat" + +call "%B_WINPYTHON35%\scripts\env.bat" +call "%B_VC%\vcvars64.bat" + +cd /D %R% + +msbuild astra_vc14.sln /p:Configuration=Release_CUDA /p:Platform=x64 /t:astra_vc14 + +cd python + +rd /s /q build +rd /s /q "%WINPYDIR%\lib\site-packages\astra" + +set CL=/DASTRA_CUDA /DASTRA_PYTHON +set INCLUDE=%R%\include;%R%\lib\include;%CUDA_PATH%\include +copy ..\bin\x64\Release_CUDA\AstraCuda64.lib astra.lib +python builder.py build_ext --compiler=msvc install +copy ..\bin\x64\Release_CUDA\AstraCuda64.dll "%WINPYDIR%\lib\site-packages\astra" + +pause diff --git a/build/msvc/build_release.bat b/build/msvc/build_release.bat new file mode 100644 index 0000000..87bfb28 --- /dev/null +++ b/build/msvc/build_release.bat @@ -0,0 +1,145 @@ +@echo off + +cd /D %~dp0 +cd ..\.. + +set R=%CD% + +call "%~dp0build_env.bat" + +rd /s /q release + +mkdir release +cd release +mkdir src +mkdir matlab +mkdir python27 +mkdir python35 + +cd src +git clone https://github.com/astra-toolbox/astra-toolbox astra-%B_RELEASE% +cd astra-%B_RELEASE% +git checkout %B_RELEASE_TAG% +rd /s /q .git + +pause + +cd %R%\release\matlab +mkdir astra-%B_RELEASE% +cd astra-%B_RELEASE% +xcopy /e /i %R%\samples\matlab samples +xcopy /e /i %R%\matlab\algorithms algorithms +xcopy /e /i %R%\matlab\tools tools +copy %R%\NEWS.txt . +copy %R%\README.txt . +copy %R%\COPYING COPYING.txt + +copy %B_VCREDIST% . + +mkdir mex +copy %R%\bin\x64\Release_CUDA\*.mexw64 mex +copy %R%\bin\x64\Release_CUDA\AstraCuda64.dll mex +copy %R%\bin\x64\Release_CUDA\AstraCuda64.lib mex +copy "%CUDA_PATH%\bin\cudart64_80.dll" mex +copy "%CUDA_PATH%\bin\cufft64_80.dll" mex + +pause + +rem ------------------------------------------------------------------- + +cd %R%\release\python27 +mkdir astra-%B_RELEASE% +cd astra-%B_RELEASE% +xcopy /e /i %R%\samples\python samples +copy %R%\NEWS.txt . +copy %R%\COPYING COPYING.txt + +copy %B_VCREDIST% . + +mkdir astra +call "%B_WINPYTHON27%\scripts\env.bat" +copy %WINPYDIR%\lib\site-packages\astra\*.* astra +copy %R%\bin\x64\Release_CUDA\AstraCuda64.lib astra +copy "%CUDA_PATH%\bin\cudart64_80.dll" astra +copy "%CUDA_PATH%\bin\cufft64_80.dll" astra + +( +echo ----------------------------------------------------------------------- +echo This file is part of the ASTRA Toolbox +echo. +echo Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +echo 2014-2016, CWI, Amsterdam +echo http://visielab.uantwerpen.be/ and http://www.cwi.nl/ +echo License: Open Source under GPLv3 +echo Contact: astra@uantwerpen.be +echo Website: http://www.astra-toolbox.com/ +echo ----------------------------------------------------------------------- +echo. +echo. +echo This directory contains pre-built Python modules for the ASTRA Toolbox. +echo. +echo It has been built with WinPython-64bit-%B_WP27%. +echo. +echo To use it, move the astra\ directory to your existing site-packages directory. +echo Its exact location depends on your Python installation, but should look +echo similar to %B_README_WP27% . +echo. +echo Sample code can be found in the samples\ directory. +) > README.txt + +pause + +rem ------------------------------------------------------------------- + +cd %R%\release\python35 +mkdir astra-%B_RELEASE% +cd astra-%B_RELEASE% +xcopy /e /i %R%\samples\python samples +copy %R%\NEWS.txt . +copy %R%\COPYING COPYING.txt + +copy %B_VCREDIST% . + +mkdir astra +call "%B_WINPYTHON35%\scripts\env.bat" +copy %WINPYDIR%\lib\site-packages\astra\*.* astra +copy %R%\bin\x64\Release_CUDA\AstraCuda64.lib astra +copy "%CUDA_PATH%\bin\cudart64_80.dll" astra +copy "%CUDA_PATH%\bin\cufft64_80.dll" astra + +( +echo ----------------------------------------------------------------------- +echo This file is part of the ASTRA Toolbox +echo. +echo Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +echo 2014-2016, CWI, Amsterdam +echo http://visielab.uantwerpen.be/ and http://www.cwi.nl/ +echo License: Open Source under GPLv3 +echo Contact: astra@uantwerpen.be +echo Website: http://www.astra-toolbox.com/ +echo ----------------------------------------------------------------------- +echo. +echo. +echo This directory contains pre-built Python modules for the ASTRA Toolbox. +echo. +echo It has been built with WinPython-64bit-%B_WP35%. +echo. +echo To use it, move the astra\ directory to your existing site-packages directory. +echo Its exact location depends on your Python installation, but should look +echo similar to %B_README_WP35% . +echo. +echo Sample code can be found in the samples\ directory. +) > README.txt + +pause + +cd %R%\release\matlab +python -c "import shutil; shutil.make_archive('astra-%B_RELEASE%-matlab-win-x64', 'zip', 'astra-%B_RELEASE%')" +cd %R%\release\python27 +python -c "import shutil; shutil.make_archive('astra-%B_RELEASE%-python27-win-x64', 'zip', 'astra-%B_RELEASE%')" +cd %R%\release\python35 +python -c "import shutil; shutil.make_archive('astra-%B_RELEASE%-python35-win-x64', 'zip', 'astra-%B_RELEASE%')" +cd %R%\release\src +python -c "import shutil; shutil.make_archive('astra-%B_RELEASE%', 'zip', 'astra-%B_RELEASE%')" + +pause diff --git a/build/msvc/build_setup.bat b/build/msvc/build_setup.bat new file mode 100644 index 0000000..4314386 --- /dev/null +++ b/build/msvc/build_setup.bat @@ -0,0 +1,37 @@ +@echo off + +call "%~dp0build_env.bat" + +cd /D %~dp0 +cd ..\.. +set R=%CD% + +rd /s /q "%R%\lib\x64" +rd /s /q "%R%\lib\include\boost" +rd /s /q "%R%\bin\x64\Release_CUDA" + +cd /D "%B_BOOST%\lib64-msvc-14.0" + +mkdir "%R%\lib\x64" +mkdir "%R%\bin\x64\Release_CUDA" + +copy boost_unit_test_framework-vc140-mt-%B_BV%.lib %R%\lib\x64 +copy boost_unit_test_framework-vc140-mt-gd-%B_BV%.lib %R%\lib\x64 + +copy libboost_chrono-vc140-mt-%B_BV%.lib %R%\lib\x64 +copy libboost_chrono-vc140-mt-gd-%B_BV%.lib %R%\lib\x64 + +copy libboost_date_time-vc140-mt-%B_BV%.lib %R%\lib\x64 +copy libboost_date_time-vc140-mt-gd-%B_BV%.lib %R%\lib\x64 + +copy libboost_system-vc140-mt-%B_BV%.lib %R%\lib\x64 +copy libboost_system-vc140-mt-gd-%B_BV%.lib %R%\lib\x64 + +copy libboost_thread-vc140-mt-%B_BV%.lib %R%\lib\x64 +copy libboost_thread-vc140-mt-gd-%B_BV%.lib %R%\lib\x64 + +cd %B_BOOST% + +xcopy /i /e /q boost "%R%\lib\include\boost" + +pause -- cgit v1.2.3