2 * SPDX-License-Identifier: MIT
4 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
10 #include <babeltrace2/babeltrace.h>
11 #include "babeltrace2-cfg.h"
12 #include "babeltrace2-cfg-cli-args.h"
13 #include "babeltrace2-cfg-cli-args-default.h"
15 #ifdef ENABLE_DEBUG_INFO
16 # define BT_ENABLE_DEBUG_INFO 1
18 # define BT_ENABLE_DEBUG_INFO 0
21 #ifdef BT_SET_DEFAULT_IN_TREE_CONFIGURATION
23 struct bt_config
*bt_config_cli_args_create_with_default(int argc
,
24 const char *argv
[], int *retcode
,
25 const bt_interrupter
*interrupter
)
27 bt_value
*initial_plugin_paths
;
28 struct bt_config
*cfg
= NULL
;
31 initial_plugin_paths
= bt_value_array_create();
32 if (!initial_plugin_paths
) {
36 ret
= bt_config_append_plugin_paths(initial_plugin_paths
,
37 CONFIG_IN_TREE_PLUGIN_PATH
);
42 #ifdef CONFIG_IN_TREE_PROVIDER_DIR
44 * Set LIBBABELTRACE2_PLUGIN_PROVIDER_DIR to load the in-tree Python
45 * plugin provider, if the env variable is already set, do not overwrite
48 g_setenv("LIBBABELTRACE2_PLUGIN_PROVIDER_DIR", CONFIG_IN_TREE_PROVIDER_DIR
, 0);
51 * If the Pyhton plugin provider is disabled, use a non-exitent path to avoid
52 * loading the system installed provider if it exit, if the env variable is
53 * already set, do not overwrite it.
55 g_setenv("LIBBABELTRACE2_PLUGIN_PROVIDER_DIR", "/nonexistent", 0);
58 cfg
= bt_config_cli_args_create(argc
, argv
, retcode
, true, true,
59 initial_plugin_paths
, interrupter
);
64 BT_OBJECT_PUT_REF_AND_RESET(cfg
);
67 bt_value_put_ref(initial_plugin_paths
);
71 #else /* BT_SET_DEFAULT_IN_TREE_CONFIGURATION */
73 struct bt_config
*bt_config_cli_args_create_with_default(int argc
,
74 const char *argv
[], int *retcode
,
75 const bt_interrupter
*interrupter
)
77 return bt_config_cli_args_create(argc
, argv
, retcode
, false, false,
81 #endif /* BT_SET_DEFAULT_IN_TREE_CONFIGURATION */