forked from NUCAR-DEV/Hetero-Mark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (47 loc) · 1.63 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
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
cmake_minimum_required(VERSION 3.2)
project(Hetero-Mark)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
include(ExternalProject)
include(HCC)
include(HIP)
include(CUDA)
include(StyleCheck)
include(OpenCL)
set(FOLDER_NAME Hetero-Mark)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -pthread")
add_definitions(-std=c++11)
# For Clang
if (CMAKE_CXX_COMPILER_ID MATCHES "[cC][lL][aA][nN][gG]")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument")
endif ()
# 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 (ENABLE_TEST)
# set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
set(SUBDIRECTORIES src)
foreach(subdir ${SUBDIRECTORIES})
add_subdirectory(${subdir})
endforeach(subdir)