@@ -120,14 +120,14 @@ function(link_bc)
120
120
endif ()
121
121
122
122
add_custom_command (
123
- OUTPUT ${LIBCLC_ARCH_OBJFILE_DIR} /${ ARG_TARGET}.bc
124
- COMMAND ${llvm-link_exe} ${link_flags} -o ${LIBCLC_ARCH_OBJFILE_DIR} /${ ARG_TARGET}.bc ${LINK_INPUT_ARG}
123
+ OUTPUT ${ARG_TARGET} .bc
124
+ COMMAND ${llvm-link_exe} ${link_flags} -o ${ARG_TARGET} .bc ${LINK_INPUT_ARG}
125
125
DEPENDS ${llvm-link_target} ${ARG_DEPENDENCIES} ${ARG_INPUTS} ${RSP_FILE}
126
126
)
127
127
128
- add_custom_target ( ${ARG_TARGET} ALL DEPENDS ${LIBCLC_ARCH_OBJFILE_DIR} /${ ARG_TARGET}.bc )
128
+ add_custom_target ( ${ARG_TARGET} ALL DEPENDS ${ARG_TARGET} .bc )
129
129
set_target_properties ( ${ARG_TARGET} PROPERTIES
130
- TARGET_FILE ${LIBCLC_ARCH_OBJFILE_DIR } /${ARG_TARGET}.bc
130
+ TARGET_FILE ${CMAKE_CURRENT_BINARY_DIR } /${ARG_TARGET}.bc
131
131
FOLDER "libclc/Device IR/Linking"
132
132
)
133
133
endfunction ()
@@ -360,36 +360,33 @@ function(add_libclc_builtin_set)
360
360
# llvm-spirv tool.
361
361
if ( ARG_ARCH STREQUAL spirv OR ARG_ARCH STREQUAL spirv64 )
362
362
set ( obj_suffix ${ARG_ARCH_SUFFIX} .spv )
363
- set ( libclc_builtins_lib ${LIBCLC_OUTPUT_LIBRARY_DIR} /${obj_suffix} )
364
- add_custom_command ( OUTPUT ${libclc_builtins_lib}
365
- COMMAND ${llvm-spirv_exe} ${spvflags} -o ${libclc_builtins_lib} ${builtins_link_lib}
363
+ add_custom_command ( OUTPUT ${obj_suffix}
364
+ COMMAND ${llvm-spirv_exe} ${spvflags} -o ${obj_suffix} ${builtins_link_lib}
366
365
DEPENDS ${llvm-spirv_target} ${builtins_link_lib} ${builtins_link_lib_tgt}
367
366
)
368
367
else ()
369
368
# Non-SPIR-V targets add an extra step to optimize the bytecode
370
369
set ( builtins_opt_lib_tgt builtins.opt.${ARG_ARCH_SUFFIX} )
371
370
372
- add_custom_command ( OUTPUT ${LIBCLC_ARCH_OBJFILE_DIR} /${ builtins_opt_lib_tgt}.bc
373
- COMMAND ${opt_exe} ${ARG_OPT_FLAGS} -o ${LIBCLC_ARCH_OBJFILE_DIR} /${ builtins_opt_lib_tgt}.bc
371
+ add_custom_command ( OUTPUT ${builtins_opt_lib_tgt} .bc
372
+ COMMAND ${opt_exe} ${ARG_OPT_FLAGS} -o ${builtins_opt_lib_tgt} .bc
374
373
${builtins_link_lib}
375
374
DEPENDS ${opt_target} ${builtins_link_lib} ${builtins_link_lib_tgt}
376
375
)
377
376
add_custom_target ( ${builtins_opt_lib_tgt}
378
- ALL DEPENDS ${LIBCLC_ARCH_OBJFILE_DIR} /${ builtins_opt_lib_tgt}.bc
377
+ ALL DEPENDS ${builtins_opt_lib_tgt} .bc
379
378
)
380
379
set_target_properties ( ${builtins_opt_lib_tgt} PROPERTIES
381
- TARGET_FILE ${LIBCLC_ARCH_OBJFILE_DIR } /${builtins_opt_lib_tgt}.bc
380
+ TARGET_FILE ${CMAKE_CURRENT_BINARY_DIR } /${builtins_opt_lib_tgt}.bc
382
381
FOLDER "libclc/Device IR/Opt"
383
382
)
384
383
385
384
set ( builtins_opt_lib $< TARGET_PROPERTY:${builtins_opt_lib_tgt} ,TARGET_FILE> )
386
385
387
386
set ( obj_suffix ${ARG_ARCH_SUFFIX} .bc )
388
- set ( libclc_builtins_lib ${LIBCLC_OUTPUT_LIBRARY_DIR} /${obj_suffix} )
389
- add_custom_command ( OUTPUT ${libclc_builtins_lib}
390
- COMMAND ${prepare_builtins_exe} -o ${libclc_builtins_lib} ${builtins_opt_lib}
391
- DEPENDS ${builtins_opt_lib} ${builtins_opt_lib_tgt} ${prepare_builtins_target}
392
- )
387
+ add_custom_command ( OUTPUT ${obj_suffix}
388
+ COMMAND ${prepare_builtins_exe} -o ${obj_suffix} ${builtins_opt_lib}
389
+ DEPENDS ${builtins_opt_lib} ${builtins_opt_lib_tgt} ${prepare_builtins_target} )
393
390
endif ()
394
391
395
392
# Add a 'prepare' target
@@ -405,7 +402,7 @@ function(add_libclc_builtin_set)
405
402
add_dependencies ( prepare-${ARG_TRIPLE} prepare-${obj_suffix} )
406
403
407
404
install (
408
- FILES ${libclc_builtins_lib }
405
+ FILES ${CMAKE_CURRENT_BINARY_DIR} /${obj_suffix }
409
406
DESTINATION "${CMAKE_INSTALL_DATADIR} /clc"
410
407
)
411
408
@@ -421,27 +418,20 @@ function(add_libclc_builtin_set)
421
418
# * clspv targets don't include all OpenCL builtins
422
419
if ( NOT ARG_ARCH MATCHES "^(nvptx|clspv)(64)?$" )
423
420
add_test ( NAME external-calls-${obj_suffix}
424
- COMMAND ./check_external_calls.sh ${libclc_builtins_lib } ${LLVM_TOOLS_BINARY_DIR}
421
+ COMMAND ./check_external_calls.sh ${CMAKE_CURRENT_BINARY_DIR} /${obj_suffix } ${LLVM_TOOLS_BINARY_DIR}
425
422
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
426
423
endif ()
427
424
428
425
foreach ( a ${ARG_ALIASES} )
429
426
set ( alias_suffix "${a} -${ARG_TRIPLE} .bc" )
430
427
add_custom_command (
431
- OUTPUT ${LIBCLC_OUTPUT_LIBRARY_DIR} /${alias_suffix}
432
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${libclc_builtins_lib} ${LIBCLC_OUTPUT_LIBRARY_DIR} /${alias_suffix}
433
- DEPENDS prepare-${obj_suffix}
434
- )
435
- add_custom_target ( alias-${alias_suffix} ALL
436
- DEPENDS ${LIBCLC_OUTPUT_LIBRARY_DIR} /${alias_suffix}
437
- )
438
- set_target_properties ( alias-${alias_suffix}
439
- PROPERTIES FOLDER "libclc/Device IR/Aliases"
440
- )
441
- install (
442
- FILES ${LIBCLC_OUTPUT_LIBRARY_DIR} /${alias_suffix}
443
- DESTINATION "${CMAKE_INSTALL_DATADIR} /clc"
444
- )
428
+ OUTPUT ${alias_suffix}
429
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${obj_suffix} ${alias_suffix}
430
+ DEPENDS prepare-${obj_suffix} )
431
+ add_custom_target ( alias-${alias_suffix} ALL DEPENDS ${alias_suffix} )
432
+ set_target_properties ( alias-${alias_suffix} PROPERTIES FOLDER "libclc/Device IR/Aliases" )
433
+ install ( FILES ${CMAKE_CURRENT_BINARY_DIR} /${alias_suffix}
434
+ DESTINATION "${CMAKE_INSTALL_DATADIR} /clc" )
445
435
endforeach ( a )
446
436
endfunction (add_libclc_builtin_set )
447
437
0 commit comments