Skip to content

CMake: Address review comment from PR#13566 #13870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ if(${MBED_TOOLCHAIN_FILE_USED})
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})
endif()


set(MBED_TARGET_LABELS
${MBED_TARGET_LABELS} CACHE INTERNAL ""
)

target_compile_definitions(mbed-core
INTERFACE
${MBED_TARGET_DEFINITIONS}
Expand Down Expand Up @@ -124,7 +119,12 @@ add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL)
# Configures the application
#
function(mbed_configure_app_target target)
mbed_set_language_standard(${target})
# Set the language standard to use per target
target_compile_features(${target}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be in our toolchain file (related to toolchain set up, although for an app)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the changes and keep the mbed_set_language_standard funcion and moved target_compile_feature inside of it, please re-review

PUBLIC
c_std_11
cxx_std_14
)
endfunction()

#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("MCU_NRF52840" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_MCU_NRF52840)
elseif("NRF5x" IN_LIST MBED_TARGET_LABELS)
if("NRF5x" IN_LIST MBED_TARGET_LABELS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was there an intention here? The build failed to built this target with cordio sources. please review logs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, this makes sense. So why it fails now then?

add_subdirectory(TARGET_NRF5x)
endif()

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ target_sources(mbed-ble-cordio
stack/sources/pal_crypto.c
stack/sources/pal_timer.c
)

target_link_libraries(mbed-ble-cordio
INTERFACE
mbed-ble-cordio_ll
mbed-mbedtls-cryptocell310
)
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ target_sources(mbed-mbedtls-cryptocell310
source/trng.c
)

target_compile_definitions(mbed-mbedtls-cryptocell310
INTERFACE
MBED_CONF_CRYPTOCELL310_PRESENT=1
)

target_link_libraries(mbed-mbedtls-cryptocell310
INTERFACE
mbed-mbedtls
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,16 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

function(_mbed_get_libcc_310_ext)
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LIBCC_310_EXT TOOLCHAIN_GCC_ARM/libcc_310_ext.a)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LIBCC_310_EXT TOOLCHAIN_ARM/libcc_310_ext.ar)
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
set(LIBCC_310_EXT TOOLCHAIN_IAR/lib_cc310_ext.a)
endif()
target_link_libraries(mbed-mbedtls-cryptocell310
INTERFACE
./${LIBCC_310_EXT}
)
endfunction()

function(_mbed_get_libcc_310_trng)
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LIBCC_310_TRNG TOOLCHAIN_GCC_ARM/libcc_310_trng.a)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LIBCC_310_TRNG TOOLCHAIN_ARM/libcc_310_trng.ar)
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
set(LIBCC_310_TRNG TOOLCHAIN_IAR/lib_cc310_trng.a)
endif()
target_link_libraries(mbed-mbedtls-cryptocell310
INTERFACE
./${LIBCC_310_TRNG}
)
endfunction()

_mbed_get_libcc_310_ext()
_mbed_get_libcc_310_trng()
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LIBCC_310_EXT TOOLCHAIN_GCC_ARM/libcc_310_ext.a)
set(LIBCC_310_TRNG TOOLCHAIN_GCC_ARM/libcc_310_trng.a)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LIBCC_310_EXT TOOLCHAIN_ARM/libcc_310_ext.ar)
set(LIBCC_310_TRNG TOOLCHAIN_ARM/libcc_310_trng.ar)
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
set(LIBCC_310_EXT TOOLCHAIN_IAR/lib_cc310_ext.a)
set(LIBCC_310_TRNG TOOLCHAIN_IAR/lib_cc310_trng.a)
endif()

target_include_directories(mbed-mbedtls-cryptocell310
INTERFACE
Expand All @@ -40,4 +20,10 @@ target_include_directories(mbed-mbedtls-cryptocell310
target_sources(mbed-mbedtls-cryptocell310
INTERFACE
crypto_device_platform.c
)
)

target_link_libraries(mbed-mbedtls-cryptocell310
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/${LIBCC_310_EXT}
${CMAKE_CURRENT_SOURCE_DIR}/${LIBCC_310_TRNG}
)
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

function(_mbed_get_libcc_310_core)
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LIBCC_310_CORE TOOLCHAIN_GCC_ARM/libcc_310_core.a)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LIBCC_310_CORE TOOLCHAIN_ARM/libcc_310_core.ar)
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
set(LIBCC_310_CORE TOOLCHAIN_IAR/lib_cc310_ext.a)
endif()
target_link_libraries(mbed-mbedtls-cryptocell310
INTERFACE
./${LIBCC_310_CORE}
)
endfunction()
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LIBCC_310_CORE TOOLCHAIN_GCC_ARM/libcc_310_core.a)
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LIBCC_310_CORE TOOLCHAIN_ARM/libcc_310_core.ar)
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
set(LIBCC_310_CORE TOOLCHAIN_IAR/lib_cc310_ext.a)
endif()

_mbed_get_libcc_310_core()
target_link_libraries(mbed-mbedtls-cryptocell310
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/${LIBCC_310_CORE}
)
2 changes: 1 addition & 1 deletion connectivity/netsocket/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# TODO CMake: Perhaps move this/these file(s)
# TODO CMake: Perhaps move this/these file(s) into connectivity/drivers/cellular
target_sources(mbed-cellular
INTERFACE
source/CellularNonIPSocket.cpp
Expand Down
17 changes: 0 additions & 17 deletions tools/cmake/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,6 @@ set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_CXX_COMPILER_WORKS TRUE)

# Set the language standard to use per target
function(mbed_set_language_standard target)
set_target_properties(${target}
PROPERTIES
C_STANDARD 11
C_STANDARD_REQUIRED YES
C_EXTENSIONS YES
)

set_target_properties(${target}
PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS YES
)
endfunction()

# Clear toolchains options for all languages as Mbed OS uses
# different initialisation options (such as for optimization and debug symbols)
set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "" FORCE)
Expand Down