Skip to content

Commit fb5626f

Browse files
authored
[NFC][libclc] Set MACRO_ARCH to ${ARCH} uncondionally before customizing (#156789)
Our downstream libclc add a few more targets that customizes build_flags and opt_flags. Then in each customization block, MACRO_ARCH is defined to be ${ARCH}. Hoisting MACRO_ARCH definition out of if-else-end block avoids code duplication. This also avoids potential error when MACRO_ARCH definition is forgotten, e.g. in intel/llvm#19971.
1 parent 10bcf0c commit fb5626f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libclc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
394394

395395
message( STATUS " device: ${d} ( ${${d}_aliases} )" )
396396

397+
set( MACRO_ARCH ${ARCH} )
397398
if ( ARCH STREQUAL spirv OR ARCH STREQUAL spirv64 )
398399
set( build_flags -O0 -finline-hint-functions -DCLC_SPIRV )
399400
set( opt_flags )
@@ -412,7 +413,6 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
412413
else()
413414
set( build_flags )
414415
set( opt_flags -O3 )
415-
set( MACRO_ARCH ${ARCH} )
416416
endif()
417417

418418
set( LIBCLC_ARCH_OBJFILE_DIR "${LIBCLC_OBJFILE_DIR}/${arch_suffix}" )

0 commit comments

Comments
 (0)