Skip to content

Commit 482c95d

Browse files
committed
Remove indirection from ocloc_lib and ocloc names
This allows CMAKE to wrap the executable with -DCMAKE_CROSSCOMPILING_EMULATOR=... Signed-off-by: Zoltán Böszörményi <[email protected]>
1 parent 92c2c07 commit 482c95d

File tree

7 files changed

+42
-43
lines changed

7 files changed

+42
-43
lines changed

level_zero/core/test/unit_tests/gen_kernel.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ function(level_zero_gen_kernels target platform_name suffix options)
3333
)
3434

3535
add_custom_command(
36-
COMMAND echo generate ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
36+
COMMAND echo generate ocloc -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
3737
OUTPUT ${output_files}
38-
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
38+
COMMAND ocloc -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
3939
WORKING_DIRECTORY ${workdir}
4040
DEPENDS ${filepath} ocloc
4141
)

opencl/source/built_ins/kernels/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
7676
list(APPEND __cloc__options__ "-cl-kernel-arg-info")
7777
add_custom_command(
7878
OUTPUT ${OUTPUT_FILES}
79-
COMMAND ${cloc_cmd_prefix} -q -file ${FILENAME} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -out_dir ${OUTPUTDIR} -options "$<JOIN:${__cloc__options__}, >"
79+
COMMAND ocloc -q -file ${FILENAME} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -out_dir ${OUTPUTDIR} -options "$<JOIN:${__cloc__options__}, >"
8080
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
8181
DEPENDS ${builtin} ocloc copy_compiler_files
8282
)

opencl/source/scheduler/scheduler_binary.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function(compile_kernel target gen_type platform_type kernel)
4949
list(APPEND __cloc__options__ "-cl-intel-disable-a64WA")
5050
add_custom_command(
5151
OUTPUT ${OUTPUTPATH}
52-
COMMAND ${cloc_cmd_prefix} -q -file ${kernel} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} -cl-intel-greater-than-4GB-buffer-required -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "$<JOIN:${__cloc__options__}, >" -internal_options "-cl-intel-no-spill"
52+
COMMAND ocloc -q -file ${kernel} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} -cl-intel-greater-than-4GB-buffer-required -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "$<JOIN:${__cloc__options__}, >" -internal_options "-cl-intel-no-spill"
5353
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
5454
DEPENDS ${kernel} ocloc copy_compiler_files
5555
)

