Skip to content

Commit

Permalink
coap.h: Remove need for different coap.h files for different OS
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdeep1 committed Aug 16, 2024
1 parent 3d790a5 commit b86dbfa
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 176 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ examples/*.exe
examples/riot/pkg_libcoap/patches

# the include/ folder
include/coap3/coap.h
include/coap3/coap_defines.h

# the tests/ folder
Expand Down
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,6 @@ else(ENABLE_TCP)
endif(ENABLE_TCP)

# creates config header file in build directory
configure_file(${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h)

configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake_coap_config.h.in
${CMAKE_CURRENT_BINARY_DIR}/coap_config.h)

Expand Down Expand Up @@ -994,8 +991,6 @@ install(
COMPONENT dev
FILES_MATCHING
PATTERN "*.h"
PATTERN "coap.h" EXCLUDE
PATTERN "coap_riot.h" EXCLUDE
PATTERN "*_internal.h" EXCLUDE
PATTERN "oscore*" EXCLUDE)
install(
Expand Down
5 changes: 1 addition & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ EXTRA_DIST = \
include/coap$(LIBCOAP_API_VERSION)/coap_uthash_internal.h \
include/coap$(LIBCOAP_API_VERSION)/coap_utlist_internal.h \
include/coap$(LIBCOAP_API_VERSION)/coap_ws_internal.h \
include/coap$(LIBCOAP_API_VERSION)/coap.h.in \
include/coap$(LIBCOAP_API_VERSION)/coap.h.riot \
include/coap$(LIBCOAP_API_VERSION)/coap.h.windows \
include/oscore/oscore_cbor.h \
include/oscore/oscore_context.h \
include/oscore/oscore_cose.h \
Expand Down Expand Up @@ -242,7 +239,7 @@ libcoap_includedir = $(includedir)/coap$(LIBCOAP_API_VERSION)/
# $(top_srcdir)/include/coap-$(LIBCOAP_API_VERSION)/*

libcoap_include_HEADERS = \
$(top_builddir)/include/coap$(LIBCOAP_API_VERSION)/coap.h \
$(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap.h \
$(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/libcoap.h \
$(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_address.h \
$(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_async.h \
Expand Down
1 change: 0 additions & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ depcomp
doc/Doxyfile doc/doxyfile.stamp doc/doxygen_sqlite3.db doc/Makefile doc/Makefile.in
examples/*.o examples/coap-client examples/coap-server examples/coap-rd
examples/Makefile examples/Makefile.in
include/coap3/coap.h
install-sh
libcoap-*.pc libtool ltmain.sh
man/coap*.[357] man/coap*.txt man/Makefile man/Makefile.in
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,6 @@ AC_CONFIG_FILES([
Makefile
doc/Makefile
examples/Makefile
include/coap$LIBCOAP_API_VERSION/coap.h
man/coap.txt
man/coap_address.txt
man/coap_async.txt
Expand Down
1 change: 0 additions & 1 deletion examples/riot/pkg_libcoap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ endif

libcoap:
$(QQ)@cp $(LIBCOAP_SOURCE_DIR)/coap_config.h.riot $(LIBCOAP_SOURCE_DIR)/coap_config.h
$(QQ)@cp $(LIBCOAP_INCLUDE_DIR)/coap.h.riot $(LIBCOAP_INCLUDE_DIR)/coap.h
$(QQ)"$(MAKE)" -C $(LIBCOAP_SOURCE_DIR)/src -f $(CURDIR)/Makefile.libcoap

libcoap_oscore:
Expand Down
4 changes: 2 additions & 2 deletions include/coap3/coap.h.windows → include/coap3/coap.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* coap.h -- main header file for CoAP stack of libcoap (Windows)
* coap.h -- main header file for CoAP stack of libcoap
*
* Copyright (C) 2010-2012,2015-2024 Olaf Bergmann <[email protected]>
* 2015 Carsten Schoenert <[email protected]>
Expand Down Expand Up @@ -34,7 +34,7 @@
#define LIBCOAP_PACKAGE_VERSION "4.3.5rc3"

/* Define the numeric version identifier for libcoap */
#define LIBCOAP_VERSION (4003004U)
#define LIBCOAP_VERSION (4003004ULL)

