Skip to content
Snippets Groups Projects
Commit f7fc0cf5 authored by Stephan Schulz's avatar Stephan Schulz
Browse files

somewhat autoconfig for makefiles

parent 45066c2d
No related branches found
No related tags found
No related merge requests found
...@@ -133,7 +133,6 @@ endif(CM_ALL_AUTO_DOC) ...@@ -133,7 +133,6 @@ endif(CM_ALL_AUTO_DOC)
# Export targets and create package # Export targets and create package
install(EXPORT ALLTargets install(EXPORT ALLTargets
NAMESPACE ALL:: NAMESPACE ALL::
FILE ALLTargets.cmake FILE ALLTargets.cmake
...@@ -154,5 +153,24 @@ install(FILES ...@@ -154,5 +153,24 @@ install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/ALLConfigVersion.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ALLConfigVersion.cmake"
DESTINATION lib/cmake/ALL) DESTINATION lib/cmake/ALL)
# Create Makefile.libALL.in for inclusion in external Makefile projects
# todo(s.schulz): The include directories and libraries should be auto
# detected... but that is not easily done right now. Ideally, this should also
# provide the very long VTK linker flags.
set(ALL_MAKEFILE_INC ${CMAKE_CURRENT_BINARY_DIR}/Makefile.libALL.in)
get_target_property(_liball_defines ALL INTERFACE_COMPILE_DEFINITIONS)
list(TRANSFORM _liball_defines PREPEND " -D")
list(JOIN _liball_defines " " _liball_defines_string)
file(WRITE ${ALL_MAKEFILE_INC} "LIBALL_DEFINES := ${_liball_defines_string}\n")
file(APPEND ${ALL_MAKEFILE_INC} "LIBALL_INCLUDE := -I\$(ALL_DIR)/include\n")
file(APPEND ${ALL_MAKEFILE_INC} "LIBALL_LIB :=\n")
if(CM_ALL_FORTRAN)
file(APPEND ${ALL_MAKEFILE_INC} "LIBALL_LIB += \$(ALL_DIR)/lib/libALL_fortran.a \$(ALL_DIR)/lib/libALL.a -lstdc++\n")
file(APPEND ${ALL_MAKEFILE_INC} "LIBALL_INCLUDE += -I\$(ALL_DIR)/include/modules\n")
endif()
if(CM_ALL_VORONOI)
file(APPEND ${ALL_MAKEFILE_INC} "LIBALL_LIB += \$(ALL_DIR)/lib/libvoro.a\n")
endif()
install(FILES ${ALL_MAKEFILE_INC} DESTINATION lib/make)
# vim: sw=4 ts=4 et # vim: sw=4 ts=4 et
...@@ -19,18 +19,20 @@ MFC=mpifort ...@@ -19,18 +19,20 @@ MFC=mpifort
ALL_DIR=all_bin ALL_DIR=all_bin
VTK_DIR=vtk_bin VTK_DIR=vtk_bin
# Source tree and temporary build directory
ALL_BUILD=all_build ALL_BUILD=all_build
ALL_SOURCE=all ALL_SOURCE=all
ALL_SOURCE=../.. ALL_SOURCE=../..
LIBALL_INCLUDE := -I$(ALL_DIR)/include/modules -I$(ALL_DIR)/include # Which features should be enabled for ALL
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_DEFINES += -DALL_VTK_OUTPUT -DALL_VORONOI_ACTIVE
LIBALL_CONFIGURE := -DCM_ALL_FORTRAN=ON -DCM_ALL_VORONOI=ON -DCM_ALL_VTK_OUTPUT=ON -DCMAKE_BUILD_TYPE=Release LIBALL_CONFIGURE := -DCM_ALL_FORTRAN=ON -DCM_ALL_VORONOI=ON -DCM_ALL_VTK_OUTPUT=ON -DCMAKE_BUILD_TYPE=Release
LIBALL_CONFIG_FILE := $(ALL_DIR)/lib/make/Makefile.libALL.in
# This will provide the variables LIBALL_DEFINES, LIBALL_INCLUDE and
# LIBALL_LIB, which need to be passed to the compiler and linker.
-include $(LIBALL_CONFIG_FILE)
# Since gfortran does not link the standard C++ library by default, we need to # Since gfortran does not link the standard C++ library by default, we need to
# explicitly state it. # explicitly state it.
FFLAGS += -lstdc++ FFLAGS += -lstdc++
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment