1 cmake_minimum_required(VERSION 3.23)
2
3 # Heroius: set() function should be called before project() to take effect, otherwise default compilers will be used.
4
5 # specify Intel oneAPI compiler
6 # Heroius: use '/' instead of '\\' in file paths to avoid incorrect mutiple letter escaping.
7 # Heroius: however these compiler flags seem only placeholders and not used at all.
8 set(CMAKE_C_COMPILER "C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/dpcpp.exe" CACHE STRING "" FORCE)
9 set(CMAKE_CXX_COMPILER "C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/dpcpp.exe" CACHE STRING "" FORCE)
10
11 # Heroius: the toolchain string determines used c++ compiler, but leaves c compiler unset.
12 set(CMAKE_GENERATOR_TOOLSET "Intel(R) oneAPI DPC++ Compiler 2023")
13
14 # Heroius: skip c compiler checking, since c compiler is just a mock.
15 set(CMAKE_C_COMPILER_WORKS TRUE)
16
17 # Set the project name and version
18 # Heroius: move project() instruction here to make flags take effect.
19 project(HelloCMake)
20
21 # look for Intel oneAPI CMake toolchain files
22 # Heroius: strange error occurs if c compiler checking is not skipped.
23 find_package(IntelSYCL REQUIRED)
24
25 # Add the executable
26 add_executable(HelloCMake HelloCMake.cpp)
27
28 # Heroius: there should be a way that can include sycl libs to generation path, so that the app can run itself.
29 # add_sycl_to_target(TARGET HelloCMake SOURCES HelloCMake.cpp)
30
31 set_target_properties(HelloCMake PROPERTIES
32 RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin
33 RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin
34 # ... add other configurations if needed
35 )
36
37 # Set executable path
38 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)