Skip to content

Commit

Permalink
Add Oasis Filter Wheel driver
Browse files Browse the repository at this point in the history
  • Loading branch information
astroasis committed Sep 30, 2023
1 parent 270a67a commit 8538735
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 18 deletions.
12 changes: 11 additions & 1 deletion cmake_modules/FindASTROASIS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ else (ASTROASIS_INCLUDE_DIR AND ASTROASIS_LIBRARIES)
${GNUWIN32_DIR}/include
)

find_library(ASTROASIS_LIBRARIES NAMES oasisfocuser
find_library(ASTROASIS_FOCUSER_LIBRARIES NAMES oasisfocuser
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)

find_library(ASTROASIS_FILTER_WHEEL_LIBRARIES NAMES oasisfilterwheel
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)

if (ASTROASIS_FOCUSER_LIBRARIES AND ASTROASIS_FILTER_WHEEL_LIBRARIES)
set(ASTROASIS_LIBRARIES ${ASTROASIS_FOCUSER_LIBRARIES} ${ASTROASIS_FILTER_WHEEL_LIBRARIES})
endif (ASTROASIS_FOCUSER_LIBRARIES AND ASTROASIS_FILTER_WHEEL_LIBRARIES)

if(ASTROASIS_INCLUDE_DIR AND ASTROASIS_LIBRARIES)
set(ASTROASIS_FOUND TRUE)
else (ASTROASIS_INCLUDE_DIR AND ASTROASIS_LIBRARIES)
Expand Down
13 changes: 12 additions & 1 deletion indi-astroasis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ find_package(USB1 REQUIRED)
find_package(Threads REQUIRED)

set(ASTROASIS_VERSION_MAJOR 1)
set(ASTROASIS_VERSION_MINOR 0)
set(ASTROASIS_VERSION_MINOR 1)

set(INDI_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/indi")

Expand All @@ -35,11 +35,22 @@ ELSE()
target_link_libraries(indi_oasis_focuser ${INDI_LIBRARIES} ${ASTROASIS_LIBRARIES} ${USB1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
ENDIF()

########### indi_oasis_filter_wheel ###########
add_executable(indi_oasis_filter_wheel ${CMAKE_CURRENT_SOURCE_DIR}/oasis_filter_wheel.cpp)
IF (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework CoreFoundation")
target_link_libraries(indi_oasis_filter_wheel ${INDI_LIBRARIES} ${ASTROASIS_LIBRARIES} ${LIBUSB_LIBRARIES})
ELSE()
target_link_libraries(indi_oasis_filter_wheel ${INDI_LIBRARIES} ${ASTROASIS_LIBRARIES} ${USB1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
ENDIF()

#####################################

if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")
target_link_libraries(indi_oasis_focuser rt)
target_link_libraries(indi_oasis_filter_wheel rt)
endif (CMAKE_SYSTEM_PROCESSOR MATCHES "arm*")

install(TARGETS indi_oasis_focuser RUNTIME DESTINATION bin)
install(TARGETS indi_oasis_filter_wheel RUNTIME DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_astroasis.xml DESTINATION ${INDI_DATA_DIR})
6 changes: 6 additions & 0 deletions indi-astroasis/indi_astroasis.xml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@
<version>@ASTROASIS_VERSION_MAJOR@.@ASTROASIS_VERSION_MINOR@</version>
</device>
</devGroup>
<devGroup group="Filter Wheels">
<device label="Oasis Filter Wheel" manufacturer="Astroasis">
<driver name="Oasis Filter Wheel">indi_oasis_filter_wheel</driver>
<version>@ASTROASIS_VERSION_MAJOR@.@ASTROASIS_VERSION_MINOR@</version>
</device>
</devGroup>
</driversList>
41 changes: 25 additions & 16 deletions libastroasis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
cmake_minimum_required (VERSION 3.0)
project (libastroasis)

set (OASISFOCUSER_VERSION "1.0.5")
set (OASISFOCUSER_SOVERSION "1")
set (OASIS_FOCUSER_VERSION "1.0.5")
set (OASIS_FOCUSER_SOVERSION "1")

set (OASIS_FILTER_WHEEL_VERSION "1.0.0")
set (OASIS_FILTER_WHEEL_SOVERSION "1")

list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/")
include (GNUInstallDirs)
include (InstallImported)

add_library (oasisfocuser SHARED IMPORTED)
add_library (oasisfocuser SHARED IMPORTED)
add_library (oasisfilterwheel SHARED IMPORTED)

set_target_properties (oasisfocuser PROPERTIES VERSION ${OASISFOCUSER_VERSION} SOVERSION ${OASISFOCUSER_SOVERSION})
set_target_properties (oasisfocuser PROPERTIES VERSION ${OASIS_FOCUSER_VERSION} SOVERSION ${OASIS_FOCUSER_SOVERSION})
set_target_properties (oasisfilterwheel PROPERTIES VERSION ${OASIS_FILTER_WHEEL_VERSION} SOVERSION ${OASIS_FILTER_WHEEL_SOVERSION})

if (APPLE)

set_property (TARGET oasisfocuser PROPERTY IMPORTED_LOCATION "mac/liboasisfocuser.bin")
set_property (TARGET oasisfocuser PROPERTY IMPORTED_LOCATION "mac/liboasisfocuser.bin")
set_property (TARGET oasisfilterwheel PROPERTY IMPORTED_LOCATION "mac/liboasisfilterwheel.bin")

FIX_MACOS_LIBRARIES("liboasisfocuser" "mac/liboasisfocuser.bin" "ASTROASIS")

# Install library
install_imported (TARGETS oasisfocuser DESTINATION ${CMAKE_INSTALL_LIBDIR})
FIX_MACOS_LIBRARIES("liboasisfocuser" "mac/liboasisfocuser.bin" "ASTROASIS")
FIX_MACOS_LIBRARIES("liboasisfilterwheel" "mac/liboasisfilterwheel.bin" "ASTROASIS")

elseif (UNIX AND NOT WIN32)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "armv+")
set_property (TARGET oasisfocuser PROPERTY IMPORTED_LOCATION "armhf/liboasisfocuser.bin")
set_property (TARGET oasisfocuser PROPERTY IMPORTED_LOCATION "armhf/liboasisfocuser.bin")
set_property (TARGET oasisfilterwheel PROPERTY IMPORTED_LOCATION "armhf/liboasisfilterwheel.bin")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set_property (TARGET oasisfocuser PROPERTY IMPORTED_LOCATION "arm64/liboasisfocuser.bin")
set_property (TARGET oasisfocuser PROPERTY IMPORTED_LOCATION "arm64/liboasisfocuser.bin")
set_property (TARGET oasisfilterwheel PROPERTY IMPORTED_LOCATION "arm64/liboasisfilterwheel.bin")
elseif (CMAKE_SIZEOF_VOID_P MATCHES "8")
set_property (TARGET oasisfocuser PROPERTY IMPORTED_LOCATION "x64/liboasisfocuser.bin")
set_property (TARGET oasisfocuser PROPERTY IMPORTED_LOCATION "x64/liboasisfocuser.bin")
set_property (TARGET oasisfilterwheel PROPERTY IMPORTED_LOCATION "x64/liboasisfilterwheel.bin")
else ()
message (FATAL_ERROR "x86-32 architecture is not supported.")
endif ()
Expand All @@ -37,10 +44,12 @@ elseif (UNIX AND NOT WIN32)
set (UDEVRULES_INSTALL_DIR "/lib/udev/rules.d" CACHE STRING "Base directory for udev rules")
install (FILES 99-astroasis.rules DESTINATION ${UDEVRULES_INSTALL_DIR})

# Install library
install_imported (TARGETS oasisfocuser DESTINATION ${CMAKE_INSTALL_LIBDIR})

endif ()

# Install library
install_imported (TARGETS oasisfocuser DESTINATION ${CMAKE_INSTALL_LIBDIR})
install_imported (TARGETS oasisfilterwheel DESTINATION ${CMAKE_INSTALL_LIBDIR})

# Install header files
install (FILES AOFocus.h DESTINATION include/libastroasis)
install (FILES AOFocus.h DESTINATION include/libastroasis)
install (FILES OasisFilterWheel.h DESTINATION include/libastroasis)
2 changes: 2 additions & 0 deletions libastroasis/libastroasis.spec
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ BuildRequires: pkgconfig(zlib)

Provides: liboasisfocuser.so()(64bit)
Provides: liboasisfocuser.so
Provides: liboasisfilterwheel.so()(64bit)
Provides: liboasisfilterwheel.so

%description
INDI is a distributed control protocol designed to operate
Expand Down

0 comments on commit 8538735

Please sign in to comment.