Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-meshdist
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
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
extensions
dune-meshdist
Commits
6993dd94
Commit
6993dd94
authored
2 months ago
by
Simon Praetorius
Browse files
Options
Downloads
Patches
Plain Diff
Allow nanoflann and alglib to be external packages
parent
feda220f
No related branches found
No related tags found
1 merge request
!2
Allow nanoflann and alglib to be external packages
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+5
-0
5 additions, 0 deletions
CMakeLists.txt
libs/CMakeLists.txt
+34
-24
34 additions, 24 deletions
libs/CMakeLists.txt
with
39 additions
and
24 deletions
CMakeLists.txt
+
5
−
0
View file @
6993dd94
...
...
@@ -23,9 +23,11 @@ include(FeatureSummary)
dune_project
()
option
(
ENABLE_NANOFLANN
"Use KDTree search tree from nanoflann."
ON
)
option
(
DOWNLOAD_NANOFLANN
"Download and build nanoflann library."
OFF
)
add_feature_info
(
ENABLE_NANOFLANN ENABLE_NANOFLANN
"Use KDTree search tree from nanoflann."
)
option
(
ENABLE_ALGLIB
"Use ALGLIB to implement the LM constrained least-squares solver."
ON
)
option
(
DOWNLOAD_ALGLIB
"Download and build ALGLIB library."
OFF
)
add_feature_info
(
ENABLE_ALGLIB ENABLE_ALGLIB
"Use ALGLIB to implement the LM constrained least-squares solver."
)
# provide external packages
...
...
@@ -59,5 +61,8 @@ add_subdirectory(src)
add_subdirectory
(
dune
)
add_subdirectory
(
doc
)
# write contents into DUNE_CUSTOM_PKG_CONFIG_SECTION
string
(
JOIN
"
\n
"
DUNE_CUSTOM_PKG_CONFIG_SECTION
${
DUNE_MESHDIST_PACKAGE_DEPENDENCIES
}
)
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project
()
This diff is collapsed.
Click to expand it.
libs/CMakeLists.txt
+
34
−
24
View file @
6993dd94
include
(
FetchContent
)
set
(
_find_dependencies
)
if
(
ENABLE_NANOFLANN
)
if
(
NOT nanoflann_SOURCE_DIR
)
if
(
DOWNLOAD_NANOFLANN
)
set
(
NANOFLANN_BUILD_EXAMPLES OFF CACHE BOOL
"Do not build examples for nanoflann"
FORCE
)
set
(
NANOFLANN_BUILD_TESTS OFF CACHE BOOL
"Do not build tests for nanoflann"
FORCE
)
FetchContent_Declare
(
nanoflann
# name of the content
...
...
@@ -12,22 +13,25 @@ if(ENABLE_NANOFLANN)
if
(
NOT nanoflann_POPULATED
)
FetchContent_Populate
(
nanoflann
)
endif
()
endif
()
file
(
GLOB NANOFLANN_HEADERS CONFIGURE_DEPENDS
"
${
nanoflann_SOURCE_DIR
}
/include/*.hpp"
)
file
(
GLOB NANOFLANN_HEADERS CONFIGURE_DEPENDS
"
${
nanoflann_SOURCE_DIR
}
/include/*.hpp"
)
# Create a library from the source files
dune_add_library
(
nanoflann INTERFACE
EXPORT_NAME nanoflann NAMESPACE nanoflann::
)
target_include_directories
(
nanoflann INTERFACE
$<BUILD_INTERFACE:
${
nanoflann_SOURCE_DIR
}
/include>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
/nanoflann>
)
install
(
FILES
${
NANOFLANN_HEADERS
}
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/nanoflann"
)
# Create a library from the source files
dune_add_library
(
nanoflann INTERFACE
EXPORT_NAME nanoflann NAMESPACE nanoflann::
)
target_include_directories
(
nanoflann INTERFACE
$<BUILD_INTERFACE:
${
nanoflann_SOURCE_DIR
}
/include>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
/nanoflann>
)
install
(
FILES
${
NANOFLANN_HEADERS
}
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/nanoflann"
)
else
()
find_package
(
nanoflann 1.6 REQUIRED
)
list
(
APPEND _find_dependencies
"find_dependency(nanoflann 1.6)"
)
endif
()
endif
()
if
(
ENABLE_ALGLIB
)
if
(
NOT alglib_SOURCE_DIR
)
if
(
DOWNLOAD_ALGLIB
)
FetchContent_Declare
(
alglib
URL https://www.alglib.net/translator/re/alglib-4.03.0.cpp.gpl.tgz
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
...
...
@@ -35,17 +39,23 @@ if(ENABLE_ALGLIB)
${
CMAKE_COMMAND
}
-E create_symlink <SOURCE_DIR>/src <SOURCE_DIR>/alglib
)
FetchContent_MakeAvailable
(
alglib
)
file
(
GLOB ALGLIB_HEADERS CONFIGURE_DEPENDS
"
${
alglib_SOURCE_DIR
}
/src/*.hpp"
)
file
(
GLOB ALGLIB_SOURCES CONFIGURE_DEPENDS
"
${
alglib_SOURCE_DIR
}
/src/*.cpp"
)
# Create a library from the source files
dune_add_library
(
alglib SOURCES
${
ALGLIB_SOURCES
}
EXPORT_NAME alglib NAMESPACE alglib::
)
target_include_directories
(
alglib PUBLIC
$<BUILD_INTERFACE:
${
alglib_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
install
(
FILES
${
ALGLIB_HEADERS
}
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/alglib"
)
else
()
find_package
(
alglib 4.0 REQUIRED
)
list
(
APPEND _find_dependencies
"find_dependency(alglib 4.0)"
)
endif
()
endif
()
file
(
GLOB ALGLIB_HEADERS CONFIGURE_DEPENDS
"
${
alglib_SOURCE_DIR
}
/src/*.hpp"
)
file
(
GLOB ALGLIB_SOURCES CONFIGURE_DEPENDS
"
${
alglib_SOURCE_DIR
}
/src/*.cpp"
)
# Create a library from the source files
dune_add_library
(
alglib SOURCES
${
ALGLIB_SOURCES
}
EXPORT_NAME alglib NAMESPACE alglib::
)
target_include_directories
(
alglib PUBLIC
$<BUILD_INTERFACE:
${
alglib_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
install
(
FILES
${
ALGLIB_HEADERS
}
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/alglib"
)
endif
()
\ No newline at end of file
set
(
DUNE_MESHDIST_PACKAGE_DEPENDENCIES
"
${
_find_dependencies
}
"
PARENT_SCOPE
)
\ No newline at end of file
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