1/*
2 Copyright (c) 2005-2019 Intel Corporation
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17// Used in tests that work with TBB scheduler but do not link to the TBB library.
18// In other words it embeds the TBB library core into the test executable.
19
20#ifndef harness_inject_scheduler_H
21#define harness_inject_scheduler_H
22
23#if HARNESS_DEFINE_PRIVATE_PUBLIC
24#include <string> // merely prevents LNK2019 error to happen (on ICL+VC9 configurations)
25#include <algorithm> // include it first to avoid error on define below
26#define private public
27#define protected public
28#endif
29
30// Suppress usage of #pragma comment
31#define __TBB_NO_IMPLICIT_LINKAGE 1
32
33// Enable preview features if any
34#define __TBB_BUILD 1
35
36#undef DO_ITT_NOTIFY
37
38#define __TBB_SOURCE_DIRECTLY_INCLUDED 1
39#include "../tbb/tbb_main.cpp"
40#include "../tbb/dynamic_link.cpp"
41#include "../tbb/tbb_misc_ex.cpp"
42
43// Tasking subsystem files
44#include "../tbb/governor.cpp"
45#include "../tbb/market.cpp"
46#include "../tbb/arena.cpp"
47#include "../tbb/scheduler.cpp"
48#include "../tbb/observer_proxy.cpp"
49#include "../tbb/task.cpp"
50#include "../tbb/task_group_context.cpp"
51
52// Other dependencies
53#include "../tbb/cache_aligned_allocator.cpp"
54#include "../tbb/tbb_thread.cpp"
55#include "../tbb/mutex.cpp"
56#include "../tbb/spin_rw_mutex.cpp"
57#include "../tbb/spin_mutex.cpp"
58#include "../tbb/private_server.cpp"
59#include "../tbb/concurrent_monitor.cpp"
60#if _WIN32||_WIN64
61#include "../tbb/semaphore.cpp"
62#endif
63#include "../rml/client/rml_tbb.cpp"
64
65#if HARNESS_USE_RUNTIME_LOADER
66#undef HARNESS_USE_RUNTIME_LOADER
67#include "harness.h"
68
69int TestMain () {
70 // Tests that directly include sources make no sense in runtime loader testing mode.
71 return Harness::Skipped;
72}
73// Renaming the TestMain function avoids conditional compilation around same function in the test file
74#define TestMain TestMainSkipped
75#endif
76
77#if HARNESS_DEFINE_PRIVATE_PUBLIC
78#undef protected
79#undef private
80#endif
81
82#endif /* harness_inject_scheduler_H */
83