36c79f3a2e
This commit significantly restructures the way we setup threading in SMO. We now don't use the CRT main() thread at all. It's only used as a mechanism to ensure that Marionette doesn't execute before global constructors have been executed. JOLTing: This is a simple ASIO post()ed message that makes each thread setup its thread-local data pointer to its own ComponentThread object, and then enter its main ASIO run() loop to await commands from Marionette. Exception bubbling: We now cleanly cause mind threads to report their exceptions to marionette, so that marionette can cleanly shut the mind down in an orderly fashion. Thread Control messaging API: A namespace of asynchronous messages to be post()ed to threads to control them. It enables us to pause and resume threads. This will be very useful for Marionette when we add the ability for it to suspend Salmanoff's running mind, inject new goals, inspect current state, etc; and then resume the mind's execution.
68 lines
1.7 KiB
CMake
68 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(salmanoff VERSION 0.00.002 LANGUAGES CXX)
|
|
|
|
include(CMakeDependentOption)
|
|
|
|
# Set C++ standard
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# Build type
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE Debug FORCE)
|
|
endif()
|
|
|
|
# Compiler flags
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
|
|
|
|
# Mind oscillator configuration
|
|
set(MIND_VOSCILLATOR_PERIOD_MS 33 CACHE STRING "Mind's virtual osc clock rate (ms)")
|
|
if(NOT MIND_VOSCILLATOR_PERIOD_MS GREATER 0)
|
|
message(FATAL_ERROR "MIND_VOSCILLATOR_PERIOD_MS must be a positive integer > 0")
|
|
endif()
|
|
math(EXPR MIND_VOSCILLATOR_FREQ_MS "1000 / ${MIND_VOSCILLATOR_PERIOD_MS}")
|
|
|
|
# Configure config.h
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/include/config.h
|
|
)
|
|
|
|
# Include directories
|
|
include_directories(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
${CMAKE_CURRENT_SOURCE_DIR}/smocore/include
|
|
${CMAKE_CURRENT_BINARY_DIR}/include
|
|
)
|
|
|
|
# Find core dependencies
|
|
find_package(Boost 1.69.0 REQUIRED COMPONENTS system)
|
|
find_package(PkgConfig REQUIRED)
|
|
find_package(FLEX REQUIRED)
|
|
find_package(BISON REQUIRED)
|
|
|
|
# Need dlopen() and dlsym()
|
|
find_library(DL_LIBRARY NAMES dl ldl)
|
|
if(NOT DL_LIBRARY)
|
|
message(FATAL_ERROR "Dynamic linking library (libdl/libldl) not found")
|
|
endif()
|
|
|
|
# Add core components
|
|
add_subdirectory(smocore)
|
|
add_subdirectory(commonLibs)
|
|
add_subdirectory(senseApis)
|
|
add_subdirectory(wilzorApis)
|
|
|
|
# Main executable
|
|
add_executable(salmanoff main.cpp)
|
|
target_link_libraries(salmanoff
|
|
smocore
|
|
marionette
|
|
deviceManager
|
|
senseApis
|
|
${Boost_LIBRARIES}
|
|
${DL_LIBRARY}
|
|
)
|
|
|
|
install(TARGETS salmanoff DESTINATION bin)
|