Commit 4a44ad9f by FritzFlorian

WIP: temporally fix cmake issues with export tangets.

Older CMAKE versions wont work with export targets in different directories. For now we simply add the context_switcher manually to the export target of pls.
parent 7796022f
Pipeline #1394 failed with stages
in 36 seconds
...@@ -37,7 +37,7 @@ void conquer(fft::complex_vector::iterator data, int n) { ...@@ -37,7 +37,7 @@ void conquer(fft::complex_vector::iterator data, int n) {
constexpr int MAX_NUM_THREADS = 8; constexpr int MAX_NUM_THREADS = 8;
constexpr int MAX_NUM_TASKS = 32; constexpr int MAX_NUM_TASKS = 32;
constexpr int MAX_STACK_SIZE = 1024 * 8; constexpr int MAX_STACK_SIZE = 1024 * 1;
static_scheduler_memory<MAX_NUM_THREADS, static_scheduler_memory<MAX_NUM_THREADS,
MAX_NUM_TASKS, MAX_NUM_TASKS,
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
# Add optional sanitizer, off by default # Add optional sanitizer, off by default
option(THREAD_SANITIZER "Add thread sanitizer" OFF) option(THREAD_SANITIZER "Add thread sanitizer" OFF)
if(THREAD_SANITIZER) if (THREAD_SANITIZER)
add_compile_options(-fsanitize=thread -g) add_compile_options(-fsanitize=thread -g -fno-omit-frame-pointer)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread -fno-omit-frame-pointer")
endif() endif ()
message("-- Thread Sanitizer: ${THREAD_SANITIZER}") message("-- Thread Sanitizer: ${THREAD_SANITIZER}")
...@@ -20,7 +20,10 @@ message("-- Context Switcher: ${CMAKE_SYSTEM_PROCESSOR} running ${CMAKE_SYSTEM_N ...@@ -20,7 +20,10 @@ message("-- Context Switcher: ${CMAKE_SYSTEM_PROCESSOR} running ${CMAKE_SYSTEM_N
add_library(context_switcher STATIC add_library(context_switcher STATIC
${CONTEXT_SWITCH_ASSEMBLY} ${CONTEXT_SWITCH_ASSEMBLY}
include/context_switcher/context_switcher.h src/context_switcher.cpp include/context_switcher/assembly_bindings.h include/context_switcher/continuation.h include/context_switcher/lambda_capture.h) include/context_switcher/context_switcher.h src/context_switcher.cpp
include/context_switcher/assembly_bindings.h
include/context_switcher/continuation.h
include/context_switcher/lambda_capture.h)
# Add everything in `./include` to be in the include path of this project # Add everything in `./include` to be in the include path of this project
target_include_directories(context_switcher target_include_directories(context_switcher
...@@ -31,3 +34,16 @@ target_include_directories(context_switcher ...@@ -31,3 +34,16 @@ target_include_directories(context_switcher
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src
) )
# Installation on the system (we pack the context switcher with pls for now...)
INSTALL(TARGETS context_switcher
EXPORT pls-targets
LIBRARY DESTINATION lib/context_switcher
ARCHIVE DESTINATION lib/context_switcher
)
# ...all headers in `include`
INSTALL(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/pls
DESTINATION include
FILES_MATCHING PATTERN "*.h*"
)
# List all required files here (cmake best practice to NOT automate this step!) # List all required files here (cmake best practice to NOT automate this step!)
add_library(pls STATIC add_library(pls STATIC
# include/pls/pls.h src/pls.cpp
#
# 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
include/pls/internal/base/spin_lock.h 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/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/ttas_spin_lock.h src/internal/base/ttas_spin_lock.cpp
...@@ -67,6 +42,13 @@ add_library(pls STATIC ...@@ -67,6 +42,13 @@ add_library(pls STATIC
include/pls/internal/scheduling/heap_scheduler_memory.h include/pls/internal/scheduling/heap_scheduler_memory.h
src/internal/scheduling/task_manager.cpp) src/internal/scheduling/task_manager.cpp)
# 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 ()
# Add everything in `./include` to be in the include path of this project # Add everything in `./include` to be in the include path of this project
target_include_directories(pls target_include_directories(pls
PUBLIC PUBLIC
...@@ -76,23 +58,19 @@ target_include_directories(pls ...@@ -76,23 +58,19 @@ target_include_directories(pls
${CMAKE_CURRENT_SOURCE_DIR}/src # TODO: Set this up when we require private headers ${CMAKE_CURRENT_SOURCE_DIR}/src # TODO: Set this up when we require private headers
) )
# Add cmake dependencies here if needed # Enable warnings/tidy code checking from our compiler
target_link_libraries(pls target_compile_options(pls PRIVATE
Threads::Threads # pthread support $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
context_switcher # coroutine support -Wall>
) $<$<CXX_COMPILER_ID:MSVC>:
if (EASY_PROFILER) -W4>)
target_link_libraries(pls easy_profiler)
endif ()
# Rules for istalling the library on a system # Rules for installing the library on a system
# ...binaries # ...binaries
INSTALL(TARGETS pls context_switcher INSTALL(TARGETS pls
EXPORT pls-targets EXPORT pls-targets
LIBRARY LIBRARY DESTINATION lib/pls
DESTINATION lib/pls ARCHIVE DESTINATION lib/pls
ARCHIVE
DESTINATION lib/pls
) )
# ...all headers in `include` # ...all headers in `include`
INSTALL( INSTALL(
...@@ -111,17 +89,10 @@ INSTALl( ...@@ -111,17 +89,10 @@ INSTALl(
FILES pls-config.cmake FILES pls-config.cmake
DESTINATION lib/pls DESTINATION lib/pls
) )
# ...add a custom target that will only build the library when istalling. # ...add a custom target that will only build the library when installing.
# This can allow us to speed up the installation on embedded devices. # This can allow us to speed up the installation on embedded devices.
ADD_CUSTOM_TARGET(install.pls ADD_CUSTOM_TARGET(install.pls
${CMAKE_COMMAND} ${CMAKE_COMMAND}
-DBUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_TYPE=${CMAKE_BUILD_TYPE}
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake) -P ${CMAKE_BINARY_DIR}/cmake_install.cmake)
ADD_DEPENDENCIES(install.pls pls) ADD_DEPENDENCIES(install.pls context_switcher pls)
# 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>)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment