1# Copyright (c) 2020-2023 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 15cmake_minimum_required(VERSION 3.5) 16 17project(tbb_examples CXX) 18 19add_custom_target(build_examples) 20add_custom_target(run_examples) 21add_dependencies(run_examples build_examples) 22 23add_custom_target(light_test_examples) 24add_dependencies(light_test_examples build_examples) 25 26macro(tbb_add_example subdir name) 27 add_subdirectory(${subdir}/${name}) 28 add_dependencies(build_examples ${name}) 29 add_dependencies(run_examples run_${name}) 30 if (TARGET light_test_${name}) 31 add_dependencies(light_test_examples light_test_${name}) 32 else() 33 add_dependencies(light_test_examples run_${name}) 34 endif() 35endmacro() 36 37tbb_add_example(concurrent_hash_map count_strings) 38tbb_add_example(concurrent_priority_queue shortpath) 39 40tbb_add_example(getting_started sub_string_finder) 41 42tbb_add_example(graph binpack) 43 44# TODO: Consider using FindMKL module 45find_library(MKL_INTEL_LP64_LIB mkl_intel_lp64 PATHS ENV LIBRARY_PATH) 46find_library(MKL_SEQUENTIAL_LIB mkl_sequential PATHS ENV LIBRARY_PATH) 47find_library(MKL_CORE_LIB mkl_core PATHS ENV LIBRARY_PATH) 48if(MKL_INTEL_LP64_LIB AND MKL_SEQUENTIAL_LIB AND MKL_CORE_LIB) 49 tbb_add_example(graph cholesky) 50else() 51 message(WARNING "Intel(R) Math Kernel Library (Intel(R) MKL) libraries were not found, graph/cholesky example is excluded from the build.") 52endif() 53 54tbb_add_example(graph dining_philosophers) 55tbb_add_example(graph fgbzip2) 56tbb_add_example(graph logic_sim) 57tbb_add_example(graph som) 58 59tbb_add_example(parallel_for game_of_life) 60tbb_add_example(parallel_for polygon_overlay) 61tbb_add_example(parallel_for seismic) 62tbb_add_example(parallel_for tachyon) 63 64tbb_add_example(parallel_for_each parallel_preorder) 65 66tbb_add_example(parallel_pipeline square) 67 68tbb_add_example(parallel_reduce convex_hull) 69tbb_add_example(parallel_reduce pi) 70tbb_add_example(parallel_reduce primes) 71 72tbb_add_example(task_arena fractal) 73 74tbb_add_example(task_group sudoku) 75 76tbb_add_example(test_all fibonacci) 77 78tbb_add_example(migration recursive_fibonacci) 79