Skip to content
Snippets Groups Projects
Commit 085adb4b authored by Christian Engwer's avatar Christian Engwer
Browse files

Merge branch 'feature/deprecate-external-ug' into 'master'

Feature/deprecate external ug



See merge request !94
parents 199b5472 5bafb3d5
No related branches found
No related tags found
1 merge request!94Feature/deprecate external ug
Pipeline #
......@@ -58,88 +58,90 @@
# old doc: indicates that the targets are object libraries.
#
# support for exgernal UG is deprecated in Dune 2.5. We will keep it in Dune 2.6-git as long as feasable
set_package_info("UG" "External UG grid, superseded by dune-uggrid" "http://www.iwr.uni-heidelberg.de/frame/iwrwikiequipment/software/ug")
if(NOT dune-uggrid_FOUND)
if(UG_ROOT AND NOT UG_DIR)
# define the directory where the config file resides
if(EXISTS "${UG_ROOT}/lib/cmake/ug/ug-config.cmake")
set(UG_DIR ${UG_ROOT}/lib/cmake/ug)
elseif(EXISTS "${UG_ROOT}/lib64/cmake/ug/ug-config.cmake")
set(UG_DIR ${UG_ROOT}/lib64/cmake/ug)
else()
message(WARNING "Could not find file ug-config.cmake relative to given UG_ROOT")
if(UG_ROOT AND NOT UG_DIR)
# define the directory where the config file resides
if(EXISTS "${UG_ROOT}/lib/cmake/ug/ug-config.cmake")
set(UG_DIR ${UG_ROOT}/lib/cmake/ug)
elseif(EXISTS "${UG_ROOT}/lib64/cmake/ug/ug-config.cmake")
set(UG_DIR ${UG_ROOT}/lib64/cmake/ug)
else()
message(WARNING "Could not find file ug-config.cmake relative to given UG_ROOT")
endif()
endif()
endif(UG_ROOT AND NOT UG_DIR)
find_package(UG 3.11.0
NO_MODULE QUIET
NO_DEFAULT_PATH)
find_package(UG 3.11.0
NO_MODULE
NO_SYSTEM_ENVIRONMENT_PATH)
find_package(UG 3.11.0
NO_MODULE QUIET
NO_DEFAULT_PATH)
find_package(UG 3.11.0
NO_MODULE
NO_SYSTEM_ENVIRONMENT_PATH)
set(HAVE_UG ${UG_FOUND})
set(HAVE_UG ${UG_FOUND})
if(UG_FOUND)
# parse patch level: last number in UG version string is DUNE patch level
string(REGEX MATCH "[0-9]*$" UG_DUNE_PATCHLEVEL ${UG_VERSION})
if(UG_FOUND)
# parse patch level: last number in UG version string is DUNE patch level
string(REGEX MATCH "[0-9]*$" UG_DUNE_PATCHLEVEL ${UG_VERSION})
if (UG_VERSION VERSION_GREATER 3.13.0
OR UG_VERSION VERSION_EQUAL 3.13.0)
list(APPEND UG_DEFINITIONS "UG_USE_NEW_DIMENSION_DEFINES")
endif()
if (UG_VERSION VERSION_GREATER 3.13.0
OR UG_VERSION VERSION_EQUAL 3.13.0)
list(APPEND UG_DEFINITIONS "UG_USE_NEW_DIMENSION_DEFINES")
endif()
dune_define_gridtype(GRID_CONFIG_H_BOTTOM GRIDTYPE UGGRID ASSERTION GRIDDIM == WORLDDIM
DUNETYPE "Dune::UGGrid< dimgrid >"
HEADERS dune/grid/uggrid.hh dune/grid/io/file/dgfparser/dgfug.hh)
#Overwrite flags by hand (like for autoconf).
set(UG_LIBRARIES)
set(paths "${prefix}")
#Find out the full path to the libs.
foreach(entry ${UG_LIBRARY_FLAGS} -L/bla)
string(REGEX REPLACE "^-L([a-zA-Z/-_]+)" "\\1" _path ${entry})
list(APPEND _paths ${_path})
endforeach(entry {UG_LIBRARY_FLAGS})
foreach(lib ugS2 ugS3 devS)
set(full_path "full_path-NOTFOUND")
find_library(full_path ${lib} PATHS ${_paths} NO_DEFAULT_PATH)
if(full_path)
list(APPEND UG_LIBRARIES ${full_path})
endif(full_path)
endforeach(lib ugS2 ugS3 devS)
# register all UG related flags
list(APPEND UG_DEFINITIONS "ENABLE_UG=1")
if(UG_PARALLEL STREQUAL "yes")
list(APPEND UG_DEFINITIONS "ModelP")
dune_define_gridtype(GRID_CONFIG_H_BOTTOM GRIDTYPE UGGRID ASSERTION GRIDDIM == WORLDDIM
DUNETYPE "Dune::UGGrid< dimgrid >"
HEADERS dune/grid/uggrid.hh dune/grid/io/file/dgfparser/dgfug.hh)
# Overwrite flags by hand
set(UG_LIBRARIES "")
set(_paths "${prefix}")
# Find out the full path to the libs
foreach(entry ${UG_LIBRARY_FLAGS} -L/bla)
string(REGEX REPLACE "^-L([a-zA-Z/-_]+)" "\\1" _path ${entry})
list(APPEND _paths ${_path})
endforeach()
foreach(lib ugS2 ugS3 devS)
set(full_path "full_path-NOTFOUND")
find_library(full_path ${lib} PATHS ${_paths} NO_DEFAULT_PATH)
if(full_path)
list(APPEND UG_LIBRARIES ${full_path})
endif()
endforeach()
# register all UG related flags
list(APPEND UG_DEFINITIONS "ENABLE_UG=1")
if(UG_PARALLEL STREQUAL "yes")
list(APPEND UG_DEFINITIONS "ModelP")
endif()
# log result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining location of UG ${UG_VERSION} succeeded:\n"
"Include directories: ${UG_INCLUDES}\n"
"Libraries: ${UG_LIBRARIES}\n\n")
else()
# log errornous result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining location of UG failed:\n"
"Include directories: ${UG_INCLUDES}\n"
"Libraries: ${UG_LIBRARIES}\n\n")
endif()
# log result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining location of UG ${UG_VERSION} succeeded:\n"
"Include directories: ${UG_INCLUDES}\n"
"Libraries: ${UG_LIBRARIES}\n\n")
else()
# log errornous result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining location of UG failed:\n"
"Include directories: ${UG_INCLUDES}\n"
"Libraries: ${UG_LIBRARIES}\n\n")
# output whether UG found
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
"UG"
DEFAULT_MSG
UG_DIR
HAVE_UG
)
endif()
# output whether UG found
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
"UG"
DEFAULT_MSG
UG_DIR
HAVE_UG
)
endif(NOT dune-uggrid_FOUND)
# Add dgf magic to config.h and register flags
if(UG_FOUND)
dune_register_package_flags(COMPILE_DEFINITIONS "${UG_DEFINITIONS}"
......@@ -148,6 +150,9 @@ if(UG_FOUND)
dune_define_gridtype(GRID_CONFIG_H_BOTTOM GRIDTYPE UGGRID ASSERTION GRIDDIM == WORLDDIM
DUNETYPE "Dune::UGGrid< dimgrid >"
HEADERS dune/grid/uggrid.hh dune/grid/io/file/dgfparser/dgfug.hh)
# support for exgernal UG is deprecated in Dune 2.5. We will keep it in Dune 2.6-git as long as feasable
message(WARNING "The support of UG as an external library is deprecated in Dune 2.5. Use dune-uggrid instead.")
endif()
# Add flags to targets
......@@ -165,7 +170,7 @@ function(add_dune_ug_flags)
endif()
target_link_libraries(${_target}
${UG_LIBRARIES} ${DUNE_LIBS})
endforeach(_target ${ADD_UG_UNPARSED_ARGUMENTS})
endforeach()
endif()
set(_prefix TARGET)
endif()
......@@ -199,6 +204,6 @@ function(add_dune_ug_flags)
COMPILE_DEFINITIONS ModelP)
# Add mpi flags.
add_dune_mpi_flags(${ADD_UG_UNPARSED_ARGUMENTS} ${_source_only})
endif(UG_PARALLEL STREQUAL "yes")
endif(UG_FOUND)
endif()
endif()
endfunction(add_dune_ug_flags)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment