-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use add_umf_library() instead of add_ur_library()
add_ur_library() is undefined in UMF now, because it is defined only in the UR project. Define and use add_umf_library() instead of add_ur_library(), so that UMF can be used as a stand-alone project. Fixes: #981 Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
- Loading branch information
Showing
2 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
source/common/unified_malloc_framework/cmake/helpers.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Copyright (C) 2023 Intel Corporation | ||
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
# See LICENSE.TXT | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# | ||
# helpers.cmake -- helper functions for top-level CMakeLists.txt | ||
# | ||
|
||
function(add_umf_target_compile_options name) | ||
if(NOT MSVC) | ||
target_compile_options(${name} PRIVATE | ||
-fPIC | ||
-Wall | ||
-Wpedantic | ||
-Wempty-body | ||
-Wunused-parameter | ||
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always> | ||
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-fcolor-diagnostics> | ||
) | ||
if (CMAKE_BUILD_TYPE STREQUAL "Release") | ||
target_compile_definitions(${name} PRIVATE -D_FORTIFY_SOURCE=2) | ||
endif() | ||
if(UR_DEVELOPER_MODE) | ||
target_compile_options(${name} PRIVATE | ||
-Werror | ||
-fno-omit-frame-pointer | ||
-fstack-protector-strong | ||
) | ||
endif() | ||
elseif(MSVC) | ||
target_compile_options(${name} PRIVATE | ||
$<$<CXX_COMPILER_ID:MSVC>:/MP> # clang-cl.exe does not support /MP | ||
/W3 | ||
/MD$<$<CONFIG:Debug>:d> | ||
/GS | ||
) | ||
|
||
if(UR_DEVELOPER_MODE) | ||
target_compile_options(${name} PRIVATE /WX /GS) | ||
endif() | ||
endif() | ||
endfunction() | ||
|
||
function(add_umf_target_link_options name) | ||
if(NOT MSVC) | ||
if (NOT APPLE) | ||
target_link_options(${name} PRIVATE "LINKER:-z,relro,-z,now") | ||
endif() | ||
elseif(MSVC) | ||
target_link_options(${name} PRIVATE | ||
/DYNAMICBASE | ||
/HIGHENTROPYVA | ||
/NXCOMPAT | ||
) | ||
endif() | ||
endfunction() | ||
|
||
function(add_umf_library name) | ||
add_library(${name} ${ARGN}) | ||
add_umf_target_compile_options(${name}) | ||
add_umf_target_link_options(${name}) | ||
endfunction() |