CMakeLists.txt 2.95 KB
Newer Older
1 2
# List all required files here (cmake best practice to NOT automate this step!)
add_library(pls STATIC
3
            src/pls.cpp include/pls/pls.h
4 5
            src/internal/base/spin_lock.cpp include/pls/internal/base/spin_lock.h
            src/internal/base/thread.cpp include/pls/internal/base/thread.h
6
            include/pls/internal/helpers/prohibit_new.h
7 8 9
            src/internal/scheduling/abstract_task.cpp include/pls/internal/scheduling/abstract_task.h
            src/internal/scheduling/scheduler.cpp include/pls/internal/scheduling/scheduler.h
            src/internal/scheduling/thread_state.cpp  include/pls/internal/scheduling/thread_state.h
FritzFlorian committed
10
            src/internal/base/barrier.cpp include/pls/internal/base/barrier.h
11
            src/internal/scheduling/root_task.cpp include/pls/internal/scheduling/root_task.h
FritzFlorian committed
12
            src/internal/base/aligned_stack.cpp include/pls/internal/base/aligned_stack.h
13
            include/pls/internal/base/system_details.h
14
            src/internal/scheduling/run_on_n_threads_task.cpp include/pls/internal/scheduling/run_on_n_threads_task.h
15 16
            src/internal/scheduling/fork_join_task.cpp include/pls/internal/scheduling/fork_join_task.h
            src/internal/base/deque.cpp include/pls/internal/base/deque.h
17 18
            src/algorithms/invoke_parallel.cpp include/pls/algorithms/invoke_parallel.h
            include/pls/internal/base/error_handling.h
19
            include/pls/internal/scheduling/scheduler_memory.h src/internal/scheduling/scheduler_memory.cpp
20 21
            include/pls/internal/helpers/profiler.h
            include/pls/internal/helpers/mini_benchmark.h)
22

23 24 25 26 27 28 29 30 31 32 33 34 35
# 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
)
36 37 38
if(EASY_PROFILER)
    target_link_libraries(pls easy_profiler)
endif()
39 40 41

# Rules for istalling the library on a system
# ...binaries
42 43
INSTALL(TARGETS pls
        EXPORT pls-targets
44
        LIBRARY
45
            DESTINATION lib/pls
46
        ARCHIVE
47
            DESTINATION lib/pls
48 49
)
# ...all headers in `include`
50 51
INSTALL(
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/pls
52 53 54
        DESTINATION include
        FILES_MATCHING PATTERN "*.h*"
)
55 56 57 58 59 60 61 62 63 64 65
# ...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
)
66 67 68 69 70 71

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