-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathCMakeLists.txt
90 lines (79 loc) · 3.91 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#/***************************************************************************
# *
# * Copyright (C) Codeplay Software Ltd.
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *
# * Codeplay's SYCL-For-CUDA-Examples
# *
# * CMakeLists.txt
# *
# * Description:
# * CMake for hash functions
# **************************************************************************/
cmake_minimum_required(VERSION 3.0)
project(SYCL_HASH LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
option(VERBOSE_LIB "Adds various prints in the code" OFF)
if (VERBOSE_LIB)
#message(WARNING "Verbose mode on. Did you forget it?")
add_compile_definitions(VERBOSE_HASH_LIB)
endif ()
# If you're using the DPCPP compiler, these flags will be used. Set here the devies you want to target
set(DPCPP_FLAGS -fsycl -fsycl-targets=spir64_x86_64,nvptx64-nvidia-cuda -Xcuda-ptxas -v -Xsycl-target-backend=nvptx64-nvidia-cuda --cuda-gpu-arch=sm_75 -Wno-linker-warnings)
include(cmake/FindSYCL.cmake)
# Default C++ Flags for warnings and optimisation
set(WARNING_FLAGS "-Wall -Wextra -Wshadow -Wdouble-promotion -fno-common -Winit-self -Wuninitialized -Wmissing-declarations -Woverloaded-virtual")
set(EXTRA_W_FLAGS "-pedantic -Wall -Wextra -Wcast-align -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5") #-Wnoexcept -Wold-style-cast -Wstrict-null-sentinel -switch-default -Wlogical-op
set(DISABLED_WARNINGS "-Wno-c++20-extensions -Wno-inline-namespace-reopened-noninline -Wno-undef -Wno-unused -Wno-unused-command-line-argument")
set(OPT_FLAGS "-march=native -mtune=native -Ofast -fomit-frame-pointer")
# Adding the flags to the targets
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OPT_FLAGS} ${DISABLED_WARNINGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${WARNING_FLAGS} ${EXTRA_W_FLAGS} ${DISABLED_WARNINGS} -g -Og")
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/include)
set(sycl_hash_all_kernels
src/hash_functions/sha256.cpp
src/hash_functions/blake2b.cpp
src/hash_functions/sha1.cpp
src/hash_functions/md5.cpp
src/hash_functions/keccak.cpp
src/hash_functions/md2.cpp
src/tools/queue_tester.cpp
)
set(sycl_hash_all_sources
src/benchmarks/misc.hpp
include/sycl_hash.hpp
include/internal/config.hpp
include/internal/handle.hpp
include/internal/common.hpp
include/internal/determine_kernel_config.hpp
include/internal/sync_api.hpp
include/internal/async_api.hpp
include/hash_functions/sha256.hpp
include/hash_functions/blake2b.hpp
include/hash_functions/sha1.hpp
include/hash_functions/md5.hpp
include/hash_functions/keccak.hpp
include/hash_functions/md2.hpp
include/tools/fill_rand.hpp
include/tools/sycl_queue_helpers.hpp
include/tools/usm_smart_ptr.hpp
include/tools/runtime_byte_array.hpp
include/tools/intrinsics.hpp
)
add_library(sycl_hash SHARED ${sycl_hash_all_sources} ${sycl_hash_all_kernels})
add_sycl_to_target(TARGET sycl_hash SOURCES ${sycl_hash_all_kernels})
add_executable(demo demo_main.cpp src/benchmarks/misc.hpp)
target_link_libraries(demo PUBLIC sycl_hash)
add_sycl_to_target(TARGET demo SOURCES demo_main.cpp)
include(tests/CMakeLists.txt)