file(GLOB_RECURSE SOFT_DEF_SOURCES include/*.def)
list(REMOVE_ITEM SOFT_BACKEND_SOURCES ${TESTS} ${DEF_CONV})
-# TODO move this macro to common make file
-macro(replace_ext ext dest_list src_list)
- SET(${dest_list} "")
- FOREACH(file IN LISTS ${src_list})
- GET_FILENAME_COMPONENT(file_path ${file} PATH)
- GET_FILENAME_COMPONENT(file_name ${file} NAME_WE)
- list(APPEND ${dest_list} "${file_path}/${file_name}/${ext}")
- ENDFOREACH()
-endmacro()
-
-replace_ext(".h" SOFT_GENERATED_SOURCES SOFT_DEF_SOURCES)
+set(SOFT_GENERATED_SOURCES "")
+foreach(file IN LISTS SOFT_DEF_SOURCES)
+ get_filename_component(file_name ${file} NAME_WE)
+ set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.h")
+ list(APPEND SOFT_GENERATED_SOURCES "${out_file}")
+ add_custom_command(
+ OUTPUT ${out_file}
+ COMMAND def2src ${CMAKE_CURRENT_BINARY_DIR} ${file}
+ DEPENDS def2src ${file}
+ )
+endforeach()
add_library(soft_backend SHARED ${SOFT_BACKEND_SOURCES} ${SOFT_GENERATED_SOURCES})
add_executable(def2src ${DEF_CONV})
-add_custom_command(
- OUTPUT ${SOFT_GENERATED_SOURCES}
- COMMAND def2src ${CMAKE_CURRENT_BINARY_DIR} ${SOFT_DEF_SOURCES}
- DEPENDS def2src ${SOFT_DEF_SOURCES}
-)
-
target_link_libraries(soft_backend PRIVATE nncc_core)
target_include_directories(soft_backend PUBLIC include)