Summary: The current handling of `libclc` is to use custom clang jobs to compile source files. This is the way we used to compile GPU libraries, but we have largely moved away from this. The eventual goal is to simple be able to use `clang` like a normal project. One barrier to this is the lack of language support for OpenCL in CMake. This PR uses CMake's custom language support to define a minimal OpenCL language, largely just a wrapper around `clang -x cl`. This does nothing, just enables the support. Future PRs will need to untangle the mess of dependencies. The 'link+opt' steps that we now do should be able to simply be done as a custom `llvm-link` and `opt` job on the library, which isn't ideal but it still better than the current state.
27 lines
865 B
CMake
27 lines
865 B
CMake
set(CMAKE_CLC_OUTPUT_EXTENSION .o)
|
|
set(CMAKE_INCLUDE_FLAG_CLC "-I")
|
|
|
|
set(CMAKE_CLC_DEPFILE_FORMAT gcc)
|
|
set(CMAKE_DEPFILE_FLAGS_CLC "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
|
|
|
|
cmake_initialize_per_config_variable(CMAKE_CLC_FLAGS "Flags used by the CLC compiler")
|
|
|
|
if(NOT CMAKE_CLC_COMPILE_OBJECT)
|
|
set(CMAKE_CLC_COMPILE_OBJECT
|
|
"<CMAKE_CLC_COMPILER> -x cl <DEFINES> <INCLUDES> <FLAGS> -c -o <OBJECT> <SOURCE>")
|
|
endif()
|
|
|
|
if(NOT DEFINED CMAKE_CLC_ARCHIVE_CREATE)
|
|
set(CMAKE_CLC_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
endif()
|
|
if(NOT DEFINED CMAKE_CLC_ARCHIVE_APPEND)
|
|
set(CMAKE_CLC_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
endif()
|
|
if(NOT DEFINED CMAKE_CLC_ARCHIVE_FINISH)
|
|
set(CMAKE_CLC_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
|
|
endif()
|
|
|
|
set(CMAKE_CLC_USE_LINKER_INFORMATION FALSE)
|
|
|
|
set(CMAKE_CLC_INFORMATION_LOADED 1)
|