cmake_minimum_required(VERSION 3.10) project(context_switcher VERSION 0.0.1 DESCRIPTION "allows to execute functions and lambdas on a new stack and switch between them" LANGUAGES CXX ASM) set(CMAKE_CXX_STANDARD 11) # Platform Support - Edit this when porting the context switch facility. # We are rather conservative with our flags, maybe more systems follow implemented calling conventions. # See our documentation and boost context for help when adding a new system. if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") SET(CONTEXT_SWITCH_ASSEMBLY "asm/enter_context_x86_64.s" "asm/switch_context_x86_64.s") elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") SET(CONTEXT_SWITCH_ASSEMBLY "asm/enter_context_arm32.s" "asm/switch_context_arm32.s") else () MESSAGE(FATAL_ERROR "Platform (${CMAKE_SYSTEM_PROCESSOR} on ${CMAKE_SYSTEM_NAME}) not supported! Please see Readme for instructions to port.") endif () message("-- Context Switcher: ${CMAKE_SYSTEM_PROCESSOR} running ${CMAKE_SYSTEM_NAME}") add_library(context_switcher STATIC ${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) # Add everything in `./include` to be in the include path of this project target_include_directories(context_switcher PUBLIC $ $ PRIVATE ${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*" )