Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Astroasis INID Driver #783

Merged
merged 18 commits into from
May 10, 2023
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
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ option(WITH_BRESSEREXOS2 "Install Bresser Exos 2 GoTo Mount Driver" On)
option(WITH_PLAYERONE "Install Player One Astronomy's Camera Driver" On)
option(WITH_WEEWX_JSON "Install Weewx JSON Driver" On)
option(WITH_ROLLOFFINO "Install RollOff ino Dome Driver" On)
option(WITH_ASTROASIS "Install Astroasis Driver" On)

# FFMPEG required for INDI Webcam driver
find_package(FFmpeg)
Expand Down Expand Up @@ -241,6 +242,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(WITH_GPSD Off)
set(WITH_AHP_XC Off)
set(WITH_AHP_GT Off)
set(WITH_ASTROASIS Off)
ENDIF ()
# Disable apogee, qhy and mi with gcc 4.8 and earlier versions
IF (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
Expand Down Expand Up @@ -268,6 +270,7 @@ if (NO_PRE_BUILT)
SET(WITH_SBIG Off)
SET(WITH_SVBONY Off)
SET(WITH_TOUPBASE Off)
SET(WITH_ASTROASIS Off)
endif(NO_PRE_BUILT)

# If the Build Libs option is selected, it will just build the required libraries.
Expand Down Expand Up @@ -365,6 +368,11 @@ if (WITH_PLAYERONE)
add_subdirectory(libplayerone)
endif(WITH_PLAYERONE)

#libastroasis
if (WITH_ASTROASIS)
add_subdirectory(libastroasis)
endif(WITH_ASTROASIS)

# This is the main 3rd Party build. It runs if the Build Libs option is not selected.
ELSE(BUILD_LIBS)

Expand Down Expand Up @@ -750,6 +758,17 @@ if (WITH_NUT)
add_subdirectory(indi-nut)
endif()

# Astroasis
if (WITH_ASTROASIS)
find_package(ASTROASIS)
if (ASTROASIS_FOUND)
add_subdirectory(indi-astroasis)
else (ASTROASIS_FOUND)
add_subdirectory(libastroasis)
SET(LIBRARIES_FOUND FALSE)
endif(ASTROASIS_FOUND)
endif(WITH_ASTROASIS)

# Check if libraries are found. If not, we must build them, install them, THEN run CMake again to build and instal the drivers. If all the libraraies are installed, then we build and install the drivers only now.
if (LIBRARIES_FOUND)
message(STATUS "############################################################################")
Expand Down Expand Up @@ -851,6 +870,10 @@ if (WITH_AHPGT AND NOT AHPGT_FOUND)
message(STATUS "libahp-gt was not found and will now be built. Please install libahp-gt first before running cmake again to install indi-ahpgt.")
endif (WITH_AHPGT AND NOT AHPGT_FOUND)

if (WITH_ASTROASIS AND NOT ASTROASIS_FOUND)
message(STATUS "libastroasis was not found and will now be built. Please install libastroasis first before running cmake again to install indi-astroasis.")
endif (WITH_ASTROASIS AND NOT ASTROASIS_FOUND)

message(STATUS "####################################################################################################################################")
endif (LIBRARIES_FOUND)

Expand Down
49 changes: 49 additions & 0 deletions cmake_modules/FindASTROASIS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# - Try to find Astroasis Library
# Once done this will define
#
# ASTROASIS_FOUND - system has Astroasis
# ASTROASIS_INCLUDE_DIR - the Astroasis include directory
# ASTROASIS_LIBRARIES - Link these to use Astroasis

# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

if (ASTROASIS_INCLUDE_DIR AND ASTROASIS_LIBRARIES)

# in cache already
set(ASTROASIS_FOUND TRUE)
message(STATUS "Found libastroasis: ${ASTROASIS_LIBRARIES}")

else (ASTROASIS_INCLUDE_DIR AND ASTROASIS_LIBRARIES)

find_path(ASTROASIS_INCLUDE_DIR AOFocus.h
PATH_SUFFIXES libastroasis
${_obIncDir}
${GNUWIN32_DIR}/include
)

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

if(ASTROASIS_INCLUDE_DIR AND ASTROASIS_LIBRARIES)
set(ASTROASIS_FOUND TRUE)
else (ASTROASIS_INCLUDE_DIR AND ASTROASIS_LIBRARIES)
set(ASTROASIS_FOUND FALSE)
endif(ASTROASIS_INCLUDE_DIR AND ASTROASIS_LIBRARIES)

if (ASTROASIS_FOUND)
if (NOT ASTROASIS_FIND_QUIETLY)
message(STATUS "Found Astroasis Library: ${ASTROASIS_LIBRARIES}")
endif (NOT ASTROASIS_FIND_QUIETLY)
else (ASTROASIS_FOUND)
if (ASTROASIS_FIND_REQUIRED)
message(FATAL_ERROR "Astroasis Library not found. Please install Astroasis Library http://www.indilib.org")
endif (ASTROASIS_FIND_REQUIRED)
endif (ASTROASIS_FOUND)

mark_as_advanced(ASTROASIS_INCLUDE_DIR ASTROASIS_LIBRARIES)

endif (ASTROASIS_INCLUDE_DIR AND ASTROASIS_LIBRARIES)
47 changes: 47 additions & 0 deletions indi-astroasis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.0)
PROJECT(indi_astroasis CXX C)

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

find_package(ASTROASIS REQUIRED)
find_package(CFITSIO REQUIRED)
find_package(INDI REQUIRED)
find_package(ZLIB REQUIRED)
find_package(USB1 REQUIRED)
find_package(Threads REQUIRED)

set(ASTROASIS_VERSION_MAJOR 1)
set(ASTROASIS_VERSION_MINOR 0)

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

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/indi_astroasis.xml.cmake ${CMAKE_CURRENT_BINARY_DIR}/indi_astroasis.xml)

include_directories( ${CMAKE_CURRENT_BINARY_DIR})
include_directories( ${CMAKE_CURRENT_SOURCE_DIR})
include_directories( ${INDI_INCLUDE_DIR})
include_directories( ${CFITSIO_INCLUDE_DIR})
include_directories( ${ASTROASIS_INCLUDE_DIR})

include(CMakeCommon)

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

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

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

install(TARGETS indi_oasis_focuser RUNTIME DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_astroasis.xml DESTINATION ${INDI_DATA_DIR})
Loading