From eb6e0d38a84056f025787b5ec1e533e51972d36c Mon Sep 17 00:00:00 2001
From: Andreas Naumann <andreas.naumann@tu-dresden.de>
Date: Fri, 19 Nov 2010 09:36:47 +0000
Subject: [PATCH] preparation for demo packing, part II

---
 demo/CMakeLists.txt   |  51 ++++-------------
 demo/Makefile_libtool | 126 ++++++++++++++++++++++++++++++++++++++++++
 demo/README           |  36 ++++++++++++
 3 files changed, 174 insertions(+), 39 deletions(-)
 create mode 100644 demo/Makefile_libtool
 create mode 100644 demo/README

diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt
index 03c0a656..813776e5 100644
--- a/demo/CMakeLists.txt
+++ b/demo/CMakeLists.txt
@@ -12,7 +12,7 @@ if(AMDiS_FOUND)
 endif(AMDiS_FOUND)
 
 option(USE_PARALLEL "check if the parallel demo are also used" false)
-option(USE_OPENMP "check if amdis is compiled with openmp" false)
+#option(USE_OPENMP "check if amdis is compiled with openmp" false)
 
 if(USE_PARALLEL)
   #Message("look for mpi package")
@@ -35,41 +35,14 @@ if(USE_PARALLEL)
   target_link_libraries(parallelheat ${BASIS_LIBS})
 endif(USE_PARALLEL)
 
