CMakeLists.txt 4.97 KB
Newer Older
1 2
# List all required files here (cmake best practice to NOT automate this step!)
add_library(pls STATIC
3 4 5
        include/pls/pls.h
        include/pls/internal/build_flavour.h

6
        include/pls/algorithms/loop_partition_strategy.h
7 8 9 10 11
        include/pls/algorithms/for_each.h include/pls/algorithms/for_each_impl.h
        include/pls/algorithms/invoke.h include/pls/algorithms/invoke_impl.h
        include/pls/algorithms/loop_partition_strategy.h
        include/pls/algorithms/reduce.h include/pls/algorithms/reduce_impl.h

FritzFlorian committed
12
        include/pls/internal/base/spin_lock.h
13 14 15 16
        include/pls/internal/base/tas_spin_lock.h src/internal/base/tas_spin_lock.cpp
        include/pls/internal/base/ttas_spin_lock.h src/internal/base/ttas_spin_lock.cpp
        include/pls/internal/base/swmr_spin_lock.h src/internal/base/swmr_spin_lock.cpp
        include/pls/internal/base/barrier.h src/internal/base/barrier.cpp
17
        include/pls/internal/base/system_details.h src/internal/base/system_details.cpp
18
        include/pls/internal/base/error_handling.h src/internal/base/error_handling.cpp
19
        include/pls/internal/base/alignment.h src/internal/base/alignment.cpp
20
        include/pls/internal/base/stack_allocator.h src/internal/base/stack_allocator.cpp
21
        include/pls/internal/base/futex_wrapper.h
22

23
        include/pls/internal/data_structures/stamped_integer.h
24
        include/pls/internal/data_structures/stamped_split_integer.h
25
        include/pls/internal/data_structures/delayed_initialization.h
26
        include/pls/internal/data_structures/optional.h
27 28

        include/pls/internal/helpers/prohibit_new.h
29
        include/pls/internal/helpers/easy_profiler.h
FritzFlorian committed
30
        include/pls/internal/helpers/unique_id.h
31
        include/pls/internal/helpers/range.h
32
        include/pls/internal/helpers/seqence.h
33
        include/pls/internal/helpers/member_function.h
34

35
        include/pls/internal/scheduling/scheduler.h include/pls/internal/scheduling/scheduler_impl.h src/internal/scheduling/scheduler.cpp
36 37 38
        include/pls/internal/scheduling/base_task.h src/internal/scheduling/base_task.cpp
        include/pls/internal/scheduling/thread_state.h src/internal/scheduling/thread_state.cpp
        include/pls/internal/scheduling/task_manager.h
39
        include/pls/internal/scheduling/strain_local_resource.h src/internal/scheduling/strain_local_resource.cpp
40 41 42 43

        include/pls/internal/scheduling/lock_free/task.h
        include/pls/internal/scheduling/lock_free/task_manager.h src/internal/scheduling/lock_free/task_manager.cpp
        include/pls/internal/scheduling/lock_free/external_trading_deque.h src/internal/scheduling/lock_free/external_trading_deque.cpp
44 45 46
        include/pls/internal/scheduling/lock_free/traded_cas_field.h src/internal/scheduling/lock_free/task.cpp

        include/pls/internal/profiling/dag_node.h src/internal/profiling/dag_node.cpp
47
        include/pls/internal/profiling/profiler.h src/internal/profiling/profiler.cpp
48
        include/pls/internal/profiling/thread_stats.h src/internal/profiling/thread_stats.cpp)
49

50 51 52 53 54 55 56
# Dependencies for pls
target_link_libraries(pls Threads::Threads)
target_link_libraries(pls context_switcher)
if (EASY_PROFILER)
    target_link_libraries(pls easy_profiler)
endif ()

57 58 59 60 61 62 63 64 65 66 67 68
# Generate defines needed
if (EASY_PROFILER)
    set(PLS_EASY_PROFILER_ENABLED true)
else ()
    set(PLS_EASY_PROFILER_ENABLED false)
endif ()
option(PLS_PROFILER "Enable the internal DAG profiler" OFF)
if (PLS_PROFILER)
    set(PLS_PROFILING_ENABLED true)
else ()
    set(PLS_PROFILING_ENABLED false)
endif ()
69
message("-- PLS Profiler: ${PLS_PROFILER}")
70 71 72 73 74 75
option(SLEEP_WORKERS "Enable sleeping workers if queues are empty" OFF)
if (SLEEP_WORKERS)
    set(PLS_SLEEP_WORKERS_ON_EMPTY true)
else ()
    set(PLS_SLEEP_WORKERS_ON_EMPTY false)
endif ()
76
message("-- Sleep Workers: ${SLEEP_WORKERS}")
77 78 79

configure_file(include/pls/internal/build_flavour.h.in include/pls/internal/build_flavour.h)

80 81 82
# Add everything in `./include` to be in the include path of this project
target_include_directories(pls
        PUBLIC
83 84
        $<INSTALL_INTERFACE:include>
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
85
        PRIVATE
86 87 88 89 90 91
        ${CMAKE_CURRENT_SOURCE_DIR}/src
        )
target_include_directories(pls
        PUBLIC
        $<INSTALL_INTERFACE:include>
        $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
92
        )
93

94
# Rules for installing the library on a system
95
# ...binaries
96
INSTALL(TARGETS pls
97
        EXPORT pls-targets
98 99
        LIBRARY DESTINATION lib/pls
        ARCHIVE DESTINATION lib/pls
100
        )
101
# ...all headers in `include`
102 103
INSTALL(
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/pls
104 105 106
        DESTINATION include
        FILES_MATCHING PATTERN "*.h*"
)
107 108 109 110 111 112
INSTALL(
        DIRECTORY ${PROJECT_BINARY_DIR}/lib/pls/include/pls
        DESTINATION include
        FILES_MATCHING PATTERN "*.h*"
)

113 114 115 116 117 118 119 120 121 122 123
# ...allow our project to be a cmake dependency
install(
        EXPORT pls-targets
        FILE plsTargets.cmake
        NAMESPACE pls::
        DESTINATION lib/pls
)
INSTALl(
        FILES pls-config.cmake
        DESTINATION lib/pls
)