Skip to content

Commit

Permalink
Adding Pololu Tic Focuser
Browse files Browse the repository at this point in the history
  • Loading branch information
bzizou committed Jan 18, 2024
1 parent 853b488 commit 0f42617
Show file tree
Hide file tree
Showing 40 changed files with 5,240 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ SET(LIBRARIES_FOUND FALSE)
endif(ASTROASIS_FOUND)
endif(WITH_ASTROASIS)

# Pololu Tic Focuser (depends on https://github.com/pololu/pololu-tic-software)
# Pololu Tic Focuser
if (WITH_TICFOCUSER)
add_subdirectory(indi-ticfocuser)
endif(WITH_TICFOCUSER)
Expand Down
70 changes: 70 additions & 0 deletions cmake_modules/FindLIBBLUETOOTH.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# - Find libbluetooth
# Find the Bluez Linux Bluetooth library
#
# LIBBLUETOOTH_INCLUDE_DIR - where to find bluetooth.h etc.
# LIBBLUETOOTH_LIBRARIES - List of libraries when using libbluetooth.
# LIBBLUETOOTH_FOUND - True if libbluetooth was found.


# [License]
# The Ariba-Underlay Copyright
#
# Copyright (c) 2008-2012, Institute of Telematics, UniversitÀt Karlsruhe (TH)
#
# Institute of Telematics
# UniversitÀt Karlsruhe (TH)
# Zirkel 2, 76128 Karlsruhe
# Germany
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation
# are those of the authors and should not be interpreted as representing
# official policies, either expressed or implied, of the Institute of
# Telematics.
# [License]


# Look for the header files.
find_path(LIBBLUETOOTH_INCLUDE_DIR NAMES bluetooth/bluetooth.h)
mark_as_advanced(LIBBLUETOOTH_INCLUDE_DIR)


# Look for the library.
find_library(LIBBLUETOOTH_LIBRARY NAMES bluetooth
DOC "The path to the Bluez Linux Bluetooth library"
)
mark_as_advanced(LIBBLUETOOTH_LIBRARY)


# handle the QUIETLY and REQUIRED arguments and set LIBBLUETOOTH_FOUND to TRUE
# if all listed variables are TRUE
find_package(PackageHandleStandardArgs)
find_package_handle_standard_args(LibBluetooth DEFAULT_MSG
LIBBLUETOOTH_LIBRARY
LIBBLUETOOTH_INCLUDE_DIR
)

if(LIBBLUETOOTH_FOUND)
set(LIBBLUETOOTH_LIBRARIES "${LIBBLUETOOTH_LIBRARY}")
endif()
49 changes: 49 additions & 0 deletions cmake_modules/FindLIBTIC1.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# - Find LIBTIC1
# Find the Pololu Tic Library

pkg_check_modules(LIBTIC1 QUIET libpololu-tic-1)

find_path(LIBTIC1_INCLUDE_DIR
NAMES
tic.h
HINTS
${LIBTIC1_INCLUDE_DIRS}
PATH_SUFFIXES
libpololu-tic-1
)

find_library(LIBTIC1_LIBRARY
NAMES
${LIBTIC1_LIBRARIES}
libpololu-tic-1
HINTS
${LIBTIC1_LIBRARY_DIRS}
)

set(LIBTIC1_INCLUDE_DIRS ${LIBTIC1_INCLUDE_DIR})
set(LIBTIC1_LIBRARIES ${LIBTIC1_LIBRARY})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBTIC1
FOUND_VAR
LIBTIC1_FOUND
REQUIRED_VARS
LIBTIC1_LIBRARY
LIBTIC1_INCLUDE_DIR
VERSION_VAR
PC_LIBLIBTIC1_VERSION
)

set(LIBTIC1_INCLUDE_DIRS ${LIBTIC1_INCLUDE_DIR})
set(LIBTIC1_LIBRARIES ${LIBTIC1_LIBRARY})

mark_as_advanced(LIBTIC1_INCLUDE_DIRS LIBTIC1_LIBRARIES)

IF(LIBTIC1_FOUND)
include(CheckCXXSourceCompiles)
include(CMakePushCheckState)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_INCLUDES ${LIBTIC1_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${LIBTIC1_LIBRARIES})
cmake_pop_check_state()
ENDIF(LIBTIC1_FOUND)
3 changes: 3 additions & 0 deletions indi-ticfocuser/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Radek Kaczorek (rkaczorek AT gmail DOT com)
Helge Kutzop
Sebastian Baberowski (sebastian AT baberowski DOT com)
98 changes: 98 additions & 0 deletions indi-ticfocuser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
cmake_minimum_required(VERSION 3.16)

if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

PROJECT(TicFocuserNG CXX)

set (TICFOCUSER_VERSION_MAJOR 1)
set (TICFOCUSER_VERSION_MINOR 0)

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

set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
set(INDI_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/indi")
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")


set(INDI_TICFOCUSER-NG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/TicFocuser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/UsbConnectionBase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/SerialConnection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/driver_interfaces/TiclibInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/TicBase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/TicDefs.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/StreamSerial.cpp
)

add_executable(indi_ticfocuser-ng)

find_package(INDI REQUIRED)
target_link_libraries( indi_ticfocuser-ng indidriver)

include_directories( ${CMAKE_CURRENT_BINARY_DIR})
include_directories( ${CMAKE_CURRENT_SOURCE_DIR})

include_directories(
{CMAKE_CURRENT_BINARY_DIR}
${INDI_INCLUDE_DIR} )

find_package(USB1)
if (USB1_FOUND)

list(APPEND INDI_TICFOCUSER-NG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/connection/LibUsbConnection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/TicUsb.cpp
)

include_directories(${USB1_INCLUDE_DIRS})
target_link_libraries( indi_ticfocuser-ng "${USB1_LIBRARIES}")

set(WITH_LIBUSB TRUE)
endif()

find_package(LIBBLUETOOTH)
if (LIBBLUETOOTH_FOUND)

list(APPEND INDI_TICFOCUSER-NG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/connection/ticlib/StreamBT.cpp ${CMAKE_CURRENT_SOURCE_DIR}/connection/BluetoothConnection.cpp
)

target_link_libraries( indi_ticfocuser-ng "${LIBBLUETOOTH_LIBRARIES}")

set(WITH_BLUETOOTH TRUE)
endif()


find_package(LIBTIC1)
if(LIBTIC1_FOUND)

list(APPEND INDI_TICFOCUSER-NG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/connection/driver_interfaces/PololuUsbInterface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/connection/PololuUsbConnection.cpp
)
include_directories(${LIBTIC1_INCLUDE_DIR})
target_compile_options(indi_ticfocuser-ng PUBLIC ${LIBTIC1_CFLAGS})
target_link_libraries( indi_ticfocuser-ng "${LIBTIC1_LIBRARIES}")

set(WITH_LIBTIC TRUE)
endif()

target_sources(indi_ticfocuser-ng PUBLIC ${INDI_TICFOCUSER-NG_SRCS})

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/TicFocuser_config.h.in
${CMAKE_CURRENT_BINARY_DIR}/TicFocuser_config.h
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/indi_ticfocuser.xml.cmake
${CMAKE_CURRENT_BINARY_DIR}/indi_ticfocuser.xml
)

install(TARGETS indi_ticfocuser-ng RUNTIME DESTINATION bin )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_ticfocuser.xml DESTINATION ${INDI_DATA_DIR})

Loading

0 comments on commit 0f42617

Please sign in to comment.