forked from intel/vc-intrinsics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (56 loc) · 1.97 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
#=========================== begin_copyright_notice ============================
#
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
#============================ end_copyright_notice =============================
cmake_minimum_required(VERSION 3.13.4)
set(LLVM_GENX_INTRINSICS_VERSION 1.0)
set(LLVM_GENX_INTRINSICS_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
# check if we build inside llvm or not
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
get_filename_component(LLVM_CMAKE_PATH ${LLVM_DIR} ABSOLUTE BASE_DIR ${CMAKE_BINARY_DIR})
set(BUILD_EXTERNAL YES)
if(NOT DEFINED INSTALL_REQUIRED)
set(INSTALL_REQUIRED YES)
endif()
project(LLVM_GenXIntrinsics
VERSION
${LLVM_GENX_INTRINSICS_VERSION}
LANGUAGES
C CXX
)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED OFF)
find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_PATH}")
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${LLVM_CMAKE_DIR}
)
include(AddLLVM)
include(HandleLLVMOptions)
include_directories("${LLVM_INCLUDE_DIR}")
link_directories("${LLVM_LIBRARY_DIR}")
message(STATUS "Found LLVM: ${LLVM_VERSION}")
else(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(BUILD_EXTERNAL NO)
# LLVM_CMAKE_DIR is not set for non-standalone builds. Use LLVM_CMAKE_PATH
# instead. (see clang/CMakeLists.txt)
if(NOT LLVM_CMAKE_DIR)
set(LLVM_CMAKE_DIR ${LLVM_CMAKE_PATH})
endif()
endif(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
if(LLVM_VERSION_MAJOR VERSION_LESS 8)
message(FATAL_ERROR "VC-intrinsics do not support ${LLVM_VERSION} LLVM version")
endif()
include(FindPythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR
"Unable to find Python interpreter, required for builds and testing.
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
endif()
if("${PYTHON_VERSION_STRING}" VERSION_LESS 2.7)
message(FATAL_ERROR "Python 2.7 or newer is required")
endif()
add_subdirectory(GenXIntrinsics)