-SET(ELLIPT_SRC src/ellipt.cc)
-SET(HEAT_SRC src/heat.cc)
-SET(VECELLIPT_SRC src/vecellipt.cc)
-SET(VECHEAT_SRC src/vecheat.cc)
-SET(SPHERE_SRC src/sphere.cc)
-SET(BALL_SRC src/ball.cc)
-SET(PARAMETRIC_SRC src/parametric.cc)
-SET(TORUS_SRC src/torus.cc)
-SET(BUNNY_SRC src/bunny.cc)
-SET(PERIODIC_SRC src/periodic.cc)
-#SET(COUPLE_SRC src/couple.cc)
-
-add_executable(ellipt ${ELLIPT_SRC})
-add_executable(heat ${HEAT_SRC})
-add_executable(vecellipt ${VECELLIPT_SRC})
-add_executable(vecheat ${VECHEAT_SRC})
-add_executable(sphere ${SPHERE_SRC})
-add_executable(ball ${BALL_SRC})
-add_executable(parametric ${PARAMETRIC_SRC})
-add_executable(torus ${TORUS_SRC})
-add_executable(bunny ${BUNNY_SRC})
-add_executable(periodic ${PERIODIC_SRC})
-#add_executable(couple ${COUPLE_SRC})
-
-target_link_libraries(ellipt ${BASIS_LIBS})
-target_link_libraries(heat ${BASIS_LIBS})
-target_link_libraries(vecellipt ${BASIS_LIBS})
-target_link_libraries(vecheat ${BASIS_LIBS})
-target_link_libraries(sphere ${BASIS_LIBS})
-target_link_libraries(ball ${BASIS_LIBS})
-target_link_libraries(parametric ${BASIS_LIBS})
-target_link_libraries(torus ${BASIS_LIBS})
-target_link_libraries(bunny ${BASIS_LIBS})
-target_link_libraries(periodic ${BASIS_LIBS})
-#target_link_libraries(couple ${BASIS_LIBS})
-
-
-
+set(DONTBUILD "couple" "parallelellipt" "parallelheat")
+
+file(GLOB sources src/*.cc)
+foreach(s ${sources})
+  get_filename_component(swe ${s} NAME_WE)
+  list(FIND DONTBUILD ${swe} DBUILD)
+  if( ${DBUILD} EQUAL -1 )
+	add_executable(${swe} ${s})
+	target_link_libraries(${swe} ${BASIS_LIBS})
+  endif()
+endforeach(s)
diff --git a/demo/Makefile_libtool b/demo/Makefile_libtool
new file mode 100644
index 00000000..0b2b3d96
--- /dev/null
+++ b/demo/Makefile_libtool
@@ -0,0 +1,126 @@
+SHELL = /bin/sh
+
+# ============================================================================
+# ===== flags and directories (to be modified by the user) ===================
+# ============================================================================
+
+USE_PARALLEL_AMDIS = 0      # 1 if AMDiS was compiled with parallel support, 0 otherwise
+USE_OPENMP = 0              # 1 if AMDiS was compiled with OpenMP support, 0 otherwise
+USE_UMFPACK = 1             # 1 if AMDiS was compiled with UMFPACK library, 0 otherwise
+USE_MKL = 0                 # 1 if AMDiS was compiled with Intel MKL library, 0 otherwise
+USE_SERVER =                # mars, deimos or themisto. If no special server blank
+USE_COMPILER = gcc          # gcc  or icc
+DEBUG = 0
+
+AMDIS_DIR = ../AMDiS
+MPI_DIR =                   # on mars, deimos or themisto, leave this field blank
+
+#==== standard definitions and rules to compile AMDiS user programs ==========
+include $(AMDIS_DIR)/other/include/Makefile_AMDiS.mk
+
+# ============================================================================
+# ===== user programs ========================================================
+# ============================================================================
+
+PROGRAMS = ellipt heat vecellipt vecheat sphere ball parametric torus bunny
+
+VPATH = .:./src
+
+# ===== ellipt ============================================================
+
+ELLIPT_OFILES = ellipt.o
+
+ellipt: $(ELLIPT_OFILES)
+	$(LINK) $(CPPFLAGS) -o ellipt $(ELLIPT_OFILES) $(LIBS)
+
+# ===== heat ============================================================
+
+HEAT_OFILES = heat.o
+
+heat: 	$(HEAT_OFILES)
+	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o heat $(HEAT_OFILES) $(LIBS)
+
+# ===== vecellipt ============================================================
+
+VECELLIPT_OFILES = vecellipt.o
+
+vecellipt: $(VECELLIPT_OFILES)
+	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o vecellipt $(VECELLIPT_OFILES) $(LIBS)
+
+# ===== vecheat ============================================================
+
+VECHEAT_OFILES = vecheat.o
+
+vecheat: $(VECHEAT_OFILES)
+	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o vecheat $(VECHEAT_OFILES)  $(LIBS)
+
+# ===== sphere ============================================================
+
+SPHERE_OFILES = sphere.o
+
+sphere: $(SPHERE_OFILES)
+	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o sphere $(SPHERE_OFILES) $(LIBS)
+
+# ===== bunny ============================================================
+
+BUNNY_OFILES = bunny.o
+
+bunny: $(BUNNY_OFILES)
+	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o bunny $(BUNNY_OFILES) $(LIBS)
+
+# ===== torus ============================================================
+
+TORUS_OFILES = torus.o
+
+torus: $(TORUS_OFILES)
+	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o torus $(TORUS_OFILES) $(AMDIS_LIB) $(LIBS)
+
+# ===== ball ============================================================
+
+BALL_OFILES = ball.o
+
+ball: $(BALL_OFILES)
+	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o ball $(BALL_OFILES) $(LIBS)
+
+# ===== parametric ============================================================
+
+PARAMETRIC_OFILES = parametric.o
+
+parametric: $(PARAMETRIC_OFILES)
+	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o parametric $(PARAMETRIC_OFILES) $(LIBS)
+
+# ===== periodic ============================================================
+
+PERIODIC_OFILES = periodic.o
+
+periodic: $(PERIODIC_OFILES)
+	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o periodic $(INCLUDES) $(PERIODIC_OFILES) $(LIBS)
+
+# ===== parallelellipt =======================================================
+
+PARALLELELLIPT_OFILES = parallelellipt.o
+
+parallelellipt: $(PARALLELELLIPT_OFILES)
+	$(LINK) $(CPPFLAGS) -o parallelellipt $(PARALLELELLIPT_OFILES) $(LIBS) $(PARMETIS_LIB)
+
+# ===== parallelheat =======================================================
+
+PARALLELHEAT_OFILES = parallelheat.o
+
+parallelheat: $(PARALLELHEAT_OFILES)
+	$(LINK) $(CPPFLAGS) -o parallelheat $(PARALLELHEAT_OFILES) $(LIBS) $(PARMETIS_LIB)
+
+# ===== couple ============================================================
+
+COUPLE_OFILES = couple.o
+
+couple: $(COUPLE_OFILES)
+	$(LINK) $(CPPFLAGS) -o couple $(COUPLE_OFILES) $(LIBS)
+
+# ===== neumann ============================================================
+
+NEUMANN_OFILES = neumann.o
+
+neumann: $(NEUMANN_OFILES)
+	$(LINK) $(CPPFLAGS) -o neumann $(NEUMANN_OFILES) $(LIBS)
+
diff --git a/demo/README b/demo/README
new file mode 100644
index 00000000..02d6ee56
--- /dev/null
+++ b/demo/README
@@ -0,0 +1,36 @@
+This readme shortly explains how to use the different buildsystems. 
+Currently (November 2010) we provide a CMake and a libtool version. 
+Each buildsystem uses it own configuration file:
+	buildsystem	configfile
+	cmake		CMakeLists.txt
+	libtool		Makefile_libtool
+
+The cmake system will generate a new Makefile, thus if we would use 
+simple Makefile for libtool, the libtool configuration would be overidden.
+
+LIBTOOL version
+The libtool version requires
+   * AMDiS was build with libtool 
+      (i.e.: configure --prefix=`pwd` ; make ; make install )
+   * The prefix MUST be the AMDiS-directory
+   * The AMDiS directory should be ../AMDiS. But you can change the 
+   variable AMDIS_DIR (see line 15 in the libtool configuration file).
+If those requirements are fullfilled, you can compile all demos with
+   make -f Makefile_libtool
+or a subset {demo1, demo2} with
+   make -f Makefile_libtoo demo1 demo2
+
+CMAKE version
+The cmake version requires
+   * AMDiS was build and installed using cmake or downloaded from www.simunova.com 
+      or installed from a package from http://www.simunova.com. For more information, 
+      simply have a look at http://www.simunova.com.
+To use the cmake buildsystem, simply run
+   cmake .
+If your cmake complains about not to find AMDiS, you have at least two ways:
+    1. run cmake -DAMDiS_DIR=<path-to-AMDiS> .
+    2. run a graphic cmake tool (i.e. ccmake, cmake-gui, ...) and select your amdis 
+    	configuration directory <path-to-AMDiS>
+
+HINT: The <path-to-AMDiS> is the directoy containing the file AMDiSConfig.cmake.
+If you installed AMDiS with a package manager, cmake should already find AMDiS.
-- 
GitLab