summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2019-04-21 17:07:07 -0600
committerTuowen Zhao <ztuowen@gmail.com>2019-04-21 17:07:07 -0600
commit0d9d17554280bf9d19ce2db84bd29b5c5743d454 (patch)
tree49f78b1e7dc4937483245c13053f03fc584ac83c /CMakeLists.txt
downloadsycltest-0d9d17554280bf9d19ce2db84bd29b5c5743d454.tar.gz
sycltest-0d9d17554280bf9d19ce2db84bd29b5c5743d454.tar.bz2
sycltest-0d9d17554280bf9d19ce2db84bd29b5c5743d454.zip
Initial commit
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..70da54a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 3.14)
+project(sycltest)
+
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_EXTENSIONS OFF)
+find_package(OpenMP REQUIRED)
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -fsycl")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -fsycl -march=native")
+
+get_filename_component(bin_dir "${CMAKE_CXX_COMPILER}" PATH)
+get_filename_component(install_dir "${bin_dir}" PATH)
+
+message(STATUS "Setting include/lib path according to compiler path: ${CMAKE_CXX_COMPILER}")
+message(STATUS "SYCL compiler install dir: ${install_dir}")
+
+set(CMAKE_BUILD_RPATH "${install_dir}/lib")
+
+add_executable(sycltest main.cpp)
+target_include_directories(sycltest PUBLIC "${install_dir}/include")
+target_link_directories(sycltest PUBLIC "${install_dir}/lib")
+target_link_libraries(sycltest stdc++ sycl OpenCL)