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
3 changes: 2 additions & 1 deletion .github/workflows/cmake-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ jobs:
cd ${{github.workspace}}/build
rm -rf *
g++ --version
cmake -DINTERFACE_TYPE=${{env.INTERFACE_TYPE_ARCHON}} -DDETECTOR_TYPE=${{env.DETECTOR_TYPE_HXRG}} ..
cmake -DDETECTOR_TYPE=${{env.DETECTOR_TYPE_HXRG}} ..


- name: Build
run: |
cd ${{github.workspace}}/build
make
make run_unit_tests

- name: Run Unit Tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ sudo apt-get update &&
sudo apt-get install libccfits-dev &&
sudo apt-get install libcfitsio-dev &&
sudo apt-get install libcurl4-openssl-dev &&
sudo apt-get install libgtest-dev
sudo apt-get install libgtest-dev
44 changes: 22 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,45 @@


# Interface type can be set via command line ( Archon | AstroCam )
IF(NOT DEFINED INTERFACE_TYPE)
IF (NOT DEFINED INTERFACE_TYPE)
set(INTERFACE_TYPE "Archon")
endif()
endif ()

# Instrument can be set via command line generic is the default value
IF(NOT DEFINED INSTR)
IF (NOT DEFINED INSTR)
set(INSTR "generic")
endif()
endif ()

# Detector type can be set via command line ( Hxrg | Ccd )
if(NOT DEFINED DETECTOR_TYPE)
if (NOT DEFINED DETECTOR_TYPE)
set(DETECTOR_TYPE "Ccd")
endif()
endif ()
# ----------------------------------------------------------------------------

# un-comment the following to log verbose debug messages
#add_definitions(-DLOGLEVEL_DEBUG)

cmake_minimum_required( VERSION 3.12 )
cmake_minimum_required(VERSION 3.12)

set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

project( camera )
project(camera)

# Run "cmake .." from the project's build/ directory!
#
set( PROJECT_BASE_DIR $ENV{PWD}/../ )
set(PROJECT_BASE_DIR $ENV{PWD}/../)

set( EXECUTABLE_OUTPUT_PATH ${PROJECT_BASE_DIR}/bin )
set( LIBRARY_OUTPUT_PATH ${PROJECT_BASE_DIR}/lib )
set( CMAKE_C_COMPILER /usr/bin/g++ )
set( CMAKE_CXX_COMPILER /usr/bin/g++ )
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BASE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BASE_DIR}/lib)
set(CMAKE_C_COMPILER /usr/bin/g++)
set(CMAKE_CXX_COMPILER /usr/bin/g++)

find_package( Threads )
find_package(Threads)

add_subdirectory( ${PROJECT_BASE_DIR}/utils )
add_subdirectory( ${PROJECT_BASE_DIR}/common )
add_subdirectory( ${PROJECT_BASE_DIR}/camerad )
add_subdirectory( ${PROJECT_BASE_DIR}/emulator )
add_subdirectory( ${PROJECT_BASE_DIR}/tests )
add_subdirectory(${PROJECT_BASE_DIR}/utils)
add_subdirectory(${PROJECT_BASE_DIR}/common)
add_subdirectory(${PROJECT_BASE_DIR}/camerad)
add_subdirectory(${PROJECT_BASE_DIR}/emulator)
add_subdirectory(${PROJECT_BASE_DIR}/tests EXCLUDE_FROM_ALL)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ If you encounter any problems or have questions about this project, please open

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

### Controller Compatibility

Expand Down
184 changes: 92 additions & 92 deletions camerad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# camerad/CMakeLists.txt
# ----------------------------------------------------------------------------

cmake_minimum_required( VERSION 3.12 )
cmake_minimum_required(VERSION 3.12)

set( CAMERA_DIR ${PROJECT_BASE_DIR}/camerad )
set(CAMERA_DIR ${PROJECT_BASE_DIR}/camerad)

include_directories( ${PROJECT_BASE_DIR}/utils )
include_directories( ${PROJECT_BASE_DIR}/common )
link_directories( ${PROJECT_BASE_DIR}/lib )
include_directories(${PROJECT_BASE_DIR}/utils)
include_directories(${PROJECT_BASE_DIR}/common)
link_directories(${PROJECT_BASE_DIR}/lib)

