From 7ef45379a7091deb2faffd182653aff1c62d866d Mon Sep 17 00:00:00 2001 From: Francois Wautier Date: Tue, 20 Feb 2024 22:14:04 +0700 Subject: [PATCH] Try to use swig without installing it. --- .github/workflows/UnitTests.yml | 2 +- python/Makefile | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/UnitTests.yml b/.github/workflows/UnitTests.yml index 3c197b6b9..0f1daa48b 100644 --- a/.github/workflows/UnitTests.yml +++ b/.github/workflows/UnitTests.yml @@ -14,7 +14,7 @@ jobs: - name: Run tools unit tests run: (cd tools; make run_tests) - name: Build swig extension and run simple test - run: (apt-get -y install libpcre2-dev python3-dev; cd python; make testdocker) + run: (cd python; make testdocker) Unit_Tests: runs-on: ubuntu-latest diff --git a/python/Makefile b/python/Makefile index 70fca0e3f..d7f941d11 100644 --- a/python/Makefile +++ b/python/Makefile @@ -11,6 +11,11 @@ # project, except GTEST_HEADERS, which you can use in your own targets # but shouldn't modify. +ifeq (,$(wildcard ./.dockerenv)) +SWIGTYPE = local +else +SWIGTYPE = global +endif # Where to find user code. SRC_DIR = ../src @@ -38,7 +43,12 @@ library : $(objects) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -Wl,-soname,lib_irhvac.so -o _irhvac.so $(COMMON_OBJ) swig : libirhvac_wrap.cxx +ifneq (,$(wildcard /.dockerenv)) + SWIG_LIB=$(shell realpath -qe swig-4.2.0/Lib) ./swig-4.2.0/swig $(INCLUDES) $(DEFFLAGS) -c++ -python libirhvac.i +else swig $(INCLUDES) $(DEFFLAGS) -c++ -python libirhvac.i +endif + clean : rm -f *.o *.pyc *.cxx *.cpp rm -rf swig-4.2.0 @@ -96,7 +106,7 @@ _irhvac.so : $(COMMON_OBJ) swig-4.2.0/swig : rm -rf swig-4.2.0 curl -s -L -o - http://downloads.sourceforge.net/project/swig/swig/swig-4.2.0/swig-4.2.0.tar.gz | tar xfz - - ( cd swig-4.2.0; ./configure ; make; make install ) + ( cd swig-4.2.0; ./configure ; make ) # new specific targets goes above this line $(objects) : %: $(COMMON_OBJ)