Skip to content
Merged
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
67 changes: 67 additions & 0 deletions .github/workflows/cmake-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,70 @@ jobs:
shell: bash
run: |
cmake --build build -j"$(nproc)"

cmake-3-24-subproject:
runs-on: ubuntu-latest
timeout-minutes: 30

env:
CMAKE_324: cmake-3.24.4-linux-x86_64

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
shell: bash
run: |
bash .github/workflows/install-deps.sh

- name: Build and install zmqpp from source
shell: bash
run: |
git clone --depth 1 https://github.com/zeromq/zmqpp.git /tmp/zmqpp
cmake -S /tmp/zmqpp -B /tmp/zmqpp/build
cmake --build /tmp/zmqpp/build -j"$(nproc)"
sudo cmake --install /tmp/zmqpp/build
sudo ldconfig

# The declared minimum is only true if something builds with it
- name: Install CMake 3.24.4
shell: bash
run: |
cd "$RUNNER_TEMP"
curl -sSLO "https://github.com/Kitware/CMake/releases/download/v3.24.4/${CMAKE_324}.tar.gz"
echo "cac77d28fb8668c179ac02c283b058aeb846fe2133a57d40b503711281ed9f19 ${CMAKE_324}.tar.gz" | sha256sum -c
tar xzf "${CMAKE_324}.tar.gz"
echo "$RUNNER_TEMP/${CMAKE_324}/bin" >> "$GITHUB_PATH"

- name: Build the core as a top-level project
shell: bash
run: |
cmake --version
cmake -G Ninja -S . -B build -DCONTROLLER=archon
cmake --build build -j"$(nproc)"

# Stands in for an instrument's build: the core composed as a subproject,
# and a translation unit of the consumer's own that includes its headers
- name: Build the core as a subproject
shell: bash
run: |
mkdir -p "$RUNNER_TEMP/consumer"
cd "$RUNNER_TEMP/consumer"
cat > CMakeLists.txt <<'EOF'
cmake_minimum_required(VERSION 3.24)
project(consumer CXX)
# Below the core's C++17, so the core has to raise it for its headers
set(CMAKE_CXX_STANDARD 14)
set(CONTROLLER archon CACHE STRING "")
include(FetchContent)
FetchContent_Declare(camerad SOURCE_DIR ${CAMERAD_SOURCE_DIR})
FetchContent_MakeAvailable(camerad)
add_library(consumer OBJECT consumer.cpp)
target_link_libraries(consumer PRIVATE camerad_base)
EOF
cat > consumer.cpp <<'EOF'
#include "camera_interface.h"
EOF
cmake -G Ninja -S . -B build -DCAMERAD_SOURCE_DIR="$GITHUB_WORKSPACE"
cmake --build build -j"$(nproc)"
6 changes: 3 additions & 3 deletions .github/workflows/emulator-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
sudo apt-get install -y \
libccfits-dev libcfitsio-dev libcurl4-openssl-dev \
nlohmann-json3-dev libzmq3-dev \
libopencv-dev libboost-thread-dev libboost-chrono-dev
libboost-thread-dev libboost-chrono-dev

- name: Build and install zmqpp from source
run: |
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
sudo apt-get install -y \
libccfits-dev libcfitsio-dev libcurl4-openssl-dev \
nlohmann-json3-dev libzmq3-dev \
libopencv-dev libboost-thread-dev libboost-chrono-dev \
libboost-thread-dev libboost-chrono-dev \
python3-dev python3-pip
python3 -m pip install --upgrade pybind11

Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
sudo apt-get install -y \
libccfits-dev libcfitsio-dev libcurl4-openssl-dev \
nlohmann-json3-dev libzmq3-dev \
libopencv-dev libboost-thread-dev libboost-chrono-dev
libboost-thread-dev libboost-chrono-dev

- name: Build and install zmqpp from source
run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ packages=(
libgtest-dev
nlohmann-json3-dev
libzmq3-dev
libopencv-dev
libboost-thread-dev
libboost-chrono-dev
)
Expand Down
2 changes: 1 addition & 1 deletion ARC/CArcBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# @author David Hale <dhale@caltech.edu>
# ----------------------------------------------------------------------------

cmake_minimum_required( VERSION 3.12 )
cmake_minimum_required( VERSION 3.24 )

add_definitions( -std=c++17 -O3 -Wall -c -fmessage-length=0 -fPIC -MMD -MP -MF )

Expand Down
2 changes: 1 addition & 1 deletion ARC/CArcDevice/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# @author David Hale <dhale@caltech.edu>
# ----------------------------------------------------------------------------

