Commit 3ef4972d authored by Laurent Claustre's avatar Laurent Claustre

Merge branch 'adapt_install_sh_to_conda' into 'master'

install: adapt to CONDA environments

See merge request !90
parents 6f01ee8a 3be1fc48
Pipeline #5666 passed with stages
in 18 minutes and 59 seconds
......@@ -43,6 +43,11 @@ Description:
setting the corresponding "LIMACAMERA_SIMULATOR=0" option in
The --use-conda-env option, which defaults to 'yes', uses the
CONDA_SYSROOT and CONDA_PREFIX environment variables as default values
for --sysroot and --prefix-path options for CMake, respectively. Set
to 'no' or '0' to disable this behavior.
Running ./ with no parameter will just build Lima with the
options in config.txt. No installation will be performed. If at least
one of --install-prefix or --install-python-prefix option is specified
......@@ -145,7 +150,7 @@ class Config:
def decode_args(self, argv):
build_type = ('RelWithDebInfo' if OS_TYPE == 'Linux'
build_type = ('RelWithDebInfo' if OS_TYPE == 'Linux'
else 'Release')
cwd = os.getcwd()
src = os.path.realpath(os.path.join(os.path.dirname(argv[0]),
......@@ -156,8 +161,14 @@ class Config:
parser.add_argument('--git', action='store_true',
help='init/update Git submodules')
help='CMake system root path')
help='CMake default prefix path')
help='CMake find_package/library root path')
parser.add_argument('--use-conda-env', default='yes',
help='Use CONDA environ. vars. as default')
parser.add_argument('--source-prefix', default=src,
help='path to the Lima sources')
......@@ -180,6 +191,20 @@ class Config:
help='module/option to process')
self.cmd_opts = parser.parse_args(argv[1:])
use_conda = self.get('use-conda-env').lower() not in ['no', '0']
sysroot = os.environ.get('CONDA_SYSROOT', None)
prefix_path = os.environ.get('CONDA_PREFIX', None)
if use_conda and sysroot:
if self.get('sysroot'):
raise ValueError('use-conda-env provided '
'together with sysroot')
self.set_cmd('sysroot', sysroot)
if use_conda and prefix_path:
if self.get('prefix-path'):
raise ValueError('use-conda-env provided '
'together with prefix-path')
self.set_cmd('prefix-path', prefix_path)
# do install if not explicitly specified and user
# included install-[python-]prefix
install, explicit = self.get_bool_opt(self.get('install'))
......@@ -257,12 +282,13 @@ class Config:
class CMakeOptions:
direct_opts = ['build-type', 'install-prefix', 'find-root-path',
'prefix-path', 'sysroot']
cmd_2_cmake_map = {
'Common': [
('build-type', 'cmake-build-type'),
('install-prefix', 'cmake-install-prefix'),
'Common': [(x, 'cmake-' + x) for x in direct_opts] +
('install-python-prefix', 'python-site-packages-dir'),
('find-root-path', 'cmake-find-root-path'),
'Linux': [
('verbose', 'cmake-verbose-makefile'),
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment