1
1
cmake_minimum_required(VERSION 2.4.7)
4
################## INDI version ################################
5
set(INDI_VERSION "0.6")
3
################## INDI version ################################
6
4
set(INDI_SOVERSION "0")
8
set(CMAKE_INDI_VERSION_MAJOR 0)
9
set(CMAKE_INDI_VERSION_MINOR 6)
10
set(CMAKE_INDI_VERSION_RELEASE 1)
11
set(CMAKE_INDI_VERSION_STRING "${CMAKE_INDI_VERSION_MAJOR}.${CMAKE_INDI_VERSION_MINOR}.${CMAKE_INDI_VERSION_RELEASE}")
13
################## Paths ################################
5
set(CMAKE_INDI_VERSION_MAJOR 0)
6
set(CMAKE_INDI_VERSION_MINOR 8)
7
set(CMAKE_INDI_VERSION_RELEASE 0)
8
set(CMAKE_INDI_VERSION_STRING "${CMAKE_INDI_VERSION_MAJOR}.${CMAKE_INDI_VERSION_MINOR}.${CMAKE_INDI_VERSION_RELEASE}")
10
################## Paths ################################
14
11
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
15
12
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/indi/")
16
13
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
17
14
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include")
19
16
MESSAGE( STATUS "BIN_INSTALL_DIR: " ${BIN_INSTALL_DIR} )
21
################## setup install directories ################################
22
set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
23
set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name")
24
## the following are directories where stuff will be installed to
25
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/" CACHE PATH "The subdirectory to the header prefix")
26
set(PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files")
18
################## setup install directories ################################
19
set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
20
set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name")
21
## the following are directories where stuff will be installed to
22
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/" CACHE PATH "The subdirectory to the header prefix")
23
set(PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files")
28
25
################## Includes ################################
29
26
Include (CheckCXXSourceCompiles)
30
27
include (MacroOptionalFindPackage)
35
32
find_package(ZLIB REQUIRED)
36
INCLUDE_DIRECTORIES(${BOOST_INCLUDE_DIR})
37
40
macro_optional_find_package(USB)
38
macro_log_feature(LIBUSB_FOUND "libusb" "User level access to USB devices" "http://indi.sf.net" FALSE "" "Provides support for USB based drivers in INDI.")
41
macro_log_feature(LIBUSB_FOUND "libusb" "User level access to USB devices" "http://www.libusb.org" FALSE "" "Provides support for USB based drivers in INDI.")
40
43
macro_optional_find_package(CFITSIO)
42
45
if (NOT CFITSIO_FOUND OR CFITSIO_VERSION_MAJOR LESS 3)
43
message(FATAL_ERROR "CFITSIO version too old, Please install cfitsio 3.x and try again. http://indi.sf.net")
46
message(FATAL_ERROR "CFITSIO version too old, Please install cfitsio 3.x and try again. http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html")
44
47
endif (NOT CFITSIO_FOUND OR CFITSIO_VERSION_MAJOR LESS 3)
46
49
macro_bool_to_01(CFITSIO_FOUND HAVE_CFITSIO_H)
47
50
macro_log_feature(CFITSIO_FOUND "libcfitsio" "A library for reading and writing data files in FITS (Flexible Image Transport System) data format" "http://indi.sf.net" FALSE "3.03" "Provides INDI with FITS I/O support.")
50
macro_optional_find_package(FLI)
51
macro_log_feature(FLI_FOUND "libfli" "Finger Lakes Instrument Library" "http://indi.sourceforge.net/" FALSE "1.71" "Provides INDI with support for controlling FLI CCDS & Filter Wheels.")
53
53
macro_optional_find_package(Nova)
54
54
macro_bool_to_01(NOVA_FOUND HAVE_NOVA_H)
55
55
macro_log_feature(NOVA_FOUND "libnova" "A general purpose, double precision, Celestial Mechanics, Astrometry and Astrodynamics library" "http://indi.sf.net" FALSE "0.12.1" "Provides INDI with astrodynamics library.")
61
61
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
63
if(COMMAND cmake_policy)
64
cmake_policy(SET CMP0003 NEW)
65
endif(COMMAND cmake_policy)
63
67
include_directories( ${CMAKE_CURRENT_BINARY_DIR})
64
68
include_directories( ${CMAKE_SOURCE_DIR})
65
69
include_directories( ${CMAKE_SOURCE_DIR}/libs)
96
${CMAKE_SOURCE_DIR}/indidriver.c
96
97
${CMAKE_SOURCE_DIR}/indidrivermain.c
97
98
${CMAKE_SOURCE_DIR}/eventloop.c
102
${CMAKE_SOURCE_DIR}/libs/indibase/basedriver.cpp
103
${CMAKE_SOURCE_DIR}/libs/indibase/baseclient.cpp
107
${CMAKE_SOURCE_DIR}/libs/indibase/basedriver.cpp
108
${CMAKE_SOURCE_DIR}/libs/indibase/defaultdriver.cpp
109
${CMAKE_SOURCE_DIR}/libs/indibase/indiccd.cpp
110
${CMAKE_SOURCE_DIR}/libs/indibase/inditelescope.cpp
111
${CMAKE_SOURCE_DIR}/libs/indibase/indifilterwheel.cpp
112
${CMAKE_SOURCE_DIR}/libs/indibase/indifocuser.cpp
113
${CMAKE_SOURCE_DIR}/libs/indibase/indiusbdevice.cpp
100
117
######################################
101
118
########### INDI SERVER ##############
102
119
######################################
114
131
install(TARGETS indiserver RUNTIME DESTINATION bin )
116
######################################
117
######## INDI Static Library #########
118
######################################
119
add_library(indidriver STATIC ${indimain_SRCS})
120
install(TARGETS indidriver ARCHIVE DESTINATION lib${LIB_POSTFIX})
122
######################################
123
######## INDI Shared Library #########
124
######################################
133
#################################################
134
############# INDI Shared Library ###############
135
# To offer lilxml and communination routines #
136
# Mostly used by generic clients #
137
#################################################
125
138
add_library(indi SHARED ${libindicom_SRCS} ${liblilxml_SRCS})
126
139
target_link_libraries(indi m z)
131
144
if (CFITSIO_FOUND)
132
145
target_link_libraries(indi ${CFITSIO_LIBRARIES})
133
146
endif(CFITSIO_FOUND)
135
target_link_libraries(indi ${FLI_LIBRARIES})
138
148
install(TARGETS indi LIBRARY DESTINATION lib${LIB_POSTFIX})
139
set_target_properties(indi PROPERTIES VERSION ${INDI_VERSION} SOVERSION ${INDI_SOVERSION})
149
set_target_properties(indi PROPERTIES VERSION ${CMAKE_INDI_VERSION_STRING} SOVERSION ${INDI_SOVERSION})
151
##################################################
152
############ INDI Main Static Library ############
153
# To link with main() for 3rd party drivers #
154
##################################################
155
add_library(indimain STATIC ${indimain_SRCS})
156
install(TARGETS indimain ARCHIVE DESTINATION lib${LIB_POSTFIX})
158
##################################################
159
###### INDI Default Driver Static Library ########
160
# To link with main() and indibase classes #
161
##################################################
162
add_library(indidriver STATIC ${indimain_SRCS} ${indidriver_SRCS})
163
install(TARGETS indidriver ARCHIVE DESTINATION lib${LIB_POSTFIX})
165
##################################################
166
########### INDI Client Static Library ###########
167
##################################################
168
add_library(indiclient STATIC ${indiclient_SRCS})
169
target_link_libraries(indiclient indi pthread)
170
install(TARGETS indiclient ARCHIVE DESTINATION lib${LIB_POSTFIX})
141
172
#####################################
142
173
########## TELESCOPE GROUP ##########
276
308
install(TARGETS indi_intelliscope RUNTIME DESTINATION bin )
278
#####################################
279
########## FOCUSER GROUP ############
280
#####################################
282
###### FLI Precision Digital Focuser ######
286
${CMAKE_SOURCE_DIR}/drivers/focuser/fli_pdf.c
289
add_executable(indi_fli_pdf ${flipdf_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
291
target_link_libraries(indi_fli_pdf m ${FLI_LIBRARIES})
294
target_link_libraries(indi_fli_pdf ${NOVA_LIBRARIES})
297
install(TARGETS indi_fli_pdf RUNTIME DESTINATION bin )
310
########### Syncscan ###############
313
${CMAKE_SOURCE_DIR}/drivers/telescope/synscanmount.cpp )
315
add_executable(indi_synscan ${synscan_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
317
target_link_libraries(indi_synscan indidriver m z)
320
target_link_libraries(indi_synscan ${NOVA_LIBRARIES})
323
install(TARGETS indi_synscan RUNTIME DESTINATION bin )
325
########### Telescope Simulator ##############
326
set(telescopesimulator_SRCS
328
${CMAKE_SOURCE_DIR}/drivers/telescope/telescope_simulator.cpp
331
add_executable(indi_simulator_telescope ${telescopesimulator_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
333
target_link_libraries(indi_simulator_telescope indidriver ${CFITSIO_LIBRARIES} m z pthread)
336
target_link_libraries(indi_simulator_telescope ${NOVA_LIBRARIES})
339
install(TARGETS indi_simulator_telescope RUNTIME DESTINATION bin )
341
#####################################
342
########## FOCUSER GROUP ############
343
#####################################
345
########### CCD Simulator ##############
348
set(ccdsimulator_SRCS
350
${CMAKE_SOURCE_DIR}/drivers/ccd/ccd_simulator.cpp
353
add_executable(indi_simulator_ccd ${ccdsimulator_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
355
target_link_libraries(indi_simulator_ccd indidriver ${CFITSIO_LIBRARIES} m z pthread)
358
target_link_libraries(indi_simulator_ccd ${NOVA_LIBRARIES})
361
install(TARGETS indi_simulator_ccd RUNTIME DESTINATION bin )
363
endif (CFITSIO_FOUND)
366
#####################################
367
########## FOCUSER GROUP ############
368
#####################################
299
370
#################################################################################
301
372
################ Robo Focuser ################
306
377
${CMAKE_SOURCE_DIR}/drivers/focuser/robofocusdriver.c
309
add_executable(indi_robofocus ${robofocus_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
311
target_link_libraries(indi_robofocus m)
314
target_link_libraries(indi_robofocus ${NOVA_LIBRARIES})
317
install(TARGETS indi_robofocus RUNTIME DESTINATION bin )
380
add_executable(indi_robo_focus ${robofocus_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
382
target_link_libraries(indi_robo_focus m)
385
target_link_libraries(indi_robo_focus ${NOVA_LIBRARIES})
388
install(TARGETS indi_robo_focus RUNTIME DESTINATION bin )
390
################ Optec TCF-S ################
394
${CMAKE_SOURCE_DIR}/drivers/focuser/tcfs.cpp
397
add_executable(indi_tcfs_focus ${tcfs_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
399
target_link_libraries(indi_tcfs_focus indidriver m z)
402
target_link_libraries(indi_tcfs_focus ${NOVA_LIBRARIES})
405
install(TARGETS indi_tcfs_focus RUNTIME DESTINATION bin )
407
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/make_tcfs_symlink.cmake
408
"exec_program(${CMAKE_COMMAND} ARGS -E create_symlink ${BIN_INSTALL_DIR}/indi_tcfs_focus ${BUILD_ROOT}${BIN_INSTALL_DIR}/indi_tcfs3_focus)\n")
409
set_target_properties(indi_tcfs_focus PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/make_tcfs_symlink.cmake)
319
411
#################################################################################
339
431
install(TARGETS indi_trutech_wheel RUNTIME DESTINATION bin )
341
#################################################################################
343
########## FLI Filter Wheel ############
347
${CMAKE_SOURCE_DIR}/drivers/filter_wheel/fli_wheel.c
433
########### Filter Simulator ##############
434
set(filtersimulator_SRCS
436
${CMAKE_SOURCE_DIR}/drivers/filter_wheel/filter_simulator.cpp
350
add_executable(indi_fli_wheel ${fliwheel_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
352
target_link_libraries(indi_fli_wheel ${FLI_LIBRARIES} m)
355
target_link_libraries(indi_fli_wheel ${NOVA_LIBRARIES})
358
install(TARGETS indi_fli_wheel RUNTIME DESTINATION bin )
360
#################################################################################
362
#######################################
363
############# CCD GROUP ###############
364
#######################################
366
############# FLI CCD ###############
367
if (CFITSIO_FOUND AND FLI_FOUND)
371
${CMAKE_SOURCE_DIR}/drivers/ccd/fli_ccd.c
374
add_executable(indi_fli_ccd ${fliccd_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
376
target_link_libraries(indi_fli_ccd ${FLI_LIBRARIES} ${CFITSIO_LIBRARIES} m z)
379
target_link_libraries(indi_fli_ccd ${NOVA_LIBRARIES})
382
install(TARGETS indi_fli_ccd RUNTIME DESTINATION bin )
384
endif (CFITSIO_FOUND AND FLI_FOUND)
439
add_executable(indi_simulator_wheel ${filtersimulator_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
441
target_link_libraries(indi_simulator_wheel indidriver ${CFITSIO_LIBRARIES} m z pthread)
444
target_link_libraries(indi_simulator_wheel ${NOVA_LIBRARIES})
447
install(TARGETS indi_simulator_wheel RUNTIME DESTINATION bin )
385
449
#################################################################################
387
451
#########################################
430
495
install(TARGETS indi_meade_lpi RUNTIME DESTINATION bin )
432
497
endif (CFITSIO_FOUND)
498
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
434
500
#################################################################################
436
502
########### V4L Philips ##############
503
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
437
504
if (CFITSIO_FOUND)
439
506
set(v4lphilips_SRCS
454
521
install(TARGETS indi_v4l_philips RUNTIME DESTINATION bin )
456
523
endif (CFITSIO_FOUND)
524
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
458
526
#################################################################################
460
528
########### Generic V4L Driver ###############
529
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
461
530
if (CFITSIO_FOUND)
463
532
set(v4ldriver_SRCS
534
604
endif (NOVA_FOUND)
537
install(TARGETS indi_eval RUNTIME DESTINATION bin )
539
#################################################################################
540
## Build Examples. Not installation
541
########### Tutorial one ##############
607
install(TARGETS indi_eval RUNTIME DESTINATION bin )
609
#################################################################################
610
## Build Examples. Not installation
611
########### Tutorial one ##############
542
612
set(tutorialone_SRCS
544
614
${CMAKE_SOURCE_DIR}/examples/tutorial_one.c
580
650
target_link_libraries(tutorial_three ${NOVA_LIBRARIES})
581
651
endif (NOVA_FOUND)
583
########### Tutorial dome ##############
653
########### Tutorial four ##############
656
set(tutorialfour_SRCS
658
${CMAKE_SOURCE_DIR}/examples/tutorial_four.cpp
661
add_executable(tutorial_four ${tutorialfour_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
663
target_link_libraries(tutorial_four indidriver ${CFITSIO_LIBRARIES} m z pthread)
666
target_link_libraries(tutorial_four ${NOVA_LIBRARIES})
669
endif (CFITSIO_FOUND)
671
########### Tutorial dome ##############
584
672
set(tutorialdome_SRCS
586
674
${CMAKE_SOURCE_DIR}/examples/tutorial_dome.c
608
696
target_link_libraries(tutorial_rain ${NOVA_LIBRARIES})
609
697
endif (NOVA_FOUND)
700
########### Client Tutorial ##############
701
set(tutorialclient_SRCS
702
${CMAKE_SOURCE_DIR}/examples/tutorial_client.cpp
705
add_executable(tutorial_client ${tutorialclient_SRCS} ${liblilxml_SRCS} ${libindicom_SRCS})
707
target_link_libraries(tutorial_client indiclient m pthread)
710
target_link_libraries(tutorial_client ${NOVA_LIBRARIES})
611
713
#################################################################################
613
install( FILES drivers.xml DESTINATION ${DATA_INSTALL_DIR})
615
install( FILES indiapi.h indidevapi.h base64.h eventloop.h ${CMAKE_SOURCE_DIR}/libs/lilxml.h
616
${CMAKE_SOURCE_DIR}/libs/indicom.h DESTINATION ${INCLUDE_INSTALL_DIR}/libindi COMPONENT Devel)
618
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libindi.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libindi.pc @ONLY)
619
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libindi.pc DESTINATION ${PKGCONFIG_INSTALL_PREFIX})
715
install( FILES drivers.xml ${CMAKE_SOURCE_DIR}/drivers/focuser/indi_tcfs_sk.xml DESTINATION ${DATA_INSTALL_DIR})
717
install( FILES indiapi.h indidevapi.h base64.h eventloop.h indidriver.h ${CMAKE_SOURCE_DIR}/libs/lilxml.h ${CMAKE_SOURCE_DIR}/libs/indibase/indibase.h
718
${CMAKE_SOURCE_DIR}/libs/indibase/basedriver.h ${CMAKE_SOURCE_DIR}/libs/indibase/defaultdriver.h
719
${CMAKE_SOURCE_DIR}/libs/indibase/indiccd.h ${CMAKE_SOURCE_DIR}/libs/indibase/indifilterwheel.h
720
${CMAKE_SOURCE_DIR}/libs/indibase/indifocuser.h ${CMAKE_SOURCE_DIR}/libs/indibase/inditelescope.h
721
${CMAKE_SOURCE_DIR}/libs/indibase/baseclient.h ${CMAKE_SOURCE_DIR}/libs/indicom.h
722
${CMAKE_SOURCE_DIR}/libs/indibase/indiusbdevice.h
723
DESTINATION ${INCLUDE_INSTALL_DIR}/libindi COMPONENT Devel)
725
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libindi.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libindi.pc @ONLY)
726
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libindi.pc DESTINATION ${PKGCONFIG_INSTALL_PREFIX})