aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/swig/swig_lib.cpp
diff options
context:
space:
mode:
authorvitalyisaev <vitalyisaev@ydb.tech>2023-11-30 13:26:22 +0300
committervitalyisaev <vitalyisaev@ydb.tech>2023-11-30 15:44:45 +0300
commit0a98fece5a9b54f16afeb3a94b3eb3105e9c3962 (patch)
tree291d72dbd7e9865399f668c84d11ed86fb190bbf /contrib/tools/swig/swig_lib.cpp
parentcb2c8d75065e5b3c47094067cb4aa407d4813298 (diff)
downloadydb-0a98fece5a9b54f16afeb3a94b3eb3105e9c3962.tar.gz
YQ Connector:Use docker-compose in integrational tests
Diffstat (limited to 'contrib/tools/swig/swig_lib.cpp')
-rw-r--r--contrib/tools/swig/swig_lib.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/tools/swig/swig_lib.cpp b/contrib/tools/swig/swig_lib.cpp
new file mode 100644
index 0000000000..75b98501e8
--- /dev/null
+++ b/contrib/tools/swig/swig_lib.cpp
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define _STR(a) #a
+#define STR(a) _STR(a)
+
+static const char* ArcadiaRoot() {
+ const char* root = getenv("ARCADIA_ROOT_DISTBUILD");
+ return root ? root : STR(ARCADIA_ROOT);
+}
+
+#ifdef _MSC_VER
+static int setenv(const char* name, const char* value, int overwrite) {
+ return (overwrite || !getenv(name)) ? _putenv_s(name, value) : 0;
+}
+#endif
+
+static void InitSwigLib() {
+ const char* root = ArcadiaRoot();
+ const char* lib = STR(SWIG_LIB_ARCPATH);
+ char* s = new char[strlen(root) + 1 + strlen(lib) + 1];
+ sprintf(s, "%s/%s", root, lib);
+ setenv("SWIG_LIB", s, false);
+ delete[] s;
+}
+
+static int initSwigLib = (InitSwigLib(), 0);