Make sure to net generate 64bit suffixed source multiple times
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
co-authored by
Copilot
parent
275bc4c7b3
commit
fdee741c8a
@@ -22,7 +22,7 @@ function(_add_blas_test name src test_input)
|
||||
endfunction()
|
||||
|
||||
function(add_blas_test name source)
|
||||
get_filename_component(baseNAME ${input_src} NAME_WE)
|
||||
get_filename_component(baseNAME ${source} NAME_WE)
|
||||
set(test_input "${CMAKE_CURRENT_SOURCE_DIR}/${baseNAME}.in")
|
||||
|
||||
if(BUILD_DEFAULT_API)
|
||||
@@ -31,7 +31,7 @@ function(add_blas_test name source)
|
||||
|
||||
if(BUILD_INDEX64_EXT_API)
|
||||
include(ExtendedAPIHelpers)
|
||||
generate_64bit_suffixed_sources(${name}_64 source source_64)
|
||||
generate_64bit_suffixed_sources(${name} source source_64)
|
||||
|
||||
# Create 64-bit version of test input if it exists, replacing output
|
||||
# file names with their 64-bit counterparts
|
||||
|
||||
@@ -13,6 +13,8 @@ endif()
|
||||
# at build time in the Generate64BitSuffixedSource.cmake script.
|
||||
function(generate_64bit_suffixed_sources target source_list generated_sources)
|
||||
get_filename_component(destination "${target}_64_sources" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
get_property(_generated_64bit_source_files GLOBAL PROPERTY EXTENDED_API_GENERATED_SOURCE_FILES)
|
||||
set(new_generated_source_files)
|
||||
set(generated_source_files)
|
||||
|
||||
foreach(source IN LISTS ${source_list})
|
||||
@@ -27,28 +29,36 @@ function(generate_64bit_suffixed_sources target source_list generated_sources)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${output_file}"
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
"-DINPUT_FILE=${source_abs}"
|
||||
"-DOUTPUT_FILE=${output_file}"
|
||||
-P "${EXTENDED_API_GENERATOR}"
|
||||
DEPENDS
|
||||
"${source_abs}"
|
||||
"${EXTENDED_API_GENERATOR}"
|
||||
COMMENT "Generating 64-bit extended API source for ${source}"
|
||||
VERBATIM)
|
||||
# Make sure we only have one custom command generating a given output file
|
||||
if(NOT "${output_file}" IN_LIST _generated_64bit_source_files)
|
||||
add_custom_command(
|
||||
OUTPUT "${output_file}"
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
"-DINPUT_FILE=${source_abs}"
|
||||
"-DOUTPUT_FILE=${output_file}"
|
||||
-P "${EXTENDED_API_GENERATOR}"
|
||||
DEPENDS
|
||||
"${source_abs}"
|
||||
"${EXTENDED_API_GENERATOR}"
|
||||
COMMENT "Generating 64-bit extended API source for ${source}"
|
||||
VERBATIM)
|
||||
|
||||
list(APPEND new_generated_source_files "${output_file}")
|
||||
endif()
|
||||
|
||||
list(APPEND generated_source_files "${output_file}")
|
||||
endforeach()
|
||||
|
||||
if(generated_source_files)
|
||||
# Make sure each generated source file is only part of one target to
|
||||
# avoid multiple targets trying to generate the same file
|
||||
if(new_generated_source_files)
|
||||
add_custom_target("${target}_64bit_codegen" ALL
|
||||
DEPENDS ${generated_source_files}
|
||||
DEPENDS ${new_generated_source_files}
|
||||
COMMENT "Generating 64-bit suffixed sources for target ${target}")
|
||||
add_dependencies(64bit_codegen "${target}_64bit_codegen")
|
||||
set_source_files_properties(${generated_source_files} PROPERTIES GENERATED TRUE)
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY EXTENDED_API_GENERATED_SOURCE_FILES ${new_generated_source_files})
|
||||
endif()
|
||||
|
||||
set(${generated_sources} ${generated_source_files} PARENT_SCOPE)
|
||||
|
||||
@@ -113,11 +113,16 @@ function(add_eig_executable name)
|
||||
|
||||
if(BUILD_INDEX64_EXT_API)
|
||||
include(ExtendedAPIHelpers)
|
||||
generate_64bit_suffixed_sources(${name}_64 ${sources} sources_64)
|
||||
generate_64bit_suffixed_sources(${name} sources sources_64)
|
||||
|
||||
add_executable(${name}_64 ${sources_64})
|
||||
target_compile_options(${name}_64 PRIVATE ${FOPT_ILP64})
|
||||
target_link_libraries(${name}_64 ${TMGLIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
|
||||
|
||||
# Add depedency to the global codegen target. Since we reuse the same
|
||||
# generated source file for multiple tests, the generation could be
|
||||
# triggered by multiple targets when building in parallel.
|
||||
add_dependencies(${name}_64 64bit_codegen)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
@@ -254,11 +254,16 @@ function(add_lin_executable name)
|
||||
|
||||
if(BUILD_INDEX64_EXT_API)
|
||||
include(ExtendedAPIHelpers)
|
||||
generate_64bit_suffixed_sources(${name}_64 sources sources_64)
|
||||
generate_64bit_suffixed_sources(${name} sources sources_64)
|
||||
|
||||
add_executable(${name}_64 ${sources_64})
|
||||
target_compile_options(${name}_64 PRIVATE ${FOPT_ILP64})
|
||||
target_link_libraries(${name}_64 ${TMGLIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
|
||||
|
||||
# Add depedency to the global codegen target. Since we reuse the same
|
||||
# generated source file for multiple tests, the generation could be
|
||||
# triggered by multiple targets when building in parallel.
|
||||
add_dependencies(${name}_64 64bit_codegen)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user