# ----------------------------------------------------------------------------
# Setup for appropriate hardware interface...
Expand All @@ -24,90 +24,90 @@ link_directories( ${PROJECT_BASE_DIR}/lib )
# AstroCam ARC-64/66 PCI/e interfaces
# ----------------------------------------------------------------------------
if (${INTERFACE_TYPE} STREQUAL "AstroCam")
message( STATUS "compiling for AstroCam GenIII PCI/PCIe")
set( INTERFACE_TARGET astrocam)
set( ARCAPI_DIR "/opt/ARC_API/3.6")
add_definitions( -Wall -ansi -O1 -Wno-variadic-macros -std=c++17 -ggdb )
add_definitions( -DASTROCAM)
add_definitions( -DARC66_PCIE)
find_path( ARCAPI_BASE "CArcBase.h" PATHS ${ARCAPI_DIR}/CArcBase/inc)
find_path( ARCAPI_FITS "CArcFitsFile.h" PATHS ${ARCAPI_DIR}/CArcFitsFile/inc)
find_path( ARCAPI_CFITS "CArcFitsFile.h" PATHS ${ARCAPI_DIR}/CArcFitsFile/inc)
find_path( ARCAPI_DEVICE "CArcDevice.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)
find_path( ARCAPI_PCI "CArcPCI.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)
find_path( ARCAPI_EXPIFACE "CExpIFace.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)
find_path( ARCAPI_CONIFACE "CConIFace.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)
find_path( ARCAPI_DEFS "ArcDefs.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)

set(INTERFACE_SOURCE
"${CAMERA_DIR}/astrocam.cpp"
)

set(INTERFACE_INCLUDES
"${ARC_INTERFACE}"
"${ARCAPI_BASE}"
"${ARCAPI_FITS}"
"${ARCAPI_CFITS}"
"${ARCAPI_DEVICE}"
"${ARCAPI_PCI}"
"${ARCAPI_EXPIFACE}"
"${ARCAPI_CONIFACE}"
"${ARCAPI_DEFS}"
)
find_library(CARC_BASE "CArcBase3.6" NAMES "libCArcBase3.6" PATHS ${ARCAPI_DIR}/Release)
find_library(CARC_DEVICE "CArcDevice3.6" NAMES "libCArcDevice3.6.so" PATHS ${ARCAPI_DIR}/Release)
find_library(CARC_FITS "CArcFitsFile3.6" NAMES "libCArcFitsFile3.6.so" PATHS ${ARCAPI_DIR}/Release)

# ----------------------------------------------------------------------------
# STA Archon interfaces
# ----------------------------------------------------------------------------

elseif(${INTERFACE_TYPE} STREQUAL "Archon")
message(STATUS "compiling for STA Archon")
set(INTERFACE_TARGET archon)
add_definitions( -Wall -ansi -O1 -Wno-variadic-macros -std=c++17 -ggdb )
add_definitions(-DSTA_ARCHON)
list(APPEND INTERFACE_SOURCE
"${CAMERA_DIR}/archon.cpp"
)
list(APPEND INTERFACE_INCLUDES
"${ARCHON_INCLUDE}"
)
add_library( interface STATIC "${INTERFACE_SOURCE}" )
if (${DETECTOR_TYPE} STREQUAL "Hxrg")
message(STATUS "compiling for HXRG detector")
add_definitions(-DDET_HXRG)
else()
message(STATUS "compiling for CCD detector")
endif()
else()
message(FATAL_ERROR " unknown interface type: " ${INTERFACE_TYPE})
endif()
message(STATUS "compiling for AstroCam GenIII PCI/PCIe")
set(INTERFACE_TARGET astrocam)
set(ARCAPI_DIR "/opt/ARC_API/3.6")
add_definitions(-Wall -ansi -O1 -Wno-variadic-macros -std=c++17 -ggdb)
add_definitions(-DASTROCAM)
add_definitions(-DARC66_PCIE)
find_path(ARCAPI_BASE "CArcBase.h" PATHS ${ARCAPI_DIR}/CArcBase/inc)
find_path(ARCAPI_FITS "CArcFitsFile.h" PATHS ${ARCAPI_DIR}/CArcFitsFile/inc)
find_path(ARCAPI_CFITS "CArcFitsFile.h" PATHS ${ARCAPI_DIR}/CArcFitsFile/inc)
find_path(ARCAPI_DEVICE "CArcDevice.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)
find_path(ARCAPI_PCI "CArcPCI.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)
find_path(ARCAPI_EXPIFACE "CExpIFace.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)
find_path(ARCAPI_CONIFACE "CConIFace.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)
find_path(ARCAPI_DEFS "ArcDefs.h" PATHS ${ARCAPI_DIR}/CArcDevice/inc)

set(INTERFACE_SOURCE
"${CAMERA_DIR}/astrocam.cpp"
)

set(INTERFACE_INCLUDES
"${ARC_INTERFACE}"
"${ARCAPI_BASE}"
"${ARCAPI_FITS}"
"${ARCAPI_CFITS}"
"${ARCAPI_DEVICE}"
"${ARCAPI_PCI}"
"${ARCAPI_EXPIFACE}"
"${ARCAPI_CONIFACE}"
"${ARCAPI_DEFS}"
)
find_library(CARC_BASE "CArcBase3.6" NAMES "libCArcBase3.6" PATHS ${ARCAPI_DIR}/Release)
find_library(CARC_DEVICE "CArcDevice3.6" NAMES "libCArcDevice3.6.so" PATHS ${ARCAPI_DIR}/Release)
find_library(CARC_FITS "CArcFitsFile3.6" NAMES "libCArcFitsFile3.6.so" PATHS ${ARCAPI_DIR}/Release)

# ----------------------------------------------------------------------------
# STA Archon interfaces
# ----------------------------------------------------------------------------

elseif (${INTERFACE_TYPE} STREQUAL "Archon")
message(STATUS "compiling for STA Archon")
set(INTERFACE_TARGET archon)
add_definitions(-Wall -ansi -O1 -Wno-variadic-macros -std=c++17 -ggdb)
add_definitions(-DSTA_ARCHON)
list(APPEND INTERFACE_SOURCE
"${CAMERA_DIR}/archon.cpp"
)
list(APPEND INTERFACE_INCLUDES
"${ARCHON_INCLUDE}"
)
add_library(interface STATIC "${INTERFACE_SOURCE}")
if (${DETECTOR_TYPE} STREQUAL "Hxrg")
message(STATUS "compiling for HXRG detector")
add_definitions(-DDET_HXRG)
else ()
message(STATUS "compiling for CCD detector")
endif ()
else ()
message(FATAL_ERROR " unknown interface type: " ${INTERFACE_TYPE})
endif ()

# ----------------------------------------------------------------------------
# Add appropriate instrument library here.
# The user adds a "-DINSTR=<instr>" to the cmake command line.
# Currently supported <instr> names are: nirc2 generic
# ----------------------------------------------------------------------------

if ( NOT DEFINED INSTR )
set( INSTR "undefined" )
else()
if ( ${INSTR} STREQUAL "nirc2" )
message( STATUS "building for nirc2 instrument" )
list( APPEND INTERFACE_SOURCE "${CAMERA_DIR}/nirc2.cpp" )
elseif( ${INSTR} STREQUAL "generic" )
message( STATUS "building for generic instrument" )
list( APPEND INTERFACE_SOURCE "${CAMERA_DIR}/generic.cpp" )
elseif( ${INSTR} STREQUAL "undefined" )
message( STATUS "no INSTR defined. using generic but other options are:" )
message( STATUS "cmake -DINSTR=nirc2,generic .." )
list( APPEND INTERFACE_SOURCE "${CAMERA_DIR}/generic.cpp" )
else()
message( STATUS "unknown instrument " ${INSTR} ": using generic" )
list( APPEND INTERFACE_SOURCE "${CAMERA_DIR}/generic.cpp" )
endif()
endif()
if (NOT DEFINED INSTR)
set(INSTR "undefined")
else ()
if (${INSTR} STREQUAL "nirc2")
message(STATUS "building for nirc2 instrument")
list(APPEND INTERFACE_SOURCE "${CAMERA_DIR}/nirc2.cpp")
elseif (${INSTR} STREQUAL "generic")
message(STATUS "building for generic instrument")
list(APPEND INTERFACE_SOURCE "${CAMERA_DIR}/generic.cpp")
elseif (${INSTR} STREQUAL "undefined")
message(STATUS "no INSTR defined. using generic but other options are:")
message(STATUS "cmake -DINSTR=nirc2,generic ..")
list(APPEND INTERFACE_SOURCE "${CAMERA_DIR}/generic.cpp")
else ()
message(STATUS "unknown instrument " ${INSTR} ": using generic")
list(APPEND INTERFACE_SOURCE "${CAMERA_DIR}/generic.cpp")
endif ()
endif ()

# ----------------------------------------------------------------------------
# End interface setup
Expand All @@ -121,21 +121,21 @@ target_include_directories(${INTERFACE_TARGET} PUBLIC ${INTERFACE_INCLUDES})

add_library(camera STATIC
${CAMERA_DIR}/camera.cpp
)
)

# ----------------------------------------------------------------------------
# External libraries, such as FITS, etc.
# ----------------------------------------------------------------------------

find_library(CCFITS_LIB CCfits NAMES libCCfits PATHS /usr/local/lib)
find_library(CFITS_LIB cfitsio NAMES libcfitsio PATHS /usr/local/lib)
find_library(CFITS_LIB cfitsio NAMES libcfitsio PATHS /usr/local/lib)

find_package(Threads)

add_executable(camerad
${CAMERA_DIR}/camerad.cpp
add_executable(camerad
${CAMERA_DIR}/camerad.cpp
${INTERFACE_INCLUDES}
)
)

# ----------------------------------------------------------------------------
# Everyone gets this:
Expand All @@ -151,7 +151,7 @@ target_link_libraries(camerad
${CMAKE_THREAD_LIBS_INIT}
${CCFITS_LIB}
${CFITS_LIB}
)
)

target_link_libraries(camerad ${CARC_BASE})
target_link_libraries(camerad ${CARC_DEVICE})
Expand All @@ -166,8 +166,8 @@ target_link_libraries(camerad ${CARC_FITS})
include(FindCURL)

if (CURL_FOUND STREQUAL "FALSE")
message(STATUS "cURL was not found but may be needed by some systems if built into cfitsio.\n If you experience undefined curl references during linking \n then please your cURL installation.")
else()
target_link_libraries(camerad ${CURL_LIBRARIES})
endif()
message(STATUS "cURL was not found but may be needed by some systems if built into cfitsio.\n If you experience undefined curl references during linking \n then please your cURL installation.")
else ()
target_link_libraries(camerad ${CURL_LIBRARIES})
endif ()

Loading