Merge pull request #1277 from liamfraser/fix-cmake-skip
Fix family_support.cmake to use new skip.txt and only.txt files
This commit is contained in:
commit
58b8bdc2e4
|
@ -11,23 +11,52 @@ if (NOT TARGET _family_support_marker)
|
||||||
|
|
||||||
function(family_filter RESULT DIR)
|
function(family_filter RESULT DIR)
|
||||||
get_filename_component(DIR ${DIR} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
get_filename_component(DIR ${DIR} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
file(GLOB ONLYS "${DIR}/.only.MCU_*")
|
|
||||||
if (ONLYS)
|
if (EXISTS "${DIR}/only.txt")
|
||||||
|
file(READ "${DIR}/only.txt" ONLYS)
|
||||||
|
# Replace newlines with semicolon so that it is treated as a list by CMake
|
||||||
|
string(REPLACE "\n" ";" ONLYS_LINES ${ONLYS})
|
||||||
|
# For each mcu
|
||||||
foreach(MCU IN LISTS FAMILY_MCUS)
|
foreach(MCU IN LISTS FAMILY_MCUS)
|
||||||
if (EXISTS ${DIR}/.only.MCU_${MCU})
|
# For each line in only.txt
|
||||||
set(${RESULT} 1 PARENT_SCOPE)
|
foreach(_line ${ONLYS_LINES})
|
||||||
return()
|
# If mcu:xxx exists for this mcu then include
|
||||||
endif()
|
if (${_line} STREQUAL "mcu:${MCU}")
|
||||||
|
set(${RESULT} 1 PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
# Didn't find it in only file so don't build
|
||||||
|
set(${RESULT} 0 PARENT_SCOPE)
|
||||||
|
|
||||||
|
elseif (EXISTS "${DIR}/skip.txt")
|
||||||
|
file(READ "${DIR}/skip.txt" SKIPS)
|
||||||
|
# Replace newlines with semicolon so that it is treated as a list by CMake
|
||||||
|
string(REPLACE "\n" ";" SKIPS_LINES ${SKIPS})
|
||||||
|
# For each mcu
|
||||||
|
foreach(MCU IN LISTS FAMILY_MCUS)
|
||||||
|
# For each line in only.txt
|
||||||
|
foreach(_line ${SKIPS_LINES})
|
||||||
|
# If mcu:xxx exists for this mcu then skip
|
||||||
|
if (${_line} STREQUAL "mcu:${MCU}")
|
||||||
|
set(${RESULT} 0 PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Didn't find in skip file so build
|
||||||
|
set(${RESULT} 1 PARENT_SCOPE)
|
||||||
|
|
||||||
else()
|
else()
|
||||||
foreach(MCU IN LISTS FAMILY_MCUS)
|
|
||||||
if (EXISTS ${DIR}/.skip.MCU_${MCU})
|
# Didn't find skip or only file so build
|
||||||
set(${RESULT} 0 PARENT_SCOPE)
|
set(${RESULT} 1 PARENT_SCOPE)
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
endif()
|
||||||
set(${RESULT} 1 PARENT_SCOPE)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(family_add_subdirectory DIR)
|
function(family_add_subdirectory DIR)
|
||||||
|
|
Loading…
Reference in New Issue