From: maier Date: Tue, 7 Aug 2012 16:12:40 +0000 (+0000) Subject: A first attempt for cmake X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=603e1524cd3002196306370ef1a841ad2c3f4d22;p=dealii-svn.git A first attempt for cmake git-svn-id: https://svn.dealii.org/branches/branch_cmake@25761 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 6d5ae65067..2aa76debe5 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -1,105 +1,13 @@ -# ----------------------------------------------------------------- -# Configuration and build system description for deal.II -# -# This file is subject to QPL and may not be distributed -# without copyright and license information. Please refer -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -# Copyright (C) 2012 by the deal.II authors -# -# $Id: aclocal.m4 24924 2012-01-25 12:35:17Z kormann $ +PROJECT (deal.II) +set (VERSION "8.0.pre") +CMAKE_MINIMUM_REQUIRED (VERSION 2.8) +SET (CMAKE_CXX_FLAGS "-std=c++0x -D_REENTRANT -fPIC -O2 -march=native -Wall -Wfatal-errors -pedantic") -# ########################################################### -# Configuration of deal.II # -# ########################################################### +INCLUDE_DIRECTORIES( + "${CMAKE_SOURCE_DIR}/contrib/tbb/tbb30_104oss/include" #TODO + "${CMAKE_SOURCE_DIR}/include/" + ) - -message ("") -message ("=========================================") -message ("== Configuring deal.II ==") -message ("=========================================") -message ("") - -message ("------ Configuring the compilers") - -cmake_minimum_required(VERSION 2.8) -project(deal.II) - - -# ----------------------------------------------------------- -# Find a few programs that we need throughout this script and -# deal.II. -# ----------------------------------------------------------- - -message ("") -message ("------ Searching for external programs") -find_program (perl perl) -if (${perl} STREQUAL perl-NOTFOUND) - message (FATAL_ERROR "** Searching for perl: not found") -else() - message ("-- Searching for perl: " ${perl}) -endif() - -find_program (doxygen doxygen) -if (${doxygen} STREQUAL doxygen-NOTFOUND) - message (FATAL_ERROR "** Searching for doxygen: not found") -else() - message ("-- Searching for doxygen: " ${doxygen}) -endif() - - - -# ########################################################### -# Build system of deal.II # -# ########################################################### - -# common defines -include_directories(include) -include_directories(contrib/boost-1.46.1/include) -include_directories(contrib/tbb/tbb30_104oss/include) -include_directories(contrib) - -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_CONFIG_H -DHAVE_ISNAN -ggdb -DBOOST_NO_HASH -DBOOST_NO_SLIST -DDEBUG -Wall -W -Wpointer-arith -Wwrite-strings -Wsynth -Wsign-compare -Wswitch -ftemplate-depth-128 -Wno-long-long -std=c++0x -Wa,--compress-debug-sections -pthread -D_REENTRANT -fPIC") - -set (BUILD_SHARED_LIBS on) - - -# define what's needed for the program that builds the .inst files from -# the .inst.in files -set (EXPAND_INSTANTIATIONS_SOURCES common/scripts/expand_instantiations.cc) -add_executable (expand_instantiations - ${EXPAND_INSTANTIATIONS_SOURCES}) -get_target_property (expand_instantiations_exe - expand_instantiations - LOCATION) - - -# we then need to describe how we can build the .inst files from the -# .inst.in files -file (GLOB_RECURSE inst_in_files source/*.inst.in) -foreach (inst_file ${inst_in_files}) - add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${inst_file} - DEPENDS expand_instantiations ${inst_file}.in - COMMAND ${expand_instantiations_exe} - ARGS common/template-arguments < ${inst_file}.in - > ${PROJECT_BINARY_DIR}/${inst_file}) - set (inst_files ${inst_files} ${PROJECT_BINARY_DIR}/${inst_file}) -endforeach() - -# then do the same for the .inst.pl files -file (GLOB_RECURSE inst_pl_files source/*.inst.pl) -foreach (inst_file ${inst_pl_files}) - add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${inst_file} - DEPENDS ${inst_file}.pl - COMMAND ${perl} - ARGS -I common ${inst_file}.pl - > ${PROJECT_BINARY_DIR}/${inst_file}) - set (inst_files ${inst_files} ${PROJECT_BINARY_DIR}/${inst_file}) -endforeach () - - -# then define what's needed for the deal.II library -file (GLOB_RECURSE cc_files source/*.cc) -add_library(deal_II ${inst_files} ${cc_files}) +# ADD_SUBDIRECTORY(contrib) +ADD_SUBDIRECTORY(source) diff --git a/deal.II/source/CMakeLists.txt b/deal.II/source/CMakeLists.txt new file mode 100644 index 0000000000..99de2964b7 --- /dev/null +++ b/deal.II/source/CMakeLists.txt @@ -0,0 +1,11 @@ +INCLUDE(base/CMakeLists.txt) +#INCLUDE(distributed/CMakeLists.txt) +#INCLUDE(dofs/CMakeLists.txt) +#INCLUDE(fe/CMakeLists.txt) +#INCLUDE(grid/CMakeLists.txt) +#INCLUDE(hp/CMakeLists.txt) +#INCLUDE(lac/CMakeLists.txt) +#INCLUDE(multigrid/CMakeLists.txt) +#INCLUDE(numerics/CMakeLists.txt) + +ADD_LIBRARY(deal.II ${SRC_BASE}) diff --git a/deal.II/source/Makefile b/deal.II/source/Makefile deleted file mode 100644 index 2e997901b7..0000000000 --- a/deal.II/source/Makefile +++ /dev/null @@ -1,292 +0,0 @@ -# $Id$ -# Copyright by the deal.II authors, 1998, 1999, 2000, 2001, 2002, 2010, 2011, 2012 - - -ifneq ($(CLEAN),yes) - -# deal.II top level directory -D=.. - - -# get options which hold for all files of the project -include $D/common/Make.global_options - -# top level targets -default all: debug optimized - - -# list the directories and the various kinds of files, the ones with the -# largest compile jobs first so that 'make -j N' saturates many processors -# also towards the end of compiling (e.g. numerics/vectors.cc takes several -# minutes to compile...) -all-dirs := numerics fe dofs lac base grid hp multigrid distributed - -cc-files := $(shell for i in $(all-dirs) ; do echo $D/source/$$i/*.cc ; done) -h-files := $(sort $(shell echo $D/include/deal.II/*/*.h)) - -# build unique object file names -tmp1 := $(shell echo $(cc-files) | $(PERL) -pi -e 's,$D/source/,,g; s,/,_,g;') -o-files := $(addprefix $(LIBDIR)/optimized/, $(tmp1:.cc=.$(OBJEXT)) ) -go-files := $(addprefix $(LIBDIR)/debug/, $(tmp1:.cc=.$(OBJEXT))) - - -debug: $(LIBDIR)/libdeal_II.g$(lib-suffix) -optimized: $(LIBDIR)/libdeal_II$(lib-suffix) - - - -# rules how to generate object files from source files. -$(LIBDIR)/debug/%.$(OBJEXT) : - @echo "======================debug======$(MT)== $(<:$D/source/%=%)" - @$(CXX) $(CXXFLAGS.g) -c $< -o $@ -$(LIBDIR)/optimized/%.$(OBJEXT) : - @echo "======================optimized==$(MT)== $(<:$D/source/%=%)" - @$(CXX) $(CXXFLAGS.o) -c $< -o $@ - - - -%.inst : %.inst.in $D/common/template-arguments - @echo "======================instantiate==== $(@F)" - @$D/common/scripts/expand_instantiations $D/common/template-arguments < $< > $@ || exit 1 - -%.inst : %.inst.pl $D/common/dealiitemplates.pm - @echo "======================instantiate==== $(@F)" - @perl -I $D/common/ $< > $@ || exit 1 - -#Todo: remove this target after renaming files -%.inst : %.pl $D/common/dealiitemplates.pm - @echo "======================instantiate==== $(@F)" - @perl -I $D/common/ $< > $@ || exit 1 - - - -# there are extra .o file for the function parser and umfpack that we -# need to link into out library -ifeq ($(enable-parser),yes) - extra-o-files := $(LIBDIR)/contrib/functionparser/fparser.$(OBJEXT) - extra-g.o-files := $(LIBDIR)/contrib/functionparser/fparser.$(OBJEXT) -endif - -ifeq ($(USE_CONTRIB_UMFPACK),yes) - umfpack-files := $(sort $(shell echo $(LIBDIR)/contrib/umfpack/*.$(OBJEXT))) - extra-o-files += $(umfpack-files) - extra-g.o-files += $(umfpack-files) -endif - - - -# in general, when linking shared libraries, we will want to link with -# the underlying libs as well. AIX even requires this. on the other -# hand, on DEC OSF with CXX this will fail with duplicate symbols, so -# make sure that it doesn't happen on that system and that compiler -ifneq ($(GXX-VERSION),compaq_cxx) - # if we use HSL, then we need to link against libhsl.so. - ifeq ($(USE_CONTRIB_HSL),yes) - deplibs.g += $(lib-contrib-hsl) - deplibs.o += $(lib-contrib-hsl) - endif - - # same with PETSC - ifeq ($(USE_CONTRIB_PETSC),yes) - deplibs.g += $(lib-contrib-petsc.g) \ - $(call DEAL_II_RPATH,$(DEAL_II_PETSC_LIBDIR)) - deplibs.o += $(lib-contrib-petsc.o) \ - $(call DEAL_II_RPATH,$(DEAL_II_PETSC_LIBDIR)) - endif - - # same with SLEPC - ifeq ($(USE_CONTRIB_SLEPC),yes) - deplibs.g += $(lib-contrib-slepc) \ - $(call DEAL_II_RPATH,$(DEAL_II_SLEPC_LIBDIR)) - deplibs.o += $(lib-contrib-slepc) \ - $(call DEAL_II_RPATH,$(DEAL_II_SLEPC_LIBDIR)) - endif - - # same with TRILINOS - ifeq ($(USE_CONTRIB_TRILINOS),yes) - deplibs.g += $(lib-contrib-trilinos) \ - $(call DEAL_II_RPATH,$(DEAL_II_TRILINOS_LIBDIR)) - deplibs.o += $(lib-contrib-trilinos) \ - $(call DEAL_II_RPATH,$(DEAL_II_TRILINOS_LIBDIR)) - endif - - # same with MUMPS - ifeq ($(USE_CONTRIB_MUMPS),yes) - deplibs.g += $(lib-contrib-mumps) - deplibs.o += $(lib-contrib-mumps) - endif - - # and METIS - ifeq ($(USE_CONTRIB_METIS),yes) - deplibs.g += $(lib-contrib-metis) - deplibs.o += $(lib-contrib-metis) - endif - - # also link with TBB - ifeq ($(enable-threads),yes) - deplibs.g += $D/lib/libtbb_debug$(shared-lib-suffix) - deplibs.o += $D/lib/libtbb$(shared-lib-suffix) - endif - - # and p4est - ifeq ($(USE_CONTRIB_P4EST),yes) - deplibs.g += $(DEAL_II_P4EST_DIR)/DEBUG/$(DEAL_II_P4EST_LIBDIR_NAME)/libp4est$(shared-lib-suffix) \ - $(DEAL_II_P4EST_DIR)/DEBUG/$(DEAL_II_P4EST_LIBDIR_NAME)/libsc$(shared-lib-suffix) \ - $(call DEAL_II_RPATH,$(DEAL_II_P4EST_DIR)/DEBUG/$(DEAL_II_P4EST_LIBDIR_NAME)) - deplibs.o += $(DEAL_II_P4EST_DIR)/FAST/$(DEAL_II_P4EST_LIBDIR_NAME)/libp4est$(shared-lib-suffix) \ - $(DEAL_II_P4EST_DIR)/FAST/$(DEAL_II_P4EST_LIBDIR_NAME)/libsc$(shared-lib-suffix) \ - $(call DEAL_II_RPATH,$(DEAL_II_P4EST_DIR)/FAST/$(DEAL_II_P4EST_LIBDIR_NAME)) - endif - - # for cygwin and darwin, also llapack and such are necessary - # we better link all libraries mentioned in $(LIBS) - ifneq ($(findstring cygwin,$(TARGET))$(findstring darwin,$(TARGET)),) - deplibs.g += $(LIBS) - deplibs.o += $(LIBS) - endif - -else - deplibs.g = - deplibs.o = -endif - - -# rules for static libraries -$(LIBDIR)/libdeal_II.g$(static-lib-suffix): $(go-files) $(extra-g.o-files) - @echo "=====deal.II==========debug======$(MT)== Linking library: $(@F)" - @$(AR) ru $@ $(go-files) $(extra-g.o-files) - @$(RANLIB) $@ -$(LIBDIR)/libdeal_II$(static-lib-suffix): $(o-files) $(extra-o-files) - @echo "=====deal.II==========optimized==$(MT)== Linking library: $(@F)" - @$(AR) ru $@ $(o-files) $(extra-o-files) - @$(RANLIB) $@ - - -# Rules for shared libraries. these are much more difficult to link -# because the linker has to update relocations etc. This requires -# seeking back and forth in memory mapped files and is excruciatingly -# slow on remotely mounted file systems. Consequently, we link in a -# local file in the $TMPDIR directory, and only after the fact move -# them to their final location -$(LIBDIR)/libdeal_II.g$(shared-lib-suffix): $(go-files) $(extra-g.o-files) - @echo "=====deal.II==========debug======$(MT)== Linking library: $(@F)" - @rm -f $@ - @WORKFILE=`mktemp $${TMPDIR:-/tmp}/tmp.XXXXXXXXXX` && \ - $(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $$WORKFILE $(call DEAL_II_ADD_SONAME,deal_II.g) $(go-files) $(extra-g.o-files) $(deplibs.g) && \ - mv $$WORKFILE $(LIBDIR)/$(call DEAL_II_SHLIB_NAME,deal_II.g) - @ln -f -s $(call DEAL_II_SHLIB_NAME,deal_II.g) $@ - -$(LIBDIR)/libdeal_II$(shared-lib-suffix): $(o-files) $(extra-o-files) - @echo "=====deal.II==========optimized==$(MT)== Linking library: $(@F)" - @rm -f $@ - @WORKFILE=`mktemp $${TMPDIR:-/tmp}/tmp.XXXXXXXXXX` && \ - $(SHLIBLD) $(LDFLAGS) $(SHLIBFLAGS) -o $$WORKFILE $(call DEAL_II_ADD_SONAME,deal_II) $(o-files) $(extra-o-files) $(deplibs.o) && \ - mv $$WORKFILE $(LIBDIR)/$(call DEAL_II_SHLIB_NAME,deal_II) - @ln -f -s $(call DEAL_II_SHLIB_NAME,deal_II) $@ - - - -# generate a file that contains prototypes for BLAS and LAPACK functions -../include/deal.II/lac/lapack_templates.h: ../include/deal.II/lac/lapack_templates.h.in \ - $D/common/scripts/lapack_templates.pl - @echo ===================================== Remaking $@ - @$(PERL) $D/common/scripts/lapack_templates.pl ../include/deal.II/lac/lapack_templates.h.in > $@ - - -# A rule to make sure the various */Makefile.dep files have the right -# dependencies on their source files. Use the opportunity to also ensure that -# .inst and the lapack file are built before everything else -Makefile.dep: ../include/deal.II/lac/lapack_templates.h \ - $(cc-files) - @echo "===================================== Remaking $@" - @for i in $(all-dirs) ; do \ - echo $$i/Makefile.dep: $$i/*.cc \ - $(h-files) \ - Makefile \ - $D/common/Make.global_options ; \ - done >> $@ - @echo "lac/Makefile.dep: $D/include/deal.II/lac/lapack_templates.h.in \ - $D/include/deal.II/lac/lapack_templates.h.in" \ - >> $@ -include Makefile.dep - - -# Rule to generate the dependency files, one for each source -# directory. These file are automagically remade whenever needed, -# i.e. whenever one of the cc-/h-files changed. Make detects whether -# to remake this file upon inclusion below. -# -# If the command fails, then remove Makefile.dep again and fail -%/Makefile.dep: - @echo "===================================== Remaking $@" - @$D/common/scripts/make_dependencies -n $(INCLUDE) "-B\$$(LIBDIR)" \ - $(filter $D/source/$(dir $@)%, $(cc-files)) \ - | $(PERL) -pe 's!LIBDIR\)/(debug|optimized)/(.*):!LIBDIR)/$$1/$(@:%/Makefile.dep=%)_$$2:!g;' \ - > $@ - @if test ! -s $@ ; then \ - echo "*** make_dependencies failed to produce a valid file $@" ; \ - rm $@ ; \ - false ; \ - fi - - -# include all the dependencies -include $(addsuffix /Makefile.dep, $(all-dirs)) - -endif - - - -################### some clean-up rules - -clean: - -rm -f Makefile.dep *~ */*~ */*/*~ */Makefile.dep source/*/*.inst \ - $D/lib/{debug,optimized}/*.o - - -################### coverage -# A target that creates a visual representation of which files and -# lines are covered by the testsuite, the example programs, and -# possible other executables. To use this rule, configure deal.II -# as usual, then add "-fprofile-arcs -ftest-coverage" to the following -# variables in common/Make.global_options: -# - SHLIBFLAGS -# - LDFLAGS -# - CXXFLAGS.g -# Then compile the library and run all the executables for which you -# want it reported that. Note, however, that you can't run them in -# parallel or they will step on each other's toes when writing output. -# In other words, the testsuite has to be run with -j1, however long -# that may take. -# -# When all of these programs have been run, the do -# cd source -# make coverage -# This may take a long time: both running lcov and, in particular, -# genhtml can take hours. In the latter case, there isn't even an -# indication that anything is happening, but it is -- just be -# patient, let it run overnight. -coverage: - for dir in $(all-dirs) ; do \ - cd $$dir ; \ - for file in *.cc ; do \ - basename=`echo $$file | perl -pi -e 's/\\.cc$$//;'` ; \ - for ext in o gcda gcno ; do \ - rm -f $${basename}.$$ext ; \ - if test -f $D/lib/debug/$${dir}_$${basename}.$$ext ; then \ - ln $D/lib/debug/$${dir}_$${basename}.$$ext $${basename}.$$ext ; \ - fi ; \ - done ; \ - done ; \ - cd .. ; \ - done - lcov --base-directory . --directory . -c -o d2.info - lcov --remove d2.info "/usr*" -o d2.info - rm -rf ../coverage - genhtml -o ../coverage -t "deal.II test coverage" --num-spaces 8 d2.info - - -################### - -.PHONY: default all debug optimized TAGS -.PHONY: clean diff --git a/deal.II/source/base/CMakeLists.txt b/deal.II/source/base/CMakeLists.txt new file mode 100644 index 0000000000..928c8431ec --- /dev/null +++ b/deal.II/source/base/CMakeLists.txt @@ -0,0 +1,49 @@ +set(SRC_BASE + ${CMAKE_CURRENT_SOURCE_DIR}/base/auto_derivative_function.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/boost_serialization.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/boost_threads.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/conditional_ostream.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/config.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/convergence_table.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/data_out_base.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/event.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/exceptions.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/flow_function.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/function.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/function_derivative.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/function_lib.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/function_lib_cutoff.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/function_parser.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/function_time.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/geometry_info.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/index_set.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/job_identifier.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/logstream.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/memory_consumption.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/mpi.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/multithread_info.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/parallel.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/parameter_handler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/parsed_function.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/partitioner.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/path_search.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/polynomial.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/polynomials_abf.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/polynomials_adini.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/polynomials_bdm.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/polynomials_nedelec.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/polynomial_space.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/polynomials_p.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/polynomials_raviart_thomas.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/quadrature.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/quadrature_lib.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/quadrature_selector.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/subscriptor.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/symmetric_tensor.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/table_handler.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/tensor_function.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/tensor_product_polynomials.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/thread_management.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/timer.cc + ${CMAKE_CURRENT_SOURCE_DIR}/base/utilities.cc + )