Skip to content

Commit

Permalink
We need to install swig when using docker. So rearrange make file to …
Browse files Browse the repository at this point in the history
…support that.
  • Loading branch information
frawau committed Feb 19, 2024
1 parent 8356389 commit 8eb036b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/UnitTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: (cd python; make test)
run: (apt-get -y install libpcre2-dev python3-dev; cd python; make testdocker)

Unit_Tests:
runs-on: ubuntu-latest
Expand Down
19 changes: 10 additions & 9 deletions python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,24 @@ all : _irhvac.so
library : $(objects)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -Wl,-soname,lib_irhvac.so -o _irhvac.so $(COMMON_OBJ)

swig : libirhvac_wrap.cxx swig-4.2.0/swig
swig-4.2.0/swig $(INCLUDES) $(DEFFLAGS) -c++ -python libirhvac.i
swig : libirhvac_wrap.cxx
swig $(INCLUDES) $(DEFFLAGS) -c++ -python libirhvac.i
clean :
rm -f *.o *.pyc *.cxx *.cpp
rm -rf swig-4.2.0
distclean :
rm -f *.o *.pyc libirhvac_wrap.cxx irhvac.py _irhvac.so
rm -rf swig-4.2.0

install-swig : 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 )

test : _irhvac.so
python test_lib.py

docker : swig-4.2.0/swig _irhvac.so

testdocker : swig-4.2.0/swig _irhvac.so
python test_lib.py

# Keep all intermediate files.
.SECONDARY:

Expand Down Expand Up @@ -86,16 +87,16 @@ IRrecv.o : $(SRC_DIR)/IRrecv.cpp $(SRC_DIR)/IRrecv.h $(SRC_DIR)/IRremoteESP8266.
libirhvac_wrap.o : libirhvac_wrap.cxx
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(PYTHONINCL) -c libirhvac_wrap.cxx

libirhvac_wrap.cxx : swig-4.2.0/swig
swig-4.2.0/swig $(INCLUDES) $(DEFFLAGS) -c++ -python libirhvac.i
libirhvac_wrap.cxx :
swig $(INCLUDES) $(DEFFLAGS) -c++ -python libirhvac.i

_irhvac.so : $(COMMON_OBJ)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -Wl,-soname,lib_irhvac.so -o _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 )
( cd swig-4.2.0; ./configure ; make; make install )
# new specific targets goes above this line

$(objects) : %: $(COMMON_OBJ)
Expand Down

0 comments on commit 8eb036b

Please sign in to comment.