James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 1 | set(scripts_dir "${CMAKE_CURRENT_LIST_DIR}/../scripts") |
Maxwell Henderson | 80bec32 | 2024-01-09 15:48:44 -0800 | [diff] [blame^] | 2 | macro( |
| 3 | generate_resources |
| 4 | inputDir |
| 5 | outputDir |
| 6 | prefix |
| 7 | namespace |
| 8 | outputFiles |
| 9 | ) |
| 10 | file(GLOB inputFiles ${inputDir}/*) |
| 11 | set(${outputFiles}) |
| 12 | foreach(input ${inputFiles}) |
| 13 | get_filename_component(inputBase ${input} NAME) |
| 14 | if("${inputBase}" MATCHES "^\\.") |
| 15 | continue() |
| 16 | endif() |
| 17 | set(output "${outputDir}/${inputBase}.cpp") |
| 18 | list(APPEND ${outputFiles} "${output}") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 19 | |
Maxwell Henderson | 80bec32 | 2024-01-09 15:48:44 -0800 | [diff] [blame^] | 20 | add_custom_command( |
| 21 | OUTPUT ${output} |
| 22 | COMMAND |
| 23 | ${CMAKE_COMMAND} "-Dinput=${input}" "-Doutput=${output}" "-Dprefix=${prefix}" |
| 24 | "-Dnamespace=${namespace}" -P "${scripts_dir}/GenResource.cmake" |
| 25 | MAIN_DEPENDENCY ${input} |
| 26 | DEPENDS ${scripts_dir}/GenResource.cmake |
| 27 | VERBATIM |
| 28 | ) |
| 29 | endforeach() |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame] | 30 | endmacro() |