xref: /oneTBB/python/rml/CMakeLists.txt (revision fa3268c3)
1# Copyright (c) 2020-2021 Intel Corporation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15add_library(irml
16    ../../src/tbb/allocator.cpp
17    ../../src/tbb/dynamic_link.cpp
18    ../../src/tbb/misc.cpp
19    ../../src/tbb/misc_ex.cpp
20    ../../src/tbb/exception.cpp
21    ipc_server.cpp
22    ipc_utils.cpp
23)
24add_library(TBB::irml ALIAS irml)
25
26set_target_properties(irml PROPERTIES VERSION 1)
27
28target_include_directories(irml
29    PUBLIC
30    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
31    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
32
33target_compile_options(irml
34    PRIVATE
35    ${TBB_CXX_STD_FLAG} # TODO: consider making it PUBLIC.
36    ${TBB_MMD_FLAG}
37    ${TBB_DSE_FLAG}
38    ${TBB_WARNING_LEVEL}
39    ${TBB_LIB_COMPILE_FLAGS}
40    ${TBB_COMMON_COMPILE_FLAGS}
41)
42
43target_compile_definitions(irml
44                           PUBLIC
45                           $<$<CONFIG:DEBUG>:TBB_USE_DEBUG>)
46
47# Prefer using target_link_options instead of target_link_libraries to specify link options because
48# target_link_libraries may incorrectly handle some options (on Windows, for example).
49if (COMMAND target_link_options)
50    target_link_options(irml
51        PRIVATE
52        ${TBB_LIB_LINK_FLAGS}
53        ${TBB_COMMON_LINK_FLAGS}
54    )
55else()
56    target_link_libraries(irml
57        PRIVATE
58        ${TBB_LIB_LINK_FLAGS}
59        ${TBB_COMMON_LINK_FLAGS}
60    )
61endif()
62
63target_link_libraries(irml
64    PRIVATE
65    Threads::Threads
66    ${TBB_LIB_LINK_LIBS}
67    ${TBB_COMMON_LINK_LIBS}
68)
69
70if (DEFINED TBB_SIGNTOOL)
71    string(REPLACE " " ";" TBB_SIGNTOOL_ARGS "${TBB_SIGNTOOL_ARGS}")
72    add_custom_command(TARGET irml POST_BUILD COMMAND ${TBB_SIGNTOOL} $<TARGET_FILE:irml> ${TBB_SIGNTOOL_ARGS})
73endif()
74
75install(TARGETS irml
76    EXPORT TBBTargets
77    LIBRARY
78        DESTINATION ${CMAKE_INSTALL_LIBDIR}
79        COMPONENT tbb4py
80    RUNTIME
81        DESTINATION ${CMAKE_INSTALL_BINDIR}
82        COMPONENT tbb4py
83    ARCHIVE
84        DESTINATION ${CMAKE_INSTALL_LIBDIR}
85        COMPONENT tbb4py)
86