2020-12-29 01:09:59 +01:00
|
|
|
function(post_source_hw_os_config)
|
|
|
|
|
|
|
|
if(LINKER_SCRIPT)
|
2022-02-09 21:38:56 +01:00
|
|
|
add_link_options(
|
2020-12-29 01:09:59 +01:00
|
|
|
-T${LINKER_SCRIPT}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(C_FLAGS "" CACHE INTERNAL "C flags")
|
|
|
|
|
|
|
|
set(C_DEFS ""
|
|
|
|
CACHE INTERNAL
|
|
|
|
"C Defines"
|
|
|
|
)
|
|
|
|
|
|
|
|
set(CXX_FLAGS ${C_FLAGS})
|
|
|
|
set(CXX_DEFS ${C_DEFS})
|
|
|
|
|
|
|
|
if(CMAKE_VERBOSE)
|
|
|
|
message(STATUS "C Flags: ${C_FLAGS}")
|
|
|
|
message(STATUS "CXX Flags: ${CXX_FLAGS}")
|
|
|
|
message(STATUS "C Defs: ${C_DEFS}")
|
|
|
|
message(STATUS "CXX Defs: ${CXX_DEFS}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Generator expression. Can be used to set different C, CXX and ASM flags.
|
2022-02-09 21:38:56 +01:00
|
|
|
add_compile_options(
|
2020-12-29 01:09:59 +01:00
|
|
|
$<$<COMPILE_LANGUAGE:C>:${C_DEFS} ${C_FLAGS}>
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:${CXX_DEFS} ${CXX_FLAGS}>
|
|
|
|
$<$<COMPILE_LANGUAGE:ASM>:${ASM_FLAGS}>
|
|
|
|
)
|
|
|
|
|
2022-05-06 16:46:22 +02:00
|
|
|
set(STRIPPED_OBSW_NAME ${OBSW_BIN_NAME}-stripped)
|
2022-04-18 21:49:04 +02:00
|
|
|
set(STRIPPED_WATCHDOG_NAME eive-watchdog-stripped)
|
2021-08-14 15:25:30 +02:00
|
|
|
|
2022-05-06 16:43:12 +02:00
|
|
|
if(EIVE_CREATE_UNIQUE_OBSW_BIN)
|
|
|
|
set(UNIQUE_OBSW_BIN_NAME ${OBSW_BIN_NAME}-$ENV{USERNAME})
|
|
|
|
endif()
|
|
|
|
|
2020-12-29 01:09:59 +01:00
|
|
|
add_custom_command(
|
2022-02-09 21:38:56 +01:00
|
|
|
TARGET ${OBSW_NAME}
|
2020-12-29 01:09:59 +01:00
|
|
|
POST_BUILD
|
2022-02-20 10:34:41 +01:00
|
|
|
COMMAND ${CMAKE_STRIP} --strip-all ${OBSW_BIN_NAME} -o ${STRIPPED_OBSW_NAME}
|
2022-02-09 21:38:56 +01:00
|
|
|
BYPRODUCTS ${STRIPPED_OBSW_NAME}
|
|
|
|
COMMENT "Generating stripped executable ${STRIPPED_OBSW_NAME}.."
|
2020-12-29 01:09:59 +01:00
|
|
|
)
|
|
|
|
|
2022-05-06 16:46:22 +02:00
|
|
|
if(UNIQUE_OBSW_BIN_NAME)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${OBSW_NAME}
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${OBSW_BIN_NAME}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${UNIQUE_OBSW_BIN_NAME}
|
|
|
|
COMMENT "Generating unique EIVE OBSW binary ${UNIQUE_OBSW_BIN_NAME}")
|
|
|
|
endif()
|
2022-05-06 16:43:12 +02:00
|
|
|
|
2022-04-18 21:49:04 +02:00
|
|
|
add_custom_command(
|
|
|
|
TARGET ${WATCHDOG_NAME}
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_STRIP} --strip-all eive-watchdog -o ${STRIPPED_WATCHDOG_NAME}
|
|
|
|
BYPRODUCTS ${STRIPPED_WATCHDOG_NAME}
|
|
|
|
COMMENT "Generating stripped executable ${STRIPPED_WATCHDOG_NAME}.."
|
|
|
|
)
|
|
|
|
|
2020-12-29 01:09:59 +01:00
|
|
|
endfunction()
|