Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-istl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Patrick Jaap
dune-istl
Commits
dfd91208
Commit
dfd91208
authored
4 years ago
by
Christoph Grüninger
Browse files
Options
Downloads
Patches
Plain Diff
[cmake] Introduce targets for Find SuperLU
parent
8f458c76
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmake/modules/AddSuperLUFlags.cmake
+9
-15
9 additions, 15 deletions
cmake/modules/AddSuperLUFlags.cmake
cmake/modules/FindSuperLU.cmake
+27
-1
27 additions, 1 deletion
cmake/modules/FindSuperLU.cmake
with
36 additions
and
16 deletions
cmake/modules/AddSuperLUFlags.cmake
+
9
−
15
View file @
dfd91208
...
...
@@ -13,26 +13,20 @@
# set HAVE_SUPERLU for config.h
set
(
HAVE_SUPERLU
${
SUPERLU_FOUND
}
)
# register all
s
uper
lu
related flags
# register all
S
uper
LU
related flags
if
(
SUPERLU_FOUND
)
dune_register_package_flags
(
COMPILE_DEFINITIONS
"ENABLE_SUPERLU=1"
LIBRARIES
"
${
SUPERLU_DUNE_LIBRARIES
}
"
INCLUDE_DIRS
"
${
SUPERLU_INCLUDE_DIRS
}
"
)
dune_register_package_flags
(
COMPILE_DEFINITIONS
"ENABLE_SUPERLU=1
"
LIBRARIES SuperLU::SuperLU
)
endif
()
# Provide function to set target properties for linking to SuperLU
function
(
add_dune_superlu_flags
)
function
(
add_dune_superlu_flags
_targets
)
if
(
SUPERLU_FOUND
)
cmake_parse_arguments
(
_add_superlu
"OBJECT"
""
""
${
ARGN
}
)
foreach
(
_target
${
_add_superlu_UNPARSED_ARGUMENTS
}
)
if
(
NOT _add_superlu_OBJECT
)
target_link_libraries
(
${
_target
}
${
SUPERLU_DUNE_LIBRARIES
}
)
endif
()
get_target_property
(
_props
${
_target
}
COMPILE_FLAGS
)
string
(
REPLACE
"_props-NOTFOUND"
""
_props
"
${
_props
}
"
)
set_target_properties
(
${
_target
}
PROPERTIES COMPILE_FLAGS
"
${
_props
}
${
SUPERLU_DUNE_COMPILE_FLAGS
}
-DENABLE_SUPERLU=1"
)
foreach
(
_target
${
_targets
}
)
target_link_libraries
(
${
_target
}
SuperLU::SuperLU
)
target_compile_definitions
(
${
_target
}
PUBLIC ENABLE_SUPERLU=1
)
endforeach
()
endif
(
SUPERLU_FOUND
)
endif
()
endfunction
(
add_dune_superlu_flags
)
This diff is collapsed.
Click to expand it.
cmake/modules/FindSuperLU.cmake
+
27
−
1
View file @
dfd91208
...
...
@@ -13,9 +13,19 @@
#
# :code:`SUPERLU_INCLUDE_DIRS`
# Path to the SuperLU include dirs.
# .. deprecated:: 2.8
# Use target SuperLU::SuperLU instead.
#
# :code:`SUPERLU_LIBRARIES`
# Name to the SuperLU library.
# .. deprecated:: 2.8
# Use target SuperLU::SuperLU instead.
#
#
# This module provides the following imported targets, if found:
#
# :code:`SuperLU:SuperLU`
# Library and include directories for the found SuperLU.
#
#
# This module provides the following imported targets, if found:
...
...
@@ -99,8 +109,24 @@ find_package_handle_standard_args(
mark_as_advanced
(
SUPERLU_INCLUDE_DIR SUPERLU_LIBRARY SUPERLU_MIN_VERSION_5
)
# if both headers and library are found, store results
if
(
SUPERLU_FOUND
)
if
(
NOT TARGET SuperLU::SuperLU
)
add_library
(
SuperLU::SuperLU UNKNOWN IMPORTED
)
set_target_properties
(
SuperLU::SuperLU
PROPERTIES
IMPORTED_LOCATION
${
SUPERLU_LIBRARY
}
INTERFACE_INCLUDE_DIRECTORIES
"
${
SUPERLU_INCLUDE_DIR
}
"
)
# Link BLAS library
if
(
TARGET BLAS::BLAS
)
target_link_libraries
(
SuperLU::SuperLU
INTERFACE BLAS::BLAS
)
else
()
target_link_libraries
(
SuperLU::SuperLU
INTERFACE
${
BLAS_LINKER_FLAGS
}
${
BLAS_LIBRARIES
}
)
endif
()
endif
()
set
(
SUPERLU_INCLUDE_DIRS
${
SUPERLU_INCLUDE_DIR
}
)
set
(
SUPERLU_LIBRARIES
${
SUPERLU_LIBRARY
}
)
# log result
...
...
@@ -112,7 +138,7 @@ if(SUPERLU_FOUND)
CACHE STRING
"Compile flags used by DUNE when compiling SuperLU programs"
)
set
(
SUPERLU_DUNE_LIBRARIES
${
SUPERLU_LIBRARIES
}
${
BLAS_LIBRARIES
}
CACHE STRING
"Libraries used by DUNE when linking SuperLU programs"
)
else
(
SUPERLU_FOUND
)
else
()
# log errornous result
file
(
APPEND
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/CMakeError.log
"Determining location of SuperLU failed:
\n
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment