CMakeLists.txt 4.36 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
        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
11

12
        include/pls/dataflow/dataflow.h
13
        include/pls/dataflow/internal/token.h
14
        include/pls/dataflow/graph.h
15 16 17 18
        include/pls/dataflow/internal/inputs.h
        include/pls/dataflow/internal/outputs.h
        include/pls/dataflow/internal/input.h
        include/pls/dataflow/internal/output.h
19

FritzFlorian committed
20
        include/pls/internal/base/spin_lock.h
21 22 23 24
        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
25
        include/pls/internal/base/thread_impl.h
26
        include/pls/internal/base/barrier.h src/internal/base/barrier.cpp
27 28
        include/pls/internal/base/system_details.h
        include/pls/internal/base/error_handling.h
29
        include/pls/internal/base/alignment.h src/internal/base/alignment.cpp
30

31
        include/pls/internal/data_structures/aligned_stack.h src/internal/data_structures/aligned_stack.cpp
32
        include/pls/internal/data_structures/aligned_stack_impl.h
33
        include/pls/internal/data_structures/deque.h
34
        include/pls/internal/data_structures/locking_deque.h
35
        include/pls/internal/data_structures/locking_deque_impl.h
36
        include/pls/internal/data_structures/work_stealing_deque.h include/pls/internal/data_structures/work_stealing_deque_impl.h
37
        include/pls/internal/data_structures/stamped_integer.h
38 39 40 41

        include/pls/internal/helpers/prohibit_new.h
        include/pls/internal/helpers/profiler.h
        include/pls/internal/helpers/mini_benchmark.h
FritzFlorian committed
42
        include/pls/internal/helpers/unique_id.h
43
        include/pls/internal/helpers/range.h
44

45
        include/pls/internal/scheduling/thread_state.h
46
        include/pls/internal/scheduling/scheduler.h src/internal/scheduling/scheduler.cpp
47
        include/pls/internal/scheduling/scheduler_impl.h
48
        include/pls/internal/scheduling/task.h src/internal/scheduling/task.cpp
49
        include/pls/internal/scheduling/scheduler_memory.h src/internal/scheduling/scheduler_memory.cpp
50
        include/pls/internal/scheduling/lambda_task.h include/pls/dataflow/inputs.h include/pls/dataflow/outputs.h include/pls/dataflow/input.h include/pls/dataflow/output.h)
51 52 53
# Add everything in `./include` to be in the include path of this project
target_include_directories(pls
        PUBLIC
54 55
        $<INSTALL_INTERFACE:include>
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
56
        PRIVATE
57 58
        ${CMAKE_CURRENT_SOURCE_DIR}/src # TODO: Set this up when we require private headers
        )
59 60 61 62

# Add cmake dependencies here if needed
target_link_libraries(pls
        Threads::Threads # pthread support
63 64
        )
if (EASY_PROFILER)
65
    target_link_libraries(pls easy_profiler)
66
endif ()
67 68 69

# Rules for istalling the library on a system
# ...binaries
70 71
INSTALL(TARGETS pls
        EXPORT pls-targets
72
        LIBRARY
73
        DESTINATION lib/pls
74
        ARCHIVE
75 76
        DESTINATION lib/pls
        )
77
# ...all headers in `include`
78 79
INSTALL(
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/pls
80 81 82
        DESTINATION include
        FILES_MATCHING PATTERN "*.h*"
)
83 84 85 86 87 88 89 90 91 92 93
# ...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
)
94 95 96 97 98 99 100
# ...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)
101 102 103 104 105 106

# 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>:
107
        -W4>)