cmake_minimum_required( VERSION 3.12 )
cmake_minimum_required( VERSION 3.24 )

include_directories( ${ARC_DIR}/CArcBase/inc )
include_directories( ${CARC_DEVICE_DIR}/inc )
Expand Down
2 changes: 1 addition & 1 deletion ARC/CArcFitsFile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# @author David Hale <dhale@caltech.edu>
# ----------------------------------------------------------------------------

cmake_minimum_required( VERSION 3.12 )
cmake_minimum_required( VERSION 3.24 )

add_definitions( -std=c++17 -O0 -Wall -c -fmessage-length=0 -D_REENTRANT -fPIC -MMD -MP -MF )

Expand Down
2 changes: 1 addition & 1 deletion ARC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# @author David Hale <dhale@caltech.edu>
# ----------------------------------------------------------------------------

cmake_minimum_required( VERSION 3.12 )
cmake_minimum_required( VERSION 3.24 )

set( ARC_DIR ${PROJECT_BASE_DIR}/ARC )

Expand Down
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ option(ENABLE_SHM_OUTPUT "Build shared-memory output support (requires ImageStre
# un-comment the following to log verbose debug messages
#add_definitions(-DLOGLEVEL_DEBUG)

cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.24)

# 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
Expand Down Expand Up @@ -62,7 +62,7 @@ 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. 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)
if (NOT SKBUILD AND PROJECT_IS_TOP_LEVEL)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BASE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BASE_DIR}/lib)
endif()
Expand All @@ -88,8 +88,15 @@ if (BUILD_PYTHON_MODULE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

# A project that composes this one gets the libraries; the programs and the
# install rules are built only if it asks for them
option(CAMERAD_BUILD_TOOLS "Build the emulator, listener, socksend and shm_reader" ${PROJECT_IS_TOP_LEVEL})
option(CAMERAD_INSTALL "Generate install rules" ${PROJECT_IS_TOP_LEVEL})

add_subdirectory(${PROJECT_BASE_DIR}/utils)
add_subdirectory(${PROJECT_BASE_DIR}/common)
add_subdirectory(${PROJECT_BASE_DIR}/camerad)
add_subdirectory(${PROJECT_BASE_DIR}/emulator)
if (CAMERAD_BUILD_TOOLS)
add_subdirectory(${PROJECT_BASE_DIR}/emulator)
endif()
add_subdirectory(${PROJECT_BASE_DIR}/tests EXCLUDE_FROM_ALL)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you encounter any problems or have questions about this project, please open

## Requirements

- **CMake** 3.12 or higher
- **CMake** 3.24 or higher
- **cfitsio** and **CCFits** libraries (expected in `/usr/local/lib`)
- **gtest** (Google Test) library (needed to run unit tests)

Expand Down Expand Up @@ -81,7 +81,7 @@ If you encounter any problems or have questions about this project, please open

pybind11 is located by asking the interpreter CMake selected, so pass `-DPython3_EXECUTABLE=...` to build against a specific one (a virtualenv, say). The module and that interpreter then always agree on the ABI.

pybind11 is header-only and needed only to compile: the built module links cfitsio, CCfits and OpenCV but not pybind11, so it does not have to be present where the module is imported.
pybind11 is header-only and needed only to compile: the built module links cfitsio and CCfits but not pybind11, so it does not have to be present where the module is imported.

4. **Compile the sources:**

Expand Down
15 changes: 7 additions & 8 deletions camerad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# @author David Hale <dhale@caltech.edu>
# ----------------------------------------------------------------------------

cmake_minimum_required( VERSION 3.12 )
cmake_minimum_required( VERSION 3.24 )

set( CAMERAD_DIR ${PROJECT_BASE_DIR}/camerad )

Expand Down Expand Up @@ -146,6 +146,9 @@ target_link_libraries(camerad_base PUBLIC
logentry
frame_output_factory
)
# The public headers need C++17. The standard set for this directory is not
# inherited by a project consuming this one, so it has to travel with the target
target_compile_features(camerad_base PUBLIC cxx_std_17)

# ----------------------------------------------------------------------------
# controller implementation, linking the base PUBLIC so that anything
Expand Down Expand Up @@ -181,11 +184,6 @@ find_library(CFITS_LIB cfitsio NAMES libcfitsio PATHS /usr/local/lib)
find_library( ZMQPP_LIB zmqpp NAMES libzmqpp PATHS /usr/local/lib )
find_library( ZMQ_LIB zmq NAMES libzmq PATHS /usr/local/lib )

# OpenCV
#
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )

