-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
61 lines (49 loc) · 1.87 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
cmake_minimum_required(VERSION 3.21)
project(Hetero-Mark LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
option(HMARK_BUILD_HIP "Build all Hetero-mark benchmarks for HIP" OFF)
option(HMARK_BUILD_CUDA "Build all Hetero-mark benchmarks for CUDA" OFF)
option(HMARK_BUILD_OPENCL20 "Build all Hetero-mark benchmarks for OpenCL2.0" OFF)
option(HMARK_BUILD_OPENCL12 "Build all Hetero-mark benchmarks for OpenCL1.2" OFF)
if (${HMARK_BUILD_HIP})
enable_language(HIP)
find_package(HIP REQUIRED)
endif ()
if (${HMARK_BUILD_OPENCL20} OR ${HMARK_BUILD_OPENCL12})
find_package(OpenCL REQUIRED)
endif ()
if (${HMARK_BUILD_CUDA})
enable_language(CUDA)
endif ()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
include(ExternalProject)
include(StyleCheck)
set(FOLDER_NAME Hetero-Mark)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
# Include from path root
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR})
# Test
option(ENABLE_TEST "Compile all Hetero-Mark unit tests" OFF)
if (${ENABLE_TEST})
enable_testing()
ExternalProject_Add(googletest
URL https://googletest.googlecode.com/files/gtest-1.7.0.zip
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gtest
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(googletest binary_dir)
ExternalProject_Get_Property(googletest source_dir)
add_library(gtest UNKNOWN IMPORTED)
add_library(gtest_main UNKNOWN IMPORTED)
set_target_properties(gtest PROPERTIES
IMPORTED_LOCATION ${binary_dir}/libgtest.a)
set_target_properties(gtest_main PROPERTIES
IMPORTED_LOCATION ${binary_dir}/libgtest_main.a)
add_dependencies(gtest googletest)
add_dependencies(gtest_main googletest)
include_directories(${source_dir}/include)
endif ()
add_subdirectory(src)