CMakeLists.txt 5.4 KB
Newer Older
1 2
# List all required files here (cmake best practice to NOT automate this step!)
add_library(pls STATIC
3
        #        include/pls/pls.h src/pls.cpp
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
        #
        #        include/pls/algorithms/invoke.h
        #        include/pls/algorithms/invoke_impl.h
        #        include/pls/algorithms/for_each.h
        #        include/pls/algorithms/for_each_impl.h
        #        include/pls/algorithms/scan.h
        #        include/pls/algorithms/scan_impl.h
        #
        #        include/pls/dataflow/dataflow.h
        #        include/pls/dataflow/internal/inputs.h
        #        include/pls/dataflow/internal/outputs.h
        #        include/pls/dataflow/internal/token.h
        #        include/pls/dataflow/internal/in_port.h
        #        include/pls/dataflow/internal/out_port.h
        #        include/pls/dataflow/internal/function_node.h
        #        include/pls/dataflow/internal/node.h
        #        include/pls/dataflow/internal/graph.h
        #        include/pls/dataflow/internal/build_state.h
        #        include/pls/dataflow/internal/function_node_impl.h
        #        include/pls/dataflow/internal/graph_impl.h
        #        include/pls/dataflow/internal/switch_node.h
        #        include/pls/dataflow/internal/merge_node.h
        #        include/pls/dataflow/internal/split_node.h
27

FritzFlorian committed
28
        include/pls/internal/base/spin_lock.h
29 30 31 32
        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/thread.h src/internal/base/thread.cpp
33
        include/pls/internal/base/thread_impl.h
34
        include/pls/internal/base/barrier.h src/internal/base/barrier.cpp
35 36
        include/pls/internal/base/system_details.h
        include/pls/internal/base/error_handling.h
37
        include/pls/internal/base/alignment.h src/internal/base/alignment.cpp
38

39 40 41
        include/pls/internal/data_structures/aligned_stack.h src/internal/data_structures/aligned_stack.cpp
        include/pls/internal/data_structures/aligned_stack_impl.h
        include/pls/internal/data_structures/stamped_integer.h
42
        include/pls/internal/data_structures/delayed_initialization.h
43 44 45 46

        include/pls/internal/helpers/prohibit_new.h
        include/pls/internal/helpers/profiler.h
        include/pls/internal/helpers/mini_benchmark.h
FritzFlorian committed
47
        include/pls/internal/helpers/unique_id.h
48
        include/pls/internal/helpers/range.h
49
        include/pls/internal/helpers/seqence.h
50
        include/pls/internal/helpers/member_function.h
51

52
        include/pls/internal/scheduling/thread_state.h
53
        include/pls/internal/scheduling/scheduler.h src/internal/scheduling/scheduler.cpp
54
        include/pls/internal/scheduling/scheduler_impl.h
55 56
        include/pls/internal/scheduling/scheduler_memory.h
        include/pls/internal/scheduling/task_manager.h
57
        include/pls/internal/scheduling/task.h src/internal/scheduling/task.cpp
58 59 60 61
        include/pls/internal/data_structures/bounded_ws_deque.h
        include/pls/internal/data_structures/optional.h
        include/pls/internal/scheduling/thread_state_static.h
        src/internal/base/error_handling.cpp
62 63
        include/pls/internal/data_structures/bounded_trading_deque.h
        include/pls/internal/scheduling/external_trading_deque.h
64 65 66 67 68
        include/pls/internal/scheduling/traded_cas_field.h
        include/pls/internal/scheduling/task_manager_impl.h
        include/pls/internal/scheduling/static_scheduler_memory.h
        include/pls/internal/scheduling/heap_scheduler_memory.h
        src/internal/scheduling/task_manager.cpp)
69

70 71 72
# Add everything in `./include` to be in the include path of this project
target_include_directories(pls
        PUBLIC
73 74
        $<INSTALL_INTERFACE:include>
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
75
        PRIVATE
76 77
        ${CMAKE_CURRENT_SOURCE_DIR}/src # TODO: Set this up when we require private headers
        )
78 79 80 81

# Add cmake dependencies here if needed
target_link_libraries(pls
        Threads::Threads # pthread support
82
        context_switcher # coroutine support
83 84
        )
if (EASY_PROFILER)
85
    target_link_libraries(pls easy_profiler)
86
endif ()
87 88 89

# Rules for istalling the library on a system
# ...binaries
90
INSTALL(TARGETS pls context_switcher
91
        EXPORT pls-targets
92
        LIBRARY
93
        DESTINATION lib/pls
94
        ARCHIVE
95 96
        DESTINATION lib/pls
        )
97
# ...all headers in `include`
98 99
INSTALL(
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/pls
100 101 102
        DESTINATION include
        FILES_MATCHING PATTERN "*.h*"
)
103 104 105 106 107 108 109 110 111 112 113
# ...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
)
114 115 116 117 118 119 120
# ...add a custom target that will only build the library when istalling.
# This can allow us to speed up the installation on embedded devices.
ADD_CUSTOM_TARGET(install.pls
        ${CMAKE_COMMAND}
        -DBUILD_TYPE=${CMAKE_BUILD_TYPE}
        -P ${CMAKE_BINARY_DIR}/cmake_install.cmake)
ADD_DEPENDENCIES(install.pls pls)
121 122 123 124 125 126

# Enable warnings/tidy code checking from our compiler
target_compile_options(pls PRIVATE
        $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
        -Wall>
        $<$<CXX_COMPILER_ID:MSVC>:
127
        -W4>)