Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,22 @@ option(ENABLE_SHM_OUTPUT "Build shared-memory output support (requires ImageStre

cmake_minimum_required(VERSION 3.12)

find_program(GXX_COMPILER NAMES g++)

if(GXX_COMPILER)
message(STATUS "Found g++: ${GXX_COMPILER}")
set(CMAKE_CXX_COMPILER ${GXX_COMPILER})
else()
message(FATAL_ERROR "g++ compiler not found. Please install g++ and try again.")
# Choosing the compiler belongs to whoever owns the build. A parent project has
# already detected a compiler by the time it descends into this file, and
# overriding that here would cause CMake to discard its cache and reconfigure,
# losing the command line, -DCONTROLLER included
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
find_program(GXX_COMPILER NAMES g++)

if(GXX_COMPILER)
message(STATUS "Found g++: ${GXX_COMPILER}")
set(CMAKE_CXX_COMPILER ${GXX_COMPILER})
else()
message(FATAL_ERROR "g++ compiler not found. Please install g++ and try again.")
endif()
endif()

project(camera)
project(camerad)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -54,8 +60,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(PROJECT_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

# A wheel build has nowhere to put a source-tree bin/, so let CMake keep its
# outputs in the build directory
if (NOT SKBUILD)
# outputs in the build directory. A project that add_subdirectory()s this one
# has nowhere to put them either, and its source tree is not ours to write into
if (NOT SKBUILD AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BASE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BASE_DIR}/lib)
endif()
Expand Down
22 changes: 19 additions & 3 deletions camerad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,32 @@ list (FILTER INSTRUMENT_SOURCES EXCLUDE REGEX "_interface_factory\\.cpp$")

# ----------------------------------------------------------------------------
# Camera Interface Base
#
# Controller-agnostic. Carries its own include directories and link interface
# rather than relying on the directory-scoped include_directories above, which
# a project consuming this one does not inherit
# ----------------------------------------------------------------------------
list (APPEND INTERFACE_SOURCES
add_library(camerad_base
${CAMERAD_DIR}/camera_interface.cpp
${CAMERAD_DIR}/image_process.cpp
)
add_library(${INTERFACE_TARGET} ${INTERFACE_SOURCES})
target_link_libraries(${INTERFACE_TARGET}
target_include_directories(camerad_base PUBLIC
${CAMERAD_DIR}
${PROJECT_BASE_DIR}/common
${PROJECT_BASE_DIR}/utils
)
target_link_libraries(camerad_base PUBLIC
common
logentry
frame_output_factory
)

# ----------------------------------------------------------------------------
# controller implementation, linking the base PUBLIC so that anything
# depending on the controller gets the base transitively
# ----------------------------------------------------------------------------
add_library(${INTERFACE_TARGET} ${INTERFACE_SOURCES})
target_link_libraries(${INTERFACE_TARGET} PUBLIC camerad_base)
target_include_directories(${INTERFACE_TARGET} PUBLIC ${INTERFACE_INCLUDES})

# ----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ include_directories(${PROJECT_BASE_DIR}/utils) # needed for logentry
add_library(common STATIC
${PROJECT_UTILS_DIR}/common.cpp
)
target_link_libraries(common nlohmann_json::nlohmann_json)
target_link_libraries(common nlohmann_json::nlohmann_json logentry)
1 change: 1 addition & 0 deletions utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ find_library(FITSWRITER_CCFITS_LIB CCfits NAMES libCCfits PATHS /usr/local/lib /
find_library(FITSWRITER_CFITS_LIB cfitsio NAMES libcfitsio PATHS /usr/local/lib /opt/homebrew/lib)
target_link_libraries(fits_writer
nlohmann_json::nlohmann_json
utilities
${FITSWRITER_CCFITS_LIB}
${FITSWRITER_CFITS_LIB}
)
Expand Down
Loading