# Boost
#
find_package(Boost REQUIRED COMPONENTS thread chrono)
Expand Down Expand Up @@ -215,15 +213,16 @@ target_link_libraries(camerad
${CMAKE_THREAD_LIBS_INIT}
${CCFITS_LIB}
${CFITS_LIB}
${OpenCV_LIBS}
${BOOST_INCLUDES}
Boost::thread
Boost::chrono
${ZMQPP_LIB}
${ZMQ_LIB}
)

install(TARGETS camerad RUNTIME DESTINATION ${CAMERAD_INSTALL_BINDIR})
if (CAMERAD_INSTALL)
install(TARGETS camerad RUNTIME DESTINATION ${CAMERAD_INSTALL_BINDIR})
endif()

# ----------------------------------------------------------------------------
# optional Python module
Expand Down
2 changes: 1 addition & 1 deletion common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# @author David Hale <dhale@caltech.edu>
# ----------------------------------------------------------------------------

cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.24)

set(PROJECT_UTILS_DIR ${PROJECT_BASE_DIR}/common)

Expand Down
6 changes: 3 additions & 3 deletions docs/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ emulator stands in for the hardware.

## Dependencies

`camerad` needs a C++20 compiler, CMake 3.12 or newer, and:
`camerad` needs a C++20 compiler, CMake 3.24 or newer, and:

- cfitsio and CCfits, for FITS output
- OpenCV, Boost (thread and chrono), nlohmann-json
- Boost (thread and chrono), nlohmann-json
- ZeroMQ and [zmqpp](https://github.com/zeromq/zmqpp), which is not usually packaged and is built from source
- gtest, to run the unit tests
- [ImageStreamIO](https://github.com/milk-org/ImageStreamIO), only for the shared-memory output
Expand All @@ -18,7 +18,7 @@ On Debian or Ubuntu the packaged ones are what CI installs:
```bash
sudo apt-get install -y build-essential cmake ninja-build \
libccfits-dev libcfitsio-dev libcurl4-openssl-dev libgtest-dev \
nlohmann-json3-dev libzmq3-dev libopencv-dev \
nlohmann-json3-dev libzmq3-dev \
libboost-thread-dev libboost-chrono-dev
```

Expand Down
6 changes: 4 additions & 2 deletions emulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# emulator/CMakeLists.txt
# ----------------------------------------------------------------------------

cmake_minimum_required( VERSION 3.12 )
cmake_minimum_required( VERSION 3.24 )

set( EMULATOR_DIR ${PROJECT_BASE_DIR}/emulator )

Expand Down Expand Up @@ -52,7 +52,9 @@ target_link_directories(emulator PRIVATE ${CFITSIO_LIBRARY_DIRS})
# Prefixed because "emulator" is too generic for a shared bin directory
set_target_properties(emulator PROPERTIES OUTPUT_NAME camerad-emulator)

install(TARGETS emulator RUNTIME DESTINATION ${CAMERAD_INSTALL_BINDIR})
if( CAMERAD_INSTALL )
install(TARGETS emulator RUNTIME DESTINATION ${CAMERAD_INSTALL_BINDIR})
endif()
elseif( ${INTERFACE_TYPE} STREQUAL "AstroCam" )
message( STATUS "emulator not implemented for AstroCam" )
else()
Expand Down
2 changes: 1 addition & 1 deletion packaging/tracking/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "camera_interface built for the HISPEC tracking camera"
requires-python = ">=3.10"

[tool.scikit-build]
cmake.version = ">=3.15"
cmake.version = ">=3.24"
cmake.source-dir = "../.."
wheel.packages = []

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Python bindings for the camera-interface detector controller soft
requires-python = ">=3.10"

[tool.scikit-build]
cmake.version = ">=3.15"
cmake.version = ">=3.24"

# The wheel carries camerad and its tools as well as the module, so installing
# the Python side gives a working command line too
Expand Down
5 changes: 3 additions & 2 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ target_link_libraries(camera_interface PRIVATE
${CMAKE_THREAD_LIBS_INIT}
${CCFITS_LIB}
${CFITS_LIB}
${OpenCV_LIBS}
Boost::thread
Boost::chrono
${ZMQPP_LIB}
${ZMQ_LIB}
)

install(TARGETS camera_interface LIBRARY DESTINATION ${CAMERAD_INSTALL_LIBDIR})
if (CAMERAD_INSTALL)
install(TARGETS camera_interface LIBRARY DESTINATION ${CAMERAD_INSTALL_LIBDIR})
endif()
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.24)

set(PROJECT_TESTS_DIR ${PROJECT_BASE_DIR}/tests)

Expand Down
Loading
Loading