#ifdef __cplusplus
extern "C" {
Expand Down
74 changes: 0 additions & 74 deletions include/coap3/coap.h.in

This file was deleted.

74 changes: 0 additions & 74 deletions include/coap3/coap.h.riot

This file was deleted.

10 changes: 6 additions & 4 deletions scripts/fix_version.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
FILES="coap_config.h.contiki \
coap_config.h.riot \
coap_config.h.windows \
include/coap@LIBCOAP_API_VERSION@/coap.h.riot \
include/coap@LIBCOAP_API_VERSION@/coap.h.windows \
examples/lwip/config/coap_config.h"
examples/lwip/config/coap_config.h \
include/coap@LIBCOAP_API_VERSION@/coap.h"

for file in $FILES ; do
sed -i $file -e 's/#define PACKAGE_NAME ".*"/#define PACKAGE_NAME "@PACKAGE_NAME@"/g'
sed -i $file -e 's/#define PACKAGE_STRING ".*"/#define PACKAGE_STRING "@PACKAGE_STRING@"/g'
sed -i $file -e 's/#define PACKAGE_VERSION ".*"/#define PACKAGE_VERSION "@PACKAGE_VERSION@"/g'
sed -i $file -e 's/#define PACKAGE_TARNAME ".*"/#define PACKAGE_TARNAME "@PACKAGE_TARNAME@"/g'
sed -i $file -e 's/#define LIBCOAP_VERSION (.*)/#define LIBCOAP_VERSION (@LIBCOAP_VERSION@U)/g'

sed -i $file -e 's/#define LIBCOAP_PACKAGE_BUGREPORT (.*)/#define LIBCOAP_PACKAGE_BUGREPORT (@PACKAGE_BUGREPORT@)/g'
sed -i $file -e 's/#define LIBCOAP_PACKAGE_STRING ".*"/#define LIBCOAP_PACKAGE_STRING "@PACKAGE_STRING@"/g'
sed -i $file -e 's^#define LIBCOAP_PACKAGE_URL ".*"^#define LIBCOAP_PACKAGE_URL "@PACKAGE_URL@"^g'
sed -i $file -e 's/#define LIBCOAP_PACKAGE_VERSION ".*"/#define LIBCOAP_PACKAGE_VERSION "@PACKAGE_VERSION@"/g'
sed -i $file -e 's/#define LIBCOAP_VERSION (.*)/#define LIBCOAP_VERSION (@LIBCOAP_VERSION@ULL)/g'
done

for file in CMakeLists.txt ; do
Expand Down
9 changes: 0 additions & 9 deletions win32/libcoap.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ TYPE %(FullPath) &gt;&gt; "$(IntDir)$(TargetName).def"</Command>
</Link>
<PreBuildEvent>
<Command>copy /Y ..\coap_config.h.windows ..\coap_config.h
copy /Y ..\$(LibCoAPIncludeDir)\coap.h.windows ..\$(LibCoAPIncludeDir)\coap.h
copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command>
</PreBuildEvent>
<PreBuildEvent>
Expand Down Expand Up @@ -432,7 +431,6 @@ copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command
</Link>
<PreBuildEvent>
<Command>copy /Y ..\coap_config.h.windows ..\coap_config.h
copy /Y ..\$(LibCoAPIncludeDir)\coap.h.windows ..\$(LibCoAPIncludeDir)\coap.h
copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command>
</PreBuildEvent>
<PreBuildEvent>
Expand Down Expand Up @@ -473,7 +471,6 @@ copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command
</Link>
<PreBuildEvent>
<Command>copy /Y ..\coap_config.h.windows ..\coap_config.h
copy /Y ..\$(LibCoAPIncludeDir)\coap.h.windows ..\$(LibCoAPIncludeDir)\coap.h
copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command>
<Message>Copying config files for windows</Message>
</PreBuildEvent>
Expand All @@ -499,7 +496,6 @@ copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command
</Link>
<PreBuildEvent>
<Command>copy /Y ..\coap_config.h.windows ..\coap_config.h
copy /Y ..\$(LibCoAPIncludeDir)\coap.h.windows ..\$(LibCoAPIncludeDir)\coap.h
copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command>
<Message>Copying config files for windows</Message>
</PreBuildEvent>
Expand All @@ -523,7 +519,6 @@ copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command
</Link>
<PreBuildEvent>
<Command>copy /Y ..\coap_config.h.windows ..\coap_config.h
copy /Y ..\$(LibCoAPIncludeDir)\coap.h.windows ..\$(LibCoAPIncludeDir)\coap.h
copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command>
</PreBuildEvent>
<PreBuildEvent>
Expand Down Expand Up @@ -569,7 +564,6 @@ copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command
</Link>
<PreBuildEvent>
<Command>copy /Y ..\coap_config.h.windows ..\coap_config.h
copy /Y ..\$(LibCoAPIncludeDir)\coap.h.windows ..\$(LibCoAPIncludeDir)\coap.h
copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command>
</PreBuildEvent>
<PreBuildEvent>
Expand Down Expand Up @@ -612,7 +606,6 @@ copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command
</Link>
<PreBuildEvent>
<Command>copy /Y ..\coap_config.h.windows ..\coap_config.h
copy /Y ..\$(LibCoAPIncludeDir)\coap.h.windows ..\$(LibCoAPIncludeDir)\coap.h
copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command>
<Message>Copying config files for windows</Message>
</PreBuildEvent>
Expand Down Expand Up @@ -641,7 +634,6 @@ copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command
</Link>
<PreBuildEvent>
<Command>copy /Y ..\coap_config.h.windows ..\coap_config.h
copy /Y ..\$(LibCoAPIncludeDir)\coap.h.windows ..\$(LibCoAPIncludeDir)\coap.h
copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command>
<Message>Copying config files for windows</Message>
</PreBuildEvent>
Expand All @@ -666,7 +658,6 @@ copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command
</Link>
<PreBuildEvent>
<Command>copy /Y ..\coap_config.h.windows ..\coap_config.h
copy /Y ..\$(LibCoAPIncludeDir)\coap.h.windows ..\$(LibCoAPIncludeDir)\coap.h
copy /Y ..\coap_config.h.windows ..\$(LibCoAPIncludeDir)\coap_defines.h</Command>
<Message>Copying config files for windows</Message>
</PreBuildEvent>
Expand Down

0 comments on commit b86dbfa

Please sign in to comment.