forked from tenstorrent/tt-umd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
68 lines (54 loc) · 1.81 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
cmake_minimum_required(VERSION 3.16)
include(cmake/compilers.cmake)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) # This also impacts dependencies brought in through CPM
if(DEFINED ENV{CMAKE_C_COMPILER} AND DEFINED ENV{CMAKE_CXX_COMPILER})
message(STATUS "Setting C and C++ compiler from environment variables")
set(CMAKE_C_COMPILER $ENV{CMAKE_C_COMPILER})
set(CMAKE_CXX_COMPILER $ENV{CMAKE_CXX_COMPILER})
endif()
if(CMAKE_CXX_COMPILER AND CMAKE_C_COMPILER)
message(STATUS "Using specifed C++ compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS "Using specifed C compiler: ${CMAKE_C_COMPILER}")
else()
message(STATUS "No C or C++ compiler specified, defaulting to Clang-17")
FIND_AND_SET_CLANG17()
endif()
project(
umd
VERSION 0.1.0
DESCRIPTION "Tenstorrent User Mode Driver"
HOMEPAGE_URL "https://github.com/tenstorrent/tt-umd"
LANGUAGES
CXX
)
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
CHECK_COMPILERS()
include(check_libcpp)
include(GNUInstallDirs)
set(MASTER_PROJECT OFF)
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MASTER_PROJECT ON)
endif()
if(MASTER_PROJECT)
message(STATUS "UMD: Building as master project")
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING
"Release build is the default"
FORCE
)
endif()
include(sanitizer_options)
endif()
message(STATUS "UMD build type: ${CMAKE_BUILD_TYPE}")
include(dependencies)
add_subdirectory(device)
option(TT_UMD_BUILD_TESTS "Enables build of tt_umd tests" OFF)
if(TT_UMD_BUILD_TESTS)
add_subdirectory(tests)
endif(TT_UMD_BUILD_TESTS)
include(packaging)