diff --git a/example/MakefileProject/ALL_Staggered.cpp b/example/MakefileProject/ALL_Staggered.cpp new file mode 120000 index 0000000000000000000000000000000000000000..8bca7c2bfb9323f5e40ba4b3d616cf451accc289 --- /dev/null +++ b/example/MakefileProject/ALL_Staggered.cpp @@ -0,0 +1 @@ +../ALL_Staggered.cpp \ No newline at end of file diff --git a/example/MakefileProject/ALL_Staggered_f.F90 b/example/MakefileProject/ALL_Staggered_f.F90 new file mode 120000 index 0000000000000000000000000000000000000000..824e45ef989b09920cc0a5660a3403b88361d251 --- /dev/null +++ b/example/MakefileProject/ALL_Staggered_f.F90 @@ -0,0 +1 @@ +../ALL_Staggered_f.F90 \ No newline at end of file diff --git a/example/MakefileProject/ALL_test_src.cpp b/example/MakefileProject/ALL_test_src.cpp new file mode 120000 index 0000000000000000000000000000000000000000..4ade0dc2b2c72bdc89006407f66ef7965ea88924 --- /dev/null +++ b/example/MakefileProject/ALL_test_src.cpp @@ -0,0 +1 @@ +../ALL_test.cpp \ No newline at end of file diff --git a/example/MakefileProject/Makefile b/example/MakefileProject/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..1e121a9ff50a53a473165d1a82b18fda6baf3e58 --- /dev/null +++ b/example/MakefileProject/Makefile @@ -0,0 +1,81 @@ +# Set our compilers +CC=gcc +CXX=g++ +FC=gfortran +# as well as MPI wrapper +MCC=mpicc +MCXX=mpic++ +MFC=mpifort + +# This Makefile will build ALL automatically, but not VTK. That is assumed to +# be available in $(VTK_DIR). It can be built automatically by reproducing the +# way ALL is included. In general, changes to the library do not trigger a +# rebuild, so in those cases, you need to run `make clean-ext-liball` +# explicitly to trigger the rebuild. +# +# This Makefile also enables the Voronoi and VTK features of ALL. If these are +# not necessary, you can remove the corresponding lines. + +ALL_DIR=all_bin +VTK_DIR=vtk_bin + +ALL_BUILD=all_build +ALL_SOURCE=all +ALL_SOURCE=../.. + +LIBALL_INCLUDE := -I$(ALL_DIR)/include/modules -I$(ALL_DIR)/include +LIBALL_LIB := $(ALL_DIR)/lib/libALL_fortran.a $(ALL_DIR)/lib/libALL.a +LIBALL_LIB += $(ALL_DIR)/lib/libvoro.a +LIBALL_CONFIG_FILE := $(ALL_DIR)/lib/cmake/ALL/ALLConfig.cmake + +LIBALL_CONFIGURE := -DCM_ALL_FORTRAN=ON -DCM_ALL_VORONOI=ON -DCM_ALL_VTK_OUTPUT=ON -DCMAKE_BUILD_TYPE=Release + +# Since gfortran does not link the standard C++ library by default, we need to +# explicitly state it. +FFLAGS += -lstdc++ + +# The linking order of VTK can be gleaned from the CMake invocation of any +# executable of the library. Just compile the library using `VERBOSE=1` and the +# command lines are output as well. +VTK_INCLUDE := -I$(VTK_DIR)/include/vtk-7.1 +VTK_LIB := $(subst lib/,$(VTK_DIR)/lib/, lib/libvtkFiltersProgrammable-7.1.a lib/libvtkIOParallelXML-7.1.a lib/libvtkIOXML-7.1.a lib/libvtkIOXMLParser-7.1.a lib/libvtkexpat-7.1.a lib/libvtkParallelMPI-7.1.a lib/libvtkParallelCore-7.1.a lib/libvtkIOLegacy-7.1.a lib/libvtkIOCore-7.1.a lib/libvtkCommonExecutionModel-7.1.a lib/libvtkCommonDataModel-7.1.a lib/libvtkCommonTransforms-7.1.a lib/libvtkCommonMisc-7.1.a lib/libvtkCommonMath-7.1.a lib/libvtkCommonSystem-7.1.a lib/libvtkCommonCore-7.1.a lib/libvtksys-7.1.a -ldl -lpthread lib/libvtkzlib-7.1.a) + +INCLUDES += $(LIBALL_INCLUDE) +INCLUDES += $(VTK_INCLUDE) +LIBS += $(LIBALL_LIB) $(VTK_LIB) + +.PHONY: all clean clean-ext clean-ext-liball + +all: ALL_Staggered ALL_Staggered_f ALL_test + +clean: + rm -rf ALL_Staggered ALL_Staggered_f ALL_test.cpp ALL_test + +clean-ext: clean-ext-liball + +clean-ext-liball: + rm -rf $(ALL_BUILD) $(ALL_DIR) + +# Our projects executables: +ALL_Staggered: ALL_Staggered.cpp liball + $(MCXX) $(CXXFLAGS) $(INCLUDES) $< $(LIBS) -o $@ + +ALL_Staggered_f: ALL_Staggered_f.F90 liball + $(MFC) $(FFLAGS) $(INCLUDES) $< $(LIBS) -o $@ + +ALL_test.cpp: ALL_test_src.cpp + $(shell cat $< | sed -e 's/ALL_VTK_OUTPUT/TEST_VTK_OUTPUT/' -e 's/ALL_VORONOI_ACTIVE/TEST_VORONOI/' > $@) + +ALL_test: ALL_test.cpp liball + $(MCXX) $(CXXFLAGS) $(INCLUDES) $< $(LIBS) -o $@ + +# The library part follows: +liball: $(LIBALL_CONFIG_FILE) + +$(LIBALL_CONFIG_FILE): + rm -rf $(ALL_BUILD) + mkdir -p $(ALL_BUILD) + CC=$(CC) CXX=$(CXX) FC=$(FC) VTK_DIR=$(VTK_DIR)/lib/cmake/vtk-7.1 cmake -S $(ALL_SOURCE) -B $(ALL_BUILD) -DCMAKE_INSTALL_PREFIX=`pwd`/$(ALL_DIR) $(LIBALL_CONFIGURE) + cmake --build $(ALL_BUILD) + rm -rf $(ALL_DIR) + cmake --install $(ALL_BUILD)