navid/haze / commit
cea4731f3756
Navid M <navidmomtahen@gmail.com> · 2026-12-02
parents: 0609cfc40265
Browse files at this commit · Download source
--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -104,6 +104,13 @@ add_executable(hazert_test EXCLUDE_FROM_ALL tests/runtime_test.cpp) target_link_libraries(hazert_test PRIVATE hazert)++add_custom_target(clean-samples+ COMMAND "${CMAKE_COMMAND}"+ "-DSAMPLES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/samples"+ -P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/clean_samples.cmake"+ COMMENT "Removing generated sample binaries"+ VERBATIM) include(GNUInstallDirs) install(TARGETS hz RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")--- /dev/null+++ b/cmake/clean_samples.cmake@@ -0,0 +1,18 @@+if(NOT DEFINED SAMPLES_DIR)+ message(FATAL_ERROR "SAMPLES_DIR is required")+endif()++file(GLOB_RECURSE sample_sources LIST_DIRECTORIES false "${SAMPLES_DIR}/*.hz")++foreach(source IN LISTS sample_sources)+ get_filename_component(directory "${source}" DIRECTORY)+ get_filename_component(stem "${source}" NAME_WE)++ foreach(extension "" ".exe" ".o" ".s" ".ssa")+ set(candidate "${directory}/${stem}${extension}")+ if(EXISTS "${candidate}" AND NOT IS_DIRECTORY "${candidate}")+ file(REMOVE "${candidate}")+ message(STATUS "Removed ${candidate}")+ endif()+ endforeach()+endforeach()--- /dev/null+++ b/fw/clean.sh@@ -0,0 +1,3 @@+#!/usr/bin/sh++cmake --build build --target clean-samples