opencl/test/unit_test/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ function(neo_gen_kernels platform_name_with_type platform_name revision_id suffi
232232

233233
add_custom_command(
234234
OUTPUT ${output_files}
235-
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir}
235+
COMMAND ocloc -q -file ${filename} -device ${platform_name} -${NEO_BITS} -revision_id ${revision_id} -out_dir ${outputdir}
236236
WORKING_DIRECTORY ${workdir}
237237
DEPENDS ${filepath} ocloc
238238
)
@@ -265,7 +265,7 @@ function(neo_gen_kernels_with_options platform_name_with_type platform_name revi
265265

266266
add_custom_command(
267267
OUTPUT ${output_files}
268-
COMMAND ${cloc_cmd_prefix} -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id} -options ${arg} -options_name
268+
COMMAND ocloc -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id} -options ${arg} -options_name
269269
WORKING_DIRECTORY ${workdir}
270270
DEPENDS ${filearg} ocloc
271271
)
@@ -304,7 +304,7 @@ function(neo_gen_kernels_with_internal_options platform_name_with_type platform_
304304

305305
add_custom_command(
306306
OUTPUT ${output_files}
307-
COMMAND ${cloc_cmd_prefix} -file ${filename} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} ${output_name} -internal_options ${ARGN}
307+
COMMAND ocloc -file ${filename} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} ${output_name} -internal_options ${ARGN}
308308
WORKING_DIRECTORY ${workdir}
309309
DEPENDS ${filearg} ocloc
310310
)
@@ -338,7 +338,7 @@ function(neo_gen_kernel_with_kernel_debug_options platform_name_with_type platfo
338338

339339
add_custom_command(
340340
OUTPUT ${output_files}
341-
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} -output ${argwospaces} -internal_options ${TEST_KERNEL_kernel_debug_enable} -options "-g"
341+
COMMAND ocloc -q -file ${filename} -device ${platform_name} -revision_id ${revision_id} -${NEO_BITS} -out_dir ${outputdir} -output ${argwospaces} -internal_options ${TEST_KERNEL_kernel_debug_enable} -options "-g"
342342
WORKING_DIRECTORY ${workdir}
343343
DEPENDS ${filepath} ocloc
344344
)
@@ -363,7 +363,7 @@ function(neo_gen_kernel_from_ll platform_name_with_type platform_name suffix fil
363363

364364
add_custom_command(
365365
OUTPUT ${output_files}
366-
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -output ${output_name} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${compile_options} -llvm_input
366+
COMMAND ocloc -q -file ${filename} -output ${output_name} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${compile_options} -llvm_input
367367
WORKING_DIRECTORY ${workdir}
368368
DEPENDS ${filepath} ocloc
369369
)

shared/offline_compiler/source/CMakeLists.txt

+29-30
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
# SPDX-License-Identifier: MIT
55
#
66

7-
project(${OCLOC_NAME}_lib)
7+
project(ocloc_lib)
88

9-
set(OCLOC_NAME "ocloc")
109
set(OCLOC_FOLDER_NAME "offline_compiler")
1110

1211
set(CLOC_LIB_SRCS_LIB
@@ -146,12 +145,12 @@ set(CLOC_LIB_SRCS
146145
${CLOC_LIB_SRCS_LIB}
147146
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
148147
)
149-
add_library(${OCLOC_NAME}_lib SHARED ${CLOC_LIB_SRCS})
148+
add_library(ocloc_lib SHARED ${CLOC_LIB_SRCS})
150149

151150
add_subdirectories()
152151

153-
create_project_source_tree(${OCLOC_NAME}_lib)
154-
set_target_properties(${OCLOC_NAME}_lib PROPERTIES FOLDER ${OCLOC_FOLDER_NAME})
152+
create_project_source_tree(ocloc_lib)
153+
set_target_properties(ocloc_lib PROPERTIES FOLDER ${OCLOC_FOLDER_NAME})
155154

156155
set(CLOC_LIB_INCLUDES
157156
${ENGINE_NODE_DIR}
@@ -162,20 +161,20 @@ set(CLOC_LIB_INCLUDES
162161
${NEO__IGC_INCLUDE_DIR}
163162
)
164163

165-
target_include_directories(${OCLOC_NAME}_lib BEFORE PRIVATE ${CLOC_LIB_INCLUDES})
166-
target_include_directories(${OCLOC_NAME}_lib BEFORE PRIVATE ${IGA_INCLUDE_DIR})
164+
target_include_directories(ocloc_lib BEFORE PRIVATE ${CLOC_LIB_INCLUDES})
165+
target_include_directories(ocloc_lib BEFORE PRIVATE ${IGA_INCLUDE_DIR})
167166

168-
target_compile_definitions(${OCLOC_NAME}_lib PUBLIC ${CLOC_LIB_LIB_FLAGS_DEFINITIONS} ${SUPPORTED_GEN_FLAGS_DEFINITONS} DEFAULT_PLATFORM=${DEFAULT_SUPPORTED_PLATFORM}
167+
target_compile_definitions(ocloc_lib PUBLIC ${CLOC_LIB_LIB_FLAGS_DEFINITIONS} ${SUPPORTED_GEN_FLAGS_DEFINITONS} DEFAULT_PLATFORM=${DEFAULT_SUPPORTED_PLATFORM}
169168
IGA_LIBRARY_NAME=${CMAKE_SHARED_LIBRARY_PREFIX}${IGA_LIBRARY_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
170169
)
171-
target_compile_definitions(${OCLOC_NAME}_lib PUBLIC ${NEO__IGC_COMPILE_DEFINITIONS})
170+
target_compile_definitions(ocloc_lib PUBLIC ${NEO__IGC_COMPILE_DEFINITIONS})
172171

173172
if(MSVC)
174-
target_link_libraries(${OCLOC_NAME}_lib dbghelp)
173+
target_link_libraries(ocloc_lib dbghelp)
175174
endif()
176175

177176
if(UNIX)
178-
target_link_libraries(${OCLOC_NAME}_lib dl pthread)
177+
target_link_libraries(ocloc_lib dl pthread)
179178
endif()
180179

181180
set(CLOC_LIB_SRCS_LIB ${CLOC_LIB_SRCS_LIB} PARENT_SCOPE)
@@ -185,11 +184,11 @@ set(OCLOC_SRCS
185184
${OCLOC_DIRECTORY}/source/main.cpp
186185
)
187186

188-
add_executable(${OCLOC_NAME} ${OCLOC_SRCS})
189-
target_link_libraries(${OCLOC_NAME} ${OCLOC_NAME}_lib)
187+
add_executable(ocloc ${OCLOC_SRCS})
188+
target_link_libraries(ocloc ocloc_lib)
190189

191-
create_project_source_tree(${OCLOC_NAME})
192-
set_target_properties(${OCLOC_NAME} PROPERTIES FOLDER ${OCLOC_FOLDER_NAME})
190+
create_project_source_tree(ocloc)
191+
set_target_properties(ocloc PROPERTIES FOLDER ${OCLOC_FOLDER_NAME})
193192

194193
if(MSVC)
195194
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
@@ -203,42 +202,42 @@ endif()
203202

204203
if(UNIX)
205204
if(NEO_BUILD_DEBUG_SYMBOLS_PACKAGE)
206-
get_filename_component(lib_file_name $<TARGET_FILE:${OCLOC_NAME}_lib> NAME_WE)
205+
get_filename_component(lib_file_name $<TARGET_FILE:ocloc_lib> NAME_WE)
207206
set(symbols_file_name ${lib_file_name}.debug)
208-
set(debug_symbols_target_name "${STRIP_SYMBOLS_TARGET}_${OCLOC_NAME}_lib")
207+
set(debug_symbols_target_name "${STRIP_SYMBOLS_TARGET}_ocloc_lib")
209208
add_custom_target(${debug_symbols_target_name}
210209
COMMAND sh -c "objcopy --only-keep-debug ${lib_file_name} ${symbols_file_name}"
211210
COMMAND sh -c "strip -g ${lib_file_name}"
212211
COMMAND sh -c "objcopy --add-gnu-debuglink=${symbols_file_name} ${lib_file_name}"
213212
)
214-
add_dependencies(${debug_symbols_target_name} ${OCLOC_NAME}_lib)
213+
add_dependencies(${debug_symbols_target_name} ocloc_lib)
215214
add_dependencies(${STRIP_SYMBOLS_TARGET} ${debug_symbols_target_name})
216215
set_property(GLOBAL APPEND PROPERTY DEBUG_SYMBOL_FILES "${symbols_file_name}")
217216
endif()
218217

219-
set_property(GLOBAL APPEND PROPERTY NEO_OCL_COMPONENTS_LIST ${OCLOC_NAME})
220-
install(FILES $<TARGET_FILE:${OCLOC_NAME}>
218+
set_property(GLOBAL APPEND PROPERTY NEO_OCL_COMPONENTS_LIST ocloc)
219+
install(FILES $<TARGET_FILE:ocloc>
221220
DESTINATION ${CMAKE_INSTALL_BINDIR}
222221
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
223-
COMPONENT ${OCLOC_NAME}
222+
COMPONENT ocloc
224223
)
225-
install(FILES $<TARGET_FILE:${OCLOC_NAME}_lib>
224+
install(FILES $<TARGET_FILE:ocloc_lib>
226225
DESTINATION ${CMAKE_INSTALL_LIBDIR}
227226
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
228-
COMPONENT ${OCLOC_NAME}
227+
COMPONENT ocloc
229228
)
230229
install(FILES ${OCLOC_DIRECTORY}/source/ocloc_api.h
231230
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
232231
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
233-
COMPONENT ${OCLOC_NAME}
232+
COMPONENT ocloc
234233
)
235234
elseif(WIN32)
236235
if(NEO_WINDOWS_INSTALL)
237-
install(TARGETS ${OCLOC_NAME}
236+
install(TARGETS ocloc
238237
DESTINATION ${CMAKE_INSTALL_BINDIR}
239238
COMPONENT ocloc
240239
)
241-
install(TARGETS ${OCLOC_NAME}_lib
240+
install(TARGETS ocloc_lib
242241
DESTINATION ${CMAKE_INSTALL_LIBDIR}
243242
COMPONENT ocloc
244243
)
@@ -249,8 +248,8 @@ elseif(WIN32)
249248
endif()
250249
endif()
251250

252-
set(OCLOC_OUTPUT_NAME "${OCLOC_NAME}${OCLOC_BITNESS_SUFFIX}")
253-
set_target_properties(${OCLOC_NAME}_lib PROPERTIES OUTPUT_NAME ${OCLOC_OUTPUT_NAME})
251+
set(OCLOC_OUTPUT_NAME "ocloc${OCLOC_BITNESS_SUFFIX}")
252+
set_target_properties(ocloc_lib PROPERTIES OUTPUT_NAME ${OCLOC_OUTPUT_NAME})
254253

255254
add_custom_target(copy_compiler_files DEPENDS ${NEO__IGC_TARGETS})
256255
set_target_properties(copy_compiler_files PROPERTIES FOLDER ${OCLOC_FOLDER_NAME})
@@ -260,8 +259,8 @@ if(WIN32)
260259
add_custom_command(
261260
TARGET copy_compiler_files
262261
PRE_BUILD
263-
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${OCLOC_NAME}_lib>
264-
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_tmp}> $<TARGET_FILE_DIR:${OCLOC_NAME}_lib>
262+
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:ocloc_lib>
263+
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_tmp}> $<TARGET_FILE_DIR:ocloc_lib>
265264
)
266265
endforeach()
267266
endif()

shared/source/built_ins/kernels/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
7878
set(INTERNAL_OPTIONS "${${mode}_OPTIONS}")
7979
add_custom_command(
8080
OUTPUT ${OUTPUT_FILE_SPV}
81-
COMMAND ${cloc_cmd_prefix} -q -file ${FILENAME} -spv_only -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME} -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$<JOIN:${__cloc__options__}, >"
81+
COMMAND ocloc -q -file ${FILENAME} -spv_only -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME} -out_dir ${OUTPUTDIR} ${INTERNAL_OPTIONS} -options "$<JOIN:${__cloc__options__}, >"
8282
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
8383
DEPENDS ${builtin} ocloc copy_compiler_files
8484
)
@@ -94,7 +94,7 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
9494
list(APPEND BUILTINS_COMMANDS "${OUTPUT_FILE_CPP}")
9595
add_custom_command(
9696
OUTPUT ${OUTPUT_FILES_BINARIES}
97-
COMMAND ${cloc_cmd_prefix} -q -file ${OUTPUT_FILE_SPV} -spirv_input -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME}_${REVISION_ID} -out_dir ${OUTPUTDIR} -revision_id ${REVISION_ID} ${INTERNAL_OPTIONS} -options "$<JOIN:${__cloc__options__}, >"
97+
COMMAND ocloc -q -file ${OUTPUT_FILE_SPV} -spirv_input -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${builtin_options} -${bits} -output ${mode}_${BASENAME}_${REVISION_ID} -out_dir ${OUTPUTDIR} -revision_id ${REVISION_ID} ${INTERNAL_OPTIONS} -options "$<JOIN:${__cloc__options__}, >"
9898
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
9999
DEPENDS ${OUTPUT_FILE_SPV} ocloc copy_compiler_files
100100
)
@@ -138,7 +138,7 @@ if(NOT NEO_DISABLE_BUILTINS_COMPILATION)
138138
set(OUTPUT_LIST_CPP_FILES ${OUTPUT_LIST_CPP_FILES} ${OUTPUT_FILE_CPP} PARENT_SCOPE)
139139
add_custom_command(
140140
OUTPUT ${GENERATED_SPV_INPUT}
141-
COMMAND ${cloc_cmd_prefix} -q -spv_only -file ${INPUT_FILENAME} -out_dir ${OUTPUTDIR} -output_no_suffix -options "-cl-kernel-arg-info"
141+
COMMAND ocloc -q -spv_only -file ${INPUT_FILENAME} -out_dir ${OUTPUTDIR} -output_no_suffix -options "-cl-kernel-arg-info"
142142
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
143143
DEPENDS ${INPUT_FILENAME} ocloc copy_compiler_files
144144
)

shared/test/common/test_files/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function(compile_kernels_gen platform_name_with_type revision_id platform_name s
3737

3838
add_custom_command(
3939
OUTPUT ${output_files}
40-
COMMAND ${cloc_cmd_prefix} -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id}
40+
COMMAND ocloc -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -revision_id ${revision_id}
4141
WORKING_DIRECTORY ${workdir}
4242
DEPENDS ${filepath} ocloc copy_compiler_files
4343
)

0 commit comments

Comments
 (0)