miniupnpc: move public .h files to include/ subdir

fixes #540
This commit is contained in:
Thomas Bernard 2021-05-23 00:23:18 +02:00
parent 384268ac46
commit 874a3aba9e
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
15 changed files with 87 additions and 79 deletions

View File

@ -70,21 +70,6 @@ set (MINIUPNPC_SOURCES
portlistingparse.c portlistingparse.c
receivedata.c receivedata.c
addr_is_reserved.c addr_is_reserved.c
connecthostport.h
igd_desc_parse.h
minisoap.h
minissdpc.h
miniupnpc.h
miniupnpctypes.h
miniwget.h
minixml.h
portlistingparse.h
receivedata.h
upnpcommands.h
upnpdev.h
upnperrors.h
upnpreplyparse.h
addr_is_reserved.h
${CMAKE_CURRENT_BINARY_DIR}/miniupnpcstrings.h ${CMAKE_CURRENT_BINARY_DIR}/miniupnpcstrings.h
) )
@ -105,12 +90,15 @@ elseif (HAIKU)
find_library (SOCKET_LIBRARY NAMES network) find_library (SOCKET_LIBRARY NAMES network)
find_library (NSL_LIBRARY NAMES network) find_library (NSL_LIBRARY NAMES network)
find_library (RESOLV_LIBRARY NAMES network) find_library (RESOLV_LIBRARY NAMES network)
set (LDLIBS ${SOCKET_LIBRARY} ${NSL_LIBRARY} ${RESOLV_LIBRARY} ${LDLIBS}) set (LDLIBS ${SOCKET_LIBRARY} ${NSL_LIBRARY} ${RESOLV_LIBRARY} ${LDLIBS})
endif () endif ()
if (UPNPC_BUILD_STATIC) if (UPNPC_BUILD_STATIC)
add_library (libminiupnpc-static STATIC ${MINIUPNPC_SOURCES}) add_library (libminiupnpc-static STATIC ${MINIUPNPC_SOURCES})
target_include_directories (libminiupnpc-static PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/miniupnpc>)
if (NOT UPNPC_BUILD_SHARED) if (NOT UPNPC_BUILD_SHARED)
add_library (miniupnpc::miniupnpc ALIAS libminiupnpc-static) add_library (miniupnpc::miniupnpc ALIAS libminiupnpc-static)
endif() endif()
@ -151,6 +139,9 @@ endif ()
if (UPNPC_BUILD_SHARED) if (UPNPC_BUILD_SHARED)
add_library (libminiupnpc-shared SHARED ${MINIUPNPC_SOURCES}) add_library (libminiupnpc-shared SHARED ${MINIUPNPC_SOURCES})
target_include_directories (libminiupnpc-shared PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/miniupnpc>)
add_library (miniupnpc::miniupnpc ALIAS libminiupnpc-shared) add_library (miniupnpc::miniupnpc ALIAS libminiupnpc-shared)
set_target_properties (libminiupnpc-shared PROPERTIES EXPORT_NAME miniupnpc) set_target_properties (libminiupnpc-shared PROPERTIES EXPORT_NAME miniupnpc)
set_target_properties (libminiupnpc-shared PROPERTIES OUTPUT_NAME "miniupnpc") set_target_properties (libminiupnpc-shared PROPERTIES OUTPUT_NAME "miniupnpc")
@ -193,6 +184,8 @@ if (UPNPC_BUILD_TESTS)
target_compile_definitions(miniupnpc-tests INTERFACE MINIUPNP_STATICLIB) target_compile_definitions(miniupnpc-tests INTERFACE MINIUPNP_STATICLIB)
add_executable (testminixml testminixml.c minixml.c igd_desc_parse.c) add_executable (testminixml testminixml.c minixml.c igd_desc_parse.c)
target_include_directories (testminixml PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_link_libraries (testminixml PRIVATE miniupnpc-tests) target_link_libraries (testminixml PRIVATE miniupnpc-tests)
add_executable (minixmlvalid minixmlvalid.c minixml.c) add_executable (minixmlvalid minixmlvalid.c minixml.c)
@ -200,6 +193,8 @@ if (UPNPC_BUILD_TESTS)
add_executable (testupnpreplyparse testupnpreplyparse.c add_executable (testupnpreplyparse testupnpreplyparse.c
minixml.c upnpreplyparse.c) minixml.c upnpreplyparse.c)
target_include_directories (testupnpreplyparse PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_link_libraries (testupnpreplyparse PRIVATE miniupnpc-tests) target_link_libraries (testupnpreplyparse PRIVATE miniupnpc-tests)
add_executable (testigddescparse testigddescparse.c add_executable (testigddescparse testigddescparse.c
@ -207,6 +202,8 @@ if (UPNPC_BUILD_TESTS)
upnpcommands.c upnpreplyparse.c minisoap.c connecthostport.c upnpcommands.c upnpreplyparse.c minisoap.c connecthostport.c
portlistingparse.c receivedata.c addr_is_reserved.c portlistingparse.c receivedata.c addr_is_reserved.c
) )
target_include_directories (testigddescparse PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_link_libraries (testigddescparse PRIVATE miniupnpc-tests) target_link_libraries (testigddescparse PRIVATE miniupnpc-tests)
add_executable (testminiwget testminiwget.c add_executable (testminiwget testminiwget.c
@ -214,6 +211,8 @@ if (UPNPC_BUILD_TESTS)
upnpreplyparse.c minixml.c igd_desc_parse.c connecthostport.c upnpreplyparse.c minixml.c igd_desc_parse.c connecthostport.c
portlistingparse.c receivedata.c addr_is_reserved.c portlistingparse.c receivedata.c addr_is_reserved.c
) )
target_include_directories (testminiwget PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_link_libraries (testminiwget PRIVATE miniupnpc-tests) target_link_libraries (testminiwget PRIVATE miniupnpc-tests)
add_executable (testaddr_is_reserved testaddr_is_reserved.c add_executable (testaddr_is_reserved testaddr_is_reserved.c

View File

@ -3,7 +3,7 @@
# http://miniupnp.free.fr/ # http://miniupnp.free.fr/
# https://miniupnp.tuxfamily.org/ # https://miniupnp.tuxfamily.org/
# https://github.com/miniupnp/miniupnp # https://github.com/miniupnp/miniupnp
# (c) 2005-2020 Thomas Bernard # (c) 2005-2021 Thomas Bernard
# to install use : # to install use :
# $ make DESTDIR=/tmp/dummylocation install # $ make DESTDIR=/tmp/dummylocation install
# or # or
@ -101,11 +101,8 @@ endif
OBJS = $(patsubst %.c,%.o,$(SRCS)) OBJS = $(patsubst %.c,%.o,$(SRCS))
# HEADERS to install # HEADERS to install
HEADERS = miniupnpc.h miniwget.h upnpcommands.h igd_desc_parse.h \ CPPFLAGS += -Iinclude/
upnpreplyparse.h upnperrors.h miniupnpctypes.h \ HEADERS = $(wildcard include/*.h)
portlistingparse.h \
upnpdev.h \
miniupnpc_declspec.h
# library names # library names
LIBRARY = libminiupnpc.a LIBRARY = libminiupnpc.a
@ -241,9 +238,9 @@ clean:
distclean: clean distclean: clean
$(RM) $(JNAERATOR) java/*.jar java/*.class out.errors.txt $(RM) $(JNAERATOR) java/*.jar java/*.class out.errors.txt
updateversion: miniupnpc.h updateversion: include/miniupnpc.h
cp miniupnpc.h miniupnpc.h.bak cp $< $<.bak
sed 's/\(.*MINIUPNPC_API_VERSION\s\+\)[0-9]\+/\1$(APIVERSION)/' < miniupnpc.h.bak > miniupnpc.h sed 's/\(.*MINIUPNPC_API_VERSION\s\+\)[0-9]\+/\1$(APIVERSION)/' < $<.bak > $<
install: updateversion $(FILESTOINSTALL) install: updateversion $(FILESTOINSTALL)
$(INSTALL) -d $(DESTDIR)$(INSTALLDIRINC) $(INSTALL) -d $(DESTDIR)$(INSTALLDIRINC)
@ -380,41 +377,49 @@ minihttptestserver: minihttptestserver.o
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
igd_desc_parse.o: igd_desc_parse.h igd_desc_parse.o: include/igd_desc_parse.h
miniupnpc.o: miniupnpc.h miniupnpc_declspec.h igd_desc_parse.h upnpdev.h miniupnpc.o: include/miniupnpc.h include/miniupnpc_declspec.h
miniupnpc.o: minissdpc.h miniwget.h minisoap.h minixml.h upnpcommands.h miniupnpc.o: include/igd_desc_parse.h include/upnpdev.h minissdpc.h
miniupnpc.o: upnpreplyparse.h portlistingparse.h miniupnpctypes.h miniupnpc.o: include/miniwget.h miniwget_private.h miniupnpc_socketdef.h
miniupnpc.o: connecthostport.h miniupnpc.o: minisoap.h minixml.h include/upnpcommands.h
miniupnpc.o: include/miniupnpctypes.h connecthostport.h addr_is_reserved.h
minixml.o: minixml.h minixml.o: minixml.h
minisoap.o: minisoap.h miniupnpcstrings.h minisoap.o: minisoap.h miniupnpc_socketdef.h miniupnpcstrings.h
miniwget.o: miniupnpcstrings.h miniwget.h miniupnpc_declspec.h miniwget.o: miniupnpcstrings.h include/miniwget.h
miniwget.o: connecthostport.h receivedata.h miniwget.o: include/miniupnpc_declspec.h connecthostport.h
upnpc.o: miniwget.h miniupnpc_declspec.h miniupnpc.h igd_desc_parse.h miniwget.o: miniupnpc_socketdef.h receivedata.h
upnpc.o: upnpdev.h upnpcommands.h upnpreplyparse.h portlistingparse.h upnpc.o: include/miniwget.h include/miniupnpc_declspec.h include/miniupnpc.h
upnpc.o: miniupnpctypes.h upnperrors.h miniupnpcstrings.h upnpc.o: include/igd_desc_parse.h include/upnpdev.h include/upnpcommands.h
upnpcommands.o: upnpcommands.h upnpreplyparse.h portlistingparse.h upnpc.o: include/miniupnpctypes.h include/portlistingparse.h
upnpcommands.o: miniupnpc_declspec.h miniupnpctypes.h miniupnpc.h upnpc.o: include/upnperrors.h miniupnpcstrings.h
upnpcommands.o: igd_desc_parse.h upnpdev.h upnpcommands.o: include/upnpcommands.h include/miniupnpc_declspec.h
upnpreplyparse.o: upnpreplyparse.h minixml.h upnpcommands.o: include/miniupnpctypes.h include/miniupnpc.h
testminixml.o: minixml.h igd_desc_parse.h upnpcommands.o: include/igd_desc_parse.h include/upnpdev.h
upnpcommands.o: include/portlistingparse.h include/upnpreplyparse.h
upnpreplyparse.o: include/upnpreplyparse.h minixml.h
testminixml.o: minixml.h include/igd_desc_parse.h
minixmlvalid.o: minixml.h minixmlvalid.o: minixml.h
testupnpreplyparse.o: upnpreplyparse.h testupnpreplyparse.o: include/upnpreplyparse.h
minissdpc.o: minissdpc.h miniupnpc_declspec.h upnpdev.h miniupnpc.h minissdpc.o: miniupnpc_socketdef.h minissdpc.h include/miniupnpc_declspec.h
minissdpc.o: igd_desc_parse.h receivedata.h codelength.h minissdpc.o: include/upnpdev.h include/miniupnpc.h include/igd_desc_parse.h
upnperrors.o: upnperrors.h miniupnpc_declspec.h upnpcommands.h minissdpc.o: receivedata.h codelength.h
upnperrors.o: upnpreplyparse.h portlistingparse.h miniupnpctypes.h upnperrors.o: include/upnperrors.h include/miniupnpc_declspec.h
upnperrors.o: miniupnpc.h igd_desc_parse.h upnpdev.h upnperrors.o: include/upnpcommands.h include/miniupnpctypes.h
testigddescparse.o: igd_desc_parse.h minixml.h miniupnpc.h upnperrors.o: include/miniupnpc.h include/igd_desc_parse.h include/upnpdev.h
testigddescparse.o: miniupnpc_declspec.h upnpdev.h testigddescparse.o: include/igd_desc_parse.h minixml.h include/miniupnpc.h
testminiwget.o: miniwget.h miniupnpc_declspec.h testigddescparse.o: include/miniupnpc_declspec.h include/upnpdev.h
connecthostport.o: connecthostport.h testminiwget.o: include/miniwget.h include/miniupnpc_declspec.h
portlistingparse.o: portlistingparse.h miniupnpc_declspec.h miniupnpctypes.h connecthostport.o: connecthostport.h miniupnpc_socketdef.h
portlistingparse.o: minixml.h portlistingparse.o: include/portlistingparse.h include/miniupnpc_declspec.h
receivedata.o: receivedata.h portlistingparse.o: include/miniupnpctypes.h minixml.h
upnpdev.o: upnpdev.h miniupnpc_declspec.h receivedata.o: receivedata.h miniupnpc_socketdef.h
testportlistingparse.o: portlistingparse.h miniupnpc_declspec.h upnpdev.o: include/upnpdev.h include/miniupnpc_declspec.h
testportlistingparse.o: miniupnpctypes.h testportlistingparse.o: include/portlistingparse.h
miniupnpcmodule.o: miniupnpc.h miniupnpc_declspec.h igd_desc_parse.h testportlistingparse.o: include/miniupnpc_declspec.h include/miniupnpctypes.h
miniupnpcmodule.o: upnpdev.h upnpcommands.h upnpreplyparse.h miniupnpcmodule.o: include/miniupnpc.h include/miniupnpc_declspec.h
miniupnpcmodule.o: portlistingparse.h miniupnpctypes.h upnperrors.h miniupnpcmodule.o: include/igd_desc_parse.h include/upnpdev.h
listdevices.o: miniupnpc.h miniupnpc_declspec.h igd_desc_parse.h upnpdev.h miniupnpcmodule.o: include/upnpcommands.h include/miniupnpctypes.h
miniupnpcmodule.o: include/upnperrors.h
testaddr_is_reserved.o: addr_is_reserved.h
listdevices.o: include/miniupnpc.h include/miniupnpc_declspec.h
listdevices.o: include/igd_desc_parse.h include/upnpdev.h

View File

@ -18,8 +18,11 @@ RM = del
else else
RM = rm -f RM = rm -f
endif endif
#CFLAGS = -Wall -g -DDEBUG -D_WIN32_WINNT=0X501 #CFLAGS = -Wall -g
CFLAGS = -Wall -W -Wstrict-prototypes -Os -DNDEBUG -D_WIN32_WINNT=0X501 #CPPFLAGS = -DDEBUG -D_WIN32_WINNT=0X501
CFLAGS = -Wall -W -Wstrict-prototypes -Os
CPPFLAGS = -DNDEBUG -D_WIN32_WINNT=0X501
CPPFLAGS += -Iinclude
LDLIBS = -lws2_32 -liphlpapi LDLIBS = -lws2_32 -liphlpapi
# -lwsock32 # -lwsock32
# -liphlpapi is needed for GetBestRoute() and GetIpAddrTable() # -liphlpapi is needed for GetBestRoute() and GetIpAddrTable()
@ -75,13 +78,13 @@ miniupnpc.dll: miniupnpc.def $(OBJSDLL)
miniupnpc.lib: miniupnpc.dll miniupnpc.lib: miniupnpc.dll
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $< $(CC) $(CFLAGS) $(CPPFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $<
dll-%.o: %.c dll-%.o: %.c
$(CC) $(CFLAGS) -DMINIUPNP_EXPORTS -c -o $@ $< $(CC) $(CFLAGS) $(CPPFLAGS) -DMINIUPNP_EXPORTS -c -o $@ $<
%-shared.o: %.c %-shared.o: %.c
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
# --enable-stdcall-fixup # --enable-stdcall-fixup
%-static.exe: %.o libminiupnpc.a %-static.exe: %.o libminiupnpc.a
@ -95,7 +98,7 @@ dll-%.o: %.c
# sed (if cross compiling from another platform). # sed (if cross compiling from another platform).
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
wingenminiupnpcstrings.exe: wingenminiupnpcstrings.c wingenminiupnpcstrings.exe: wingenminiupnpcstrings.c
$(CC) $(CFLAGS) -o $@ $^ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings.exe VERSION miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings.exe VERSION
.\wingenminiupnpcstrings.exe $< $@ rc_version.h .\wingenminiupnpcstrings.exe $< $@ rc_version.h
@ -122,23 +125,24 @@ testminixml.exe: testminixml.o minixml.o igd_desc_parse.o
minixml.o: minixml.c minixml.h minixml.o: minixml.c minixml.h
upnpc.o: miniwget.h minisoap.h miniupnpc.h igd_desc_parse.h upnpc.o: include/miniwget.h minisoap.h include/miniupnpc.h include/igd_desc_parse.h
upnpc.o: upnpreplyparse.h upnpcommands.h upnperrors.h miniupnpcstrings.h upnpc.o: include/upnpreplyparse.h include/upnpcommands.h include/upnperrors.h miniupnpcstrings.h
miniwget.o: miniwget.c miniwget.h miniupnpcstrings.h connecthostport.h miniwget.o: miniwget.c include/miniwget.h miniupnpcstrings.h connecthostport.h
minisoap.o: minisoap.c minisoap.h miniupnpcstrings.h minisoap.o: minisoap.c minisoap.h miniupnpcstrings.h
miniupnpc.o: miniupnpc.c miniupnpc.h minisoap.h miniwget.h minixml.h \ miniupnpc.o: miniupnpc.c include/miniupnpc.h minisoap.h include/miniwget.h minixml.h \
addr_is_reserved.h addr_is_reserved.h
igd_desc_parse.o: igd_desc_parse.c igd_desc_parse.h igd_desc_parse.o: igd_desc_parse.c include/igd_desc_parse.h
upnpreplyparse.o: upnpreplyparse.c upnpreplyparse.h minixml.h upnpreplyparse.o: upnpreplyparse.c include/upnpreplyparse.h minixml.h
upnpcommands.o: upnpcommands.c upnpcommands.h upnpreplyparse.h miniupnpc.h portlistingparse.h upnpcommands.o: upnpcommands.c include/upnpcommands.h include/upnpreplyparse.h \
include/miniupnpc.h include/portlistingparse.h
minissdpc.o: minissdpc.c minissdpc.h receivedata.h minissdpc.o: minissdpc.c minissdpc.h receivedata.h
upnpdev.o: upnpdev.c upnpdev.h upnpdev.o: upnpdev.c include/upnpdev.h

View File

@ -1,7 +1,7 @@
#! /usr/bin/env python #! /usr/bin/env python
# vim: tabstop=8 shiftwidth=8 expandtab # vim: tabstop=8 shiftwidth=8 expandtab
# $Id: setup.py,v 1.14 2020/04/06 10:23:02 nanard Exp $ # $Id: setup.py,v 1.14 2020/04/06 10:23:02 nanard Exp $
# the MiniUPnP Project (c) 2007-2020 Thomas Bernard # the MiniUPnP Project (c) 2007-2021 Thomas Bernard
# https://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/ # https://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
# #
# python script to build the miniupnpc module under unix # python script to build the miniupnpc module under unix
@ -30,6 +30,6 @@ setup(name="miniupnpc",
cmdclass={'build_ext': make_then_build_ext}, cmdclass={'build_ext': make_then_build_ext},
ext_modules=[ ext_modules=[
Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
extra_objects=EXT) include_dirs=['include'], extra_objects=EXT)
]) ])

View File

@ -1,7 +1,7 @@
#! /usr/bin/env python #! /usr/bin/env python
# vim: tabstop=8 shiftwidth=8 expandtab # vim: tabstop=8 shiftwidth=8 expandtab
# $Id: setupmingw32.py,v 1.12 2020/04/06 10:23:02 nanard Exp $ # $Id: setupmingw32.py,v 1.12 2020/04/06 10:23:02 nanard Exp $
# the MiniUPnP Project (c) 2007-2020 Thomas Bernard # the MiniUPnP Project (c) 2007-2021 Thomas Bernard
# https://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/ # https://miniupnp.tuxfamily.org/ or http://miniupnp.free.fr/
# #
# python script to build the miniupnpc module under windows (using mingw32) # python script to build the miniupnpc module under windows (using mingw32)
@ -30,6 +30,6 @@ setup(name="miniupnpc",
ext_modules=[ ext_modules=[
Extension(name="miniupnpc", sources=["miniupnpcmodule.c"], Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
libraries=["ws2_32", "iphlpapi"] + compat_lib, libraries=["ws2_32", "iphlpapi"] + compat_lib,
extra_objects=["miniupnpc.lib"]) include_dirs=['include'], extra_objects=["miniupnpc.lib"])
]) ])