Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
morse_cmake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
solverstack
morse_cmake
Commits
ebd7e004
Commit
ebd7e004
authored
6 months ago
by
Mathieu Faverge
Browse files
Options
Downloads
Patches
Plain Diff
Add a new environment file inspired from StarPU to fix python issues
parent
af7ca8d6
No related branches found
No related tags found
1 merge request
!70
Add a new environment file inspired from StarPU to fix python issues
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/GenPkgConfig.cmake
+74
-2
74 additions, 2 deletions
modules/GenPkgConfig.cmake
modules/env.in
+56
-0
56 additions, 0 deletions
modules/env.in
with
130 additions
and
2 deletions
modules/GenPkgConfig.cmake
+
74
−
2
View file @
ebd7e004
...
...
@@ -51,7 +51,7 @@
# The generated files are then installed in the subdirectory
# lib/pkgconfig of the prefix directory.
#
# generate_env_file
s
(
# generate_env_file(
# [PROJECTNAME name]
# )
# Where:
...
...
@@ -61,6 +61,22 @@
# The generated file is installed in the subdirectory bin of the
# prefix directory.
#
# generate_newenv_file(
# [PACKAGE name]
# [PACKAGE_TEST test]
# )
# Where:
# - PACKAGE defines the project name of the library if different
# from CMAKE_PROJECT_NAME.
# - PACKAGE_TEST defines a test string to check if the installation
# - is correct within the generated file.
#
# While the first version generates a file named $PACKAGE_env.sh, the
# new one generates a $PACKAGE_env file to avoid conflict
#
# The generated file is installed in the subdirectory bin of the
# prefix directory.
#
###
###
...
...
@@ -215,7 +231,7 @@ endmacro(generate_pkgconfig_files)
###
#
# generate_env_file: generate
pkf-config fi
les
# generate_env_file: generate
file to setup environment variab
les
#
###
macro
(
generate_env_file
)
...
...
@@ -256,6 +272,62 @@ macro(generate_env_file)
endmacro
(
generate_env_file
)
###
#
# generate_env_file2: generate file to setup environment variables (StarPU-like)
#
###
macro
(
generate_newenv_file
)
set
(
_options
)
set
(
_oneValueArgs PACKAGE PACKAGE_TEST
)
set
(
_multiValueArgs
)
set
(
MN
"generate_env_file2"
)
cmake_parse_arguments
(
generate_env_file2
"
${
_options
}
"
"
${
_oneValueArgs
}
"
"
${
_multiValueArgs
}
"
${
ARGN
}
)
set
(
MN
"generate_pkgconfig_files"
)
cmake_parse_arguments
(
${
MN
}
"
${
_options
}
"
"
${
_oneValueArgs
}
"
"
${
_multiValueArgs
}
"
${
ARGN
}
)
if
(
NOT DEFINED
${
MN
}
_PACKAGE
)
set
(
PACKAGE
${
CMAKE_PROJECT_NAME
}
)
else
()
set
(
PACKAGE
${${
MN
}
_PACKAGE
}
)
endif
()
if
(
NOT DEFINED
${
MN
}
_PACKAGE_TEST
)
set
(
PACKAGE_TEST
"0 = 0"
)
else
()
set
(
PACKAGE_TEST
${${
MN
}
_PACKAGE_TEST
}
)
endif
()
string
(
TOLOWER
${
PACKAGE
}
PACKAGE_LC
)
string
(
TOUPPER
${
PACKAGE
}
PACKAGE_UC
)
# Create .sh file
# ---------------
configure_file
(
"
${
MORSE_CMAKE_MODULE_PATH
}
/env.in"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/bin/
${
PACKAGE_LC
}
_env"
@ONLY
)
# installation
# ------------
# Check if the PREFIX is in the PATH or not
# If yes, no need to install this file
string
(
REPLACE
":"
";"
pathlist
"$ENV{PATH}"
)
if
(
"
${
CMAKE_INSTALL_PREFIX
}
/bin"
IN_LIST pathlist
)
message
(
STATUS
"No installation of
${
PACKAGE_LC
}
_env - already in the default environment"
)
else
()
message
(
STATUS
"Install
${
PACKAGE_LC
}
_env in
${
CMAKE_INSTALL_PREFIX
}
/bin"
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/bin/
${
PACKAGE_LC
}
_env"
DESTINATION bin
)
endif
()
endmacro
(
generate_newenv_file
)
##
## @end file GenPkgConfig.cmake
##
This diff is collapsed.
Click to expand it.
modules/env.in
0 → 100644
+
56
−
0
View file @
ebd7e004
#
# @file @LONAME@_env.sh
#
# @copyright 2016-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
# @version 0.9.0
# @author Mathieu Faverge
# @date 2024-09-26
#
# @brief Script to setup environment file inspired from StarPU
#
#!/bin/sh
PROGNAME=@PACKAGE_LC@_env
usage()
{
echo "Tool to set @PACKAGE@ environment variables"
echo ""
echo "Usage: source $PROGNAME"
echo ""
echo ""
echo "Options:"
echo " -h, --help display this help and exit"
echo " -v, --version output version information and exit"
echo ""
echo "Report bugs to <@PACKAGE_BUGREPORT@>"
}
if [ "$1" = "-v" ] || [ "$1" = "--version" ]
then
echo "$PROGNAME (@PACKAGE_NAME@) @PACKAGE_VERSION@"
elif [ "$1" = "-h" ] || [ "$1" = "--help" ]
then
usage
else
prefix=$(realpath @CMAKE_INSTALL_PREFIX@)
@PACKAGE_LC@_bindir=$(realpath @CMAKE_INSTALL_PREFIX@/bin)
@PACKAGE_LC@_libdir=$(realpath @CMAKE_INSTALL_PREFIX@/lib)
@PACKAGE_LC@_datarootdir=$(realpath @CMAKE_INSTALL_PREFIX@/share)
if [ -n "@PACKAGE_TEST@" ]
then
if test @PACKAGE_TEST@
then
echo "Setting @PACKAGE@ environment for $prefix"
export @PACKAGE_UC@_ROOT=$prefix
export PKG_CONFIG_PATH=$@PACKAGE_LC@_libdir/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$@PACKAGE_LC@_libdir:$LD_LIBRARY_PATH
export PATH=$@PACKAGE_LC@_bindir:$PATH
export MANPATH=$@PACKAGE_LC@_datarootdir/man:$MANPATH
for d in $@PACKAGE_LC@_libdir/python3*/site-packages ; do export PYTHONPATH=$d:$PYTHONPATH ; done
else
echo "[Error] $prefix is not a valid @PACKAGE@ installation directory"
fi
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