add handling of sub-dependencies, fix profile selection

pull/5476/head
Matthias L. Jugel 2018-01-12 22:00:11 +01:00
parent c29945b1be
commit e2ae5607e9
2 changed files with 4 additions and 3 deletions

View File

@ -51,6 +51,7 @@ ADD_LIBRARY({{libname}} STATIC
ADD_EXECUTABLE({{name}}
{% for src in sources %}{{src}}
{% endfor %})
SET_TARGET_PROPERTIES({{name}} PROPERTIES ENABLE_EXPORTS 1)
TARGET_LINK_LIBRARIES({{name}}
{% for libname in dependencies.keys()|sort(reverse=true) %}{{libname}}
{% endfor %})
@ -89,8 +90,8 @@ ELSE()
ENDIF()
# optional custom target to build via mbed-cli
ADD_CUSTOM_TARGET(mbed-cli-build EXCLUDE_FROM_ALL
COMMAND ${CMAKE_COMMAND} -E echo "mbed compile --build BUILD/${CMAKE_BUILD_TYPE} ${MBED_BUILD_PROFILE}"
ADD_CUSTOM_TARGET(mbed-cli-build
COMMAND ${CMAKE_COMMAND} -E echo "mbed compile --build BUILD/${CMAKE_BUILD_TYPE} --profile ${MBED_BUILD_PROFILE}"
COMMAND mbed compile --build BUILD/${CMAKE_BUILD_TYPE} --profile ${MBED_BUILD_PROFILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
SOURCES ${SOURCE_FILES} ${SYS_SOURCE_FILES})

View File

@ -67,7 +67,7 @@ class CMake(Exporter):
# create a list of dependencies (mbed add ...)
dependencies = [l[:-4] for l in self.resources.lib_refs]
# separate the individual dependency source files into a map with the dep name as key and an array if files
depSources = {re.sub(r'^[.]/', '', l):
depSources = {re.sub(r'^[.]/', '', l).replace('/', '_'):
sorted([f for f in allSourceFiles if f.startswith(l)]) for l in dependencies}
# delete dependencies that have no source files (may happen if a sub-dependency is ignored by .mbedignore)
depSources = {k: v for k, v in depSources.items() if len(v) != 0}