-
Notifications
You must be signed in to change notification settings - Fork 49
/
CMakeLists.txt
63 lines (53 loc) · 1.99 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
find_package(Clara REQUIRED)
# compile googletest
include(ExternalProject)
find_package(SystemBLAS REQUIRED)
set(PORTBLAS_TEST ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-shorten-64-to-32 -Wno-cast-align")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-copy-with-user-provided-copy -Wno-unused-variable")
# Download and build googletest
# The following operations are derived from the official advice on building googletest as a subproject,
# form the following documentation: https://github.com/google/googletest/blob/master/googletest/README.md
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/../cmake/templates/GTest.txt.in
${CMAKE_CURRENT_BINARY_DIR}/googletest-download/CMakeLists.txt
)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "Build step for googletest failed: ${result}")
endif()
# Prevent overriding the parent project's compiler/linker
# settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
${CMAKE_CURRENT_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)
# Set portBLAS options
if(CMAKE_CROSSCOMPILING)
set(cmake_toolchain
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
)
message(STATUS "Crossing : ${cmake_toolchain}")
endif()
if(VERBOSE)
add_definitions(-DVERBOSE=VERBOSE)
endif(VERBOSE)
if(SYCL_DEVICE)
add_definitions(-DSYCL_DEVICE=${SYCL_DEVICE})
endif(SYCL_DEVICE)
include_directories(
${GTEST_LIB}
${GMOCK_LIB}
)
add_subdirectory(unittest)
if(ENABLE_EXPRESSION_TESTS)
add_subdirectory(exprtest)
endif()