-
Notifications
You must be signed in to change notification settings - Fork 3
/
vscode-conan.sh
executable file
·60 lines (52 loc) · 1.86 KB
/
vscode-conan.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
#********************************************************************************
# Copyright (c) 2022 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License 2.0 which is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
#*******************************************************************************/
# shellcheck disable=SC1090
# shellcheck disable=SC1091
# shellcheck disable=SC2181
# Script for vs code with initialized conan environment (debug)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ "$1" = "-h" ] || [ "$1" == "--help" ]; then
echo "Usage: $0 {-h} {project_dir} {cmake_build_dir}"
echo
echo "Description:"
echo " Launcher script for vs.code with pre-initialized conan environment to work with cmake in vs.code"
echo
echo "Arguments:"
echo " project_dir vs.code project directory (default: ..)"
echo " cmake_build_dir vs.code cmake directory (default: ./build)"
echo
exit 0
fi
PROJ_DIR="$1"
[ -z "$PROJ_DIR" ] && PROJ_DIR="$SCRIPT_DIR"
BUILD_DIR="$2"
[ -z "$BUILD_DIR" ] && BUILD_DIR="$PROJ_DIR/build"
# conan setup
export CONAN_REVISIONS_ENABLED=1
echo "########## Conan Info #########"
conan --version
conan info .
echo "###############################"
conan install -if="$BUILD_DIR" --build=missing --profile:build=default --profile:host="$SCRIPT_DIR/toolchains/target_x86_64_Debug" "$SCRIPT_DIR"
[ $? -ne 0 ] && echo "conan install failed!" && exit 1
if [ -f "$BUILD_DIR/activate.sh" ]; then
source "$BUILD_DIR/activate.sh"
echo
echo "Executing: code $PROJ_DIR with cmake/conan environment..."
echo
code "$PROJ_DIR"
else
echo "Can't find $BUILD_DIR/activate.sh !"
exit 1
fi