Skip to content

Commit

Permalink
Adding FPRIME_TOOLCHAIN_NAME variable and restrict_platforms support (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStarch authored Nov 28, 2023
1 parent ec1a9b9 commit c51d2ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmake/API.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ set(FPRIME_AUTOCODER_TARGET_LIST "" CACHE INTERNAL "FPRIME_AUTOCODER_TARGET_LIST
#####
macro(restrict_platforms)
set(__CHECKER ${ARGN})
if (NOT CMAKE_SYSTEM_NAME IN_LIST __CHECKER)
if (NOT FPRIME_TOOLCHAIN_NAME IN_LIST __CHECKER AND NOT CMAKE_SYSTEM_NAME IN_LIST __CHECKER)
get_module_name("${CMAKE_CURRENT_LIST_DIR}")
message(STATUS "Platform ${CMAKE_SYSTEM_NAME} not supported for module ${MODULE_NAME}")
message(STATUS "Neither toolchain ${FPRIME_TOOLCHAIN_NAME} nor platform ${CMAKE_SYSTEM_NAME} supported for module ${MODULE_NAME}")
return()
endif()
endmacro()
Expand Down
9 changes: 9 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,12 @@ set(FPRIME_CONFIG_DIR "${FPRIME_CONFIG_DIR}" CACHE PATH "F prime configuration h
if (NOT DEFINED FPRIME_AC_CONSTANTS_FILE)
set(FPRIME_AC_CONSTANTS_FILE "${FPRIME_CONFIG_DIR}/AcConstants.ini" CACHE PATH "F prime AC constants.ini file" FORCE)
endif()

# Set FPRIME_TOOLCHAIN_NAME when not set by toolchain directly
if (NOT DEFINED FPRIME_TOOLCHAIN_NAME)
if (DEFINED CMAKE_TOOLCHAIN_FILE)
get_filename_component(FPRIME_TOOLCHAIN_NAME "${CMAKE_TOOLCHAIN_FILE}" NAME_WE CACHE)
else()
set(FPRIME_TOOLCHAIN_NAME "native" CACHE INTERNAL "Name of toolchain used" FORCE)
endif()
endif()

0 comments on commit c51d2ef

Please sign in to comment.