Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Core Modules
dune-common
Commits
94f389ba
Verified
Commit
94f389ba
authored
1 month ago
by
Santiago Ospina De Los Ríos
Browse files
Options
Downloads
Patches
Plain Diff
[dunecontrol] Use cmake instead of pkg-config to find packages
parent
3ff22a8e
Branches
feature/dune-control-without-pkg-config
No related tags found
1 merge request
!1509
Use cmake instead of pkg-config to find packages in dunecontrol
Pipeline
#76899
passed
3 weeks ago
Stage: .pre
Stage: test
Stage: code_quality
Stage: downstream
Pipeline: Dune Nightly Test
#77298
Pipeline: Dune Nightly Test
#77297
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/dunemodules.lib
+37
-15
37 additions, 15 deletions
lib/dunemodules.lib
with
37 additions
and
15 deletions
lib/dunemodules.lib
+
37
−
15
View file @
94f389ba
...
...
@@ -43,6 +43,28 @@ SPACE="$space$formfeed$newline$cr$tab$vtab"
BLANK
=
"
$space$tab
"
NOBLANK
=
"^
$space$tab
"
cmake_package_exists
()
{
$CMAKE
-DMODULE
=
$1
-P
<<
EOF
2>/dev/null
find_package(
${
MODULE
}
REQUIRED QUIET)
EOF
}
cmake_package_prefix
()
{
prefix
=
"
$CMAKE
-DMODULE=
$1
-P << EOF 2>/dev/null
find_package(
${
MODULE
}
REQUIRED QUIET)
message(NOTICE
${${
MODULE
}
_PREFIX
}
)
EOF"
echo
"
$prefix
"
}
cmake_package_version
()
{
version
=
"
$CMAKE
-DMODULE=
$1
-P << EOF 2>/dev/null
find_package(
${
MODULE
}
REQUIRED QUIET)
message(NOTICE
${${
MODULE
}
_VERSION
}
)
EOF"
echo
"
$version
"
}
#
# read parameters from a $CONTROL file
#
...
...
@@ -81,18 +103,18 @@ parse_control() {
local
vers
=
"
$(
$GREP
"^[BLANK]*Version:"
"
$1
"
|
cut
-d
':'
-f2
|
eval
$PARSER_TRIM
)
"
local
main
=
"
$(
$GREP
"^[BLANK]*Maintainer:"
"
$1
"
|
cut
-d
':'
-f2
|
eval
$PARSER_TRIM
)
"
# check whether the module is installed.
# - installed modules can be found via pkg-config
# - pkg-config --var=prefix should be the same as $path
# - installed modules can be found via cmake
#
# the path contains a different sub structure
# for installed and source modules
# - installed module: ${path}/lib/dunecontrol/${name}/dune.module
#
and there is a
file ${path}/lib
/pkgconfig/${name}.pc
#
configuration
file
:
${path}/lib
*/cmake/${name}/${name}-config.cmake
# - source module: ${path}/dune.module
#
and there is a
file ${path}/$
{name}.pc.in
#
source configuration
file ${path}/$
CMakeLists.txt
local
path
=
"
$(
canonicalpath
"
$1
"
)
"
if
pkg-config
$name
;
then
local
prefix
=
"
$(
pkg-config
--variable
=
prefix
$name
)
"
if
cmake_package_exists
$name
;
then
local
prefix
=
"
$(
cmake_package_prefix
$name
)
"
local
pkgpath
=
$(
canonicalname
"
$prefix
/lib/dunecontrol/
$name
"
)
if
test
x
"
$pkgpath
"
=
x
"
$path
"
;
then
path
=
"
$prefix
"
...
...
@@ -223,8 +245,8 @@ extract_multiarch_pkg_config_path(){
setup_control_path
()
{
if
test
-z
"
$DUNE_CONTROL_PATH
"
;
then
DUNE_CONTROL_PATH
=
.
# try
pkg-config locati
on
s
if
!
pkg-config
dune-common
;
then
# try
to find dune-comm
on
if
!
cmake_package_exists
dune-common
;
then
# try usual locations of installed modules
for
i
in
/usr/local/lib/dunecontrol/ /usr/lib/dunecontrol/
;
do
if
test
-d
$i
;
then
...
...
@@ -237,7 +259,7 @@ setup_control_path() {
fi
done
else
NEW_DUNE_CONTROL_DIR
=
$(
pkg-con
fi
g
dune-common
--variable
=
prefix
)
/lib/dunecontrol
NEW_DUNE_CONTROL_DIR
=
$(
cmake_package_pre
fi
x
dune-common
)
/lib/dunecontrol
# There might be old version of DUNE lying around, that do not contain
# lib/dunecontrol, yet. To prevent failur at a later stage of dunecontrol
# we check that the directory really exists.
...
...
@@ -418,12 +440,12 @@ _check_deps()
_sort_module
$dep
$depmode
else
# perhaps this module is installed,
# then it should be handled
via pkg-config
if
!
pkg-config
$name
;
then
# then it should be handled
as a cmake package
if
!
cmake_package_exists
$name
;
then
if
test
"
$requires
"
==
"requires"
||
test
"
$DUNE_CONTROL_VERBOSE
"
==
"yes"
;
then
echo
$'
\n
'
"
$report
could not find module '
$name
',"
>
&2
echo
" module is also unknown to
pkg-config
."
>
&2
echo
" Maybe you need to adjust
PKG_CON
FI
G
_PATH!"
>
&2
echo
" module is also unknown to
CMake
."
>
&2
echo
" Maybe you need to adjust
CMAKE_PRE
FI
X
_PATH!"
>
&2
echo
" '
$name
' is
$required
by
$modname
"
>
&2
fi
if
test
"x
$mode
"
=
"xDEPS"
;
then
...
...
@@ -432,7 +454,7 @@ _check_deps()
continue
fi
else
eval
ver
=
$(
pkg-config
$name
--mod
version
)
eval
ver
=
$(
cmake_package_
version
$name
)
if
test
"
$SKIPVERSIONCHECK
"
!=
"yes"
&&
!
check_version
"
$ver
"
"
$depver
"
;
then
echo
$'
\n
'
"
$report
version mismatch."
>
&2
echo
"
$modname
$requires
'
$name
$depver
',"
>
&2
...
...
@@ -445,7 +467,7 @@ _check_deps()
fi
fi
# update module list
parse_control
$(
pkg-config
$name
--variable
=
prefix
)
/lib/dunecontrol/
$name
/dune.module
parse_control
$(
cmake_package_prefix
$name
)
/lib/dunecontrol/
$name
/dune.module
_sort_module
$dep
$depmode
fi
fi
...
...
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