TargetArchitectureSpecificSources.cmake 1.1 KB

123456789101112131415161718192021222324252627
  1. function(target_architecture_specific_sources project arch)
  2. if (NOT DYNARMIC_MULTIARCH_BUILD)
  3. target_sources("${project}" PRIVATE ${ARGN})
  4. return()
  5. endif()
  6. foreach(input_file IN LISTS ARGN)
  7. if(input_file MATCHES ".cpp$")
  8. if(NOT IS_ABSOLUTE ${input_file})
  9. set(input_file "${CMAKE_CURRENT_SOURCE_DIR}/${input_file}")
  10. endif()
  11. set(output_file "${CMAKE_CURRENT_BINARY_DIR}/arch_gen/${input_file}")
  12. add_custom_command(
  13. OUTPUT "${output_file}"
  14. COMMAND ${CMAKE_COMMAND} "-Darch=${arch}"
  15. "-Dinput_file=${input_file}"
  16. "-Doutput_file=${output_file}"
  17. -P "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/impl/TargetArchitectureSpecificSourcesWrapFile.cmake"
  18. DEPENDS "${input_file}"
  19. VERBATIM
  20. )
  21. target_sources(${project} PRIVATE "${output_file}")
  22. endif()
  23. endforeach()
  24. endfunction()