CMakeLists.txt 3.93 KB
Newer Older
1 2
# List all required files here (cmake best practice to NOT automate this step!)
add_library(pls STATIC
FritzFlorian committed
3
        include/pls/internal/base/spin_lock.h
4 5 6 7
        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
8
        include/pls/internal/base/system_details.h src/internal/base/system_details.cpp
9
        include/pls/internal/base/error_handling.h src/internal/base/error_handling.cpp
10
        include/pls/internal/base/alignment.h src/internal/base/alignment.cpp
11
        include/pls/internal/base/stack_allocator.h src/internal/base/stack_allocator.cpp
12

13 14 15
        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
16
        include/pls/internal/data_structures/delayed_initialization.h
17 18 19
        include/pls/internal/data_structures/bounded_trading_deque.h
        include/pls/internal/data_structures/bounded_ws_deque.h
        include/pls/internal/data_structures/optional.h
20 21 22 23

        include/pls/internal/helpers/prohibit_new.h
        include/pls/internal/helpers/profiler.h
        include/pls/internal/helpers/mini_benchmark.h
FritzFlorian committed
24
        include/pls/internal/helpers/unique_id.h
25
        include/pls/internal/helpers/range.h
26
        include/pls/internal/helpers/seqence.h
27
        include/pls/internal/helpers/member_function.h
28

29
        include/pls/internal/scheduling/thread_state.h src/internal/scheduling/thread_state.cpp
30 31
        include/pls/internal/scheduling/scheduler.h include/pls/internal/scheduling/scheduler_impl.h src/internal/scheduling/scheduler.cpp
        include/pls/internal/scheduling/task_manager.h include/pls/internal/scheduling/task_manager_impl.h src/internal/scheduling/task_manager.cpp
32
        include/pls/internal/scheduling/task.h src/internal/scheduling/task.cpp
33
        include/pls/internal/scheduling/external_trading_deque.h src/internal/scheduling/external_trading_deque.cpp
34
        include/pls/internal/scheduling/traded_cas_field.h)
35

36 37 38 39 40 41 42
# 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 ()

43 44 45
# Add everything in `./include` to be in the include path of this project
target_include_directories(pls
        PUBLIC
46 47
        $<INSTALL_INTERFACE:include>
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
48
        PRIVATE
49 50
        ${CMAKE_CURRENT_SOURCE_DIR}/src # TODO: Set this up when we require private headers
        )
51

52 53 54 55 56 57
# 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>:
        -W4>)
58

59
# Rules for installing the library on a system
60
# ...binaries
61
INSTALL(TARGETS pls
62
        EXPORT pls-targets
63 64
        LIBRARY DESTINATION lib/pls
        ARCHIVE DESTINATION lib/pls
65
        )
66
# ...all headers in `include`
67 68
INSTALL(
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/pls
69 70 71
        DESTINATION include
        FILES_MATCHING PATTERN "*.h*"
)
72 73 74 75 76 77 78 79 80 81 82
# ...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
)
83
# ...add a custom target that will only build the library when installing.
84 85 86 87 88
# 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)
89
ADD_DEPENDENCIES(install.pls context_switcher pls)