diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/Cuda.rules | 358 | ||||
-rw-r--r-- | build/linux/Makefile.in | 217 | ||||
-rw-r--r-- | build/linux/configure.ac | 90 | ||||
-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 |
11 files changed, 598 insertions, 469 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/linux/Makefile.in b/build/linux/Makefile.in index f10f482..ae43afa 100644 --- a/build/linux/Makefile.in +++ b/build/linux/Makefile.in @@ -1,10 +1,18 @@ +install_type=@INSTALL_TYPE@ + cuda=@HAVECUDA@ matlab=@HAVEMATLAB@ python=@HAVEPYTHON@ boostutf=@HAVEBOOSTUTF@ - MATLAB_ROOT=@MATLAB_ROOT@ +octave=@HAVEOCTAVE@ + +MKDIR=mkdir -p +CXX=@CXX@ +LD=@CXX@ +SHELL=@SHELL@ +INSTALL_SH=$(SHELL) $(srcdir)/install-sh TARGETS=libastra.la @@ -16,10 +24,15 @@ ifeq ($(python),yes) TARGETS+=py endif +ifeq ($(octave),yes) +TARGETS+=oct +endif + all: $(TARGETS) prefix=@prefix@ exec_prefix=@exec_prefix@ +datarootdir=@datarootdir@ srcdir=@srcdir@ abs_top_builddir=@abs_top_builddir@ @@ -38,6 +51,8 @@ LDFLAGS+=-g CPPFLAGS+=@CPPFLAGS_OS@ +BOOSTUTF_LIBS=@LIBS_BOOSTUTF@ + ifeq ($(cuda),yes) CPPFLAGS += @CPPFLAGS_CUDA@ -DASTRA_CUDA NVCCFLAGS += @NVCCFLAGS_EXTRA@ @CPPFLAGS_CUDA@ -I$(srcdir)/../.. -I$(srcdir)/../../include -DASTRA_CUDA @@ -47,47 +62,37 @@ NVCC = @NVCC@ endif ifeq ($(matlab),yes) +# TODO: Do we also want -fopenmp for octave? CPPFLAGS+=-I$(MATLAB_ROOT)/extern/include -DMATLAB_MEX_FILE CXXFLAGS+=-fopenmp LDFLAGS+=-fopenmp endif +# MODLDFLAGS are the base LDFLAGS for matlab, octave, python modules +MODLDFLAGS=$(LDFLAGS) -L$(abs_top_builddir)/.libs +ifeq ($(install_type),module) +MODLDFLAGS+=-Wl,-rpath,'\$$ORIGIN' +endif + ifeq ($(python),yes) PYTHON = @PYTHON@ -PYLIBDIR = $(shell $(PYTHON) -c 'from distutils.sysconfig import get_config_var; import six; six.print_(get_config_var("LIBDIR"))') -PYINCDIR = $(shell $(PYTHON) -c 'from distutils.sysconfig import get_python_inc; import six; six.print_(get_python_inc())') +PYINCDIR := $(shell $(PYTHON) -c 'from __future__ import print_function; from distutils.sysconfig import get_python_inc; print(get_python_inc())') PYLIBVER = `basename $(PYINCDIR)` CPPFLAGS += -DASTRA_PYTHON -I$(PYINCDIR) PYCPPFLAGS := $(CPPFLAGS) PYCPPFLAGS += -I../include -PYLDFLAGS = $(LDFLAGS) -PYLDFLAGS += -L$(abs_top_builddir)/.libs +PYLDFLAGS = $(MODLDFLAGS) +MODPYLIBS=-l$(PYLIBVER) endif # This is below where PYCPPFLAGS copies CPPFLAGS. The python code is built # from a different directory, so these relative includes would be wrong. CPPFLAGS+=-I$(srcdir)/../.. -I$(srcdir)/../../include -I$(srcdir)/../../lib/include -BOOST_CPPFLAGS= -BOOST_LDFLAGS= - -BOOSTUTF_LIBS=@LIBS_BOOSTUTF@ - - -CPPFLAGS+=$(BOOST_CPPFLAGS) -LDFLAGS+=$(BOOST_LDFLAGS) - - -MKDIR=mkdir -p -CXX=@CXX@ -LD=@CXX@ -SHELL=@SHELL@ -INSTALL_SH=$(SHELL) $(srcdir)/install-sh - ifeq ($(matlab),yes) MEXFLAGS = -cxx -MEXLDFLAGS='$$LDFLAGS $(LDFLAGS)' -MEXLIBS = -L.libs -lut +MEXLDFLAGS=\$$LDFLAGS $(MODLDFLAGS) +MEXLIBS = -lut MEXSUFFIX = @MEXSUFFIX@ MEX = @MEX@ @@ -95,14 +100,20 @@ ifeq ($(cuda),yes) MEXFLAGS += -DASTRA_CUDA endif -ifeq ($(python),yes) -MEXPYLDFLAGS='$$LDFLAGS $(LDFLAGS) -L$(PYLIBDIR)' -MEXPYLIBS=$(MEXLIBS) -l$(PYLIBVER) +endif + + +ifeq ($(octave),yes) +OCTLDFLAGS:=$(MODLDFLAGS) +CPPFLAGS += @OCTAVE_CPPFLAGS@ +ifeq ($(cuda),yes) +OCTFLAGS=-DASTRA_CUDA +else +OCTFLAGS= endif endif -LIBDIR=/usr/local/lib DEPDIR=.deps @@ -255,47 +266,71 @@ MATLAB_MEX=\ matlab/mex/astra_mex_data3d_c.$(MEXSUFFIX) \ matlab/mex/astra_mex_direct_c.$(MEXSUFFIX) +OCTAVE_CXX_OBJECTS=\ + matlab/mex/octave_support.o + +OCTAVE_MEX=\ + matlab/mex/astra_mex_algorithm_c.mex \ + matlab/mex/astra_mex_data2d_c.mex \ + matlab/mex/astra_mex_c.mex \ + matlab/mex/astra_mex_matrix_c.mex \ + matlab/mex/astra_mex_projector_c.mex \ + matlab/mex/astra_mex_projector3d_c.mex \ + matlab/mex/astra_mex_log_c.mex \ + matlab/mex/astra_mex_data3d_c.mex \ + matlab/mex/astra_mex_direct_c.mex + ifeq ($(python),yes) MATLAB_MEX+=matlab/mex/astra_mex_plugin_c.$(MEXSUFFIX) +OCTAVE_MEX+=matlab/mex/astra_mex_plugin_c.mex endif + OBJECT_DIRS = src/ tests/ cuda/2d/ cuda/3d/ matlab/mex/ ./ DEPDIRS = $(addsuffix $(DEPDIR),$(OBJECT_DIRS)) -include $(wildcard $(addsuffix /*.d,$(DEPDIRS))) LIBDIRS = $(addsuffix .libs,./ src/ cuda/2d/ cuda/3d/) +SONAME=$(shell . ${abs_top_builddir}/libastra.la; echo $$dlname) ifeq ($(matlab),yes) mex: $(MATLAB_MEX) %.$(MEXSUFFIX): %.o $(MATLAB_CXX_OBJECTS) libastra.la - $(MEX) LDFLAGS=$(MEXLDFLAGS) $(MEXFLAGS) $(LIBS) $(MEXLIBS) -lastra -output $* $*.o $(MATLAB_CXX_OBJECTS) + $(MEX) LDFLAGS="$(MEXLDFLAGS)" $(MEXFLAGS) $(LIBS) $(MEXLIBS) -lastra -output $* $*.o $(MATLAB_CXX_OBJECTS) ifeq ($(python),yes) matlab/mex/astra_mex_plugin_c.$(MEXSUFFIX): matlab/mex/astra_mex_plugin_c.o $(MATLAB_CXX_OBJECTS) libastra.la - $(MEX) LDFLAGS=$(MEXPYLDFLAGS) $(MEXFLAGS) $(LIBS) $(MEXPYLIBS) -lastra -output matlab/mex/astra_mex_plugin_c $< $(MATLAB_CXX_OBJECTS) + $(MEX) LDFLAGS="$(MEXLDFLAGS)" $(MEXFLAGS) $(LIBS) $(MEXLIBS) $(MODPYLIBS) -lastra -output matlab/mex/astra_mex_plugin_c $< $(MATLAB_CXX_OBJECTS) endif endif ifeq ($(python),yes) py: libastra.la $(MKDIR) python/build - $(MKDIR) python/finalbuild - # Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++. - cd $(srcdir)/../../python; CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS="${PYLDFLAGS}" $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build install \ - --install-base=$(abs_top_builddir)/python/finalbuild --install-headers=$(abs_top_builddir)/python/finalbuild --install-purelib=$(abs_top_builddir)/python/finalbuild \ - --install-platlib=$(abs_top_builddir)/python/finalbuild --install-scripts=$(abs_top_builddir)/python/finalbuild --install-data=$(abs_top_builddir)/python/finalbuild - -python-root-install: libastra.la - $(MKDIR) python/build - # Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++. - cd $(srcdir)/../../python; CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS="${PYLDFLAGS}" $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build install +# TODO: Avoid writing into source dir + ln -s $(abs_top_builddir)/.libs/$(SONAME) $(srcdir)/../../python/astra +# Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++. + cd $(srcdir)/../../python; ASTRA_INSTALL_LIBRARY_AS_DATA=$(PYPKGDATA) CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS='${PYLDFLAGS}' $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build + rm $(srcdir)/../../python/astra/$(SONAME) endif +ifeq ($(octave),yes) +oct: $(OCTAVE_MEX) + +%.mex: %.o $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS) libastra.la + mkoctfile --mex $(OCTFLAGS) $(OCTLDFLAGS) $(LIBS) -lastra --output $* $*.o $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS) + +ifeq ($(python),yes) +matlab/mex/astra_mex_plugin_c.mex: matlab/mex/astra_mex_plugin_c.o $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS) libastra.la + mkoctfile --mex $(OCTFLAGS) $(OCTLDFLAGS) $(LIBS) $(MODPYLIBS) -lastra --output matlab/mex/astra_mex_plugin_c $< $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS) +endif +endif + libastra.la: $(ALL_OBJECTS) - ./libtool --mode=link --tag=CXX $(LD) -rpath $(LIBDIR) -o $@ $(LDFLAGS) $(LIBS) $+ + ./libtool --mode=link --tag=CXX $(LD) -rpath @libdir@ -o $@ $(LDFLAGS) $(LIBS) $+ %.o: %.cpp $(MKDIR) $(*D)/$(DEPDIR) @@ -374,43 +409,107 @@ distclean: clean rm -rf $(srcdir)/autom4te.cache rm -f $(srcdir)/configure Makefile -install: install-libraries install-matlab install-python - install-libraries: libastra.la $(INSTALL_SH) -m 755 -d @libdir@ ./libtool --mode=install $(INSTALL_SH) -m 644 libastra.la @libdir@ ./libtool --mode=finish @libdir@ -ifeq ($(matlab),yes) -# TODO: This install location doesn't work well for /usr or /usr/local -install-matlab: $(MATLAB_MEX) - $(INSTALL_SH) -m 755 -d @prefix@/matlab - $(INSTALL_SH) -m 755 -d @prefix@/matlab/mex - $(INSTALL_SH) -m 755 -d @prefix@/matlab/tools - $(INSTALL_SH) -m 644 $(MATLAB_MEX) @prefix@/matlab/mex - $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/tools/*.m @prefix@/matlab/tools -# TODO: docs + +# ------------------------ +# INSTALLATION +# ------------------------ + +ifeq ($(install_type),prefix) +# libraries into @libdir@, python into site-packages, mex into @datadir@ +install: install-libraries install-matlab install-python-site-packages install-octave + +PYPKGDATA= +MATLABBASE=@datadir@/astra/matlab +OCTAVEBASE=@datadir@/astra/octave +endif + +ifeq ($(install_type),dir) +# everything into @prefix@ +install: install-libraries install-matlab install-python install-octave + +PYPKGDATA= +MATLABBASE=@prefix@/matlab +OCTAVEBASE=@prefix@/octave +PYTHONBASE=@prefix@/python +endif + +ifeq ($(install_type),module) +# python into site-packages, mex into @datadir@ +# library copied into python/mex directories +# modules built with rpath=$ORIGIN +install: install-matlab install-python-site-packages install-octave + +PYPKGDATA=$(SONAME) +MATLABBASE=@prefix@/matlab +OCTAVEBASE=@prefix@/octave + +install-matlab-so: libastra.la + $(INSTALL_SH) -m 755 -d $(MATLABBASE)/mex + $(INSTALL_SH) -m 755 $(abs_top_builddir)/.libs/$(SONAME) $(MATLABBASE)/mex +install-octave-so: libastra.la + $(INSTALL_SH) -m 755 -d $(OCTAVEBASE)/mex + $(INSTALL_SH) -m 755 $(abs_top_builddir)/.libs/$(SONAME) $(OCTAVEBASE)/mex else -install-matlab: +install-matlab-so: +install-octave-so: endif + + ifeq ($(python),yes) -# TODO: This install location doesn't work well for /usr or /usr/local install-python: py + $(MKDIR) python/finalbuild + # Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++. + cd $(srcdir)/../../python; ASTRA_INSTALL_LIBRARY_AS_DATA=$(PYPKGDATA) CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS="${PYLDFLAGS}" $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build install \ + --install-base=$(abs_top_builddir)/python/finalbuild --install-headers=$(abs_top_builddir)/python/finalbuild --install-purelib=$(abs_top_builddir)/python/finalbuild \ + --install-platlib=$(abs_top_builddir)/python/finalbuild --install-scripts=$(abs_top_builddir)/python/finalbuild --install-data=$(abs_top_builddir)/python/finalbuild $(INSTALL_SH) -m 755 -d @prefix@/python $(INSTALL_SH) -m 755 -d @prefix@/python/astra - $(INSTALL_SH) -m 644 python/finalbuild/astra/*.so @prefix@/python/astra + $(INSTALL_SH) -m 755 -d @prefix@/python/astra/plugins + $(INSTALL_SH) -m 755 python/finalbuild/astra/*.so @prefix@/python/astra $(INSTALL_SH) -m 644 python/finalbuild/astra/*.py @prefix@/python/astra + $(INSTALL_SH) -m 644 python/finalbuild/astra/plugins/*.py @prefix@/python/astra/plugins $(INSTALL_SH) -m 644 python/finalbuild/*.egg-info @prefix@/python/ - @echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" - @echo "To use ASTRA in Python, add @prefix@/python/ to your PYTHONPATH" - @echo "and @libdir@ to your LD_LIBRARY_PATH." - @echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" # TODO: docs + +install-python-site-packages: py +# Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++. + cd $(srcdir)/../../python; ASTRA_INSTALL_LIBRARY_AS_DATA=$(PYPKGDATA) CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS="${PYLDFLAGS}" $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build install else +install-python-site-packages: install-python: endif +ifeq ($(matlab),yes) +install-matlab: $(MATLAB_MEX) install-matlab-so + $(INSTALL_SH) -m 755 -d $(MATLABBASE) + $(INSTALL_SH) -m 755 -d $(MATLABBASE)/mex + $(INSTALL_SH) -m 755 -d $(MATLABBASE)/tools + $(INSTALL_SH) -m 755 $(MATLAB_MEX) $(MATLABBASE)/mex + $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/tools/*.m $(MATLABBASE)/tools +# TODO: docs +else +install-matlab: +endif + + +ifeq ($(octave),yes) +install-octave: $(OCTAVE_MEX) install-octave-so + $(INSTALL_SH) -m 755 -d $(OCTAVEBASE) + $(INSTALL_SH) -m 755 -d $(OCTAVEBASE)/mex + $(INSTALL_SH) -m 755 -d $(OCTAVEBASE)/tools + $(INSTALL_SH) -m 755 $(OCTAVE_MEX) $(OCTAVEBASE)/mex + $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/tools/*.m $(OCTAVEBASE)/tools +# TODO: docs +else +install-octave: +endif + Makefile: $(srcdir)/Makefile.in config.status CONFIG_HEADERS= CONFIG_LINKS= CONFIG_FILES=$@ $(SHELL) ./config.status @@ -423,7 +522,7 @@ $(srcdir)/configure: $(srcdir)/configure.ac @echo "configure.ac has been changed. Regenerating configure script" cd $(srcdir) && $(SHELL) ./autogen.sh -.PHONY: all mex test clean distclean install install-libraries py python-root-install install-python +.PHONY: all mex test clean distclean install install-libraries py install-python-site-packages install-python install-octave install-matlab-so install-octave-so # don't remove intermediate files: .SECONDARY: diff --git a/build/linux/configure.ac b/build/linux/configure.ac index 630b08d..3a2a92b 100644 --- a/build/linux/configure.ac +++ b/build/linux/configure.ac @@ -24,7 +24,7 @@ dnl dnl ----------------------------------------------------------------------- dnl $Id$ -AC_INIT(astra_toolbox, 1.7.1) +AC_INIT(astra, 1.7.1) AC_CONFIG_SRCDIR([Makefile.in]) LT_INIT([disable-static]) @@ -133,14 +133,16 @@ fi AC_ARG_WITH(cuda_compute, [[ --with-cuda-compute=archs comma separated list of CUDA compute models (optional)]],,) if test x"$HAVECUDA" = xyes; then AC_MSG_CHECKING([for nvcc archs]) - dnl 10 11 12 13 20 30 32 35 37 50 + dnl 10 11 12 13 20 21 30 32 35 37 50 52 53 60 61 if test x"$with_cuda_compute" = x; then - with_cuda_compute="10,12,20,30,35,50" + with_cuda_compute="20,30,35,50,60" fi ASTRA_FIND_NVCC_ARCHS([$with_cuda_compute],NVCCFLAGS_EXTRA,NVCCARCHS) AC_MSG_RESULT([$NVCCARCHS]) fi +AC_ARG_VAR(NVCCFLAGS, [CUDA nvcc flags]) + AC_SUBST(HAVECUDA) AC_SUBST(LDFLAGS_CUDA) @@ -175,6 +177,28 @@ fi AC_SUBST(HAVEMATLAB) +# octave + +AC_ARG_ENABLE(octave, [[ --enable-octave enable Octave support]]) +if test x"$enable_octave" = xyes; then + AC_PATH_PROG([HAVEOCTAVE], [octave-config], [no], [$PATH]) + AC_MSG_CHECKING([for octave]) + if test x"HAVEOCTAVE" != xno -a $HAVEMATLAB = yes; then + HAVEOCTAVE=no + AC_MSG_RESULT([no (since Matlab support is enabled)]) + else + if test x"$HAVEOCTAVE" != xno; then + OCTAVE_CPPFLAGS="-I`octave-config -p OCTINCLUDEDIR`" + AC_SUBST(OCTAVE_CPPFLAGS) + HAVEOCTAVE=yes + fi + AC_MSG_RESULT($HAVEOCTAVE) + fi +else + HAVEOCTAVE=no +fi +AC_SUBST(HAVEOCTAVE) + # python AC_ARG_WITH(python, [[ --with-python=path path of Python binary (optional)]],,) @@ -204,8 +228,8 @@ if test x"$with_python" != x -a x"$with_python" != xno; then AC_MSG_CHECKING(for Cython module) ASTRA_TRY_PYTHON([ import Cython -from distutils.version import LooseVersion -assert(LooseVersion(Cython.__version__)>=LooseVersion("0.13")) +from pkg_resources import parse_version +assert(parse_version(Cython.__version__) >= parse_version("0.13")) ],,HAVEPYTHON=no) if test x$HAVEPYTHON = xno; then AC_MSG_RESULT(no) @@ -250,6 +274,15 @@ AC_SUBST(CPPFLAGS_OS) VPATH_SRCDIR="$srcdir" AC_SUBST(VPATH_SRCDIR) + +# Installation type +AC_ARG_WITH(install-type, [[ --with-install-type=prefix|module|dir type of installation (default prefix)]],,with_install_type=prefix) + +INSTALL_TYPE=$with_install_type +AC_SUBST(INSTALL_TYPE) + + + # TODO: # Detection of tools: @@ -269,9 +302,46 @@ AC_OUTPUT echo echo "Summary of ASTRA Toolbox build options:" -echo " CUDA : $HAVECUDA" -echo " Matlab : $HAVEMATLAB" -echo " Python : $HAVEPYTHON" -echo -echo " prefix : $prefix" +echo " CUDA : $HAVECUDA" +echo " Matlab: $HAVEMATLAB" +echo " Octave: $HAVEOCTAVE" +echo " Python: $HAVEPYTHON" echo +echo "Installation type: $with_install_type" +case $with_install_type in + prefix) + echo " Library : "$(eval echo `eval echo $libdir`) + if test $HAVEMATLAB = yes; then + echo " Matlab files: "$(eval echo `eval echo $datadir`)"/astra/matlab" + fi + if test $HAVEOCTAVE = yes; then + echo " Octave files: "$(eval echo `eval echo $datadir`)"/astra/octave" + fi + if test $HAVEPYTHON = yes; then + echo " Python files to site-packages" + fi + ;; + dir) + echo " Library : "$(eval echo `eval echo $libdir`) + if test $HAVEMATLAB = yes; then + echo " Matlab files: $prefix/matlab" + fi + if test $HAVEOCTAVE = yes; then + echo " Octave files: $prefix/octave" + fi + if test $HAVEPYTHON = yes; then + echo " Python files: $prefix/python" + fi + ;; + module) + echo " Library into Matlab/Octave/Python module directories" + if test $HAVEMATLAB = yes; then + echo " Matlab files: $prefix/matlab" + fi + if test $HAVEOCTAVE = yes; then + echo " Octave files: $prefix/octave" + fi + if test $HAVEPYTHON = yes; then + echo " Python files to site-packages" + fi +esac 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 |