Skip to content

Commit

Permalink
Fix pkg-config files
Browse files Browse the repository at this point in the history
Update pkg-config files for CMake. Dependencies mbedtls and
tinycbor are linked as static/shared libraries and therefore
must be linked in the pkg-config files.
  • Loading branch information
Danielius1922 authored and Daniel Adam committed Feb 3, 2023
1 parent a6857b1 commit 86cde01
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,11 @@ set(PKG_CONFIG_FILES
iotivity-lite-client-server.pc)

foreach(pkg-config-file IN LISTS PKG_CONFIG_FILES)
set(extra_requires "tinycbor")
if (OC_SECURITY_ENABLED)
set(extra_libs "-lmbedtls -lmbedx509 -lmbedcrypto")
endif()

configure_file(
"${PROJECT_SOURCE_DIR}/port/linux/${pkg-config-file}.in"
${pkg-config-file}
Expand Down
8 changes: 0 additions & 8 deletions deps/mbedtls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,4 @@ foreach(target ${mbedtls_targets})
if(TARGET mbedtls-support)
target_sources(${target} PRIVATE $<TARGET_OBJECTS:mbedtls-support>)
endif()

if(USE_SHARED_MBEDTLS_LIBRARY)
get_target_property(target_type ${target} TYPE)

if("${target_type}" STREQUAL "SHARED_LIBRARY")
string(APPEND extra_libs "-l${target} ")
endif()
endif()
endforeach()
3 changes: 3 additions & 0 deletions port/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ iotivity-lite-server.pc: iotivity-lite-server.pc.in
-e 's,@libdir@,$(libdir),' \
-e 's,@includedir@,$(includedir),' \
-e 's,@version@,$(VERSION),' \
-e 's,@extra_requires@,,' \
-e 's,@extra_cflags@,-I$${includedir}/iotivity-lite/tinycbor $(EXTRA_CFLAGS),' \
-e 's,@extra_libs@,$(EXTRA_LIBS),'

Expand All @@ -574,6 +575,7 @@ iotivity-lite-client.pc: iotivity-lite-client.pc.in
-e 's,@libdir@,$(libdir),' \
-e 's,@includedir@,$(includedir),' \
-e 's,@version@,$(VERSION),' \
-e 's,@extra_requires@,,' \
-e 's,@extra_cflags@,-I$${includedir}/iotivity-lite/tinycbor $(EXTRA_CFLAGS),' \
-e 's,@extra_libs@,$(EXTRA_LIBS),'

Expand All @@ -584,6 +586,7 @@ iotivity-lite-client-server.pc: iotivity-lite-client-server.pc.in
-e 's,@libdir@,$(libdir),' \
-e 's,@includedir@,$(includedir),' \
-e 's,@version@,$(VERSION),' \
-e 's,@extra_requires@,,' \
-e 's,@extra_cflags@,-I$${includedir}/iotivity-lite/tinycbor $(EXTRA_CFLAGS),' \
-e 's,@extra_libs@,$(EXTRA_LIBS),'

Expand Down
3 changes: 2 additions & 1 deletion port/linux/iotivity-lite-client-server.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ includedir=@includedir@
Name: iotivity-lite-client-server
Description: Iotivity lite client and server library
Version: @version@
Libs.private: -lm -pthread @extra_libs@
Requires: @extra_requires@
Libs.private: -lm -pthread
Cflags: -I${includedir}/iotivity-lite -DOC_CLIENT -DOC_SERVER @extra_cflags@
Libs: -L${libdir} -liotivity-lite-client-server @extra_libs@
3 changes: 2 additions & 1 deletion port/linux/iotivity-lite-client.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ includedir=@includedir@
Name: iotivity-lite-client
Description: Iotivity lite client library
Version: @version@
Libs.private: -lm -pthread @extra_libs@
Requires: @extra_requires@
Libs.private: -lm -pthread
Cflags: -I${includedir}/iotivity-lite -DOC_CLIENT @extra_cflags@
Libs: -L${libdir} -liotivity-lite-client
3 changes: 2 additions & 1 deletion port/linux/iotivity-lite-server.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ includedir=@includedir@
Name: iotivity-lite-server
Description: Iotivity lite server library
Version: @version@
Libs.private: -lm -pthread @extra_libs@
Requires: @extra_requires@
Libs.private: -lm -pthread
Cflags: -I${includedir}/iotivity-lite -DOC_SERVER @extra_cflags@
Libs: -L${libdir} -liotivity-lite-server @extra_libs@

0 comments on commit 86cde01

Please sign in to comment.