Skip to content

Commit bd6226f

Browse files
committed
Copy UMF code from UR repo
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 447dcd6 commit bd6226f

25 files changed

+1701
-0
lines changed

.gitignore

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
*.exp
10+
*.pdb
11+
*.log
12+
*.tlog
13+
*.ilk
14+
*.idb
15+
*.CopyComplete
16+
*.pyc
17+
*.tmp
18+
19+
# Precompiled Headers
20+
*.gch
21+
*.pch
22+
*.ipch
23+
24+
# Compiled Dynamic libraries
25+
*.so
26+
*.dylib
27+
*.dll
28+
29+
# Project files
30+
*.sln
31+
*.vcproj
32+
*.vcxproj
33+
*.pyproj
34+
*.suo
35+
*.db
36+
*.opendb
37+
*.user
38+
*.filters
39+
.vs/
40+
.idea/
41+
42+
# Compiled Static libraries
43+
*.lai
44+
*.la
45+
*.a
46+
*.lib
47+
48+
# Executables
49+
*.exe
50+
*.out
51+
*.app
52+
53+
# Debug files
54+
scripts/**/*.json
55+
56+
# Python cache
57+
__pycache__/
58+
*.py[cod]
59+
60+
# Generated docs
61+
docs/
62+
63+
# Build files
64+
/build*/
65+
out/
66+
67+
# irepo files
68+
.irepo
69+
70+
# ci deps
71+
.deps
72+
73+
# third_party files
74+
/third_party/*/
75+
76+
77+
# VS CMake settings
78+
/CMakeSettings.json
79+
80+
# Temporary files
81+
*.~vsdx
82+
83+
# IDE Files
84+
/.vscode
85+
/.devcontainer

CMakeLists.txt

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Copyright (C) 2022-2023 Intel Corporation
2+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
6+
project(unified-memory-framework VERSION 0.1.0)
7+
8+
include(CTest)
9+
10+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
11+
include(helpers)
12+
13+
# Build Options
14+
option(UMF_DEVELOPER_MODE "enable developer checks, treats warnings as errors" OFF)
15+
option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
16+
17+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
18+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
19+
set(CMAKE_UMF_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
20+
if(MSVC)
21+
set(CMAKE_UMF_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<CONFIG>)
22+
endif()
23+
24+
# Define a path for custom commands to work around MSVC
25+
set(CUSTOM_COMMAND_BINARY_DIR ${CMAKE_UMF_OUTPUT_DIRECTORY})
26+
if(MSVC)
27+
# MSVC implicitly adds $<CONFIG> to the output path
28+
set(CUSTOM_COMMAND_BINARY_DIR ${CUSTOM_COMMAND_BINARY_DIR}/$<CONFIG>)
29+
endif()
30+
31+
# Obtain files for clang-format and license check
32+
set(format_glob)
33+
set(license_glob)
34+
foreach(dir examples include source test tools)
35+
list(APPEND format_glob
36+
"${dir}/*.h"
37+
"${dir}/*.c"
38+
"${dir}/**/*.h"
39+
"${dir}/**/*.c")
40+
list(APPEND license_glob
41+
"${dir}/*.yml"
42+
"${dir}/**/*.yml"
43+
"${dir}/*.py"
44+
"${dir}/**/*.py"
45+
"${dir}/**/CMakeLists.txt"
46+
"${dir}/CMakeLists.txt"
47+
)
48+
endforeach()
49+
file(GLOB_RECURSE format_src ${format_glob})
50+
file(GLOB_RECURSE license_src ${license_glob})
51+
52+
# A header only library to specify include directories in transitive
53+
# dependencies.
54+
add_library(umf_headers INTERFACE)
55+
# Alias target to support FetchContent.
56+
add_library(${PROJECT_NAME}::headers ALIAS umf_headers)
57+
target_include_directories(umf_headers INTERFACE
58+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
59+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
60+
61+
# Add the include directory and the headers target to the install.
62+
install(
63+
DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
64+
DESTINATION include COMPONENT umf_headers)
65+
install(
66+
TARGETS umf_headers
67+
EXPORT ${PROJECT_NAME}-targets)
68+
69+
add_subdirectory(src)
70+
add_subdirectory(test)
71+
72+
# Add the list of installed targets to the install. This includes the namespace
73+
# which all installed targets will be prefixed with, e.g. for the headers
74+
# target users will depend on ${PROJECT_NAME}::headers.
75+
install(
76+
EXPORT ${PROJECT_NAME}-targets
77+
FILE ${PROJECT_NAME}-targets.cmake
78+
NAMESPACE ${PROJECT_NAME}::
79+
DESTINATION lib/cmake/${PROJECT_NAME})
80+
81+
# Configure the package versions file for use in find_package when installed.
82+
write_basic_package_version_file(
83+
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake
84+
COMPATIBILITY SameMajorVersion)
85+
# Configure the package file that is searched for by find_package when
86+
# installed.
87+
configure_package_config_file(
88+
${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in
89+
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake
90+
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME})
91+
92+
# Add the package files to the install.
93+
install(
94+
FILES
95+
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake
96+
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake
97+
DESTINATION lib/cmake/${PROJECT_NAME})

0 commit comments

Comments
 (0)