From b28707bc1962582a86b41ec54b284ac923a1b59e Mon Sep 17 00:00:00 2001 From: maier Date: Fri, 21 Sep 2012 16:09:27 +0000 Subject: [PATCH] Add support for the old Make.global_options file git-svn-id: https://svn.dealii.org/branches/branch_cmake@26600 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 35 +- deal.II/cmake/configure/configure_1_tbb.cmake | 1 + deal.II/cmake/configure/configure_boost.cmake | 1 + .../cmake/configure/configure_trilinos.cmake | 1 + deal.II/cmake/macros/macro_to_string.cmake | 15 +- .../macro_to_string_and_add_prefix.cmake | 17 + deal.II/cmake/setup_compiler_flags_gnu.cmake | 5 + deal.II/cmake/setup_deal_ii.cmake | 26 ++ deal.II/config/CMakeLists.txt | 17 + deal.II/config/Make.global_options.in | 345 ++---------------- deal.II/config/deal.IIConfig.cmake.in | 2 + 11 files changed, 126 insertions(+), 339 deletions(-) create mode 100644 deal.II/cmake/macros/macro_to_string_and_add_prefix.cmake diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index b8f0645427..020b2550f2 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -295,7 +295,7 @@ INCLUDE(setup_compiler_flags) # FAT NOTE: # # To keep things clean, only the following cmake variables should be -# altered in the platform checks and features configuration +# altered in the platform checks and feature configuration # (beside setting a lot of DEAL_II_* definitions...): # # @@ -312,6 +312,10 @@ INCLUDE(setup_compiler_flags) # For setting necessary include dirs for the compilation of the # deal.II library. # +# ADD_DEFINITIONS() +# For setting necessary preprocessor definitions ("-D<...>") for +# the compilation of the deal.II library +# ADD_CUSTOM_TARGET(deal_ii_target_dependencies) # Used as a dummy target for all the stuff that has to be done # before the library can be compiled. @@ -319,14 +323,19 @@ ADD_CUSTOM_TARGET(deal_ii_target_dependencies) # # For internal and external use: # -SET( DEAL_II_EXTERNAL_LIBRARIES) +# DEAL_II_EXTERNAL_LIBRARIES # Used to keep track of external libraries, the deal.II library # and user programs have to be linked against. # # # For external use: # -# CMAKE_EXTERNAL_INCLUDE_DIRS +# DEAL_II_EXTERNAL_DEFINITIONS +# Used to keep track of external preprocessor definitions, +# necessary for the compilation of user programs. +# +# +# DEAL_II_EXTERNAL_INCLUDE_DIRS # Used to keep track of external include dirs, necessary for the # compilation of user programs. # @@ -374,6 +383,7 @@ INCLUDE(setup_finalize) # # Build the toolchain and prepare the includes: # +ADD_SUBDIRECTORY(config) ADD_SUBDIRECTORY(scripts) ADD_SUBDIRECTORY(include) @@ -384,27 +394,12 @@ ADD_SUBDIRECTORY(source) # -# Set DEAL_II_LIBRARIES and DEAL_II_INCLUDE_DIRS at this point... +# Prepare some directories for installation # -GET_TARGET_PROPERTY(deal_II_NAME deal_II LOCATION) -GET_FILENAME_COMPONENT(deal_II_NAME ${deal_II_NAME} NAME) -LIST(APPEND DEAL_II_LIBRARIES - "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${deal_II_NAME}" - ) -LIST(APPEND DEAL_II_INCLUDE_DIRS - "${CMAKE_INSTALL_PREFIX}/${DEAL_II_INCLUDE_RELDIR}" - ) - - -# -# Prepare some directories for installation (include them after -# DEAL_II_LIBRARIES and DEAL_II_INCLUDE_DIRS is set) -# -ADD_SUBDIRECTORY(config) ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(examples) # -# Define some convencience custom targets for easy use: +# Define some custom targets for convenience # INCLUDE(setup_custom_targets) diff --git a/deal.II/cmake/configure/configure_1_tbb.cmake b/deal.II/cmake/configure/configure_1_tbb.cmake index 9baded21fb..159e3cf975 100644 --- a/deal.II/cmake/configure/configure_1_tbb.cmake +++ b/deal.II/cmake/configure/configure_1_tbb.cmake @@ -69,6 +69,7 @@ MACRO(SETUP_THREADING var) IF(NOT DEAL_II_HAVE_SANE_MT_DEFINITIONS) ADD_DEFINITIONS("-D_REENTRANT" "-D_THREAD_SAFE") + LIST(APPEND DEAL_II_EXTERNAL_DEFINITIONS "-D_REENTRANT" "-D_THREAD_SAFE") # TODO: Necessary? ENDIF() ENDIF(Threads_FOUND) diff --git a/deal.II/cmake/configure/configure_boost.cmake b/deal.II/cmake/configure/configure_boost.cmake index 1c8e8f3881..1ac54f7ef0 100644 --- a/deal.II/cmake/configure/configure_boost.cmake +++ b/deal.II/cmake/configure/configure_boost.cmake @@ -59,6 +59,7 @@ MACRO(FEATURE_BOOST_CONFIGURE_CONTRIB var) # library: # ADD_DEFINITIONS("-DBOOST_NO_HASH" "-DBOOST_NO_SLIST") + LIST(APPEND DEAL_II_EXTERNAL_DEFINIITONS "-DBOOST_NO_HASH" "-DBOOST_NO_SLIST") INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/contrib/boost-1.49.0/include diff --git a/deal.II/cmake/configure/configure_trilinos.cmake b/deal.II/cmake/configure/configure_trilinos.cmake index 02db58dd75..8f55dfaa95 100644 --- a/deal.II/cmake/configure/configure_trilinos.cmake +++ b/deal.II/cmake/configure/configure_trilinos.cmake @@ -126,6 +126,7 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) IF(TRILINOS_HAS_C99_TR1_WORKAROUND) ADD_DEFINITIONS("-DHAS_C99_TR1_CMATH") + LIST(APPEND DEAL_II_EXTERNAL_DEFINITIONS "-DHAS_C99_TR1_CMATH") ELSE() MESSAGE(WARNING "\n" "Your Trilinos installation is not compatible with the C++ standard selected for\n" diff --git a/deal.II/cmake/macros/macro_to_string.cmake b/deal.II/cmake/macros/macro_to_string.cmake index df29ba02cd..2bdd4de45c 100644 --- a/deal.II/cmake/macros/macro_to_string.cmake +++ b/deal.II/cmake/macros/macro_to_string.cmake @@ -1,7 +1,16 @@ -MACRO(TO_STRING variable) - SET(variable_tmp ${${variable}}) + +# +# A small macro used for converting a cmake list into a space +# separated : +# +# Usage: +# TO_STRING(string list) +# + +MACRO(TO_STRING variable list) SET(${variable} "") - FOREACH(var ${variable_tmp}) + FOREACH(var ${${list}}) SET(${variable} "${${variable}} ${var}") ENDFOREACH() + STRING(STRIP "${${variable}}" ${variable}) ENDMACRO() diff --git a/deal.II/cmake/macros/macro_to_string_and_add_prefix.cmake b/deal.II/cmake/macros/macro_to_string_and_add_prefix.cmake new file mode 100644 index 0000000000..c4c6ee9616 --- /dev/null +++ b/deal.II/cmake/macros/macro_to_string_and_add_prefix.cmake @@ -0,0 +1,17 @@ + +# +# A small macro used for converting a cmake list into a space +# separated . This macro adds the string in front of each +# element of the list . +# +# Usage: +# TO_STRING_AND_ADD_PREFIX(string list) +# + +MACRO(TO_STRING_AND_ADD_PREFIX variable prefix list) + SET(${variable} "") + FOREACH(var ${${list}}) + SET(${variable} "${${variable}} ${prefix}${var}") + ENDFOREACH() + STRING(STRIP "${${variable}}" ${variable}) +ENDMACRO() diff --git a/deal.II/cmake/setup_compiler_flags_gnu.cmake b/deal.II/cmake/setup_compiler_flags_gnu.cmake index dedf74e84d..b768c14d47 100644 --- a/deal.II/cmake/setup_compiler_flags_gnu.cmake +++ b/deal.II/cmake/setup_compiler_flags_gnu.cmake @@ -125,7 +125,12 @@ ENDIF() ############################### IF (CMAKE_BUILD_TYPE MATCHES "Debug") + + # + # Define the DEBUG preprocessor macro globally: + # ADD_DEFINITIONS("-DDEBUG") + LIST(APPEND CMAKE_EXTERNAL_DEFINTIONS "-DDEBUG") ADD_FLAGS(CMAKE_CXX_FLAGS_DEBUG "-O0") diff --git a/deal.II/cmake/setup_deal_ii.cmake b/deal.II/cmake/setup_deal_ii.cmake index 7019480701..800d1a9707 100644 --- a/deal.II/cmake/setup_deal_ii.cmake +++ b/deal.II/cmake/setup_deal_ii.cmake @@ -45,3 +45,29 @@ SET(DEAL_II_PACKAGE_BUGREPORT "dealii@dealii.org") SET(DEAL_II_PACKAGE_TARNAME ${DEAL_II_PACKAGE_NAME}) #TODO SET(DEAL_II_PACKAGE_URL "http://www.dealii.org") +LIST(APPEND DEAL_II_INCLUDE_DIRS + "${CMAKE_INSTALL_PREFIX}/${DEAL_II_INCLUDE_RELDIR}" + ) + +# +# TODO: This is decoupled from the actual library target atm... +# +IF(CMAKE_BUILD_TYPE MATCHES "Debug") + SET(DEAL_II_LIBRARY_NAME "deal_II.g") +ELSE() + SET(DEAL_II_LIBRARY_NAME "deal_II") +ENDIF() +IF(BUILD_SHARED_LIBS) + SET(DEAL_II_LIBRARY_NAME + ${CMAKE_SHARED_LIBRARY_PREFIX}deal_II${CMAKE_SHARED_LIBRARY_SUFFIX} + ) +ELSE() + SET(DEAL_II_LIBRARY_NAME + ${CMAKE_STATIC_LIBRARY_PREFIX}deal_II${CMAKE_STATIC_LIBRARY_SUFFIX} + ) +ENDIF() + +LIST(APPEND DEAL_II_LIBRARIES + "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}/${DEAL_II_LIBRARY_NAME}" + ) + diff --git a/deal.II/config/CMakeLists.txt b/deal.II/config/CMakeLists.txt index 6a465827e1..20079211e0 100644 --- a/deal.II/config/CMakeLists.txt +++ b/deal.II/config/CMakeLists.txt @@ -34,6 +34,22 @@ IF(DEAL_II_INSTALL_COMPAT_FILES) # Configure and install the old Makefile configuration: # + # + # Therefore, transform some cmake lists into a string that a Makefile + # actually understands: + # + + TO_STRING(MAKEFILE_EXTERNAL_LIBRARIES DEAL_II_EXTERNAL_LIBRARIES) + TO_STRING(MAKEFILE_LIBRARIES DEAL_II_LIBRARIES) + ADD_FLAGS(MAKEFILE_EXTERNAL_LIBRARIES "${MAKEFILE_LIBRARIES}") + + TO_STRING(MAKEFILE_EXTERNAL_DEFINITIONS DEAL_II_EXTERNAL_DEFINITIONS) + + TO_STRING_AND_ADD_PREFIX(MAKEFILE_EXTERNAL_INCLUDES + "${CMAKE_INCLUDE_FLAG_C}" + DEAL_II_EXTERNAL_INCLUDE_DIRS + ) + CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/Make.global_options.in ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options @@ -58,3 +74,4 @@ IF(DEAL_II_INSTALL_COMPAT_FILES) ) ENDIF() + diff --git a/deal.II/config/Make.global_options.in b/deal.II/config/Make.global_options.in index e057e07c0a..7eec0c7d22 100644 --- a/deal.II/config/Make.global_options.in +++ b/deal.II/config/Make.global_options.in @@ -1,5 +1,10 @@ # $Id$ +# +# Compatibility Make.global_options file +# + +# TODO: Update this comment: ############################################################################### ## Please note: ## The ./configure script generates Make.global_options from @@ -15,104 +20,31 @@ ## doc/development/Makefile. ############################################################################### - -###################################################################### -# Since most of our makefiles at some ponit use bash features, choose -# bash as default shell here once and for all -SHELL=/bin/bash - - -###################################################### -# the following lines will be replaced by the output -# of ./configure - D = @CMAKE_INSTALL_PREFIX@ - CXX = @CMAKE_CXX_COMPILER@ CXX-ID = @CMAKE_CXX_COMPILER_ID@ CXX-VERSION = @CMAKE_CXX_COMPILER_VERSION@ CC = @CMAKE_C_COMPILER@ CC-ID = @CMAKE_C_COMPILER_ID@ CC-VERSION = @CMAKE_C_COMPILER_VERSION@ -SHLIBLD = @SHLIBLD@ -SHLIBFLAGS = @SHLIBFLAGS@ -AR = @AR@ -RANLIB = @RANLIB@ -LDFLAGS = @LDFLAGS@ -F77 = @F77@ -F77-VERSION = @F77_VERSION@ -F77LIBS = @F77LIBS@ -LIBS = @LIBS@ -LIBDIR = $D/lib -PERL = @PERL@ -QMAKE = @QMAKE@ -enable-threads = @enablethreads@ -enable-shared = @enableshared@ -enable-parser = @enableparser@ -DEAL_II_VERSION = @VERSION@ -DEAL_II_MAJOR = @DEAL_II_MAJOR@ -DEAL_II_MINOR = @DEAL_II_MINOR@ - -USE_CONTRIB_PETSC = @USE_CONTRIB_PETSC@ -DEAL_II_PETSC_DIR = @DEAL_II_PETSC_DIR@ -DEAL_II_PETSC_ARCH = @DEAL_II_PETSC_ARCH@ -DEAL_II_PETSC_VERSION_MAJOR = @DEAL_II_PETSC_VERSION_MAJOR@ -DEAL_II_PETSC_VERSION_MINOR = @DEAL_II_PETSC_VERSION_MINOR@ -DEAL_II_PETSC_VERSION_SUBMINOR = @DEAL_II_PETSC_VERSION_SUBMINOR@ -DEAL_II_PETSC_VERSION_DEV = @DEAL_II_PETSC_VERSION_DEV@ -DEAL_II_PETSC_MPIUNI_LIB = @DEAL_II_PETSC_MPIUNI_LIB@ - -USE_CONTRIB_SLEPC = @USE_CONTRIB_SLEPC@ -DEAL_II_SLEPC_DIR = @DEAL_II_SLEPC_DIR@ -DEAL_II_SLEPC_VERSION_MAJOR = @DEAL_II_SLEPC_VERSION_MAJOR@ -DEAL_II_SLEPC_VERSION_MINOR = @DEAL_II_SLEPC_VERSION_MINOR@ -DEAL_II_SLEPC_VERSION_SUBMINOR = @DEAL_II_SLEPC_VERSION_SUBMINOR@ - -USE_CONTRIB_TRILINOS = @USE_CONTRIB_TRILINOS@ -DEAL_II_TRILINOS_INCDIR = @DEAL_II_TRILINOS_INCDIR@ -DEAL_II_TRILINOS_LIBDIR = @DEAL_II_TRILINOS_LIBDIR@ -DEAL_II_TRILINOS_SHARED = @DEAL_II_TRILINOS_SHARED@ -DEAL_II_TRILINOS_STATIC = @DEAL_II_TRILINOS_STATIC@ -DEAL_II_TRILINOS_VERSION_MAJOR = @DEAL_II_TRILINOS_VERSION_MAJOR@ -DEAL_II_TRILINOS_VERSION_MINOR = @DEAL_II_TRILINOS_VERSION_MINOR@ -DEAL_II_TRILINOS_VERSION_SUBMINOR = @DEAL_II_TRILINOS_VERSION_SUBMINOR@ -DEAL_II_TRILINOS_LIBPREFIX = @DEAL_II_TRILINOS_LIBPREFIX@ - -USE_CONTRIB_HDF5 = @USE_CONTRIB_HDF5@ -DEAL_II_HDF5_VERSION = @DEAL_II_HDF5_VERSION@ -DEAL_II_HDF5_CFLAGS = @DEAL_II_HDF5_CFLAGS@ -DEAL_II_HDF5_CPPFLAGS = @DEAL_II_HDF5_CPPFLAGS@ -DEAL_II_HDF5_LDFLAGS = @DEAL_II_HDF5_LDFLAGS@ -DEAL_II_HDF5_INCDIR = @DEAL_II_HDF5_INCDIR@ - -USE_CONTRIB_BLAS = @USE_CONTRIB_BLAS@ -USE_CONTRIB_LAPACK = @USE_CONTRIB_LAPACK@ - -USE_CONTRIB_MUMPS = @USE_CONTRIB_MUMPS@ -DEAL_II_MUMPS_DIR = @DEAL_II_MUMPS_DIR@ -DEAL_II_SCALAPACK_DIR = @DEAL_II_SCALAPACK_DIR@ -DEAL_II_BLACS_DIR = @DEAL_II_BLACS_DIR@ -DEAL_II_BLACS_ARCH = @DEAL_II_BLACS_ARCH@ +AR = @CMAKE_AR@ +RANLIB = @CMAKE_RANLIB@ +LDFLAGS = @CMAKE_SHARED_LINKER_FLAGS@ -USE_CONTRIB_ARPACK = @USE_CONTRIB_ARPACK@ -DEAL_II_ARPACK_DIR = @DEAL_II_ARPACK_DIR@ -DEAL_II_ARPACK_ARCH = @DEAL_II_ARPACK_ARCH@ +#LIBS = @LIBS@ # TODO -USE_CONTRIB_METIS = @USE_CONTRIB_METIS@ -DEAL_II_METIS_DIR = @DEAL_II_METIS_DIR@ -DEAL_II_METIS_LIBDIR = @DEAL_II_METIS_LIBDIR@ -DEAL_II_METIS_INCDIR = @DEAL_II_METIS_INCDIR@ +LIBDIR = @CMAKE_INSTALL_PREFIX@/@DEAL_II_LIBRARY_RELDIR@ -USE_CONTRIB_HSL = @USE_CONTRIB_HSL@ -USE_CONTRIB_UMFPACK = @USE_CONTRIB_UMFPACK@ - -USE_CONTRIB_P4EST = @USE_CONTRIB_P4EST@ -DEAL_II_P4EST_DIR = @DEAL_II_P4EST_DIR@ -DEAL_II_P4EST_LIBDIR_NAME = @DEAL_II_P4EST_LIBDIR_NAME@ +enable-threads = @MAKEFILE_enablethreads@ +enable-shared = @MAKEFILE_enableshared@ +enable-parser = @MAKEFILE_enableparser@ +DEAL_II_VERSION = @VERSION@ +DEAL_II_MAJOR = @DEAL_II_MAJOR@ +DEAL_II_MINOR = @DEAL_II_MINOR@ DEAL_II_USE_MPI = @DEAL_II_USE_MPI@ -TARGET = @target@ +#TARGET = @target@ # TODO ###################################################### # now configuration for compiler flags, paths, etc @@ -121,8 +53,8 @@ TARGET = @target@ LIBPATH += $(addprefix -L,$(LIBDIR)) -static-lib-suffix = @static_lib_suffix@ -shared-lib-suffix = @shared_lib_suffix@ +static-lib-suffix = @CMAKE_STATIC_LIBRARY_SUFFIX@ +shared-lib-suffix = @CMAKE_SHARED_LIBRARY_SUFFIX@ ifeq ($(enable-shared),yes) lib-suffix = $(shared-lib-suffix) @@ -134,248 +66,29 @@ endif vpath %@static_lib_suffix@ $(LIBDIR) vpath %@shared_lib_suffix@ $(LIBDIR) -OBJEXT = @OBJEXT@ -EXEEXT = @EXEEXT@ - -# dealing with shared libraries -ifeq ($(shared-lib-suffix),.so) - DEAL_II_SHLIB_NAME = lib$(1)$(shared-lib-suffix).$(DEAL_II_VERSION) -else - DEAL_II_SHLIB_NAME = lib$(1).$(DEAL_II_VERSION)$(shared-lib-suffix) -endif - -ifeq (@DEAL_II_LD_UNDERSTANDS_SONAME@,yes) - DEAL_II_ADD_SONAME = -Wl,-soname,$(call DEAL_II_SHLIB_NAME,$(1)) -else - ifeq (@DEAL_II_LD_UNDERSTANDS_DYLIB_INSTALL_NAME@,yes) - DEAL_II_ADD_SONAME = -Wl,-dynamic,-install_name -Wl,$(call DEAL_II_SHLIB_NAME,$(1)) - else - DEAL_II_ADD_SONAME = - endif -endif - -ifeq (@DEAL_II_LD_UNDERSTANDS_RPATH@,yes) - DEAL_II_RPATH = -Wl,-rpath,$1 -else - DEAL_II_RPATH = -endif - - -# since the PETSc libs are called the same for both debug and -# optimized mode, we have to have a trick to let the executable -# know which ones are the right (since apparently LD_LIBRARY_PATH -# can't do the trick unless you want to reset it every time -# you switch from debug to optimized mode). To avoid messing with -# -Wl,-rpath in our linker flags, we create one convenience library -# for all PETSc libraries in our own lib directory, and have this one -# twiddle with whatever is necessary to link in PETSc. This is only -# used for PETSc <=3.0. After this version, PETSc creates one library -# we can link to directly. This avoids problems with recent versions -# of gcc. -ifeq ($(USE_CONTRIB_PETSC),yes) - lib-contrib-petsc-path.g = $(DEAL_II_PETSC_DIR)/$(DEAL_II_PETSC_ARCH)/lib - lib-contrib-petsc-path.o = $(DEAL_II_PETSC_DIR)/$(DEAL_II_PETSC_ARCH)/lib - - ifeq ($(enable-shared),yes) - # Starting with PETSc versions 3.0.0: - ifeq ($(DEAL_II_PETSC_VERSION_MAJOR)$(DEAL_II_PETSC_VERSION_MINOR),30) - lib-contrib-petsc.g = $(shell echo $(DEAL_II_PETSC_DIR)/$(DEAL_II_PETSC_ARCH)/lib/*$(lib-suffix)) - lib-contrib-petsc.o = $(shell echo $(DEAL_II_PETSC_DIR)/$(DEAL_II_PETSC_ARCH)/lib/*$(lib-suffix)) - else - # but after that (petsc-3.1++), we can use the simpler PETSc - # default "--with-single-library=1" like this: - lib-contrib-petsc.g = $(shell echo $(DEAL_II_PETSC_DIR)/$(DEAL_II_PETSC_ARCH)/lib/libpetsc$(lib-suffix)) - lib-contrib-petsc.o = $(shell echo $(DEAL_II_PETSC_DIR)/$(DEAL_II_PETSC_ARCH)/lib/libpetsc$(lib-suffix)) - endif - else - # and finally this goes for static libraries - lib-contrib-petsc.g = $(LIBDIR)/libpetscall.g$(lib-suffix) - lib-contrib-petsc.o = $(LIBDIR)/libpetscall$(lib-suffix) - endif -endif # USE_CONTRIB_PETSC - -ifeq ($(USE_CONTRIB_SLEPC),yes) - lib-contrib-slepc = $(DEAL_II_SLEPC_DIR)/$(DEAL_II_PETSC_ARCH)/lib/libslepc$(lib-suffix) -endif - -# same for metis, except that there is only one library in that case -ifeq ($(USE_CONTRIB_METIS),yes) - lib-contrib-metis = $(DEAL_II_METIS_LIBDIR)/libmetis$(lib-suffix) -endif - -# List all trilinos libraries that we want to link with. These must be sorted -# in dependency order for linking. Fortunately, we can get the set of -# libraries from Trilinos's cmake files in aclocal.m4. -ifeq ($(USE_CONTRIB_TRILINOS),yes) - DEAL_II_TRILINOS_LIBS = $(addprefix $(DEAL_II_TRILINOS_LIBPREFIX), @DEAL_II_TRILINOS_LIBS@) - - ifeq ($(enable-shared),yes) - lib-contrib-trilinos = \ - $(addsuffix $(shared-lib-suffix), $(addprefix $(DEAL_II_TRILINOS_LIBDIR)/lib, \ - $(DEAL_II_TRILINOS_LIBS))) - else - lib-contrib-trilinos = \ - $(addsuffix $(static-lib-suffix), $(addprefix $(DEAL_II_TRILINOS_LIBDIR)/lib, \ - $(DEAL_II_TRILINOS_LIBS))) - endif -endif - -# Using dealii with MUMPS means we need to link the MUMPS library as -# well as bumping in its dependencies, ie, SCALAPCK and BLACS -ifeq ($(USE_CONTRIB_MUMPS),yes) - lib-contrib-mumps = $(DEAL_II_MUMPS_DIR)/lib/libdmumps.a \ - $(DEAL_II_MUMPS_DIR)/lib/libmumps_common.a \ - $(DEAL_II_MUMPS_DIR)/lib/libpord.a - lib-contrib-mumps += $(DEAL_II_SCALAPACK_DIR)/libscalapack.a - lib-contrib-mumps += $(DEAL_II_BLACS_DIR)/LIB/blacsCinit_$(DEAL_II_BLACS_ARCH).a \ - $(DEAL_II_BLACS_DIR)/LIB/blacsF77init_$(DEAL_II_BLACS_ARCH).a \ - $(DEAL_II_BLACS_DIR)/LIB/blacs_$(DEAL_II_BLACS_ARCH).a -endif - -# Using dealii with ARPACK simply means adding the libarpack library -# with the right name -ifeq ($(USE_CONTRIB_ARPACK),yes) - lib-contrib-arpack = $(DEAL_II_ARPACK_DIR)/libarpack_$(DEAL_II_ARPACK_ARCH).a -endif +OBJEXT = @CMAKE_CXX_OUTPUT_EXTENSION@ +EXEEXT = @EXEEXT@ # TODO -# deal with HSL; this should have been $(lib-contrib-hsl) but for a long time we -# accidentally had $(lib-hsl) -- so we simply make both symbols available -ifeq ($(USE_CONTRIB_HSL),yes) - lib-hsl = $(LIBDIR)/libhsl$(lib-suffix) - lib-contrib-hsl = $(lib-hsl) -endif -# need to link with libtbb if we're using threads -ifeq ($(enable-threads),yes) - lib-contrib-tbb.g = $D/lib/libtbb_debug$(shared-lib-suffix) - lib-contrib-tbb.o = $D/lib/libtbb$(shared-lib-suffix) -endif # set paths to all the libraries we need: -lib-deal2.o = $(LIBDIR)/libdeal_II$(lib-suffix) \ - $(lib-contrib-trilinos) \ - $(lib-hsl) \ - $(lib-contrib-petsc.o) $(DEAL_II_PETSC_MPIUNI_LIB) \ - $(lib-contrib-slepc) \ - $(lib-contrib-mumps) \ - $(lib-contrib-metis) \ - $(lib-contrib-tbb.o) -lib-deal2.g = $(LIBDIR)/libdeal_II.g$(lib-suffix) \ - $(lib-contrib-trilinos) \ - $(lib-hsl) \ - $(lib-contrib-petsc.g) $(DEAL_II_PETSC_MPIUNI_LIB) \ - $(lib-contrib-slepc) \ - $(lib-contrib-mumps) \ - $(lib-contrib-metis) \ - $(lib-contrib-tbb.g) - -# include paths. do not take into account a possibly existing -# environment variable, since the compiler will evaluate the value of -# that anyway at compile time -include-path-petsc = $(DEAL_II_PETSC_DIR)/include -include-path-petsc-bmake = $(DEAL_II_PETSC_DIR)/$(DEAL_II_PETSC_ARCH)/include -include-path-slepc = $(DEAL_II_SLEPC_DIR)/include -include-path-slepc-bmake = $(DEAL_II_SLEPC_DIR)/$(DEAL_II_PETSC_ARCH)/include -include-path-slepc-conf = $(DEAL_II_SLEPC_DIR)/$(DEAL_II_PETSC_ARCH)/conf -include-path-trilinos = $(DEAL_II_TRILINOS_INCDIR) -include-path-mumps = $(DEAL_II_MUMPS_DIR)/include -include-path-metis = $(DEAL_II_METIS_INCDIR) -include-path-hdf5 = $(DEAL_II_HDF5_INCDIR) - - -# include paths as command line flags. while compilers allow a space between -# the '-I' and the actual path, we also send these flags to the -# make_dependencies program that doesn't support the extra space. -# -# post 7.0 we use #include instead of just #include <...> -# but by providing two -I directives we can have it both ways. -INCLUDE = -I$D/include \ - -I$D/include/deal.II \ - @CPPFLAGS@ @TECPLOT_INCLUDE_DIR@ \ - @UMFPACK_INCLUDE_DIR@ @HSL_INCLUDE_DIR@ \ - -I$D/contrib \ - -I$D/include - -# add PETSc, SLEPSc, and Trilinos include paths if necessary. this rule -# (and the one further down below to get correct flags) should eventually -# be replaced by something where we do not blindly include PETSc make files -# (and thus import all of its variables), but rather set up a scheme to -# extract these values upon configuration -# -# also, note that this only works for PETSc before 2.3 :-] -ifeq ($(USE_CONTRIB_PETSC),yes) - INCLUDE += -I$(include-path-petsc) \ - -I$(include-path-petsc-bmake) \ - $(MPI_INCLUDE) -endif +lib-deal2.o = ${MAKEFILE_EXTERNAL_LIBRARIES} +lib-deal2.g = ${MAKEFILE_EXTERNAL_LIBRARIES} -ifeq ($(USE_CONTRIB_SLEPC),yes) - INCLUDE += -I$(include-path-slepc) \ - -I$(include-path-slepc-bmake) \ - -I$(include-path-slepc-conf) -endif - -ifeq ($(USE_CONTRIB_TRILINOS),yes) - INCLUDE += -I$(include-path-trilinos) -endif - -ifeq ($(USE_CONTRIB_MUMPS),yes) - INCLUDE += -I$(include-path-mumps) -endif - -ifeq ($(USE_CONTRIB_METIS),yes) - INCLUDE += -I$(include-path-metis) -endif - -ifeq ($(USE_CONTRIB_HDF5),yes) - INCLUDE += -I$(include-path-hdf5) -endif +# necessary includes: +INCLUDE = ${MAKEFILE_EXTERNAL_INCLUDES} -ifeq ($(enable-threads),yes) - INCLUDE += -I$(shell echo $D/contrib/tbb/tbb*/include) -endif # compiler flags for debug and optimized mode -CXXFLAGS.g = @DEFS@ @CXXFLAGSG@ $(INCLUDE) -CXXFLAGS.o = @DEFS@ @CXXFLAGSO@ $(INCLUDE) +CXXFLAGS.g = @CMAKE_CXX_FLAGS@ @CMAKE_CXX_FLAGS_DEBUG@ @MAKEFILE_EXTERNAL_DEFINITIONS@ $(INCLUDE) +CXXFLAGS.o = @CMAKE_CXX_FLAGS@ @CMAKE_CXX_FLAGS_RELEASE@ @MAKEFILE_EXTERNAL_DEFINITIONS@ $(INCLUDE) -F77FLAGS.g = @DEFS@ @F77FLAGSG@ $(INCLUDE) -F77FLAGS.o = @DEFS@ @F77FLAGSO@ $(INCLUDE) # compile flags for C compiler -CFLAGS.g = @CFLAGSG@ -CFLAGS.o = @CFLAGSO@ - -# if in debug mode, add TBB assertions -ifeq ($(enable-threads),yes) - CXXFLAGS.g += -DTBB_DO_ASSERT=1 -endif - - -# PETSc wants to see a whole lot of other flags being passed... -ifeq ($(USE_CONTRIB_PETSC),yes) - # set PETSC_DIR and PETSC_ARCH to be used in variables file - PETSC_DIR = $(DEAL_II_PETSC_DIR) - PETSC_ARCH = $(DEAL_II_PETSC_ARCH) +CFLAGS.g = @CMAKE_C_FLAGS@ @CMAKE_C_FLAGS_DEBUG@ @MAKEFILE_EXTERNAL_DEFINITIONS@ +CFLAGS.o = @CMAKE_C_FLAGS@ @CMAKE_C_FLAGS_RELEASE@ @MAKEFILE_EXTERNAL_DEFINITIONS@ - # PETSC's $(PETSC_ARCH)/conf/petscvariables include file happens - # to have a variable $(CXX) of itself. we need to save our own - # variable and restore it later. this isn't pretty :-( - SAVE_CXX := $(CXX) - include $(DEAL_II_PETSC_DIR)/conf/variables - CXX := $(SAVE_CXX) - - CXXFLAGS.g += $(GCXX_PETSCFLAGS) - CXXFLAGS.o += $(OCXX_PETSCFLAGS) -endif - -ifeq ($(USE_CONTRIB_HDF5),yes) - CFLAGS.g += $(DEAL_II_HDF5_CFLAGS) - CFLAGS.o += $(DEAL_II_HDF5_CFLAGS) - CXXFLAGS.g += $(DEAL_II_HDF5_CXXFLAGS) - CXXFLAGS.o += $(DEAL_II_HDF5_CXXFLAGS) -endif ifneq ($(enable-threads),no) MT = MT diff --git a/deal.II/config/deal.IIConfig.cmake.in b/deal.II/config/deal.IIConfig.cmake.in index 66a1bd5d93..af86f87948 100644 --- a/deal.II/config/deal.IIConfig.cmake.in +++ b/deal.II/config/deal.IIConfig.cmake.in @@ -66,4 +66,6 @@ SET(DEAL_II_EXTERNAL_INCLUDE_DIRS "${DEAL_II_EXTERNAL_INCLUDE_DIRS}") SET(DEAL_II_EXTERNAL_LIBRARIES "${DEAL_II_EXTERNAL_LIBRARIES}") +SET(DEAL_II_EXTERNAL_DEFINITIONS "${DEAL_II_EXTERNAL_DEFINITIONS}") + -- 2.39.5