Skip to content

Commit a88cb0a

Browse files
authored
Merge pull request #77 from ldorau/Fixes_required_to_use_UMF_as_an_external_project
Fixes required to use UMF as an external project
2 parents 89e431b + 1a8c31a commit a88cb0a

File tree

9 files changed

+19
-10
lines changed

9 files changed

+19
-10
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ else()
3535
message(FATAL_ERROR "Unknown OS type")
3636
endif()
3737

38+
# needed when UMF is used as an external project
39+
set(UMF_CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
40+
3841
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
3942
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
4043
set(CMAKE_UMF_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

benchmark/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ endif()
88

99
add_executable(ubench ubench.c)
1010
add_dependencies(ubench unified_memory_framework)
11-
target_include_directories(ubench PRIVATE ../include/)
11+
target_include_directories(ubench PRIVATE ${UMF_CMAKE_SOURCE_DIR}/include/)
1212
target_link_libraries(ubench
1313
unified_memory_framework
1414
numa

cmake/helpers.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ endfunction()
8282
function(add_umf_library name)
8383
add_library(${name} ${ARGN})
8484
target_include_directories(${name} PRIVATE
85-
${CMAKE_SOURCE_DIR}/include
86-
${CMAKE_SOURCE_DIR}/src/common)
85+
${UMF_CMAKE_SOURCE_DIR}/include
86+
${UMF_CMAKE_SOURCE_DIR}/src/common)
8787
add_umf_target_compile_options(${name})
8888
add_umf_target_link_options(${name})
8989
endfunction()

src/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
include(../cmake/helpers.cmake)
5+
include(${UMF_CMAKE_SOURCE_DIR}/cmake/helpers.cmake)
66

77
set(UMF_SOURCES
88
memory_pool.c
@@ -54,7 +54,12 @@ endif()
5454

5555
add_library(${PROJECT_NAME}::unified_memory_framework ALIAS unified_memory_framework)
5656

57-
target_include_directories(unified_memory_framework PUBLIC ../include ./common ./provider ./critnib)
57+
target_include_directories(unified_memory_framework PUBLIC
58+
${UMF_CMAKE_SOURCE_DIR}/include
59+
./common
60+
./critnib
61+
./provider
62+
./utils)
5863

5964
# libumf_pool_jemalloc
6065
if(UMF_BUILD_LIBUMF_POOL_JEMALLOC)

src/critnib/critnib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
#include <stdbool.h>
5858
#include <stddef.h>
5959

60-
#include "../utils/utils_concurrency.h"
6160
#include "critnib.h"
61+
#include "utils_concurrency.h"
6262

6363
/*
6464
* A node that has been deleted is left untouched for this many delete

src/pool/pool_disjoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
// TODO: replace with logger?
2323
#include <iostream>
2424

25-
#include "../utils/utils_math.h"
2625
#include "umf.h"
2726
#include "umf/pools/pool_disjoint.h"
2827
#include "umf_helpers.hpp"
28+
#include "utils_math.h"
2929

3030
typedef struct umf_disjoint_pool_shared_limits_t {
3131
size_t MaxSize;

test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ function(add_umf_test)
3939

4040
target_include_directories(${TEST_TARGET_NAME} PRIVATE
4141
${UMF_TEST_DIR}/common
42-
${CMAKE_SOURCE_DIR}/src/pool/disjoint)
42+
${UMF_CMAKE_SOURCE_DIR}/src
43+
${UMF_CMAKE_SOURCE_DIR}/src/pool/disjoint)
4344

4445
add_test(NAME ${TEST_NAME}
4546
COMMAND ${TEST_TARGET_NAME}

test/common/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ set(COMMON_SOURCES
1212

1313
add_umf_library(test_common STATIC ${COMMON_SOURCES})
1414

15-
target_include_directories(test_common PRIVATE ../../include)
15+
target_include_directories(test_common PRIVATE ${UMF_CMAKE_SOURCE_DIR}/include)

test/memory_pool_internal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#include "../src/memory_pool_internal.h"
5+
#include "memory_pool_internal.h"
66
#include "base.hpp"
77
#include "common/provider_null.h"
88
#include "pool.hpp"

0 commit comments

Comments
 (0)