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

5 6
        include/pls/algorithms/invoke_parallel.h
        include/pls/algorithms/invoke_parallel_impl.h
7

FritzFlorian committed
8 9 10
        include/pls/internal/base/spin_lock.h
        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
11
        include/pls/internal/base/thread.h                      src/internal/base/thread.cpp
12
        include/pls/internal/base/thread_impl.h
13 14 15
        include/pls/internal/base/barrier.h                     src/internal/base/barrier.cpp
        include/pls/internal/base/system_details.h
        include/pls/internal/base/error_handling.h
16
        include/pls/internal/base/alignment.h                   src/internal/base/alignment.cpp
17 18

        include/pls/internal/data_structures/aligned_stack.h    src/internal/data_structures/aligned_stack.cpp
19
        include/pls/internal/data_structures/aligned_stack_impl.h
20 21 22 23 24
        include/pls/internal/data_structures/deque.h            src/internal/data_structures/deque.cpp

        include/pls/internal/helpers/prohibit_new.h
        include/pls/internal/helpers/profiler.h
        include/pls/internal/helpers/mini_benchmark.h
FritzFlorian committed
25
        include/pls/internal/helpers/unique_id.h
26 27 28 29 30

        include/pls/internal/scheduling/root_task.h             src/internal/scheduling/root_task.cpp
        include/pls/internal/scheduling/thread_state.h          src/internal/scheduling/thread_state.cpp
        include/pls/internal/scheduling/abstract_task.h         src/internal/scheduling/abstract_task.cpp
        include/pls/internal/scheduling/scheduler.h             src/internal/scheduling/scheduler.cpp
31
        include/pls/internal/scheduling/scheduler_impl.h
32 33 34
        include/pls/internal/scheduling/run_on_n_threads_task.h src/internal/scheduling/run_on_n_threads_task.cpp
        include/pls/internal/scheduling/fork_join_task.h        src/internal/scheduling/fork_join_task.cpp
        include/pls/internal/scheduling/scheduler_memory.h      src/internal/scheduling/scheduler_memory.cpp
35 36 37
        include/pls/internal/scheduling/parallel_iterator_task.h
        include/pls/internal/scheduling/parallel_iterator_task_impl.h
        src/internal/scheduling/parallel_iterator_task.cpp)
38

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

# Add cmake dependencies here if needed
target_link_libraries(pls
        Threads::Threads # pthread support
)
52 53 54
if(EASY_PROFILER)
    target_link_libraries(pls easy_profiler)
endif()
55 56 57

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

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