Skip to content

Commit

Permalink
Fix playerone cmake and build process
Browse files Browse the repository at this point in the history
  • Loading branch information
knro committed Sep 9, 2021
1 parent 2bcae0e commit 4536dd4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 36 deletions.
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ if (WITH_SV305)
add_subdirectory(libsv305)
endif (WITH_SV305)

#libplayerone
if (WITH_PLAYERONE)
add_subdirectory(libplayerone)
endif(WITH_PLAYERONE)

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

Expand Down Expand Up @@ -584,13 +589,13 @@ endif(WITH_ORION_SSG3)

# PLAYERONE
if (WITH_PLAYERONE)
find_package(PLAYER-ONE)
if (POA_FOUND)
find_package(PLAYERONE)
if (PLAYERONE_FOUND)
add_subdirectory(indi-playerone)
else (POA_FOUND)
else (PLAYERONE_FOUND)
add_subdirectory(libplayerone)
SET(LIBRARIES_FOUND FALSE)
endif(POA_FOUND)
endif(PLAYERONE_FOUND)
endif(WITH_PLAYERONE)

# 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.
Expand Down Expand Up @@ -666,6 +671,10 @@ if (WITH_SV305 AND NOT SV305_FOUND)
message(STATUS "libsv305 was not found and will now be built. Please install this libsv305 first before running cmake again to install indi-sv305.")
endif (WITH_SV305 AND NOT SV305_FOUND)

if (WITH_PLAYERONE AND NOT PLAYERONE_FOUND)
message(STATUS "libplayerone was not found and will now be built. Please install this libplayerone first before running cmake again to install indi-playerone.")
endif (WITH_PLAYERONE AND NOT PLAYERONE_FOUND)

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

Expand Down
56 changes: 28 additions & 28 deletions cmake_modules/FindPLAYERONE.cmake
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
# - Try to find PlayerOne Library
# Once done this will define
#
# POA_FOUND - system has POA
# POA_INCLUDE_DIR - the POA include directory
# POA_LIBRARIES - Link these to use ASI
# PLAYERONE_FOUND - system has PLAYERONE
# PLAYERONE_INCLUDE_DIR - the PLAYERONE include directory
# PLAYERONE_LIBRARIES - Link these to use ASI

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

if (POA_INCLUDE_DIR AND POA_LIBRARIES)
if (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)

# in cache already
set(POA_FOUND TRUE)
message(STATUS "Found libplayerone: ${POA_LIBRARIES}")
set(PLAYERONE_FOUND TRUE)
message(STATUS "Found libplayerone: ${PLAYERONE_LIBRARIES}")

else (POA_INCLUDE_DIR AND POA_LIBRARIES)
else (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)

find_path(POA_INCLUDE_DIR PlayerOneCamera.h
find_path(PLAYERONE_INCLUDE_DIR PlayerOneCamera.h
PATH_SUFFIXES libplayerone
${_obIncDir}
${GNUWIN32_DIR}/include
)

find_library(POACAM_LIBRARIES NAMES PlayerOneCamera
find_library(PLAYERONECAM_LIBRARIES NAMES PlayerOneCamera
PATHS
${_obLinkDir}
${GNUWIN32_DIR}/lib
)


if (POACAM_LIBRARIES)
set(POA_LIBRARIES ${POACAM_LIBRARIES})
endif (POACAM_LIBRARIES)
if (PLAYERONECAM_LIBRARIES)
set(PLAYERONE_LIBRARIES ${PLAYERONECAM_LIBRARIES})
endif (PLAYERONECAM_LIBRARIES)


if(POA_INCLUDE_DIR AND POA_LIBRARIES)
set(POA_FOUND TRUE)
else (POA_INCLUDE_DIR AND POA_LIBRARIES)
set(POA_FOUND FALSE)
endif(POA_INCLUDE_DIR AND POA_LIBRARIES)
if(PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)
set(PLAYERONE_FOUND TRUE)
else (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)
set(PLAYERONE_FOUND FALSE)
endif(PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)


if (POA_FOUND)
if (NOT POA_FIND_QUIETLY)
message(STATUS "Found PLAYERONE: ${POA_LIBRARIES}")
endif (NOT POA_FIND_QUIETLY)
else (POA_FOUND)
if (POA_FIND_REQUIRED)
message(FATAL_ERROR "POA not found. Please install libPlayerOneCamera.2 http://www.indilib.org")
endif (POA_FIND_REQUIRED)
endif (POA_FOUND)
if (PLAYERONE_FOUND)
if (NOT PLAYERONE_FIND_QUIETLY)
message(STATUS "Found PLAYERONE: ${PLAYERONE_LIBRARIES}")
endif (NOT PLAYERONE_FIND_QUIETLY)
else (PLAYERONE_FOUND)
if (PLAYERONE_FIND_REQUIRED)
message(FATAL_ERROR "PLAYERONE not found. Please install libPlayerOneCamera.2 http://www.indilib.org")
endif (PLAYERONE_FIND_REQUIRED)
endif (PLAYERONE_FOUND)

mark_as_advanced(POA_INCLUDE_DIR POA_LIBRARIES)
mark_as_advanced(PLAYERONE_INCLUDE_DIR PLAYERONE_LIBRARIES)

endif (POA_INCLUDE_DIR AND POA_LIBRARIES)
endif (PLAYERONE_INCLUDE_DIR AND PLAYERONE_LIBRARIES)
8 changes: 4 additions & 4 deletions indi-playerone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/indi_playerone.xml.cmake ${CMAKE_CURR
include_directories( ${CMAKE_CURRENT_BINARY_DIR})
include_directories( ${CMAKE_CURRENT_SOURCE_DIR})
include_directories( ${INDI_INCLUDE_DIR})
include_directories( ${POA_INCLUDE_DIR})
include_directories( ${PLAYERONE_INCLUDE_DIR})
include_directories( ${CFITSIO_INCLUDE_DIR})

include(CMakeCommon)
Expand All @@ -40,7 +40,7 @@ set(indi_playerone_SRCS
)

add_executable(indi_playerone_ccd ${indi_playerone_SRCS})
target_link_libraries(indi_playerone_ccd ${INDI_LIBRARIES} ${CFITSIO_LIBRARIES} ${POA_LIBRARIES} ${USB1_LIBRARIES} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(indi_playerone_ccd ${INDI_LIBRARIES} ${CFITSIO_LIBRARIES} ${PLAYERONE_LIBRARIES} ${USB1_LIBRARIES} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
if (HAVE_WEBSOCKET)
target_link_libraries(indi_playerone_ccd ${Boost_LIBRARIES})
endif()
Expand All @@ -49,9 +49,9 @@ endif()
add_executable(playerone_camera_test ${CMAKE_CURRENT_SOURCE_DIR}/playerone_camera_test.cpp)
IF (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework CoreFoundation")
target_link_libraries(playerone_camera_test ${POA_LIBRARIES} ${LIBUSB_LIBRARIES})
target_link_libraries(playerone_camera_test ${PLAYERONE_LIBRARIES} ${LIBUSB_LIBRARIES})
ELSE()
target_link_libraries(playerone_camera_test ${POA_LIBRARIES} ${USB1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(playerone_camera_test ${PLAYERONE_LIBRARIES} ${USB1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
ENDIF()

#####################################
Expand Down

1 comment on commit 4536dd4

@hiro3110i
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full spelling is better than incomprehensible abbreviations, thank you very much!

BTW, I'd like to update the document for this camera.
Can I replace screen shot on your website?
I also update the version from 0.1 to 0.2 on the document.

Please sign in to comment.