Skip to content

Commit

Permalink
Check that calling the tools didn't fail
Browse files Browse the repository at this point in the history
If the tool does fail we'll either fail to include the generated file on the next line, or ignore the error and continue using stale config
  • Loading branch information
Daft-Freak committed Jun 7, 2021
1 parent dd9d68d commit 8845674
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
11 changes: 9 additions & 2 deletions 32blit-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (NOT DEFINED BLIT_ONCE)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release")
endif()

if(WIN32)
add_definitions("-DWIN32")
endif()
Expand All @@ -36,7 +36,14 @@ if (NOT DEFINED BLIT_ONCE)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})

# get the inputs/outputs for the asset tool (at configure time)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m ttblit --debug cmake --config ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} --output ${CMAKE_CURRENT_BINARY_DIR} --cmake ${CMAKE_CURRENT_BINARY_DIR}/assets.cmake)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -m ttblit --debug cmake --config ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} --output ${CMAKE_CURRENT_BINARY_DIR} --cmake ${CMAKE_CURRENT_BINARY_DIR}/assets.cmake
RESULT_VARIABLE TOOL_RESULT
)
if(${TOOL_RESULT})
message(FATAL_ERROR "Reading asset config failed!\n")
endif()

include(${CMAKE_CURRENT_BINARY_DIR}/assets.cmake)

# do asset packing (at build time)
Expand Down
9 changes: 8 additions & 1 deletion 32blit-sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,14 @@ function(blit_metadata TARGET FILE)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${FILE})

# parse the metadata to variables
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m ttblit cmake --config ${FILE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -m ttblit cmake --config ${FILE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake
RESULT_VARIABLE TOOL_RESULT
)
if(${TOOL_RESULT})
message(FATAL_ERROR "Reading metadata config failed!\n")
endif()

include(${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake)

if(APPLE)
Expand Down
9 changes: 8 additions & 1 deletion 32blit-stm32/executable.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ function(blit_metadata TARGET FILE)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${FILE})

# get the inputs/outputs for the asset tool (at configure time)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m ttblit cmake --config ${FILE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -m ttblit cmake --config ${FILE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake
RESULT_VARIABLE TOOL_RESULT
)
if(${TOOL_RESULT})
message(FATAL_ERROR "Reading metadata config failed!\n")
endif()

include(${CMAKE_CURRENT_BINARY_DIR}/metadata.cmake)

if(${CMAKE_VERSION} VERSION_LESS "3.15.0")
Expand Down

0 comments on commit 8845674

Please sign in to comment.