diff options
author | Willem Jan Palenstijn <wjp@usecode.org> | 2016-11-24 04:25:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-24 04:25:02 -0800 |
commit | c4b5018ca57213601d0b31139be8c4268a308910 (patch) | |
tree | 6a107420f7b6feb54429e6dbd1bb420f2f15d7b4 /build | |
parent | fc43ab40e6aaed28ecbeb904b3ec5d67f2ded77c (diff) | |
parent | 80d5397e251d8e12c8cd77efcacc54b9f7de3f0b (diff) | |
download | astra-c4b5018ca57213601d0b31139be8c4268a308910.tar.gz astra-c4b5018ca57213601d0b31139be8c4268a308910.tar.bz2 astra-c4b5018ca57213601d0b31139be8c4268a308910.tar.xz astra-c4b5018ca57213601d0b31139be8c4268a308910.zip |
Merge pull request #74 from wjp/windows
Move to VS2015+CUDA8 and automate Windows builds
Diffstat (limited to 'build')
-rw-r--r-- | build/Cuda.rules | 358 | ||||
-rw-r--r-- | build/msvc/build_clean.bat | 12 | ||||
-rw-r--r-- | build/msvc/build_env.bat | 16 | ||||
-rw-r--r-- | build/msvc/build_matlab.bat | 14 | ||||
-rw-r--r-- | build/msvc/build_python27.bat | 28 | ||||
-rw-r--r-- | build/msvc/build_python35.bat | 27 | ||||
-rw-r--r-- | build/msvc/build_release.bat | 145 | ||||
-rw-r--r-- | build/msvc/build_setup.bat | 37 | ||||
-rw-r--r-- | build/msvc/gen.py | 123 |
9 files changed, 360 insertions, 400 deletions
diff --git a/build/Cuda.rules b/build/Cuda.rules deleted file mode 100644 index 733aa1f..0000000 --- a/build/Cuda.rules +++ /dev/null @@ -1,358 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<VisualStudioToolFile - Name="CUDA Build Rule v2.1.0" - Version="8,00" - > - <Rules> - <CustomBuildRule - Name="CUDA Build Rule" - DisplayName="CUDA Build Rule v2.1.0" - CommandLine="echo [CompilerPath] [Keep] [ExtraNvccOptions] [Platform] [Arch] -ccbin "$(VCInstallDir)bin" [Emulation] [FastMath] [Defines] -Xcompiler "/EHsc [Warning] /nologo [Optimization] /Zi [RuntimeChecks] [Runtime] [TypeInfo] [ExtraCppOptions]" [Include] [MaxRegCount] [PtxAsOptionV] [NvccCompilation] "$(InputPath)" 
 [CompilerPath] [Keep] [ExtraNvccOptions] [Platform] [Arch] -ccbin "$(VCInstallDir)bin" [Emulation] [FastMath] [Defines] -Xcompiler "/EHsc [Warning] /nologo [Optimization] /Zi [RuntimeChecks] [Runtime] [TypeInfo] [ExtraCppOptions]" [Include] [MaxRegCount] [ptxasoptionv] [NvccCompilation] "$(InputPath)" " - Outputs="[compileout]" - AdditionalDependencies="[AddedDependencies]" - FileExtensions="*.cu" - ExecutionDescription="Compiling with CUDA Build Rule..." - > - <Properties> - <StringProperty - Name="Include" - DisplayName="Additional Include Directories" - Description="Specifies one or more directories to add to the include path; use semi-colon delimited list if more than one. (/I[path])" - Switch="-I[value]" - DefaultValue=""$(CUDA_INC_PATH)"" - Delimited="true" - Delimiters=";" - Inheritable="true" - /> - <BooleanProperty - Name="Debug" - DisplayName="Generate Debug Information" - Description="Specifies whether or not debugging information is generated by the CUDA compiler. (-D_DEBUG)" - Switch="-D_DEBUG" - /> - <EnumProperty - Name="NvccCompilation" - DisplayName="NVCC Compilation Type" - Description="Select desired output of NVCC compilation (-c/-compile, -cuda, -gpu, -cubin, -ptx)" - > - <Values> - <EnumValue - Value="0" - Switch="--compile -o "$(IntDir)\$(InputName).cu.obj"" - DisplayName="Generate hybrid object file (--compile / -c)" - /> - <EnumValue - Value="1" - Switch="-cuda -o "$(IntDir)\$(InputName).cu.c"" - DisplayName="Generate hybrid .c file (-cuda)" - /> - <EnumValue - Value="2" - Switch="-gpu -o "$(IntDir)\$(InputName).gpu"" - DisplayName="Generate .gpu file (-gpu)" - /> - <EnumValue - Value="3" - Switch="-m32 -cubin -o "data\$(InputName).cubin"" - DisplayName="Generate .cubin file (-cubin)" - /> - <EnumValue - Value="4" - Switch="-ptx -o "$(IntDir)\$(InputName).ptx"" - DisplayName="Generate .ptx file (-ptx)" - /> - </Values> - </EnumProperty> - <EnumProperty - Name="compileout" - DisplayName="Compiler Output (obj/cubin)" - Description="Sets output as an OBJ or cubin file" - > - <Values> - <EnumValue - Value="0" - Switch=""$(IntDir)/$(InputName).cu.obj"" - DisplayName=""$(IntDir)/$(InputName).cu.obj"" - /> - <EnumValue - Value="1" - Switch=""data/$(InputName).cubin"" - DisplayName=""data/$(InputName).cubin"" - /> - </Values> - </EnumProperty> - <EnumProperty - Name="Arch" - DisplayName="GPU Architecture" - Description="Select option for the GPU architecture to use on the command line (-arch sm_10, sm_11, sm_12, sm_13)" - DefaultValue="10" - > - <Values> - <EnumValue - Value="10" - Switch="-arch sm_10" - DisplayName="sm_10" - /> - <EnumValue - Value="11" - Switch="-arch sm_11" - DisplayName="sm_11" - /> - <EnumValue - Value="12" - Switch="-arch sm_12" - DisplayName="sm_12" - /> - <EnumValue - Value="13" - Switch="-arch sm_13" - DisplayName="sm_13" - /> - </Values> - </EnumProperty> - <EnumProperty - Name="CompilerPath" - DisplayName="Path to nvcc.exe" - Description="Specifies the path to the CUDA compiler, nvcc.exe " - > - <Values> - <EnumValue - Value="0" - Switch=""$(CUDA_BIN_PATH)\nvcc.exe"" - DisplayName="Installed Toolkit (uses CUDA_BIN_PATH environment varible)" - /> - <EnumValue - Value="1" - Switch=""[AlternateNvccPath]"" - DisplayName="Use Alternate path to CUDA, specified below" - /> - </Values> - </EnumProperty> - <StringProperty - Name="AlternateNvccPath" - DisplayName="Alternate path to nvcc.exe (non-standard installation)" - Switch="[value]\nvcc.exe" - /> - <BooleanProperty - Name="Emulation" - DisplayName="Emulation Mode" - Description="Whether or not to generate emulated code." - Switch="-deviceemu -D_DEVICEEMU" - /> - <BooleanProperty - Name="FastMath" - DisplayName="Use Fast Math" - Category="Default" - Description="Make use of the fast math library." - Switch="-use_fast_math" - /> - <IntegerProperty - Name="MaxRegCount" - DisplayName="maxrregcount" - Switch="-maxrregcount=[Value]" - DefaultValue="32" - /> - <BooleanProperty - Name="PtxAsOptionV" - DisplayName="PtxAsOptionV" - Switch="--ptxas-options=-v" - /> - <StringProperty - Name="ExtraNvccOptions" - DisplayName="Extra Options" - Description="Supply any additional command line options to NVCC" - Switch="[value]" - /> - <StringProperty - Name="Defines" - DisplayName="Preprocessor Definitions" - PropertyPageName="Preprocessor" - Description="Specifies one or more preprocessor defines. (-D[macro])" - Switch="-D[value]" - Delimited="true" - Inheritable="true" - /> - <BooleanProperty - Name="Keep" - DisplayName="Keep preprocessed files (.ptx, .cubin, cudafe1.c, cudafe1.cpp, cudafe1.gpu, etc.)" - PropertyPageName="Preprocessor" - Description="Specifies that preprocessor files generated by the CUDA compiler are not deleted." - Switch="--keep" - /> - <EnumProperty - Name="Warning" - DisplayName="Warning Level" - PropertyPageName="Hybrid CUDA/C++ Options" - Description="Select how strict you want the compiler to be about checking for potentially suspect constructs. (/W0 - /W4)" - DefaultValue="3" - > - <Values> - <EnumValue - Value="0" - Switch="/W0" - DisplayName="Off: Turn Off All Warnings (/W0)" - /> - <EnumValue - Value="1" - Switch="/W1" - DisplayName="Level 1 (/W1)" - /> - <EnumValue - Value="2" - Switch="/W2" - DisplayName="Level 2 (/W2)" - /> - <EnumValue - Value="3" - Switch="/W3" - DisplayName="Level 3 (/W3)" - /> - <EnumValue - Value="4" - Switch="/W4" - DisplayName="Level 4 (/W4)" - /> - </Values> - </EnumProperty> - <EnumProperty - Name="Optimization" - DisplayName="Optimization" - Description="Select option for code optimization; choose Custom to use specific optimization options. (/Od, /O1, /O2, /Ox)" - DefaultValue="2" - > - <Values> - <EnumValue - Value="0" - Switch="/Od" - DisplayName="Disabled (/Od)" - /> - <EnumValue - Value="1" - Switch="/O1" - DisplayName="Minimize Size (/O1)" - /> - <EnumValue - Value="2" - Switch="/O2" - DisplayName="Maximize Speed (/O2)" - /> - <EnumValue - Value="3" - Switch="/Ox" - DisplayName="Full Optimization (/Ox)" - /> - </Values> - </EnumProperty> - <StringProperty - Name="AddedDependencies" - DisplayName="Source Dependencies" - Description="Add additional CUDA file dependencies" - Switch="[value]" - /> - <EnumProperty - Name="RuntimeChecks" - DisplayName="Basic Runtime Checks" - PropertyPageName="Hybrid CUDA/C++ Options" - Description="Perform basic runtime error checks, incompatible with any optimization type other than debug. (/RTCs, /RTCu, /RTC1)" - > - <Values> - <EnumValue - Value="0" - Switch=" " - DisplayName="Default" - /> - <EnumValue - Value="1" - Switch="/RTCs" - DisplayName="Stack Frames (/RTCs)" - /> - <EnumValue - Value="2" - Switch="/RTCu" - DisplayName="Uninitialized Variables (/RTCu)" - /> - <EnumValue - Value="3" - Switch="/RTC1" - DisplayName="Both (/RTC1, equiv. to /RTCsu)" - /> - </Values> - </EnumProperty> - <EnumProperty - Name="Runtime" - DisplayName="Runtime Library" - PropertyPageName="Hybrid CUDA/C++ Options" - Description="Specify runtime library for linking. (/MT, /MTd, /MD, /MDd, /ML, /MLd)" - > - <Values> - <EnumValue - Value="0" - Switch="/MT" - DisplayName="Multi-Threaded (/MT)" - /> - <EnumValue - Value="1" - Switch="/MTd" - DisplayName="Multi-Threaded Debug (/MTd)" - /> - <EnumValue - Value="2" - Switch="/MD" - DisplayName="Multi-Threaded DLL (/MD)" - /> - <EnumValue - Value="3" - Switch="/MDd" - DisplayName="Multi-Threaded Debug DLL (/MDd)" - /> - <EnumValue - Value="4" - Switch="/ML" - DisplayName="Single-Threaded (/ML)" - /> - <EnumValue - Value="5" - Switch="/MLd" - DisplayName="Single-Threaded Debug (/MLd)" - /> - </Values> - </EnumProperty> - <BooleanProperty - Name="TypeInfo" - DisplayName="Enable Run-Time Type Info" - PropertyPageName="Hybrid CUDA/C++ Options" - Description="Adds code for checking C++ object types at run time (runtime type information). (/GR)" - Switch="/GR" - /> - <StringProperty - Name="ExtraCppOptions" - DisplayName="Extra C++ Options" - PropertyPageName="Hybrid CUDA/C++ Options" - Description="Supply any additional command line options to the host C++ compiler" - Switch="[value]" - /> - <EnumProperty - Name="Platform" - DisplayName="Platform" - > - <Values> - <EnumValue - Value="0" - DisplayName="Default" - /> - <EnumValue - Value="1" - Switch="-m32" - DisplayName="Win32" - /> - <EnumValue - Value="2" - Switch="-m64" - DisplayName="x64" - /> - </Values> - </EnumProperty> - </Properties> - </CustomBuildRule> - </Rules> -</VisualStudioToolFile> 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 diff --git a/build/msvc/gen.py b/build/msvc/gen.py index cc69a62..8a40c45 100644 --- a/build/msvc/gen.py +++ b/build/msvc/gen.py @@ -12,26 +12,28 @@ siguid = "2150E333-8FDC-42A3-9474-1A3956D46DE8" # project group # import uuid # uuid.uuid4().__str__().upper() -def create_mex_project(name, uuid11, uuid09): - return { "type": vcppguid, "name": name, "file11": "matlab\\mex\\" + name + "_vc11.vcxproj", "file09": "matlab\\mex\\" + name + "_vc09.vcproj", "uuid11": uuid11, "uuid09": uuid09, "files": [] } +def create_mex_project(name, uuid14, uuid11, uuid09): + return { "type": vcppguid, "name": name, "file14": "matlab\\mex\\" + name + "_vc14.vcxproj", "file11": "matlab\\mex\\" + name + "_vc11.vcxproj", "file09": "matlab\\mex\\" + name + "_vc09.vcproj", "uuid14": uuid14, "uuid11": uuid11, "uuid09": uuid09, "files": [] } -P_astra = { "type": vcppguid, "name": "astra_vc11", "file11": "astra_vc11.vcxproj", "file09": "astra_vc09.vcproj", "uuid11": "BE9F1326-527C-4284-AE2C-D1E25D539CEA", "uuid09": "12926444-6723-46A8-B388-12E65E0577FA" } +P_astra = { "type": vcppguid, "name": "astra_vc11", "file14": "astra_vc14.vcxproj", "file11": "astra_vc11.vcxproj", "file09": "astra_vc09.vcproj", "uuid14": "DABD9D82-609E-4C71-B1CA-A41B07495290", "uuid11": "BE9F1326-527C-4284-AE2C-D1E25D539CEA", "uuid09": "12926444-6723-46A8-B388-12E65E0577FA" } -P0 = create_mex_project("astra_mex", "3FDA35E0-0D54-4663-A3E6-5ABA96F32221", "3FDA35E0-0D54-4663-A3E6-5ABA96F32221") +P0 = create_mex_project("astra_mex", "6FDF72C4-A855-4F1C-A401-6500040B5E28", "3FDA35E0-0D54-4663-A3E6-5ABA96F32221", "3FDA35E0-0D54-4663-A3E6-5ABA96F32221") -P1 = create_mex_project("astra_mex_algorithm", "056BF7A9-294D-487C-8CC3-BE629077CA94", "056BF7A9-294D-487C-8CC3-BE629077CA94") -P2 = create_mex_project("astra_mex_data2d", "E4092269-B19C-46F7-A84E-4F146CC70E44", "E4092269-B19C-46F7-A84E-4F146CC70E44") -P3 = create_mex_project("astra_mex_data3d", "0BEC029B-0929-4BF9-BD8B-9C9806A52065", "0BEC029B-0929-4BF9-BD8B-9C9806A52065") -P4 = create_mex_project("astra_mex_matrix", "9D041710-2119-4230-BCF2-5FBE753FDE49", "9D041710-2119-4230-BCF2-5FBE753FDE49") -P5 = create_mex_project("astra_mex_projector", "4DD6056F-8EEE-4C9A-B2A9-923F01A32E97", "4DD6056F-8EEE-4C9A-B2A9-923F01A32E97") -P6 = create_mex_project("astra_mex_projector3d", "F94CCD79-AA11-42DF-AC8A-6C9D2238A883", "F94CCD79-AA11-42DF-AC8A-6C9D2238A883") -P7 = create_mex_project("astra_mex_log", "03B833F5-4FD6-4FBE-AAF4-E3305CD56D2E", "CA2840B3-DA68-41B5-AC57-F5DFD20ED8F8") -P8 = create_mex_project("astra_mex_direct", "0F68F4E2-BE1B-4A9A-B101-AECF4C069CC7", "85FE09A6-FA49-4314-A2B1-59D77C7442A8") +P1 = create_mex_project("astra_mex_algorithm", "CE5EF874-830C-4C10-8651-CCA2A34ED9E4", "056BF7A9-294D-487C-8CC3-BE629077CA94", "056BF7A9-294D-487C-8CC3-BE629077CA94") +P2 = create_mex_project("astra_mex_data2d", "D2CDCDB3-7AD9-4853-8D87-BDB1DAD9C9C1", "E4092269-B19C-46F7-A84E-4F146CC70E44", "E4092269-B19C-46F7-A84E-4F146CC70E44") +P3 = create_mex_project("astra_mex_data3d", "2A7084C6-62ED-4235-85F4-094C17689DEB", "0BEC029B-0929-4BF9-BD8B-9C9806A52065", "0BEC029B-0929-4BF9-BD8B-9C9806A52065") +P4 = create_mex_project("astra_mex_matrix", "6BFA8857-37EB-4E43-A97C-B860E21599F5", "9D041710-2119-4230-BCF2-5FBE753FDE49", "9D041710-2119-4230-BCF2-5FBE753FDE49") +P5 = create_mex_project("astra_mex_projector", "85ECCF1D-C5F6-4E0E-A4F9-0DE7C0B916B2", "4DD6056F-8EEE-4C9A-B2A9-923F01A32E97", "4DD6056F-8EEE-4C9A-B2A9-923F01A32E97") +P6 = create_mex_project("astra_mex_projector3d", "CA85BDA0-9BDD-495E-B200-BFE863EB6318", "F94CCD79-AA11-42DF-AC8A-6C9D2238A883", "F94CCD79-AA11-42DF-AC8A-6C9D2238A883") +P7 = create_mex_project("astra_mex_log", "88539382-66DB-4BBC-A48E-8B6B3CA6064F", "03B833F5-4FD6-4FBE-AAF4-E3305CD56D2E", "CA2840B3-DA68-41B5-AC57-F5DFD20ED8F8") +P8 = create_mex_project("astra_mex_direct", "47460476-912B-4313-8B10-BDF1D60A84C4", "0F68F4E2-BE1B-4A9A-B101-AECF4C069CC7", "85FE09A6-FA49-4314-A2B1-59D77C7442A8") F_astra_mex = { "type": siguid, "name": "astra_mex", + "file14": "astra_mex", "file11": "astra_mex", "file09": "astra_mex", + "uuid14": "2076FB73-ECFE-4B1B-9A8C-E351C500FAAB", "uuid11": "5E99A109-374E-4102-BE9B-99BA1FA8AA30", "uuid09": "33EF0AC5-B475-40BF-BAE5-67075B204D10", "entries": [ P0, P1, P2, P3, P4, P5, P6, P7, P8 ] } @@ -483,6 +485,8 @@ def write_sln(version): F = open("astra_vc09.sln", "w") elif version == 11: F = open("astra_vc11.sln", "w") + elif version == 14: + F = open("astra_vc14.sln", "w") else: assert(False) print(bom, file=F) @@ -496,6 +500,13 @@ def write_sln(version): print("# Visual Studio 2012", file=F) uuid = "uuid11" file_ = "file11" + elif version == 14: + print("Microsoft Visual Studio Solution File, Format Version 12.00", file=F) + print("# Visual Studio 14", file=F) + print("VisualStudioVersion = 14.0.25420.1", file=F) + print("MinimumVisualStudioVersion = 10.0.40219.1", file=F) + uuid = "uuid14" + file_ = "file14" for p in projects: s = '''Project("{%s}") = "%s", "%s", "{%s}"''' % (p["type"], p["name"], p[file_], p[uuid]) print(s, file=F) @@ -530,7 +541,7 @@ def write_sln(version): print("EndGlobal", file=F) F.close() -def write_project11_start(P, F): +def write_project11_14_start(P, F, version): print(bom + '<?xml version="1.0" encoding="utf-8"?>', file=F) print('<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', file=F) print(' <ItemGroup Label="ProjectConfigurations">', file=F) @@ -543,7 +554,10 @@ def write_project11_start(P, F): print(' <PropertyGroup Label="Globals">', file=F) if 'mex' in P["name"]: print(' <ProjectName>' + P["name"] + '</ProjectName>', file=F) - print(' <ProjectGuid>{' + P["uuid11"] + '}</ProjectGuid>', file=F) + if version == 11: + print(' <ProjectGuid>{' + P["uuid11"] + '}</ProjectGuid>', file=F) + else: + print(' <ProjectGuid>{' + P["uuid14"] + '}</ProjectGuid>', file=F) if 'mex' in P["name"]: print(' <RootNamespace>astraMatlab</RootNamespace>', file=F) else: @@ -558,7 +572,10 @@ def write_project11_start(P, F): print(' <UseDebugLibraries>true</UseDebugLibraries>', file=F) else: print(' <UseDebugLibraries>false</UseDebugLibraries>', file=F) - print(' <PlatformToolset>v110</PlatformToolset>', file=F) + if version == 11: + print(' <PlatformToolset>v110</PlatformToolset>', file=F) + else: + print(' <PlatformToolset>v140</PlatformToolset>', file=F) if 'mex' not in P["name"]: if not c.debug: print(' <WholeProgramOptimization>true</WholeProgramOptimization>', file=F) @@ -567,7 +584,7 @@ def write_project11_start(P, F): print(' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />', file=F) print(' <ImportGroup Label="ExtensionSettings">', file=F) if "mex" not in P["name"]: - print(' <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 5.5.props" />', file=F) + print(' <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.props" />', file=F) print(' </ImportGroup>', file=F) for c in configs: print(''' <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='%s'">''' % (c.name(), ), file=F) @@ -575,7 +592,7 @@ def write_project11_start(P, F): print(''' </ImportGroup>''', file=F) print(' <PropertyGroup Label="UserMacros" />', file=F) -def write_project11_end(P, F): +def write_project11_14_end(P, F): l = [ f for f in P["files"] if len(f) > 4 and f[-4:] == ".cpp" ] if l: print(' <ItemGroup>', file=F) @@ -614,18 +631,21 @@ def write_project11_end(P, F): print(' <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />', file=F) print(' <ImportGroup Label="ExtensionTargets">', file=F) if "mex" not in P["name"]: - print(' <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 5.5.targets" />', file=F) + print(' <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 8.0.targets" />', file=F) print(' </ImportGroup>', file=F) print('</Project>', end="", file=F) -def write_main_project11(): +def write_main_project11_14(version): P = P_astra; - F = open(P["file11"], "w") - write_project11_start(P, F) + if version == 11: + F = open(P["file11"], "w") + else: + F = open(P["file14"], "w") + write_project11_14_start(P, F, version) for c in configs: print(''' <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='%s'">''' % (c.name(), ), file=F) - if c.cuda: + if c.cuda and version == 11: print(' <IncludePath>$(CUDA_INC_PATH);$(IncludePath)</IncludePath>', file=F) print(' <LibraryPath>$(CUDA_LIB_PATH);$(LibraryPath)</LibraryPath>', file=F) print(' <OutDir>$(SolutionDir)bin\\$(Platform)\\' + c.config() + '\\</OutDir>', file=F) @@ -690,15 +710,18 @@ def write_main_project11(): else: print(' <TargetMachinePlatform>32</TargetMachinePlatform>', file=F) print(' <GenerateLineInfo>true</GenerateLineInfo>', file=F) - print(' <CodeGeneration>compute_20,sm_20;compute_30,sm_30;compute_30,sm_35;compute_30,compute_30</CodeGeneration>', file=F) + print(' <CodeGeneration>compute_20,sm_20;compute_30,sm_30;compute_35,sm_35;compute_50,sm_50;compute_60,sm_60;compute_60,compute_60</CodeGeneration>', file=F) print(' </CudaCompile>', file=F) print(' </ItemDefinitionGroup>', file=F) - write_project11_end(P, F) + write_project11_14_end(P, F) F.close() -def write_mex_project11(P): - F = open("matlab/mex/" + P["name"] + "_vc11.vcxproj", "w") - write_project11_start(P, F) +def write_mex_project11_14(P, version): + if version == 11: + F = open("matlab/mex/" + P["name"] + "_vc11.vcxproj", "w") + else: + F = open("matlab/mex/" + P["name"] + "_vc14.vcxproj", "w") + write_project11_14_start(P, F, version) print(' <PropertyGroup>', file=F) print(' <_ProjectFileVersion>11.0.60610.1</_ProjectFileVersion>', file=F) print(' </PropertyGroup>', file=F) @@ -772,10 +795,10 @@ def write_mex_project11(P): print(' <GenerateDebugInformation>true</GenerateDebugInformation>', file=F) print(' </Link>', file=F) print(' </ItemDefinitionGroup>', file=F) - write_project11_end(P, F) + write_project11_14_end(P, F) F.close() -def write_main_filters11(): +def write_main_filters11_14(): P = P_astra F = open(P["name"] + ".vcxproj.filters", "w") print(bom + '<?xml version="1.0" encoding="utf-8"?>', file=F) @@ -1106,8 +1129,8 @@ def write_mex_project09(P): -if (len(sys.argv) != 2) or (sys.argv[1] not in ["vc09", "vc11", "all"]): - print("Usage: python gen.py [vc09|vc11|all]", file=sys.stderr) +if (len(sys.argv) != 2) or (sys.argv[1] not in ["vc09", "vc11", "vc14", "all"]): + print("Usage: python gen.py [vc09|vc11|vc14|all]", file=sys.stderr) sys.exit(1) @@ -1121,21 +1144,37 @@ except IOError: # Change directory to main dir os.chdir("../..") +if sys.argv[1] in ["vc14", "all"]: + # HACK + P_astra["name"] = "astra_vc14" + write_sln(14) + write_main_project11_14(14) + write_main_filters11_14() + write_mex_project11_14(P0, 14) + write_mex_project11_14(P1, 14) + write_mex_project11_14(P2, 14) + write_mex_project11_14(P3, 14) + write_mex_project11_14(P4, 14) + write_mex_project11_14(P5, 14) + write_mex_project11_14(P6, 14) + write_mex_project11_14(P7, 14) + write_mex_project11_14(P8, 14) + if sys.argv[1] in ["vc11", "all"]: # HACK P_astra["name"] = "astra_vc11" write_sln(11) - write_main_project11() - write_main_filters11() - write_mex_project11(P0) - write_mex_project11(P1) - write_mex_project11(P2) - write_mex_project11(P3) - write_mex_project11(P4) - write_mex_project11(P5) - write_mex_project11(P6) - write_mex_project11(P7) - write_mex_project11(P8) + write_main_project11_14(11) + write_main_filters11_14() + write_mex_project11_14(P0, 11) + write_mex_project11_14(P1, 11) + write_mex_project11_14(P2, 11) + write_mex_project11_14(P3, 11) + write_mex_project11_14(P4, 11) + write_mex_project11_14(P5, 11) + write_mex_project11_14(P6, 11) + write_mex_project11_14(P7, 11) + write_mex_project11_14(P8, 11) if sys.argv[1] in ["vc09", "all"]: # HACK |