Skip to content

Commit

Permalink
[cmake] instance static dependent libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
wgtdkp committed Feb 3, 2021
1 parent ce6b118 commit e021a5f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
10 changes: 4 additions & 6 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ target_include_directories(commissioner-common
${PROJECT_SOURCE_DIR}/src
)

if (BUILD_SHARED_LIBS)
install(TARGETS commissioner-common
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
endif()
install(TARGETS commissioner-common
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

if (OT_COMM_TEST)
add_library(commissioner-common-test OBJECT
Expand Down
39 changes: 23 additions & 16 deletions src/library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,35 @@ install(TARGETS commissioner
## Install third-party shared libraries. We need to install
## those shared libraries to enable commissioner-cli.
##
## We here install the built .so files directly
## We here install the .a/.so files directly
## because those third-party libraries are included
## as EXCLUDE_FROM_ALL, which means `install()` is
## disabled for them (intended).
if (BUILD_SHARED_LIBS)
install(FILES
$<$<BOOL:${OT_COMM_CCM}>:$<TARGET_FILE:cn-cbor::cn-cbor>>
$<$<BOOL:${OT_COMM_CCM}>:$<TARGET_FILE:cose>>
$<$<BOOL:${OT_COMM_APP}>:$<TARGET_FILE:mdns>>
$<TARGET_FILE:mbedtls>
$<TARGET_FILE:mbedx509>
$<TARGET_FILE:mbedcrypto>
$<TARGET_FILE:fmt::fmt>
$<TARGET_FILE:event_core_shared>
$<TARGET_FILE:event_pthreads_shared>
DESTINATION lib
)

## Update ldconfig links and caches.
install(CODE "execute_process(COMMAND sudo ldconfig)")
if (BUILD_SHARED_LIBS)
set(EVENT_CORE event_core_shared)
set(EVENT_PTHREADS event_pthreads_shared)
else()
set(EVENT_CORE event_core_static)
set(EVENT_PTHREADS event_pthreads_static)
endif()

install(FILES
$<$<BOOL:${OT_COMM_CCM}>:$<TARGET_FILE:cn-cbor::cn-cbor>>
$<$<BOOL:${OT_COMM_CCM}>:$<TARGET_FILE:cose>>
$<$<BOOL:${OT_COMM_APP}>:$<TARGET_FILE:mdns>>
$<TARGET_FILE:mbedtls>
$<TARGET_FILE:mbedx509>
$<TARGET_FILE:mbedcrypto>
$<TARGET_FILE:fmt::fmt>
$<TARGET_FILE:${EVENT_CORE}>
$<TARGET_FILE:${EVENT_PTHREADS}>
DESTINATION lib
)

## Update ldconfig links and caches.
install(CODE "execute_process(COMMAND sudo ldconfig)")

install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/commissioner
DESTINATION include
)
Expand Down
14 changes: 7 additions & 7 deletions src/library/commissioner_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2114,13 +2114,6 @@ void CommissionerImpl::HandleRlyRx(const coap::Request &aRlyRx)
LOG_DEBUG(LOG_REGION_JOINER_SESSION, "received RLY_RX.ntf: joinerID={}, joinerRouterLocator={}, length={}",
utils::Hex(joinerId), joinerRouterLocator, dtlsRecords.size());

joinerPSKd = mCommissionerHandler.OnJoinerRequest(joinerId);
if (joinerPSKd.empty())
{
LOG_INFO(LOG_REGION_JOINER_SESSION, "joiner(ID={}) is disabled", utils::Hex(joinerId));
ExitNow(error = ERROR_REJECTED("joiner(ID={}) is disabled", utils::Hex(joinerId)));
}

{
auto it = mJoinerSessions.find(joinerId);
if (it != mJoinerSessions.end() && it->second.Disabled())
Expand All @@ -2133,6 +2126,13 @@ void CommissionerImpl::HandleRlyRx(const coap::Request &aRlyRx)
{
Address localAddr;

joinerPSKd = mCommissionerHandler.OnJoinerRequest(joinerId);
if (joinerPSKd.empty())
{
LOG_INFO(LOG_REGION_JOINER_SESSION, "joiner(ID={}) is disabled", utils::Hex(joinerId));
ExitNow(error = ERROR_REJECTED("joiner(ID={}) is disabled", utils::Hex(joinerId)));
}

SuccessOrExit(error = mBrClient.GetLocalAddr(localAddr));
it = mJoinerSessions
.emplace(std::piecewise_construct, std::forward_as_tuple(joinerId),
Expand Down

0 comments on commit e021a5f

Please sign in to comment.