-
Notifications
You must be signed in to change notification settings - Fork 46
/
CMakeLists.txt
618 lines (533 loc) · 25.4 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
cmake_minimum_required(VERSION 3.0)
PROJECT(StellarSolver C CXX)
set(CMAKE_CXX_STANDARD 17)
if(APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
endif(APPLE)
#cmake_policy(SET CMP0003 NEW)
# Timestamp build
string(TIMESTAMP StellarSolver_BUILD_TS UTC)
# StellarSolver Version 2.6
set (StellarSolver_VERSION_MAJOR 2)
set (StellarSolver_VERSION_MINOR 6)
set (StellarSolver_SOVERSION "${StellarSolver_VERSION_MAJOR}")
set (StellarSolver_VERSION ${StellarSolver_VERSION_MAJOR}.${StellarSolver_VERSION_MINOR})
set (StellarSolver_VERSION_STRING "${StellarSolver_VERSION_MAJOR}.${StellarSolver_VERSION_MINOR}")
# Exports
set(TARGET_EXPORT_NAME ${PROJECT_NAME}Targets)
set(TARGET_EXPORT_CONFIG ${PROJECT_NAME}Config)
# See download progress
Set(FETCHCONTENT_QUIET FALSE)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/version.h
)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
endif(APPLE)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
include(GNUInstallDirs)
include_directories( "${CMAKE_CURRENT_BINARY_DIR}")
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}")
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/tester")
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver")
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry")
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/include")
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/include/astrometry")
set(config_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/os-features-test.c
)
set(config_FN
"${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/include/astrometry/os-features-config.h"
)
file(REMOVE "${config_FN}")
if (WIN32)
file(APPEND "${config_FN}" "#define NEED_DECLARE_QSORT_R 1\n")
file(APPEND "${config_FN}" "#define NEED_QSORT_R 1\n")
file(APPEND "${config_FN}" "#define NEED_SWAP_QSORT_R 0\n")
else(WIN32)
try_run(RUN_RESULT_2 COMPILE_SUCCESS_2 ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_DECLARE_QSORT_R=ON)
if(COMPILE_SUCCESS_2 AND (RUN_RESULT_2 EQUAL 0))
SET(VAR_2 0)
else()
SET(VAR_2 1)
endif()
file(APPEND "${config_FN}" "#define NEED_DECLARE_QSORT_R ${VAR_2}\n")
try_run(RUN_RESULT_3 COMPILE_SUCCESS_3 ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_QSORT_R=ON)
if(COMPILE_SUCCESS_3 AND (RUN_RESULT_3 EQUAL 0))
SET(VAR_3 1)
else()
SET(VAR_3 0)
endif()
file(APPEND "${config_FN}" "#define NEED_QSORT_R ${VAR_3}\n")
try_run(RUN_RESULT_4 COMPILE_SUCCESS_4 ${CMAKE_CURRENT_BINARY_DIR} ${config_SRCS} COMPILE_DEFINITIONS -DTEST_SWAP_QSORT_R=ON)
if(COMPILE_SUCCESS_4 AND (RUN_RESULT_4 EQUAL 0))
SET(VAR_4 1)
else()
SET(VAR_4 0)
endif()
file(APPEND "${config_FN}" "#define NEED_SWAP_QSORT_R ${VAR_4}\n")
endif(WIN32)
# We aren't using netpbm in this program, so set this to 0 no matter what
file(APPEND "${config_FN}" "#define HAVE_NETPBM 0")
option(BUILD_TESTER "Build stellarsolver tester program, instead of just the library" Off)
option(BUILD_BATCH_SOLVER "Build stellarsolver batch solver program, instead of just the library" Off)
option(BUILD_DEMOS "Build stellarsolver basic demonstration programs, instead of just the library" Off)
option(BUILD_TESTS "Build stellarsolver tests, instead of just the library" Off)
option(BUILD_CLI "Build stellarsolver command line interface, instead of just the library" Off)
find_package(CFITSIO REQUIRED)
find_package(GSL REQUIRED)
find_package(WCSLIB REQUIRED)
# Option to choose between Qt5 and Qt6
option(USE_QT5 "Use Qt5" ON)
if(USE_QT5)
find_package(Qt5 5.15 REQUIRED COMPONENTS Gui Widgets Core Concurrent Network)
else()
message(WARNING "QT6 support is fairly new and not fully vetted yet. Currently there is an issue with partitioning in StellarSolver in QT6.")
find_package(Qt6 REQUIRED COMPONENTS Gui Widgets Core Concurrent Network)
endif()
if (NOT CFITSIO_FOUND OR CFITSIO_VERSION_MAJOR LESS 3)
message(FATAL_ERROR "CFITSIO version too old, Please install cfitsio 3.x and try again. http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html")
endif (NOT CFITSIO_FOUND OR CFITSIO_VERSION_MAJOR LESS 3)
if (CFITSIO_FOUND)
include_directories(${CFITSIO_INCLUDE_DIR})
endif (CFITSIO_FOUND)
if (GSL_FOUND)
include_directories(${GSL_INCLUDE_DIR})
endif (GSL_FOUND)
if(WCSLIB_FOUND)
include_directories( ${WCSLIB_INCLUDE_DIR} )
endif(WCSLIB_FOUND)
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an")
set(qfits_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/anqfits.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_card.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_convert.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_error.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_header.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_image.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_table.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_time.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_tools.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_byteswap.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_memory.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_rw.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/qfits-an/qfits_float.c
)
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd")
set(kd_SRCS
#Internals
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdint_ddd.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdint_fff.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdint_ddu.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdint_duu.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdint_dds.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdint_dss.c
#kd
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdtree.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdtree_dim.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdtree_mem.c
#kd fits
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/libkd/kdtree_fits_io.c
)
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util")
set(anbase_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/starutil.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/mathutil.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/bl-sort.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/bl.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/healpix.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/permutedsort.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/ioutils.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/os-features.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/errors.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/tic.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/log.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/datalog.c
)
set(anutils_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/sip-utils.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/fit-wcs.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/sip.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/gslutils.c
#These get added if QFITS is to be included
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/fitsioutils.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/fitstable.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/fitsbin.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/fitsfile.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/tic.c
)
set(anfiles_SRCS
#I think these only get added if QFITS is to be included
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/index.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/codekd.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/starkd.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/starxy.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/util/quadfile.c
)
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/blind")
set(engine_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/blind/engine.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/blind/blind.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/blind/solver.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/blind/quad-utils.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/blind/matchobj.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/blind/tweak2.c
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/blind/verify.c
)
set (sep_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/sep/analyse.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/sep/aperture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/sep/background.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/sep/convolve.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/sep/deblend.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/sep/extract.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/sep/lutz.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/sep/util.cpp
)
set(StellarSolver_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/parameters.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/extractorsolver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/internalextractorsolver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/externalextractorsolver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/onlinesolver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/stellarsolver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometrylogger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/wcsdata.cpp
)
set(ALL_SRCS
${StellarSolver_SRCS}
${sep_SRCS}
${engine_SRCS}
${anfiles_SRCS}
${anutils_SRCS}
${anbase_SRCS}
${kd_SRCS}
${qfits_SRCS}
)
if (WIN32)
add_library(stellarsolver STATIC ${ALL_SRCS})
else(WIN32)
add_library(stellarsolver SHARED ${ALL_SRCS})
endif(WIN32)
target_link_libraries(stellarsolver PUBLIC
${CFITSIO_LIBRARIES}
${GSL_LIBRARIES}
${WCSLIB_LIBRARIES}
Qt::Core
Qt::Network
Qt::Widgets
Qt::Concurrent
)
if(WIN32)
target_link_libraries(stellarsolver PUBLIC wsock32)
else(WIN32)
set_target_properties(stellarsolver PROPERTIES VERSION ${StellarSolver_VERSION_STRING} SOVERSION ${StellarSolver_SOVERSION} OUTPUT_NAME stellarsolver)
endif(WIN32)
if (MSVC) # We need to disable some warnings caused by using code designed for Unix on a Windows machine, otherwise astrometry code gives over 1500 warnings.
# Use secure functions by default and suppress warnings about deprecated or POSIX functions
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_NONSTDC_NO_DEPRECATE=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_NONSTDC_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1")
# Disabling warnings caused by assigning values to types defined with typedef double <variable>
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244")
# Disbling warnings caused by size_t being assigned to int
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4267")
# Disabling warning for comparing signed and unsigned variables
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4018")
# Disabling the warning for redefined macros, because ERROR had a conflict and it is used A LOT in astrometry
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4005")
# Disabling warning for unused local variables (This one is important because some variables only get used on Linux or MacOS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4101")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
endif (MSVC)
install(TARGETS stellarsolver
EXPORT ${TARGET_EXPORT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION include/libstellarsolver
)
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/libstellarsolver")
set(PKG_CONFIG_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/stellarsolver.h
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/structuredefinitions.h
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/extractorsolver.h
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/parameters.h
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/wcsdata.h
${CMAKE_CURRENT_BINARY_DIR}/version.h
DESTINATION "${INCLUDE_INSTALL_DIR}")
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver/astrometry/include/astrometry
DESTINATION "${INCLUDE_INSTALL_DIR}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/stellarsolver.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/stellarsolver.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/stellarsolver.pc DESTINATION ${PKGCONFIG_INSTALL_PREFIX})
if(BUILD_TESTER OR BUILD_BATCH_SOLVER OR BUILD_DEMOS OR BUILD_TESTS OR BUILD_CLI)
set(SSolverUtilsLib_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/ssolverutils/fileio.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ssolverutils/imagelabel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ssolverutils/stretch.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ssolverutils/bayer.c
${CMAKE_CURRENT_SOURCE_DIR}/ssolverutils/dms.cpp
)
add_library(SSolverUtilsLib STATIC ${SSolverUtilsLib_SRCS})
target_link_libraries(SSolverUtilsLib PUBLIC
${CFITSIO_LIBRARIES}
${GSL_LIBRARIES}
${WCSLIB_LIBRARIES}
Qt::Gui
Qt::Widgets
Qt::Core
Qt::Network
Qt::Concurrent
)
endif(BUILD_TESTER OR BUILD_BATCH_SOLVER OR BUILD_DEMOS OR BUILD_TESTS OR BUILD_CLI)
#########################################################################################
## Stellar Solver Tester
#########################################################################################
if(BUILD_TESTER)
set(StellarSolverTester_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/tester/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tester/mainwindow.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tester/resources.qrc
)
set(CMAKE_AUTOUIC ON)
if(APPLE)
set(MACOSX_BUNDLE_ICON_FILE StellarSolverIcon.icns)
set(StellarSolverTesterApp_ICON ${CMAKE_CURRENT_SOURCE_DIR}/tester/StellarSolverIcon.icns)
set_source_files_properties(${StellarSolverTesterApp_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif(APPLE)
if(WIN32)
set(StellarSolverTesterApp_ICON ${CMAKE_CURRENT_SOURCE_DIR}/tester/windowsicon.rc)
endif(WIN32)
add_executable(StellarSolverTester ${StellarSolverTester_SRCS} ${StellarSolverui_SRCS} ${StellarSolverTesterApp_ICON})
if(APPLE)
SET_TARGET_PROPERTIES(StellarSolverTester PROPERTIES MACOSX_BUNDLE TRUE)
endif(APPLE)
target_link_libraries(StellarSolverTester PUBLIC
stellarsolver
SSolverUtilsLib
${CFITSIO_LIBRARIES}
${GSL_LIBRARIES}
${WCSLIB_LIBRARIES}
Qt::Gui
Qt::Widgets
Qt::Core
Qt::Network
Qt::Concurrent
)
if(WIN32)
target_link_libraries(StellarSolverTester PUBLIC wsock32)
endif(WIN32)
if(APPLE)
install(TARGETS StellarSolverTester
BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
)
else(APPLE)
#installation for Linux and Windows
install(TARGETS StellarSolverTester RUNTIME DESTINATION bin)
install(DIRECTORY tester/icons
DESTINATION ${CMAKE_INSTALL_PREFIX}/share)
if(WIN32)
else(WIN32)
#Desktop file for Linux
install(FILES tester/com.github.rlancaste.stellarsolver.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
endif(WIN32)
endif(APPLE)
endif(BUILD_TESTER)
#########################################################################################
## Stellar Solver Batch Solver Program
#########################################################################################
if(BUILD_BATCH_SOLVER)
set(StellarBatchSolver_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stellarbatchsolver/stellarbatchsolver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stellarbatchsolver/resources.qrc
)
qt_wrap_ui(StellarBatchSolverui_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/stellarbatchsolver/stellarbatchsolver.ui
)
if(APPLE)
set(MACOSX_BUNDLE_ICON_FILE StellarBatchSolverIcon.icns)
set(StellarBatchSolver_ICON ${CMAKE_CURRENT_SOURCE_DIR}/stellarbatchsolver/StellarBatchSolverIcon.icns)
set_source_files_properties(${StellarBatchSolver_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif(APPLE)
if(WIN32)
set(StellarBatchSolver_ICON ${CMAKE_CURRENT_SOURCE_DIR}/stellarbatchsolver/windowsicon.rc)
endif(WIN32)
add_executable(StellarBatchSolver ${StellarBatchSolver_SRCS} ${StellarBatchSolverui_SRCS} ${StellarBatchSolver_ICON})
if(APPLE)
SET_TARGET_PROPERTIES(StellarBatchSolver PROPERTIES MACOSX_BUNDLE TRUE)
endif(APPLE)
target_link_libraries(StellarBatchSolver PUBLIC
stellarsolver
SSolverUtilsLib
${CFITSIO_LIBRARIES}
${GSL_LIBRARIES}
${WCSLIB_LIBRARIES}
Qt::Widgets
Qt::Core
Qt::Network
Qt::Concurrent
)
if(WIN32)
target_link_libraries(StellarBatchSolver PUBLIC wsock32)
endif(WIN32)
if(APPLE)
install(TARGETS StellarBatchSolver
BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
)
else(APPLE)
#installation for Linux and Windows
install(TARGETS StellarBatchSolver RUNTIME DESTINATION bin)
install(DIRECTORY stellarbatchsolver/icons
DESTINATION ${CMAKE_INSTALL_PREFIX}/share)
if(WIN32)
else(WIN32)
#Desktop file for Linux
install(FILES stellarbatchsolver/com.github.rlancaste.stellarbatchsolver.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
endif(WIN32)
endif(APPLE)
endif(BUILD_BATCH_SOLVER)
#########################################################################################
## Stellar Solver Basic Demonstration Programs
#########################################################################################
if(BUILD_DEMOS)
add_library(StellarSolverDemosLib STATIC)
target_link_libraries(StellarSolverDemosLib PUBLIC
stellarsolver
SSolverUtilsLib
${CFITSIO_LIBRARIES}
${GSL_LIBRARIES}
${WCSLIB_LIBRARIES}
Qt::Widgets
Qt::Core
Qt::Network
Qt::Concurrent
)
add_executable(DemoStarExtract ${CMAKE_CURRENT_SOURCE_DIR}/demos/demostarextract.cpp)
target_link_libraries(DemoStarExtract PUBLIC StellarSolverDemosLib)
add_executable(DemoPlateSolve ${CMAKE_CURRENT_SOURCE_DIR}/demos/demoplatesolve.cpp)
target_link_libraries(DemoPlateSolve PUBLIC StellarSolverDemosLib)
add_executable(DemoExtractSolve ${CMAKE_CURRENT_SOURCE_DIR}/demos/demoextractsolve.cpp)
target_link_libraries(DemoExtractSolve PUBLIC StellarSolverDemosLib)
add_executable(DemoFITSStarExtract ${CMAKE_CURRENT_SOURCE_DIR}/demos/demofitsstarextract.cpp)
target_link_libraries(DemoFITSStarExtract PUBLIC StellarSolverDemosLib)
add_executable(DemoFITSPlateSolve ${CMAKE_CURRENT_SOURCE_DIR}/demos/demofitsplatesolve.cpp)
target_link_libraries(DemoFITSPlateSolve PUBLIC StellarSolverDemosLib)
add_executable(DemoFITSExtractSolve ${CMAKE_CURRENT_SOURCE_DIR}/demos/demofitsextractsolve.cpp)
target_link_libraries(DemoFITSExtractSolve PUBLIC StellarSolverDemosLib)
add_executable(DemoSignalsSlots ${CMAKE_CURRENT_SOURCE_DIR}/demos/demosignalsslots.cpp)
target_link_libraries(DemoSignalsSlots PUBLIC StellarSolverDemosLib)
add_executable(DemoMultipleSolves ${CMAKE_CURRENT_SOURCE_DIR}/demos/demomultiplesolves.cpp)
target_link_libraries(DemoMultipleSolves PUBLIC StellarSolverDemosLib)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/demos/pleiades.jpg" DESTINATION "${CMAKE_BINARY_DIR}/")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/demos/randomsky.fits" DESTINATION "${CMAKE_BINARY_DIR}/")
# Note: These are the index files that solve the above images best.
if(NOT EXISTS "${CMAKE_BINARY_DIR}/astrometry/")
message(STATUS "Downloading two index files for solving demos/tests. . .")
make_directory("${CMAKE_BINARY_DIR}/astrometry/")
file(DOWNLOAD "http://data.astrometry.net/4100/index-4107.fits" "${CMAKE_BINARY_DIR}/astrometry/index-4107.fits" SHOW_PROGRESS)
file(DOWNLOAD "http://data.astrometry.net/4100/index-4110.fits" "${CMAKE_BINARY_DIR}/astrometry/index-4110.fits" SHOW_PROGRESS)
endif(NOT EXISTS "${CMAKE_BINARY_DIR}/astrometry/")
endif(BUILD_DEMOS)
#########################################################################################
## Stellar Solver Command Line Interface
#########################################################################################
if(BUILD_CLI)
add_library(CommandLineInterfaceLib STATIC)
target_link_libraries(CommandLineInterfaceLib PUBLIC
stellarsolver
SSolverUtilsLib
${CFITSIO_LIBRARIES}
${GSL_LIBRARIES}
${WCSLIB_LIBRARIES}
Qt::Core
Qt::Concurrent
)
add_executable(CommandLineInterface ${CMAKE_CURRENT_SOURCE_DIR}/cli/main.cpp)
set_target_properties(CommandLineInterface PROPERTIES OUTPUT_NAME "stellarsolver-cli")
target_link_libraries(CommandLineInterface PUBLIC CommandLineInterfaceLib)
if(APPLE)
install(TARGETS CommandLineInterface
BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
)
else(APPLE)
#installation for Linux and Windows
install(TARGETS CommandLineInterface RUNTIME DESTINATION bin)
if(WIN32)
else(WIN32)
#Desktop file for Linux
#install(FILES tester/com.github.rlancaste.stellarsolver.desktop
# DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
endif(WIN32)
endif(APPLE)
endif(BUILD_CLI)
#########################################################################################
## Stellar Solver Testing
#########################################################################################
if(BUILD_TESTS)
add_library(StellarSolverTestsLib STATIC)
target_link_libraries(StellarSolverTestsLib PUBLIC
stellarsolver
SSolverUtilsLib
${CFITSIO_LIBRARIES}
${GSL_LIBRARIES}
${WCSLIB_LIBRARIES}
Qt::Widgets
Qt::Core
Qt::Network
Qt::Concurrent
)
add_executable(TestTwoStellarSolvers ${CMAKE_CURRENT_SOURCE_DIR}/tests/testtwostellarsolvers.cpp)
target_link_libraries(TestTwoStellarSolvers PUBLIC StellarSolverTestsLib)
add_executable(TestDeleteSolver ${CMAKE_CURRENT_SOURCE_DIR}/tests/testdeletesolver.cpp)
target_link_libraries(TestDeleteSolver PUBLIC StellarSolverTestsLib)
add_executable(TestMultipleSyncSolvers ${CMAKE_CURRENT_SOURCE_DIR}/tests/testmultiplesyncsolvers.cpp)
target_link_libraries(TestMultipleSyncSolvers PUBLIC StellarSolverTestsLib)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/demos/pleiades.jpg" DESTINATION "${CMAKE_BINARY_DIR}/")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/demos/randomsky.fits" DESTINATION "${CMAKE_BINARY_DIR}/")
# Note: These are the index files that solve the above images best.
if(NOT EXISTS "${CMAKE_BINARY_DIR}/astrometry/")
message(STATUS "Downloading two index files for solving demos/tests. . .")
make_directory("${CMAKE_BINARY_DIR}/astrometry/")
file(DOWNLOAD "http://data.astrometry.net/4100/index-4107.fits" "${CMAKE_BINARY_DIR}/astrometry/index-4107.fits")
file(DOWNLOAD "http://data.astrometry.net/4100/index-4110.fits" "${CMAKE_BINARY_DIR}/astrometry/index-4110.fits")
endif(NOT EXISTS "${CMAKE_BINARY_DIR}/astrometry/")
endif(BUILD_TESTS)
#########################################################################################
# Generate Package Config Files
#########################################################################################
# Set destination directory
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
# 1. Generate the StellarSolverConfigVersion.cmake
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EXPORT_CONFIG}Version.cmake"
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY SameMajorVersion
)
# 2. Configure the Exports and namespace
export(TARGETS stellarsolver
NAMESPACE ${PROJECT_NAME}::
FILE ${TARGET_EXPORT_NAME}.cmake)
# 3. Configure the Include Directories
target_include_directories(stellarsolver PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include/libstellarsolver>)
# 4. Install StellarSolver Config
install(EXPORT ${TARGET_EXPORT_NAME}
FILE ${TARGET_EXPORT_CONFIG}.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${ConfigPackageLocation})
# 5. Install StellarSolver Config Version
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${TARGET_EXPORT_CONFIG}Version.cmake"
DESTINATION ${ConfigPackageLocation})