diff --git a/CMakeLists.txt b/CMakeLists.txt index 5261b20e3..52b131895 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,443 +1,446 @@ PROJECT(kstars CXX C) set (KStars_VERSION_MAJOR 2) set (KStars_VERSION_MINOR 9) set (KStars_VERSION_REVISION 6) set (CMAKE_CXX_STANDARD 11) #Build KStars Lite with -DKSTARS_LITE=ON option(BUILD_KSTARS_LITE "Build KStars Lite" OFF) -if(BUILD_KSTARS_LITE) - add_definitions(-DKSTARS_LITE) -endif(BUILD_KSTARS_LITE) # minimal requirements cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) string(TIMESTAMP KSTARS_BUILD_TS UTC) if(BUILD_KSTARS_LITE) set (QT_MIN_VERSION "5.7.0") #QtQuickControls 2 is available only in the Qt 5.7.0 else() set (QT_MIN_VERSION "5.4.0") endif() # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) # Ccache support IF (ANDROID OR UNIX OR APPLE) FIND_PROGRAM(CCACHE_FOUND ccache) SET(CCACHE_SUPPORT OFF CACHE BOOL "Enable ccache support") IF ((CCACHE_FOUND OR ANDROID) AND CCACHE_SUPPORT MATCHES ON) SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) ENDIF () ENDIF () if(CMAKE_SYSTEM_NAME STREQUAL Android) add_definitions(-DANDROID -D__STDC_LIMIT_MACROS) set(ANDROID TRUE) endif() if(CMAKE_TOOLCHAIN_FILE STREQUAL ${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake) include(${CMAKE_BINARY_DIR}/kf5/kde/install/share/ECM/cmake/ECMConfig.cmake) endif() find_package(ECM 1.7.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH}) if(BUILD_KSTARS_LITE) if(CMAKE_TOOLCHAIN_FILE STREQUAL ${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake) set(QT_ANDROID $ENV{QT_ANDROID}) include(${QT_ANDROID}/lib/cmake/Qt5/Qt5Config.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Core/Qt5CoreConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Qml/Qt5QmlConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Quick/Qt5QuickConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5QuickControls2/Qt5QuickControls2Config.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Xml/Qt5XmlConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Svg/Qt5SvgConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Sql/Qt5SqlConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Network/Qt5NetworkConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Positioning/Qt5PositioningConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5Concurrent/Qt5ConcurrentConfig.cmake) include(${QT_ANDROID}/lib/cmake/Qt5AndroidExtras/Qt5AndroidExtrasConfig.cmake) else() if(ANDROID) list(APPEND QT_EXTRA_COMPONENTS AndroidExtras) + else() + list(APPEND QT_EXTRA_COMPONENTS PrintSupport) endif() - find_package(Qt5 5.7 REQUIRED COMPONENTS Gui Qml Quick QuickControls2 Xml Svg Sql Network Positioning Concurrent ${QT_EXTRA_COMPONENTS}) + find_package(Qt5 5.7 REQUIRED COMPONENTS Gui Qml Quick QuickControls2 Xml Svg Sql Network Positioning Concurrent WebSockets ${QT_EXTRA_COMPONENTS}) endif() else() #find_package(Qt5 5.4 REQUIRED COMPONENTS Gui Qml Quick Xml Sql Svg Network PrintSupport Positioning Concurrent) find_package(Qt5 5.4 REQUIRED COMPONENTS Gui Qml Quick Xml Sql Svg Network PrintSupport Concurrent WebSockets) endif() include(ExternalProject) include(ECMInstallIcons) include(ECMAddAppIcon) include(KDEInstallDirs) include(MacroBoolTo01) include(ECMQtDeclareLoggingCategory) if(NOT CMAKE_TOOLCHAIN_FILE STREQUAL ${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake) #We get error "could not find main method" with this module include(KDECompilerSettings NO_POLICY_SCOPE) endif() include(KDECMakeSettings) include(FeatureSummary) # Load the frameworks we need if(BUILD_KSTARS_LITE) if(CMAKE_TOOLCHAIN_FILE STREQUAL ${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake) set(KF5_VERSION 5.28.0) set(KF5_HOST_TOOLING /usr/lib/x86_64-linux-gnu/cmake/) include(${CMAKE_BINARY_DIR}/kf5/kde/install/lib/cmake/KF5Config/KF5ConfigConfig.cmake) include(${CMAKE_BINARY_DIR}/kf5/kde/install/lib/cmake/KF5I18n/KF5I18nConfig.cmake) include(${CMAKE_BINARY_DIR}/kf5/kde/install/lib/cmake/KF5Plotting/KF5PlottingConfig.cmake) else() - find_package(KF5 REQUIRED COMPONENTS Config I18n Plotting) + # Find Optional package NotifyConfig for desktop notifications + find_package(KF5 COMPONENTS NotifyConfig) + MACRO_BOOL_TO_01(KF5NotifyConfig_FOUND HAVE_NOTIFYCONFIG) + + find_package(KF5 REQUIRED COMPONENTS Auth Config Crash DocTools WidgetsAddons NewStuff I18n KIO XmlGui Plotting Notifications) endif() else(BUILD_KSTARS_LITE) # Find Optional package NotifyConfig for desktop notifications find_package(KF5 COMPONENTS NotifyConfig) MACRO_BOOL_TO_01(KF5NotifyConfig_FOUND HAVE_NOTIFYCONFIG) find_package(KF5 REQUIRED COMPONENTS Auth Config Crash DocTools WidgetsAddons NewStuff I18n KIO XmlGui Plotting Notifications ) endif(BUILD_KSTARS_LITE) ## Eigen3 Library find_package(Eigen3 REQUIRED) add_definitions(${EIGEN_DEFINITIONS}) include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR}) ## CFITSIO Library if(ANDROID) if(CMAKE_TOOLCHAIN_FILE STREQUAL ${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake) set(extra_cmake "-DM_LIB=-lm") endif() externalproject_add(cfitsio SOURCE_DIR "${CMAKE_BINARY_DIR}/android/3rdparty/cfitsio" URL https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio3370.tar.gz PATCH_COMMAND bash -c "cd ${CMAKE_BINARY_DIR}/android/3rdparty/cfitsio && dos2unix ${CMAKE_BINARY_DIR}/android/3rdparty/cfitsio/CMakeLists.txt && patch -p1 < ${CMAKE_SOURCE_DIR}/android/3rdparty/cfitsio.patch" CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${extra_cmake} BUILD_COMMAND make cfitsio BUILD_IN_SOURCE 1 INSTALL_COMMAND "") set(CFITSIO_FOUND TRUE) set(CFITSIO_INCLUDE_DIR PUBLIC ${CMAKE_BINARY_DIR}/android/3rdparty/cfitsio) set(CFITSIO_LIBRARIES ${CMAKE_BINARY_DIR}/android/3rdparty/cfitsio/libcfitsio.a) else() if(BUILD_KSTARS_LITE) find_package(CFitsio REQUIRED) else() find_package(CFitsio) endif() endif() MACRO_BOOL_TO_01(CFITSIO_FOUND HAVE_CFITSIO) set_package_properties(CFitsio PROPERTIES DESCRIPTION "FITS IO Library" URL "http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html" TYPE OPTIONAL PURPOSE "Support for the FITS (Flexible Image Transport System) data format in KStars.") ## INDI Library if (ANDROID) set(QT_ANDROID $ENV{QT_ANDROID}) if(CMAKE_TOOLCHAIN_FILE STREQUAL ${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake) set(extra_cmake -DCMAKE_AR=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar) endif() externalproject_add(indi SOURCE_DIR "${CMAKE_BINARY_DIR}/android/indi" URL https://github.com/indilib/indi/archive/master.zip CONFIGURE_COMMAND cd libindi && cmake . -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \\ -DINDI_BUILD_POSIX_CLIENT=OFF -DINDI_BUILD_SERVER=OFF -DINDI_BUILD_DRIVERS=OFF -DINDI_BUILD_UNITTESTS=OFF \\ -DINDI_BUILD_DRIVERS=OFF -DINDI_BUILD_QT5_CLIENT=ON -DINDI_CALCULATE_MINMAX=ON \\ -DCFITSIO_DIR=${CMAKE_BINARY_DIR}/android/3rdparty/cfitsio -DQT_ANDROID=${QT_ANDROID} -DCMAKE_PREFIX_PATH=${QT_ANDROID} ${extra_cmake} BUILD_COMMAND make -C libindi BUILD_IN_SOURCE 1 INSTALL_COMMAND "") set(INDI_FOUND TRUE) set(INDI_INCLUDE_DIR ${CMAKE_BINARY_DIR}/android/indi/libindi/libs/indibase ${CMAKE_BINARY_DIR}/android/indi/libindi ${CMAKE_BINARY_DIR}/android/indi/libindi/libs) set(INDI_CLIENT_ANDROID_LIBRARIES ${CMAKE_BINARY_DIR}/android/indi/libindi/libindiclientqt.a) else () find_package(INDI 1.7.1) endif () MACRO_BOOL_TO_01(INDI_FOUND HAVE_INDI) set_package_properties(INDI PROPERTIES DESCRIPTION "Astronomical instrumentation control" URL "http://www.indilib.org" TYPE OPTIONAL PURPOSE "Support for controlling astronomical devices on Linux with KStars.") ## Libraw if(BUILD_KSTARS_LITE AND ANDROID) # OpenMP needed for LibRaw set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp -DLIBRAW_USE_OPENMP") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -DLIBRAW_USE_OPENMP") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgomp") externalproject_add(raw SOURCE_DIR "${CMAKE_BINARY_DIR}/android/3rdparty/libraw" URL https://www.libraw.org/data/LibRaw-0.17.2.tar.gz PATCH_COMMAND bash -c "cd ${CMAKE_BINARY_DIR}/android/3rdparty/libraw && wget -qO- https://github.com/LibRaw/LibRaw-cmake/archive/master.zip | jar xvf /dev/stdin && rm -rf cmake && mv -f LibRaw-cmake-master/CMakeLists.txt LibRaw-cmake-master/cmake . && patch -p1 < ${CMAKE_SOURCE_DIR}/android/3rdparty/libraw.patch" CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DENABLE_OPENMP=OFF -DENABLE_LCMS=OFF BUILD_COMMAND make raw BUILD_IN_SOURCE 1 INSTALL_COMMAND "") include_directories(${CMAKE_BINARY_DIR}/android/3rdparty/libraw) set(LIBRAW_LIBRARIES ${CMAKE_BINARY_DIR}/android/3rdparty/libraw/libraw.a) set(LibRaw_FOUND true) else() find_package(LibRaw) endif() MACRO_BOOL_TO_01(LibRaw_FOUND HAVE_LIBRAW) set_package_properties(LibRaw PROPERTIES DESCRIPTION "Library for reading RAW files" URL "http://www.libraw.org" TYPE OPTIONAL PURPOSE "Support for reading and displaying RAW files in KStars.") ## WCS Library find_package(WCSLIB) MACRO_BOOL_TO_01(WCSLIB_FOUND HAVE_WCSLIB) set_package_properties(WCSLIB PROPERTIES DESCRIPTION "World Coordinate System library" URL "http://www.atnf.csiro.au/people/mcalabre/WCS" TYPE OPTIONAL PURPOSE "WCS enables KStars to read and process world coordinate systems in FITS header.") ## XPlanet find_package(Xplanet) set_package_properties(Xplanet PROPERTIES DESCRIPTION "Renders an image of all the major planets and most satellites" URL "http://xplanet.sourceforge.net" TYPE RUNTIME PURPOSE "Gives KStars support for xplanet.") # Qt5 Data Visualization find_package(Qt5DataVisualization) MACRO_BOOL_TO_01(Qt5DataVisualization_FOUND HAVE_DATAVISUALIZATION) ## Astrometry.net find_package(AstrometryNet) set_package_properties(AstrometryNet PROPERTIES DESCRIPTION "Astrometrics Library" URL "http://www.astrometry.net" TYPE RUNTIME PURPOSE "Support for plate solving in KStars.") ## Key Chain find_package(Qt5Keychain) MACRO_BOOL_TO_01(Qt5Keychain_FOUND HAVE_KEYCHAIN) ## OpenGL find_package(OpenGL) set_package_properties(OpenGL PROPERTIES DESCRIPTION "Open Graphics Library" URL "http://www.opengl.org" TYPE OPTIONAL PURPOSE "Support for hardware rendering in KStars.") if (${KF5_VERSION} VERSION_GREATER 5.17.0) SET(HAVE_KF5WIT 1) else() SET(HAVE_KF5WIT 0) endif() add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) if (CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-DQT_STRICT_ITERATORS) endif() add_definitions(-DQT_NO_CAST_TO_ASCII) if (UNIX) add_definitions(-Dfexceptions) # TEMPORARY: To disable QCustomPlot warning until 2.0.0 is released which fixes these warnings SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-non-virtual-dtor") # Optimize binary size by dropping unneeded symbols at linking stage if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") endif() endif(UNIX) # Add security (hardening flags) IF (UNIX OR APPLE OR ANDROID) SET(SEC_COMP_FLAGS "-D_FORTIFY_SOURCE=2 -fstack-protector-all -Wcast-align -fPIE") IF (NOT ANDROID AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT APPLE) SET(SEC_COMP_FLAGS "${SEC_COMP_FLAGS} -Wa,--noexecstack") ENDIF () SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SEC_COMP_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SEC_COMP_FLAGS}") SET(SEC_LINK_FLAGS "") IF (NOT APPLE) SET(SEC_LINK_FLAGS "${SEC_LINK_FLAGS} -Wl,-z,nodump -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now") ENDIF () IF (NOT ANDROID AND NOT APPLE) SET(SEC_LINK_FLAGS "${SEC_LINK_FLAGS} -pie") ENDIF () SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SEC_LINK_FLAGS}") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SEC_LINK_FLAGS}") ENDIF () # Clang Format support IF (UNIX OR APPLE) SET(FORMAT_CODE OFF CACHE BOOL "Enable Clang Format") IF (FORMAT_CODE MATCHES ON) FILE(GLOB_RECURSE ALL_SOURCE_FILES *.c *.cpp *.h) FOREACH(SOURCE_FILE ${ALL_SOURCE_FILES}) STRING(FIND ${SOURCE_FILE} ${CMAKE_SOURCE_DIR} DIR_FOUND) IF (NOT ${DIR_FOUND} EQUAL 0) LIST(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE}) ENDIF () ENDFOREACH () FIND_PROGRAM(CLANGFORMAT_EXE NAMES clang-format-5.0) IF (CLANGFORMAT_EXE) ADD_CUSTOM_TARGET(clang-format COMMAND ${CLANGFORMAT_EXE} -style=file -i ${ALL_SOURCE_FILES}) ENDIF () ENDIF () ENDIF () SET(FIX_WARNINGS OFF CACHE BOOL "Enable strict compilation mode to turn compiler warnings to errors") # Warning, debug and linker flags IF (UNIX OR APPLE) SET(COMP_FLAGS "") SET(LINKER_FLAGS "") # Verbose warnings and turns all to errors SET(COMP_FLAGS "${COMP_FLAGS} -Wall -Wextra") IF (FIX_WARNINGS) SET(COMP_FLAGS "${COMP_FLAGS} -Werror") ENDIF () # Omit problematic warnings IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-unused-but-set-variable") ENDIF () IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.9.9) SET(COMP_FLAGS "${COMP_FLAGS} -Wno-format-truncation") ENDIF () IF (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-nonnull -Wno-deprecated-declarations") ENDIF () IF (BUILD_KSTARS_LITE AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-overloaded-virtual") ENDIF () SET(COMP_FLAGS "${COMP_FLAGS} -g") # Note: The following flags are problematic on older systems with gcc 4.8 IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9.9)) IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") SET(COMP_FLAGS "${COMP_FLAGS} -Wno-unused-command-line-argument") ENDIF () FIND_PROGRAM(LDGOLD_FOUND ld.gold) SET(LDGOLD_SUPPORT OFF CACHE BOOL "Enable ld.gold support") # Optional ld.gold is 2x faster than normal ld IF (LDGOLD_FOUND AND LDGOLD_SUPPORT MATCHES ON AND NOT APPLE AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES arm) SET(LINKER_FLAGS "${LINKER_FLAGS} -fuse-ld=gold") # We have Gsl library what is a special case for linking: # The gsl library must be linked with cblas. There are two alternatives for this: libcblas or libgslcblas. # For example, CMake gets the GSL_LIBRARIES linking flags from the pkgconfig (gsl.pc) file on Ubuntu. # This file defines -lgsl -lglscblas for linking flags and if KStars is compiled with Clang, the linker # finds out magically that KStars must be linked against glscblas library, but gslcblas is omitted in linking # stage if KStars is built with gcc. The linker must be instructed explicitly to link against all libraries # passed on command line by -Wl,--no-as-needed. SET(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--no-as-needed") # Use Identical Code Folding SET(COMP_FLAGS "${COMP_FLAGS} -ffunction-sections") SET(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--icf=safe") # Compress the debug sections # Note: Before valgrind 3.12.0, patch should be applied for valgrind (https://bugs.kde.org/show_bug.cgi?id=303877) IF (NOT APPLE AND NOT ANDROID AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES arm AND NOT CMAKE_CXX_CLANG_TIDY) SET(COMP_FLAGS "${COMP_FLAGS} -Wa,--compress-debug-sections") SET(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--compress-debug-sections=zlib") ENDIF () ENDIF () ENDIF () # Apply the flags SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMP_FLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMP_FLAGS}") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}") ENDIF () # Sanitizer support SET(SANITIZERS OFF CACHE BOOL "Sanitizer support for gcc and Clang") IF (SANITIZERS AND ((UNIX AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR CMAKE_COMPILER_IS_GNUCXX) OR (APPLE AND (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_COMPILER_IS_GNUCXX)))) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address,undefined -fno-omit-frame-pointer") ENDIF () # Unity build support SET(UNITY_BUILD OFF CACHE BOOL "Enable Unity Build") INCLUDE(UnityBuild) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config-kstars.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kstars.h ) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/kstars/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kstars/version.h ) # let our config.h be found first in any case include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(doc) add_subdirectory(kstars) add_subdirectory(datahandlers) IF (NOT ANDROID) IF (BUILD_TESTING) enable_testing(true) add_subdirectory(Tests) ENDIF() # Make it possible to use the po files fetched by the fetch-translations step ki18n_install("${CMAKE_CURRENT_BINARY_DIR}/po") ENDIF () install(FILES org.kde.kstars.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) # Only build k5auth for Linux -if (NOT BUILD_KSTARS_LITE AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # This helper file is generated to download astrometry.net index files. add_executable(kauth_kstars_helper kstars/auxiliary/downloadhelper.cpp ${helper_mocs}) target_link_libraries(kauth_kstars_helper Qt5::Core) target_link_libraries(kauth_kstars_helper Qt5::Widgets) target_link_libraries(kauth_kstars_helper KF5::Auth) install(TARGETS kauth_kstars_helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR}) kauth_install_helper_files(kauth_kstars_helper org.kde.kf5auth.kstars root) kauth_install_actions(org.kde.kf5auth.kstars org.kde.kf5auth.kstars.actions) ENDIF () # Final package generation if (CMAKE_TOOLCHAIN_FILE STREQUAL ${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake) set(EXPORT_DIR "${CMAKE_BINARY_DIR}/android/kstars_build_apk/") set(ANDROID_APK_DIR "${CMAKE_SOURCE_DIR}/android/apk/") set(EXECUTABLE_DESTINATION_PATH "${EXPORT_DIR}/libs/armeabi-v7a/libkstars.so") set(ANDROID_NDK $ENV{ANDROID_NDK}) set(ANDROID_SDK_ROOT $ENV{ANDROID_SDK_ROOT}) set(ANDROID_API_LEVEL $ENV{ANDROID_API_LEVEL}) set(ANDROID_TOOLCHAIN arm-linux-androideabi) set(ANDROID_GCC_VERSION 4.9) set(ANDROID_ABI armeabi-v7a) set(_HOST "${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}") string(TOLOWER "${_HOST}" _HOST) set(ANDROID_SDK_BUILD_TOOLS_REVISION 21.1.1) set(ANDROID_KEYSTORE $ENV{ANDROID_KEYSTORE}) set(ANDROID_KEYSTORE_ALIAS $ENV{ANDROID_KEYSTORE_ALIAS}) configure_file("${CMAKE_SOURCE_DIR}/android/deployment-file.json.in" "${CMAKE_BINARY_DIR}/android/kstars-deployment.json.in") add_custom_target(create-apk-kstars COMMAND cmake -E echo "Generating $ with $/androiddeployqt" COMMAND cmake -E remove_directory "${EXPORT_DIR}" COMMAND cmake -E copy_directory "${CMAKE_SOURCE_DIR}/android/apk" "${EXPORT_DIR}" COMMAND cmake -E copy "$" "${EXECUTABLE_DESTINATION_PATH}" COMMAND cmake -DINPUT_FILE="${CMAKE_BINARY_DIR}/android/kstars-deployment.json.in" -DOUTPUT_FILE="${CMAKE_BINARY_DIR}/android/kstars-deployment.json" "-DTARGET_DIR=${CMAKE_BINARY_DIR}/kstars" "-DTARGET_NAME=kstars" "-DEXPORT_DIR=${CMAKE_INSTALL_PREFIX}" -P ${CMAKE_SOURCE_DIR}/android/specifydependencies.cmake COMMAND $/androiddeployqt --input "${CMAKE_BINARY_DIR}/android/kstars-deployment.json" --output "${EXPORT_DIR}" --android-platform android-${ANDROID_API_LEVEL} --debug --deployment bundled "\\$(ARGS)" COMMAND $/androiddeployqt --input "${CMAKE_BINARY_DIR}/android/kstars-deployment.json" --output "${EXPORT_DIR}" --android-platform android-${ANDROID_API_LEVEL} --release --deployment bundled "\\$(ARGS)" ) if (ANDROID_KEYSTORE AND ANDROID_KEYSTORE_ALIAS) add_custom_target(sign-apk-kstars COMMAND jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ${ANDROID_KEYSTORE} ${CMAKE_BINARY_DIR}/android/kstars_build_apk/bin/QtApp-release-unsigned.apk ${ANDROID_KEYSTORE_ALIAS} COMMAND rm -rf ${CMAKE_BINARY_DIR}/android/kstars_build_apk/bin/kstars-signed.apk COMMAND zipalign -v 4 ${CMAKE_BINARY_DIR}/android/kstars_build_apk/bin/QtApp-release-unsigned.apk ${CMAKE_BINARY_DIR}/android/kstars_build_apk/bin/kstars-signed.apk ) endif () endif () diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ddfbdb064..6d0507b1f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1,33 +1,41 @@ include_directories( ${kstars_SOURCE_DIR}/kstars/tools ${kstars_SOURCE_DIR}/kstars/skyobjects ${kstars_SOURCE_DIR}/kstars/skycomponents ${kstars_SOURCE_DIR}/kstars/auxiliary ${kstars_SOURCE_DIR}/kstars/time ) if(WCSLIB_FOUND) include_directories( ${WCSLIB_INCLUDE_DIR} ) endif(WCSLIB_FOUND) FIND_PACKAGE(Qt5Test REQUIRED) SET( TEST_LIBRARIES Qt5::Core Qt5::Test LibKSDataHandlers htmesh ${ZLIB_LIBRARIES} KStarsLib ) +SET( TEST_KSLITE_LIBRARIES + Qt5::Core + Qt5::Test + LibKSDataHandlers + htmesh + ${ZLIB_LIBRARIES} + KStarsLiteLib +) + add_subdirectory(auxiliary) add_subdirectory(skyobjects) IF (UNIX AND NOT APPLE AND CFITSIO_FOUND) IF (BUILD_KSTARS_LITE) add_subdirectory(kstars_lite_ui) - ELSE () - add_subdirectory(kstars_ui) ENDIF () + add_subdirectory(kstars_ui) ENDIF () diff --git a/Tests/kstars_lite_ui/CMakeLists.txt b/Tests/kstars_lite_ui/CMakeLists.txt index 5826739b5..a407ba4fd 100644 --- a/Tests/kstars_lite_ui/CMakeLists.txt +++ b/Tests/kstars_lite_ui/CMakeLists.txt @@ -1,20 +1,20 @@ SET(KSTARS_LITE_UI_TESTS_SRC kstars_lite_ui_tests.cpp) ECM_ADD_APP_ICON(KSTARS_UI_TESTS_SRC ICONS ../../kstars/icons/16-apps-kstars.png ../../kstars/icons/32-apps-kstars.png ../../kstars/icons/48-apps-kstars.png ../../kstars/icons/64-apps-kstars.png ../../kstars/icons/128-apps-kstars.png ) ADD_EXECUTABLE(kstars_lite_ui_tests ${KSTARS_LITE_UI_TESTS_SRC}) -TARGET_LINK_LIBRARIES(kstars_lite_ui_tests ${TEST_LIBRARIES} -lpthread) +TARGET_LINK_LIBRARIES(kstars_lite_ui_tests ${TEST_KSLITE_LIBRARIES} -lpthread) IF (INDI_FOUND) INCLUDE_DIRECTORIES(${INDI_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(kstars_lite_ui_tests ${INDI_CLIENT_QT_LIBRARIES} ${NOVA_LIBRARIES} z) ENDIF () ADD_TEST(NAME KStarsLiteUiTests COMMAND ${CMAKE_CURRENT_BINARY_DIR}/kstars) diff --git a/datahandlers/CMakeLists.txt b/datahandlers/CMakeLists.txt index f17c96a83..ba2ee29a6 100644 --- a/datahandlers/CMakeLists.txt +++ b/datahandlers/CMakeLists.txt @@ -1,31 +1,31 @@ include_directories( ${kstars_SOURCE_DIR}/kstars/tools ${kstars_SOURCE_DIR}/kstars/skyobjects ${kstars_SOURCE_DIR}/kstars/skycomponents ${kstars_SOURCE_DIR}/kstars/auxiliary ${kstars_SOURCE_DIR}/kstars/time ${kstars_SOURCE_DIR}/kstars/kstarslite ) SET(LibKSDataHandlers_SRC ${kstars_SOURCE_DIR}/datahandlers/catalogentrydata.cpp ${kstars_SOURCE_DIR}/datahandlers/catalogdata.cpp ${kstars_SOURCE_DIR}/datahandlers/ksparser.cpp ${kstars_SOURCE_DIR}/datahandlers/catalogdb.cpp) IF (UNITY_BUILD) ENABLE_UNITY_BUILD(LibKSDataHandlers LibKSDataHandlers_SRC 10 cpp) ENDIF () ecm_qt_declare_logging_category(LibKSDataHandlers_SRC HEADER catalog_debug.h IDENTIFIER KSTARS_CATALOG CATEGORY_NAME org.kde.kstars.catalog) add_library(LibKSDataHandlers STATIC ${LibKSDataHandlers_SRC}) # Added this because includedir was missing, is this required? -if(BUILD_KSTARS_LITE) +if (ANDROID) target_link_libraries(LibKSDataHandlers KF5::I18n Qt5::Sql Qt5::Core Qt5::Gui) -else(BUILD_KSTARS_LITE) +else () target_link_libraries(LibKSDataHandlers KF5::WidgetsAddons KF5::I18n Qt5::Sql Qt5::Core Qt5::Gui) -endif(BUILD_KSTARS_LITE) +endif () diff --git a/datahandlers/catalogdb.cpp b/datahandlers/catalogdb.cpp index 73a31c1fd..bc83dca41 100644 --- a/datahandlers/catalogdb.cpp +++ b/datahandlers/catalogdb.cpp @@ -1,983 +1,983 @@ /*************************************************************************** catalogDB.cpp - K Desktop Planetarium ------------------- begin : 2012/03/08 copyright : (C) 2012 by Rishab Arora email : ra.rishab@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "catalogdb.h" #include "catalogdata.h" #include "catalogentrydata.h" #include "kstars/version.h" #include "../kstars/auxiliary/kspaths.h" #include "starobject.h" #include "deepskyobject.h" #include "skycomponent.h" #include #include #include #include bool CatalogDB::Initialize() { skydb_ = QSqlDatabase::addDatabase("QSQLITE", "skydb"); QString dbfile = KSPaths::locate(QStandardPaths::GenericDataLocation, QString("skycomponents.sqlite")); if (dbfile.isEmpty()) dbfile = KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + QString("skycomponents.sqlite"); QFile testdb(dbfile); bool first_run = false; if (!testdb.exists()) { qCWarning(KSTARS_CATALOG) << "DSO DB does not exist!"; first_run = true; } skydb_.setDatabaseName(dbfile); if (!skydb_.open()) { qCWarning(KSTARS_CATALOG) << i18n("Unable to open DSO database file!"); qCWarning(KSTARS_CATALOG) << LastError(); } else { qCDebug(KSTARS_CATALOG) << "Opened the DSO Database. Ready!"; if (first_run == true) { FirstRun(); } } skydb_.close(); return true; } void CatalogDB::FirstRun() { qCWarning(KSTARS_CATALOG) << i18n("Rebuilding Additional Sky Catalog Database"); QVector tables; tables.append("CREATE TABLE Version (" "Version CHAR DEFAULT NULL)"); tables.append("INSERT INTO Version VALUES (\"" KSTARS_VERSION "\")"); tables.append("CREATE TABLE ObjectDesignation (" "id INTEGER NOT NULL DEFAULT NULL PRIMARY KEY," "id_Catalog INTEGER DEFAULT NULL REFERENCES Catalog (id)," "UID_DSO INTEGER DEFAULT NULL REFERENCES DSO (UID)," "LongName MEDIUMTEXT DEFAULT NULL," "IDNumber INTEGER DEFAULT NULL," "Trixel INTEGER NULL)"); // TODO(kstar): `Trixel` int(11) NOT NULL COMMENT 'Trixel Number' // For Future safety tables.append("CREATE TABLE Catalog (" "id INTEGER DEFAULT NULL PRIMARY KEY AUTOINCREMENT," "Name CHAR NOT NULL DEFAULT 'NULL'," "Prefix CHAR DEFAULT 'NULL'," "Color CHAR DEFAULT '#CC0000'," "Epoch FLOAT DEFAULT 2000.0," "Author CHAR DEFAULT NULL," "License MEDIUMTEXT DEFAULT NULL," "FluxFreq CHAR DEFAULT 'NULL'," "FluxUnit CHAR DEFAULT 'NULL')"); tables.append("CREATE TABLE DSO (" "UID INTEGER DEFAULT NULL PRIMARY KEY AUTOINCREMENT," "RA DOUBLE NOT NULL DEFAULT 0.0," "Dec DOUBLE DEFAULT 0.0," //"RA CHAR NOT NULL DEFAULT 'NULL'," //"Dec CHAR NOT NULL DEFAULT 'NULL'," "Type INTEGER DEFAULT NULL," "Magnitude DECIMAL DEFAULT NULL," "PositionAngle INTEGER DEFAULT NULL," "MajorAxis FLOAT NOT NULL DEFAULT NULL," "MinorAxis FLOAT DEFAULT NULL," "Flux FLOAT DEFAULT NULL," "Add1 VARCHAR DEFAULT NULL," "Add2 INTEGER DEFAULT NULL," "Add3 INTEGER DEFAULT NULL," "Add4 INTEGER DEFAULT NULL)"); for (int i = 0; i < tables.count(); ++i) { QSqlQuery query(skydb_); if (!query.exec(tables[i])) { qCWarning(KSTARS_CATALOG) << query.lastError(); } } } CatalogDB::~CatalogDB() { skydb_.close(); } QSqlError CatalogDB::LastError() { // error description is in QSqlError::text() return skydb_.lastError(); } QStringList *CatalogDB::Catalogs() { RefreshCatalogList(); return &catalog_list_; } void CatalogDB::RefreshCatalogList() { catalog_list_.clear(); skydb_.open(); QSqlTableModel catalog(nullptr, skydb_); catalog.setTable("Catalog"); catalog.setSort(0, Qt::AscendingOrder); catalog.select(); for (int i = 0; i < catalog.rowCount(); ++i) { QSqlRecord record = catalog.record(i); QString name = record.value("Name").toString(); catalog_list_.append(name); // QString author = record.value("Author").toString(); // QString license = record.value("License").toString(); // QString compiled_by = record.value("CompiledBy").toString(); // QString prefix = record.value("Prefix").toString(); } catalog.clear(); skydb_.close(); } int CatalogDB::FindCatalog(const QString &catalog_name) { skydb_.open(); QSqlTableModel catalog(nullptr, skydb_); catalog.setTable("Catalog"); catalog.setFilter("Name LIKE \'" + catalog_name + "\'"); catalog.select(); int catalog_count = catalog.rowCount(); QSqlRecord record = catalog.record(0); int returnval = -1; if (catalog_count > 0) returnval = record.value("id").toInt(); catalog.clear(); skydb_.close(); return returnval; } void CatalogDB::AddCatalog(const CatalogData &catalog_data) { skydb_.open(); QSqlTableModel cat_entry(nullptr, skydb_); cat_entry.setTable("Catalog"); int row = 0; cat_entry.insertRows(row, 1); // row(0) is autoincerement ID cat_entry.setData(cat_entry.index(row, 1), catalog_data.catalog_name); cat_entry.setData(cat_entry.index(row, 2), catalog_data.prefix); cat_entry.setData(cat_entry.index(row, 3), catalog_data.color); cat_entry.setData(cat_entry.index(row, 4), catalog_data.epoch); cat_entry.setData(cat_entry.index(row, 5), catalog_data.author); cat_entry.setData(cat_entry.index(row, 6), catalog_data.license); cat_entry.setData(cat_entry.index(row, 7), catalog_data.fluxfreq); cat_entry.setData(cat_entry.index(row, 8), catalog_data.fluxunit); cat_entry.submitAll(); cat_entry.clear(); skydb_.close(); } void CatalogDB::RemoveCatalog(const QString &catalog_name) { // Part 1 Clear DSO Entries ClearDSOEntries(FindCatalog(catalog_name)); skydb_.open(); QSqlTableModel catalog(nullptr, skydb_); // Part 2 Clear Catalog Table catalog.setTable("Catalog"); catalog.setFilter("Name LIKE \'" + catalog_name + "\'"); catalog.select(); catalog.removeRows(0, catalog.rowCount()); catalog.submitAll(); catalog.clear(); skydb_.close(); RefreshCatalogList(); } void CatalogDB::ClearDSOEntries(int catalog_id) { skydb_.open(); QStringList del_query; // FIXME(spacetime): Only delete from DSO if removed from all Designations // del_query.append("DELETE FROM DSO WHERE UID IN (SELECT UID_DSO FROM " // "ObjectDesignation WHERE id_Catalog = " + // QString::number(catalog_id) + ")"); del_query.append("DELETE FROM ObjectDesignation WHERE id_Catalog = " + QString::number(catalog_id)); for (int i = 0; i < del_query.count(); ++i) { QSqlQuery query(skydb_); if (!query.exec(del_query[i])) { qCWarning(KSTARS_CATALOG) << query.lastError(); } } skydb_.close(); } int CatalogDB::FindFuzzyEntry(const double ra, const double dec, const double magnitude) { /* * FIXME (spacetime): Match the incoming entry with the ones from the db * with certain fuzz. If found, store it in rowuid * This Fuzz has not been established after due discussion */ //skydb_.open(); QSqlTableModel dsoentries(nullptr, skydb_); QString filter = "((RA - " + QString().setNum(ra) + ") between -0.0016 and 0.0016) and " "((Dec - " + QString().setNum(dec) + ") between -0.0016 and 0.0016) and" "((Magnitude - " + QString().setNum(magnitude) + ") between -0.1 and 0.1)"; // qDebug() << filter; dsoentries.setTable("DSO"); dsoentries.setFilter(filter); dsoentries.select(); int entry_count = dsoentries.rowCount(); QSqlRecord record = dsoentries.record(0); int returnval = -1; if (entry_count > 0) returnval = record.value("UID").toInt(); dsoentries.clear(); //skydb_.close(); // qDebug() << returnval; return returnval; } bool CatalogDB::AddEntry(const CatalogEntryData &catalog_entry, int catid) { if (!skydb_.open()) { qCWarning(KSTARS_CATALOG) << "Failed to open database to add catalog entry!"; qCWarning(KSTARS_CATALOG) << LastError(); return false; } bool retVal = _AddEntry(catalog_entry, catid); skydb_.close(); return retVal; } bool CatalogDB::_AddEntry(const CatalogEntryData &catalog_entry, int catid) { // Verification step // If RA, Dec are Null, it denotes an invalid object and should not be written if (catid < 0) { qCWarning(KSTARS_CATALOG) << "Catalog ID " << catid << " is invalid! Cannot add object."; return false; } if (catalog_entry.ra == KSParser::EBROKEN_DOUBLE || catalog_entry.ra == 0.0 || std::isnan(catalog_entry.ra) || catalog_entry.dec == KSParser::EBROKEN_DOUBLE || catalog_entry.dec == 0.0 || std::isnan(catalog_entry.dec)) { qCWarning(KSTARS_CATALOG) << "Attempt to add incorrect ra & dec with ID:" << catalog_entry.ID << " Long Name: " << catalog_entry.long_name; return false; } // Part 1: Adding in DSO table // I will not use QSQLTableModel as I need to execute a query to find // out the lastInsertId // Part 2: Fuzzy Match or Create New Entry int rowuid = FindFuzzyEntry(catalog_entry.ra, catalog_entry.dec, catalog_entry.magnitude); //skydb_.open(); if (rowuid == -1) //i.e. No fuzzy match found. Proceed to add new entry { QSqlQuery add_query(skydb_); add_query.prepare("INSERT INTO DSO (RA, Dec, Type, Magnitude, PositionAngle," " MajorAxis, MinorAxis, Flux) VALUES (:RA, :Dec, :Type," " :Magnitude, :PositionAngle, :MajorAxis, :MinorAxis," " :Flux)"); add_query.bindValue(":RA", catalog_entry.ra); add_query.bindValue(":Dec", catalog_entry.dec); add_query.bindValue(":Type", catalog_entry.type); add_query.bindValue(":Magnitude", catalog_entry.magnitude); add_query.bindValue(":PositionAngle", catalog_entry.position_angle); add_query.bindValue(":MajorAxis", catalog_entry.major_axis); add_query.bindValue(":MinorAxis", catalog_entry.minor_axis); add_query.bindValue(":Flux", catalog_entry.flux); if (!add_query.exec()) { qCWarning(KSTARS_CATALOG) << "Custom Catalog Insert Query FAILED!"; qCWarning(KSTARS_CATALOG) << add_query.lastQuery(); qCWarning(KSTARS_CATALOG) << add_query.lastError(); } // Find UID of the Row just added rowuid = add_query.lastInsertId().toInt(); add_query.clear(); } int ID = catalog_entry.ID; /* TODO(spacetime) * Possible Bugs in QSQL Db with SQLite * 1) Unless the db is closed and opened again, the next queries * fail. * 2) unless I clear the resources, db close fails. The doc says * this is to be rarely used. */ // Find ID of catalog //skydb_.close(); //catid = FindCatalog(catalog_entry.catalog_name); // Part 3: Add in Object Designation //skydb_.open(); QSqlQuery add_od(skydb_); if (ID >= 0) { add_od.prepare("INSERT INTO ObjectDesignation (id_Catalog, UID_DSO, LongName" ", IDNumber) VALUES (:catid, :rowuid, :longname, :id)"); add_od.bindValue(":id", ID); } else { //qWarning() << "FIXME: This query has not been tested!!!!"; add_od.prepare("INSERT INTO ObjectDesignation (id_Catalog, UID_DSO, LongName" ", IDNumber) VALUES (:catid, :rowuid, :longname," "(SELECT MAX(ISNULL(IDNumber,1))+1 FROM ObjectDesignation WHERE id_Catalog = :catid) )"); } add_od.bindValue(":catid", catid); add_od.bindValue(":rowuid", rowuid); add_od.bindValue(":longname", catalog_entry.long_name); bool retVal = true; if (!add_od.exec()) { qWarning() << "Query exec failed:"; qWarning() << add_od.lastQuery(); qWarning() << skydb_.lastError(); retVal = false; } add_od.clear(); //skydb_.close(); return retVal; } QString CatalogDB::GetCatalogName(const QString &fname) { QDir::setCurrent(QDir::homePath()); // for files with relative path QString filename = fname; // If the filename begins with "~", replace the "~" with the user's home // directory (otherwise, the file will not successfully open) if (filename.at(0) == '~') filename = QDir::homePath() + filename.mid(1, filename.length()); QFile ccFile(filename); if (ccFile.open(QIODevice::ReadOnly)) { QString catalog_name; QTextStream stream(&ccFile); QString line; for (int times = 10; times >= 0 && !stream.atEnd(); --times) { line = stream.readLine(); int iname = line.indexOf("# Name: "); if (iname == 0) { // line contains catalog name iname = line.indexOf(":") + 2; catalog_name = line.mid(iname); return catalog_name; } } } return QString(); } bool CatalogDB::AddCatalogContents(const QString &fname) { QDir::setCurrent(QDir::homePath()); // for files with relative path QString filename = fname; // If the filename begins with "~", replace the "~" with the user's home // directory (otherwise, the file will not successfully open) if (filename.at(0) == '~') filename = QDir::homePath() + filename.mid(1, filename.length()); QFile ccFile(filename); if (ccFile.open(QIODevice::ReadOnly)) { QStringList columns; // list of data column descriptors in the header QString catalog_name; char delimiter; QTextStream stream(&ccFile); // TODO(spacetime) : Decide appropriate number of lines to be read QStringList lines; for (int times = 10; times >= 0 && !stream.atEnd(); --times) lines.append(stream.readLine()); /*WAS * = stream.readAll().split('\n', QString::SkipEmptyParts); * Memory Hog! */ if (lines.size() < 1 || !ParseCatalogInfoToDB(lines, columns, catalog_name, delimiter)) { qWarning() << "Issue in catalog file header: " << filename; ccFile.close(); return false; } ccFile.close(); // The entry in the Catalog table is now ready! /* * Now 'Columns' should be a StringList of the Header contents * Hence, we 1) Convert the Columns to a KSParser compatible format * 2) Use KSParser to read stuff and store in DB */ // Part 1) Conversion to KSParser compatible format QList> sequence = buildParserSequence(columns); // Part 2) Read file and store into DB KSParser catalog_text_parser(filename, '#', sequence, delimiter); int catid = FindCatalog(catalog_name); skydb_.open(); skydb_.transaction(); QHash row_content; while (catalog_text_parser.HasNextRow()) { row_content = catalog_text_parser.ReadNextRow(); CatalogEntryData catalog_entry; dms read_ra(row_content["RA"].toString(), false); dms read_dec(row_content["Dc"].toString(), true); //qDebug()< assume space if (delimiter == '\0') delimiter = ' '; if (!foundDataColumns) { if (showerrs) errs.append(i18n("Parsing header: ") + i18n("No valid column descriptors found. Exiting")); return false; } if (i == lines.size()) { if (showerrs) errs.append(i18n("Parsing header: ") + i18n("No data lines found after" " header. Exiting.")); return false; } else { // Make sure Name, Prefix, Color and Epoch were set if (catalog_name.isEmpty()) { if (showerrs) errs.append(i18n("Parsing header: ") + i18n("No Catalog Name specified;" " setting to \"Custom\"")); catalog_name = i18n("Custom"); } if (catPrefix.isEmpty()) { if (showerrs) errs.append(i18n("Parsing header: ") + i18n("No Catalog Prefix specified" "; setting to \"CC\"")); catPrefix = "CC"; } if (catColor.isEmpty()) { if (showerrs) errs.append(i18n("Parsing header: ") + i18n("No Catalog Color specified" "; setting to Red")); catColor = "#CC0000"; } if (catEpoch == 0.) { if (showerrs) errs.append(i18n("Parsing header: ") + i18n("No Catalog Epoch specified" "; assuming 2000.")); catEpoch = 2000.; } -#ifndef KSTARS_LITE +#if !defined(ANDROID) // Detect a duplicate catalog name if (FindCatalog(catalog_name) != -1) { if (KMessageBox::warningYesNo(nullptr, i18n("A catalog of the same name already exists. " "Overwrite contents? If you press yes, the" " new catalog will erase the old one!"), i18n("Overwrite Existing Catalog")) == KMessageBox::No) { return false; } else { RemoveCatalog(catalog_name); } } #endif // Everything OK. Make a new Catalog entry in DB CatalogData new_catalog; new_catalog.catalog_name = catalog_name; new_catalog.prefix = catPrefix; new_catalog.color = catColor; new_catalog.epoch = catEpoch; new_catalog.fluxfreq = catFluxFreq; new_catalog.fluxunit = catFluxUnit; AddCatalog(new_catalog); return true; } } void CatalogDB::GetCatalogData(const QString &catalog_name, CatalogData &load_catalog) { skydb_.open(); QSqlTableModel catalog(nullptr, skydb_); catalog.setTable("Catalog"); catalog.setFilter("Name LIKE \'" + catalog_name + "\'"); catalog.select(); QSqlRecord record = catalog.record(0); load_catalog.prefix = record.value("Prefix").toString(); load_catalog.color = record.value("Color").toString(); load_catalog.fluxfreq = record.value("FluxFreq").toString(); load_catalog.fluxunit = record.value("FluxUnit").toString(); load_catalog.epoch = record.value("Epoch").toFloat(); catalog.clear(); skydb_.close(); } void CatalogDB::GetAllObjects(const QString &catalog, QList &sky_list, QList> &object_names, CatalogComponent *catalog_ptr, bool includeCatalogDesignation) { qDeleteAll(sky_list); sky_list.clear(); QString selected_catalog = QString::number(FindCatalog(catalog)); skydb_.open(); QSqlQuery get_query(skydb_); get_query.prepare("SELECT Epoch, Type, RA, Dec, Magnitude, Prefix, " "IDNumber, LongName, MajorAxis, MinorAxis, " "PositionAngle, Flux FROM ObjectDesignation JOIN DSO " "JOIN Catalog WHERE Catalog.id = :catID AND " "ObjectDesignation.id_Catalog = Catalog.id AND " "ObjectDesignation.UID_DSO = DSO.UID"); get_query.bindValue(":catID", selected_catalog); // qWarning() << get_query.lastQuery(); // qWarning() << get_query.lastError(); // qWarning() << FindCatalog(catalog); if (!get_query.exec()) { qWarning() << get_query.lastQuery(); qWarning() << get_query.lastError(); } while (get_query.next()) { int cat_epoch = get_query.value(0).toInt(); unsigned char iType = get_query.value(1).toInt(); dms RA(get_query.value(2).toDouble()); dms Dec(get_query.value(3).toDouble()); float mag = get_query.value(4).toFloat(); QString catPrefix = get_query.value(5).toString(); int id_number_in_catalog = get_query.value(6).toInt(); QString lname = get_query.value(7).toString(); float a = get_query.value(8).toFloat(); float b = get_query.value(9).toFloat(); float PA = get_query.value(10).toFloat(); float flux = get_query.value(11).toFloat(); QString name; if (!includeCatalogDesignation && !lname.isEmpty()) { name = lname; lname = QString(); } else name = catPrefix + ' ' + QString::number(id_number_in_catalog); SkyPoint t; t.set(RA, Dec); if (cat_epoch == 1950) { // Assume B1950 epoch t.B1950ToJ2000(); // t.ra() and t.dec() are now J2000.0 // coordinates } else if (cat_epoch == 2000) { // Do nothing { } } else { // FIXME: What should we do? // FIXME: This warning will be printed for each line in the // catalog rather than once for the entire catalog qWarning() << "Unknown epoch while dealing with custom " "catalog. Will ignore the epoch and assume" " J2000.0"; } RA = t.ra(); Dec = t.dec(); // FIXME: It is a bad idea to create objects in one class // (using new) and delete them in another! The objects created // here are usually deleted by CatalogComponent! See // CatalogComponent::loadData for more information! if (iType == 0) // Add a star { StarObject *o = new StarObject(RA, Dec, mag, lname); sky_list.append(o); } else // Add a deep-sky object { DeepSkyObject *o = new DeepSkyObject(iType, RA, Dec, mag, name, QString(), lname, catPrefix, a, b, -PA); o->setFlux(flux); o->setCustomCatalog(catalog_ptr); sky_list.append(o); // Add name to the list of object names if (!name.isEmpty()) { object_names.append(qMakePair(iType, name)); } } if (!lname.isEmpty() && lname != name) { object_names.append(qMakePair(iType, lname)); } } get_query.clear(); skydb_.close(); } QList> CatalogDB::buildParserSequence(const QStringList &Columns) { QList> sequence; QStringList::const_iterator iter = Columns.begin(); while (iter != Columns.end()) { // Available Types: ID RA Dc Tp Nm Mg Flux Mj Mn PA Ig KSParser::DataTypes current_type; if (*iter == QString("ID")) current_type = KSParser::D_QSTRING; else if (*iter == QString("RA")) current_type = KSParser::D_QSTRING; else if (*iter == QString("Dc")) current_type = KSParser::D_QSTRING; else if (*iter == QString("Tp")) current_type = KSParser::D_INT; else if (*iter == QString("Nm")) current_type = KSParser::D_QSTRING; else if (*iter == QString("Mg")) current_type = KSParser::D_FLOAT; else if (*iter == QString("Flux")) current_type = KSParser::D_FLOAT; else if (*iter == QString("Mj")) current_type = KSParser::D_FLOAT; else if (*iter == QString("Mn")) current_type = KSParser::D_FLOAT; else if (*iter == QString("PA")) current_type = KSParser::D_FLOAT; else if (*iter == QString("Ig")) current_type = KSParser::D_SKIP; sequence.append(qMakePair(*iter, current_type)); ++iter; } return sequence; } diff --git a/datahandlers/catalogdb.h b/datahandlers/catalogdb.h index 7af3bd41a..90ece8540 100644 --- a/datahandlers/catalogdb.h +++ b/datahandlers/catalogdb.h @@ -1,239 +1,239 @@ /*************************************************************************** catalogDB.h - K Desktop Planetarium ------------------- begin : 2012/03/08 copyright : (C) 2012 by Rishab Arora email : ra.rishab@gmail.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #pragma once #include "ksparser.h" #include -#ifndef KSTARS_LITE +#if !defined(ANDROID) #include #endif #include #include class SkyObject; class CatalogComponent; class CatalogData; class CatalogEntryData; /* * Some notes about the database. (skycomponents.sqlite) * 1) The uid for Object Designation is the uid being used by objects in KStars * hence, the uid is a qint64 i.e. a 64 bit signed integer. Coincidentally, * this is the max limit of an int in Sqlite3. * Hence, the db is compatible with the uid, but doesn't use it as of now. */ class CatalogDB { public: /** * @brief Initializes the database and sets up pointers to Catalog DB * Performs the following actions: * 1. Checks if database file exists * 2. Checks if database can be opened * 3. If DB file is missing, creates new DB * 4. Sets up pointer to Catalog DB * * usage: Call QSqlDatabase::removeDatabase("skydb"); after the object * of this class is deallocated * @return bool **/ bool Initialize(); /** * @brief Attempt to close database and remove reference from the DB List * **/ ~CatalogDB(); /** * @brief Accessor for list of all available catalogs in db * * @return QStringList* **/ QStringList *Catalogs(); /** * @brief Rechecks the database and builds the Catalog listing. * New listing is directly updated into catalogs (accessed using Catalogs()) * * @return void **/ void RefreshCatalogList(); /** * @short Parses the catalog header and returns the catalog name * * @p filename the name of the file containing the data to be read * @return Catalog name or empty string if there is an error */ QString GetCatalogName(const QString &filename); /** * @short Add contents of custom catalog to the program database * * @p filename the name of the file containing the data to be read * @return true if catalog was successfully added */ bool AddCatalogContents(const QString &filename); /** * @brief returns the id of the row if it matches with certain fuzz. * Else return -1 if none found * * @param ra Right Ascension of new object to be added * @param dec Declination of new object to be added * @return int RowUID of the new row **/ int FindFuzzyEntry(const double ra, const double dec, const double magnitude); /** * @brief Removes the catalog from the database and refreshes the listing. * * @param catalog_name Name of the catalog * @return void **/ void RemoveCatalog(const QString &catalog_name); /** * @brief Creates objects of type SkyObject and assigns them to references * * @param catalog Name of the catalog whose objects are needed. * @param sky_list List of all skyobjects stored in database (assigns) * @param names List of named objects in database (assigns) * @param catalog_pointer pointer to the catalogcomponent objects * (needed for building skyobjects) * @param includeCatalogDesignation This is useful when using 'fake' catalogs to bundle up * catalogs. Imagine a "Misc" catalog with a bunch of miscellaneous objects. We don't want * the designations "Misc 1", "Misc 2" etc. So the only proper designations are the * long name. When this is the case, this flag is set to false, and the catalog designation * (cat_prefix + cat_id) will not be included in the object_names returned. * * @return void **/ void GetAllObjects(const QString &catalog_name, QList &sky_list, QList> &object_names, CatalogComponent *catalog_pointer, bool includeCatalogDesignation = true); /** * @brief Get information about the catalog like Prefix etc * * @param catalog_name Name of catalog whose details are required * @param catalog_data Data structure assigned with required data * @return void **/ void GetCatalogData(const QString &catalog_name, CatalogData &catalog_data); /** * @brief Used to add a cross referenced entry into the database * * @note This public method opens and closes the database. * * @param catalog_entry Data structure with entry details * @param catid Category ID in the database * @return false if adding was unsuccessful **/ bool AddEntry(const CatalogEntryData &catalog_entry, int catid); /** * @brief Returns database ID of the required catalog. * Returns -1 if not found. * * @param name Name of the class being searched * @return int **/ int FindCatalog(const QString &catalog_name); /** * @brief Add the catalog with given details into the database * * @param catalog_data CatalogData object encompassing all catalog info * @return void **/ void AddCatalog(const CatalogData &catalog_data); private: /** * @brief Used to add a cross referenced entry into the database * * @note This private method is useful when calling the method * repeatedly on an already-opened DB. * * @param catalog_entry Data structure with entry details * @param catid Category ID in the database * @return false if adding was unsuccessful **/ bool _AddEntry(const CatalogEntryData &catalog_entry, int catid); /** * @brief Database object for the sky object. Assigned and Initialized by Initialize() **/ QSqlDatabase skydb_; /** * @brief Returns the last error the database encountered * * @return QSqlError **/ QSqlError LastError(); /** * @brief List of all the catalogs contained in the database. * This variable is accessed through Catalogs() **/ QStringList catalog_list_; /** * @short Add the catalog name and details to the db. * This does not store the contents. It only adds the catalog info * to the database. Hence, it is step 1 in AddCatalogContents * * @param lines List of lines to use for extraction of details * @param Columns Stores the read Columns in this list * @param catalog_name Name retrieved from file header * @param delimiter Delimeter retrieved from file header * @return bool **/ bool ParseCatalogInfoToDB(const QStringList &lines, QStringList &columns, QString &catalog_name, char &delimiter); /** * @brief Prepares the sequence required by KSParser according to header. * Information on the sequence is stored inside the header * * @param Columns List of the columns names as strings * @return QList of the format usable by KSParser **/ QList> buildParserSequence(const QStringList &Columns); /** * @brief Clears out the DSO table for the given catalog ID * * @param catalog_id DB generated catalog ID * @return void **/ void ClearDSOEntries(int catalog_id); /** * @brief Contains setup routines to intitialize a database for catalog storage * * @return void **/ void FirstRun(); }; diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt index 8eea33b8d..6af16bd9d 100644 --- a/kstars/CMakeLists.txt +++ b/kstars/CMakeLists.txt @@ -1,1142 +1,1139 @@ add_subdirectory( data ) add_subdirectory( icons ) add_subdirectory( htmesh ) if (${KF5_VERSION} VERSION_EQUAL 5.18.0 OR ${KF5_VERSION} VERSION_GREATER 5.18.0) SET(HAVE_KF5WIT 1) # if(NOT BUILD_KSTARS_LITE) # add_subdirectory( tools/whatsinteresting/qml) # endif(NOT BUILD_KSTARS_LITE) else() SET(HAVE_KF5WIT 0) endif() if (ANDROID AND CMAKE_TOOLCHAIN_FILE) include(${CMAKE_TOOLCHAIN_FILE}) endif () if (NOT ANDROID) find_package(ZLIB REQUIRED) find_package(Threads REQUIRED) endif () if(MSVC) add_definitions(-D_USE_MATH_DEFINES=1) add_definitions(-DNOMINMAX) endif() include_directories( ${kstars_SOURCE_DIR}/kstars ${kstars_SOURCE_DIR}/kstars/skyobjects ${kstars_SOURCE_DIR}/kstars/skycomponents ${kstars_SOURCE_DIR}/kstars/auxiliary ${kstars_SOURCE_DIR}/kstars/time + ${kstars_SOURCE_DIR}/kstars/tools ) -if(BUILD_KSTARS_LITE) - include_directories( - ${kstars_SOURCE_DIR}/kstars/triangle - ) -else(BUILD_KSTARS_LITE) - include_directories( - ${kstars_SOURCE_DIR}/kstars/tools - ) -endif(BUILD_KSTARS_LITE) - -if(NOT BUILD_KSTARS_LITE) - if (CFITSIO_FOUND) - - set (sep_SRCS - fitsviewer/sep/analyse.c - fitsviewer/sep/aperture.c - fitsviewer/sep/background.c - fitsviewer/sep/convolve.c - fitsviewer/sep/deblend.c - fitsviewer/sep/extract.c - fitsviewer/sep/lutz.c - fitsviewer/sep/util.c - ) +if (CFITSIO_FOUND) + set (sep_SRCS + fitsviewer/sep/analyse.c + fitsviewer/sep/aperture.c + fitsviewer/sep/background.c + fitsviewer/sep/convolve.c + fitsviewer/sep/deblend.c + fitsviewer/sep/extract.c + fitsviewer/sep/lutz.c + fitsviewer/sep/util.c + ) - set (fits_SRCS - fitsviewer/fitslabel.cpp - fitsviewer/fitsviewer.cpp - fitsviewer/fitstab.cpp - fitsviewer/fitsdebayer.cpp - fitsviewer/opsfits.cpp - ) + set (fits_SRCS + fitsviewer/fitslabel.cpp + fitsviewer/fitsviewer.cpp + fitsviewer/fitstab.cpp + fitsviewer/fitsdebayer.cpp + fitsviewer/opsfits.cpp + ) - if (Qt5DataVisualization_FOUND) + if (Qt5DataVisualization_FOUND) set(fits_SRCS ${fits_SRCS} fitsviewer/starprofileviewer.cpp) - endif() + endif() - set (fits2_SRCS - fitsviewer/bayer.c - fitsviewer/fitshistogram.cpp - fitsviewer/fitsdata.cpp - fitsviewer/fitsview.cpp - ) - set (fitsui_SRCS - fitsviewer/fitsheaderdialog.ui - fitsviewer/statform.ui - fitsviewer/fitsdebayer.ui - indi/streamform.ui - indi/recordingoptions.ui - fitsviewer/fitshistogramui.ui - fitsviewer/opsfits.ui - ) - include_directories(${CFITSIO_INCLUDE_DIR}) + set (fits2_SRCS + fitsviewer/bayer.c + fitsviewer/fitshistogram.cpp + fitsviewer/fitsview.cpp + fitsviewer/fitsdata.cpp + ) + set (fitsui_SRCS + fitsviewer/fitsheaderdialog.ui + fitsviewer/statform.ui + fitsviewer/fitsdebayer.ui + indi/streamform.ui + indi/recordingoptions.ui + fitsviewer/fitshistogramui.ui + fitsviewer/opsfits.ui + ) + include_directories(${CFITSIO_INCLUDE_DIR}) - endif(CFITSIO_FOUND) -endif(NOT BUILD_KSTARS_LITE) +endif(CFITSIO_FOUND) IF (CFITSIO_FOUND) IF (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) IF (SANITIZERS) SET_SOURCE_FILES_PROPERTIES(fitsviewer/bayer.c PROPERTIES COMPILE_FLAGS "-Wno-cast-align -fno-sanitize=address,undefined -fomit-frame-pointer") SET_SOURCE_FILES_PROPERTIES(fitsviewer/fitsdata.cpp PROPERTIES COMPILE_FLAGS "-fno-sanitize=address,undefined -fomit-frame-pointer") SET_SOURCE_FILES_PROPERTIES(fitsviewer/fitshistogram.cpp PROPERTIES COMPILE_FLAGS "-fno-sanitize=address,undefined -fomit-frame-pointer") SET_SOURCE_FILES_PROPERTIES(fitsviewer/fitsview.cpp PROPERTIES COMPILE_FLAGS "-fno-sanitize=address,undefined -fomit-frame-pointer") ELSE () SET_SOURCE_FILES_PROPERTIES(fitsviewer/bayer.c PROPERTIES COMPILE_FLAGS "-Wno-cast-align") ENDIF () SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/analyse.c PROPERTIES COMPILE_FLAGS "-Wno-cast-align") SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/aperture.c PROPERTIES COMPILE_FLAGS "-Wno-cast-align -Wno-pointer-arith") SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/background.c PROPERTIES COMPILE_FLAGS "-Wno-cast-align") SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/deblend.c PROPERTIES COMPILE_FLAGS "-Wno-cast-align -Wno-incompatible-pointer-types-discards-qualifiers") SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/extract.c PROPERTIES COMPILE_FLAGS "-Wno-cast-align") SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/lutz.c PROPERTIES COMPILE_FLAGS "-Wno-cast-align") SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/util.c PROPERTIES COMPILE_FLAGS "-Wno-incompatible-pointer-types-discards-qualifiers") ELSEIF (NOT WIN32) SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/aperture.c PROPERTIES COMPILE_FLAGS "-Wno-pointer-arith") SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/deblend.c PROPERTIES COMPILE_FLAGS "-Wno-discarded-qualifiers") SET_SOURCE_FILES_PROPERTIES(fitsviewer/sep/util.c PROPERTIES COMPILE_FLAGS "-Wno-discarded-qualifiers") ENDIF () ENDIF () if (INDI_FOUND) if(BUILD_KSTARS_LITE) - set (fits_SRCS + set (fits_klite_SRCS fitsviewer/fitsdata.cpp ) - set (fits2_SRCS + set (fits2_klite_SRCS fitsviewer/bayer.c ) include_directories(${CFITSIO_INCLUDE_DIR}) include_directories(${NOVA_INCLUDE_DIR}) - set (indi_SRCS + set (indi_klite_SRCS indi/clientmanagerlite.cpp indi/inditelescopelite.cpp kstarslite/skyitems/skynodes/crosshairnode.cpp kstarslite/skyitems/telescopesymbolsitem.cpp ) - else(BUILD_KSTARS_LITE) - set(indiui_SRCS - indi/streamform.ui - indi/drivermanager.ui - indi/opsindi.ui - indi/indihostconf.ui - indi/telescopewizard.ui - ) + endif () - set(indi_SRCS - indi/drivermanager.cpp - indi/servermanager.cpp - indi/clientmanager.cpp - indi/guimanager.cpp - indi/driverinfo.cpp - indi/deviceinfo.cpp - indi/indidevice.cpp - indi/indigroup.cpp - indi/indiproperty.cpp - indi/indielement.cpp - indi/indistd.cpp - indi/indilistener.cpp - indi/inditelescope.cpp - indi/indiccd.cpp - indi/indifocuser.cpp - indi/indifilter.cpp - indi/indidome.cpp - indi/indiweather.cpp - indi/indicap.cpp - indi/indilightbox.cpp - indi/indidbus.cpp - indi/opsindi.cpp - indi/telescopewizardprocess.cpp - indi/streamwg.cpp - indi/videowg.cpp - indi/indiwebmanager.cpp - ) + set(indiui_SRCS + indi/streamform.ui + indi/drivermanager.ui + indi/opsindi.ui + indi/indihostconf.ui + indi/telescopewizard.ui + ) - if (CFITSIO_FOUND) - set(ekosui_SRCS - ekos/opsekos.ui - ekos/ekosmanager.ui - ekos/profileeditor.ui - ekos/profilewizard.ui - # Scheduler - ekos/scheduler/scheduler.ui - ekos/scheduler/mosaic.ui - # Capture - ekos/capture/capture.ui - ekos/capture/calibrationoptions.ui - ekos/capture/dslrinfo.ui - ekos/capture/rotatorsettings.ui - ekos/capture/customproperties.ui - # Align - ekos/align/align.ui - ekos/align/opsastrometry.ui - ekos/align/opsalign.ui - ekos/align/opsastrometrycfg.ui - ekos/align/opsastrometryindexfiles.ui - ekos/align/mountmodel.ui - # Focus - ekos/focus/focus.ui - # Mount - ekos/mount/mount.ui - # Guide - ekos/guide/guide.ui - ekos/guide/opscalibration.ui - ekos/guide/opsguide.ui - #TODO remove from GIT - #ekos/guide/guider.ui - #ekos/guide/rcalibration.ui - # Auxiliary - ekos/auxiliary/filtersettings.ui - ekos/auxiliary/opslogs.ui - # Ekos Live - ekos/ekoslive/ekoslivedialog.ui - ) + set(indi_SRCS + indi/drivermanager.cpp + indi/servermanager.cpp + indi/clientmanager.cpp + indi/guimanager.cpp + indi/driverinfo.cpp + indi/deviceinfo.cpp + indi/indidevice.cpp + indi/indigroup.cpp + indi/indiproperty.cpp + indi/indielement.cpp + indi/indistd.cpp + indi/indilistener.cpp + indi/inditelescope.cpp + indi/indiccd.cpp + indi/indifocuser.cpp + indi/indifilter.cpp + indi/indidome.cpp + indi/indiweather.cpp + indi/indicap.cpp + indi/indilightbox.cpp + indi/indidbus.cpp + indi/opsindi.cpp + indi/telescopewizardprocess.cpp + indi/streamwg.cpp + indi/videowg.cpp + indi/indiwebmanager.cpp + ) - set(ekos_SRCS - ekos/ekos.cpp - ekos/ekosmanager.cpp - ekos/profileeditor.cpp - ekos/profilewizard.cpp - ekos/qMDNS.cpp - ekos/opsekos.cpp - - # Auxiliary - ekos/auxiliary/dome.cpp - ekos/auxiliary/weather.cpp - ekos/auxiliary/dustcap.cpp - ekos/auxiliary/darklibrary.cpp - ekos/auxiliary/filtermanager.cpp - ekos/auxiliary/filterdelegate.cpp - ekos/auxiliary/opslogs.cpp - - # Capture - ekos/capture/capture.cpp - ekos/capture/sequencejob.cpp - ekos/capture/dslrinfodialog.cpp - ekos/capture/rotatorsettings.cpp - ekos/capture/customproperties.cpp - - # Scheduler - ekos/scheduler/schedulerjob.cpp - ekos/scheduler/scheduler.cpp - ekos/scheduler/mosaic.cpp - - # Focus - ekos/focus/focus.cpp - - # Mount - ekos/mount/mount.cpp - - # Align - ekos/align/align.cpp - ekos/align/alignview.cpp - ekos/align/astrometryparser.cpp - ekos/align/opsastrometry.cpp - ekos/align/opsalign.cpp - ekos/align/opsastrometrycfg.cpp - ekos/align/opsastrometryindexfiles.cpp - ekos/align/offlineastrometryparser.cpp - ekos/align/onlineastrometryparser.cpp - ekos/align/remoteastrometryparser.cpp - - # Guide - ekos/guide/guide.cpp - ekos/guide/guideinterface.cpp - ekos/guide/opscalibration.cpp - ekos/guide/opsguide.cpp - # Internal Guide - ekos/guide/internalguide/gmath.cpp - ekos/guide/internalguide/internalguider.cpp - #ekos/guide/internalguide/guider.cpp - ekos/guide/internalguide/matr.cpp - #ekos/guide/internalguide/rcalibration.cpp - ekos/guide/internalguide/vect.cpp - ekos/guide/internalguide/imageautoguiding.cpp - # External Guide - ekos/guide/externalguide/phd2.cpp - ekos/guide/externalguide/linguider.cpp - - # Ekos Live - ekos/ekoslive/ekosliveclient.cpp - ekos/ekoslive/message.cpp - ekos/ekoslive/media.cpp - - ) - endif(CFITSIO_FOUND) - endif(BUILD_KSTARS_LITE) + if (CFITSIO_FOUND) + set(ekosui_SRCS + ekos/opsekos.ui + ekos/ekosmanager.ui + ekos/profileeditor.ui + ekos/profilewizard.ui + # Scheduler + ekos/scheduler/scheduler.ui + ekos/scheduler/mosaic.ui + # Capture + ekos/capture/capture.ui + ekos/capture/calibrationoptions.ui + ekos/capture/dslrinfo.ui + ekos/capture/rotatorsettings.ui + ekos/capture/customproperties.ui + # Align + ekos/align/align.ui + ekos/align/opsastrometry.ui + ekos/align/opsalign.ui + ekos/align/opsastrometrycfg.ui + ekos/align/opsastrometryindexfiles.ui + ekos/align/mountmodel.ui + # Focus + ekos/focus/focus.ui + # Mount + ekos/mount/mount.ui + # Guide + ekos/guide/guide.ui + ekos/guide/opscalibration.ui + ekos/guide/opsguide.ui + #TODO remove from GIT + #ekos/guide/guider.ui + #ekos/guide/rcalibration.ui + # Auxiliary + ekos/auxiliary/filtersettings.ui + ekos/auxiliary/opslogs.ui + # Ekos Live + ekos/ekoslive/ekoslivedialog.ui + ) + + set(ekos_SRCS + ekos/ekos.cpp + ekos/ekosmanager.cpp + ekos/profileeditor.cpp + ekos/profilewizard.cpp + ekos/qMDNS.cpp + ekos/opsekos.cpp + + # Auxiliary + ekos/auxiliary/dome.cpp + ekos/auxiliary/weather.cpp + ekos/auxiliary/dustcap.cpp + ekos/auxiliary/darklibrary.cpp + ekos/auxiliary/filtermanager.cpp + ekos/auxiliary/filterdelegate.cpp + ekos/auxiliary/opslogs.cpp + + # Capture + ekos/capture/capture.cpp + ekos/capture/sequencejob.cpp + ekos/capture/dslrinfodialog.cpp + ekos/capture/rotatorsettings.cpp + ekos/capture/customproperties.cpp + + # Scheduler + ekos/scheduler/schedulerjob.cpp + ekos/scheduler/scheduler.cpp + ekos/scheduler/mosaic.cpp + + # Focus + ekos/focus/focus.cpp + + # Mount + ekos/mount/mount.cpp + + # Align + ekos/align/align.cpp + ekos/align/alignview.cpp + ekos/align/astrometryparser.cpp + ekos/align/opsastrometry.cpp + ekos/align/opsalign.cpp + ekos/align/opsastrometrycfg.cpp + ekos/align/opsastrometryindexfiles.cpp + ekos/align/offlineastrometryparser.cpp + ekos/align/onlineastrometryparser.cpp + ekos/align/remoteastrometryparser.cpp + + # Guide + ekos/guide/guide.cpp + ekos/guide/guideinterface.cpp + ekos/guide/opscalibration.cpp + ekos/guide/opsguide.cpp + # Internal Guide + ekos/guide/internalguide/gmath.cpp + ekos/guide/internalguide/internalguider.cpp + #ekos/guide/internalguide/guider.cpp + ekos/guide/internalguide/matr.cpp + #ekos/guide/internalguide/rcalibration.cpp + ekos/guide/internalguide/vect.cpp + ekos/guide/internalguide/imageautoguiding.cpp + # External Guide + ekos/guide/externalguide/phd2.cpp + ekos/guide/externalguide/linguider.cpp + + # Ekos Live + ekos/ekoslive/ekosliveclient.cpp + ekos/ekoslive/message.cpp + ekos/ekoslive/media.cpp + ) + endif(CFITSIO_FOUND) include_directories(${INDI_INCLUDE_DIR}) endif (INDI_FOUND) -if(NOT BUILD_KSTARS_LITE) - if(WCSLIB_FOUND) - include_directories( ${WCSLIB_INCLUDE_DIR} ) - endif(WCSLIB_FOUND) - - set(xplanet_SRCS - xplanet/opsxplanet.cpp - ) +if(WCSLIB_FOUND) + include_directories( ${WCSLIB_INCLUDE_DIR} ) +endif(WCSLIB_FOUND) - set(xplanetui_SRCS - xplanet/opsxplanet.ui - ) +set(xplanet_SRCS + xplanet/opsxplanet.cpp +) - ########### next target ############### - set(libkstarstools_SRCS - tools/altvstime.cpp - tools/avtplotwidget.cpp - tools/calendarwidget.cpp - tools/conjunctions.cpp -# tools/jmoontool.cpp - tools/ksconjunct.cpp - tools/eqplotwidget.cpp - tools/astrocalc.cpp - tools/modcalcangdist.cpp - tools/modcalcapcoord.cpp - tools/modcalcaltaz.cpp - tools/modcalcdaylength.cpp - tools/modcalceclipticcoords.cpp - tools/modcalcvizequinox.cpp - tools/modcalcgalcoord.cpp - tools/modcalcgeodcoord.cpp - tools/modcalcjd.cpp - tools/modcalcplanets.cpp - tools/modcalcsidtime.cpp - tools/modcalcvlsr.cpp - tools/observinglist.cpp - tools/obslistpopupmenu.cpp - tools/sessionsortfilterproxymodel.cpp - tools/obslistwizard.cpp - tools/planetviewer.cpp - tools/pvplotwidget.cpp - tools/scriptargwidgets.cpp - tools/scriptbuilder.cpp - tools/scriptfunction.cpp - tools/skycalendar.cpp - tools/wutdialog.cpp - tools/flagmanager.cpp - tools/horizonmanager.cpp - tools/nameresolver.cpp - tools/polarishourangle.cpp +set(xplanetui_SRCS + xplanet/opsxplanet.ui +) - #FIXME Port to KF5 - #tools/moonphasetool.cpp +########### next target ############### +set(libkstarstools_SRCS + tools/altvstime.cpp + tools/avtplotwidget.cpp + tools/calendarwidget.cpp + tools/conjunctions.cpp +# tools/jmoontool.cpp + tools/ksconjunct.cpp + tools/eqplotwidget.cpp + tools/astrocalc.cpp + tools/modcalcangdist.cpp + tools/modcalcapcoord.cpp + tools/modcalcaltaz.cpp + tools/modcalcdaylength.cpp + tools/modcalceclipticcoords.cpp + tools/modcalcvizequinox.cpp + tools/modcalcgalcoord.cpp + tools/modcalcgeodcoord.cpp + tools/modcalcjd.cpp + tools/modcalcplanets.cpp + tools/modcalcsidtime.cpp + tools/modcalcvlsr.cpp + tools/observinglist.cpp + tools/obslistpopupmenu.cpp + tools/sessionsortfilterproxymodel.cpp + tools/obslistwizard.cpp + tools/planetviewer.cpp + tools/pvplotwidget.cpp + tools/scriptargwidgets.cpp + tools/scriptbuilder.cpp + tools/scriptfunction.cpp + tools/skycalendar.cpp + tools/wutdialog.cpp + tools/flagmanager.cpp + tools/horizonmanager.cpp + tools/nameresolver.cpp + tools/polarishourangle.cpp + #FIXME Port to KF5 + #tools/moonphasetool.cpp + + tools/starhopper.cpp + tools/eyepiecefield.cpp + tools/exporteyepieceview.cpp + tools/starhopperdialog.cpp + tools/adddeepskyobject.cpp +) - tools/starhopper.cpp - tools/eyepiecefield.cpp - tools/exporteyepieceview.cpp - tools/starhopperdialog.cpp - tools/adddeepskyobject.cpp +if(${KF5_VERSION} VERSION_EQUAL 5.18.0 OR ${KF5_VERSION} VERSION_GREATER 5.18.0) + set(libkstarstools_SRCS + ${libkstarstools_SRCS} + tools/whatsinteresting/skyobjlistmodel.cpp + tools/whatsinteresting/wiview.cpp + tools/whatsinteresting/modelmanager.cpp + tools/whatsinteresting/skyobjitem.cpp + tools/whatsinteresting/wilpsettings.cpp + tools/whatsinteresting/wiequipsettings.cpp + tools/whatsinteresting/obsconditions.cpp + tools/whatsinteresting/skyobjdescription.cpp ) +endif() - if(${KF5_VERSION} VERSION_EQUAL 5.18.0 OR ${KF5_VERSION} VERSION_GREATER 5.18.0) - set(libkstarstools_SRCS - ${libkstarstools_SRCS} - tools/whatsinteresting/skyobjlistmodel.cpp - tools/whatsinteresting/wiview.cpp - tools/whatsinteresting/modelmanager.cpp - tools/whatsinteresting/skyobjitem.cpp - tools/whatsinteresting/wilpsettings.cpp - tools/whatsinteresting/wiequipsettings.cpp - tools/whatsinteresting/obsconditions.cpp - tools/whatsinteresting/skyobjdescription.cpp - ) - endif() +ki18n_wrap_ui(libkstarstools_ui_SRCS + tools/altvstime.ui + tools/argchangeviewoption.ui + tools/argexportimage.ui + tools/argloadcolorscheme.ui + tools/arglooktoward.ui + tools/argfindobject.ui + tools/argprintimage.ui + tools/argsetaltaz.ui + tools/argsetcolor.ui + tools/argsetgeolocation.ui + tools/argsetlocaltime.ui + tools/argsetradec.ui + tools/argsettrack.ui + tools/argtimescale.ui + tools/argwaitfor.ui + tools/argwaitforkey.ui + tools/argzoom.ui + tools/conjunctions.ui + + tools/modcalcangdist.ui + tools/modcalcapcoord.ui + tools/modcalcaltaz.ui + tools/modcalcdaylength.ui + tools/modcalceclipticcoords.ui + tools/modcalcvizequinox.ui + tools/modcalcgalcoord.ui + tools/modcalcgeod.ui + tools/modcalcjd.ui + tools/modcalcplanets.ui + tools/modcalcsidtime.ui + tools/modcalcvlsr.ui + tools/observinglist.ui + tools/obslistwizard.ui + tools/optionstreeview.ui + tools/planetviewer.ui + tools/scriptbuilder.ui + tools/scriptnamedialog.ui + tools/skycalendar.ui + tools/wutdialog.ui + tools/flagmanager.ui + tools/starhopperdialog.ui + tools/horizonmanager.ui + tools/adddeepskyobject.ui + tools/polarishourangle.ui +) +if (${KF5_VERSION} VERSION_EQUAL 5.18.0 OR ${KF5_VERSION} VERSION_GREATER 5.18.0) ki18n_wrap_ui(libkstarstools_ui_SRCS - tools/altvstime.ui - tools/argchangeviewoption.ui - tools/argexportimage.ui - tools/argloadcolorscheme.ui - tools/arglooktoward.ui - tools/argfindobject.ui - tools/argprintimage.ui - tools/argsetaltaz.ui - tools/argsetcolor.ui - tools/argsetgeolocation.ui - tools/argsetlocaltime.ui - tools/argsetradec.ui - tools/argsettrack.ui - tools/argtimescale.ui - tools/argwaitfor.ui - tools/argwaitforkey.ui - tools/argzoom.ui - tools/conjunctions.ui - - tools/modcalcangdist.ui - tools/modcalcapcoord.ui - tools/modcalcaltaz.ui - tools/modcalcdaylength.ui - tools/modcalceclipticcoords.ui - tools/modcalcvizequinox.ui - tools/modcalcgalcoord.ui - tools/modcalcgeod.ui - tools/modcalcjd.ui - tools/modcalcplanets.ui - tools/modcalcsidtime.ui - tools/modcalcvlsr.ui - - tools/observinglist.ui - tools/obslistwizard.ui - tools/optionstreeview.ui - tools/planetviewer.ui - tools/scriptbuilder.ui - tools/scriptnamedialog.ui - tools/skycalendar.ui - tools/wutdialog.ui - tools/flagmanager.ui - tools/starhopperdialog.ui - tools/horizonmanager.ui - tools/adddeepskyobject.ui - tools/polarishourangle.ui + tools/whatsinteresting/wilpsettings.ui + tools/whatsinteresting/wiequipsettings.ui ) +endif() - if (${KF5_VERSION} VERSION_EQUAL 5.18.0 OR ${KF5_VERSION} VERSION_GREATER 5.18.0) - ki18n_wrap_ui(libkstarstools_ui_SRCS - tools/whatsinteresting/wilpsettings.ui - tools/whatsinteresting/wiequipsettings.ui - ) - endif() - - set(libkstarswidgets_SRCS - widgets/clicklabel.cpp - widgets/dmsbox.cpp - widgets/draglistbox.cpp - widgets/fovwidget.cpp - widgets/logedit.cpp - widgets/magnitudespinbox.cpp - widgets/mapcanvas.cpp - widgets/thumbimage.cpp - widgets/timespinbox.cpp - widgets/timestepbox.cpp - widgets/timeunitbox.cpp - widgets/infoboxwidget.cpp - # widgets/genericcalendarwidget.cpp - # widgets/moonphasecalendarwidget.cpp - widgets/kshelplabel.cpp - widgets/unitspinboxwidget.cpp - ) +set(libkstarswidgets_SRCS + widgets/clicklabel.cpp + widgets/dmsbox.cpp + widgets/draglistbox.cpp + widgets/fovwidget.cpp + widgets/logedit.cpp + widgets/magnitudespinbox.cpp + widgets/mapcanvas.cpp + widgets/thumbimage.cpp + widgets/timespinbox.cpp + widgets/timestepbox.cpp + widgets/timeunitbox.cpp + widgets/infoboxwidget.cpp +# widgets/genericcalendarwidget.cpp +# widgets/moonphasecalendarwidget.cpp + widgets/kshelplabel.cpp + widgets/unitspinboxwidget.cpp +) - ki18n_wrap_ui(libkstarswidgets_ui_SRCS - # widgets/genericcalendarwidget.ui - widgets/unitspinboxwidget.ui - ) +ki18n_wrap_ui(libkstarswidgets_ui_SRCS +# widgets/genericcalendarwidget.ui + widgets/unitspinboxwidget.ui +) - set(kstars_KCFG_SRCS Options.kcfgc) +set(kstars_KCFG_SRCS Options.kcfgc) - set(kstars_options_SRCS - options/opsadvanced.cpp - options/opscatalog.cpp - options/opscolors.cpp - options/opsguides.cpp - options/opssolarsystem.cpp - options/opssatellites.cpp - options/opssupernovae.cpp - ) +set(kstars_options_SRCS + options/opsadvanced.cpp + options/opscatalog.cpp + options/opscolors.cpp + options/opsguides.cpp + options/opssolarsystem.cpp + options/opssatellites.cpp + options/opssupernovae.cpp +) - set(kstars_optionsui_SRCS - options/opsadvanced.ui - options/opscatalog.ui - options/opscolors.ui - options/opsguides.ui - options/opssolarsystem.ui - options/opssatellites.ui - options/opssupernovae.ui - ) +set(kstars_optionsui_SRCS + options/opsadvanced.ui + options/opscatalog.ui + options/opscolors.ui + options/opsguides.ui + options/opssolarsystem.ui + options/opssatellites.ui + options/opssupernovae.ui +) - set(kstars_dialogs_SRCS - dialogs/addcatdialog.cpp - dialogs/addlinkdialog.cpp - dialogs/detaildialog.cpp - dialogs/finddialog.cpp - dialogs/focusdialog.cpp - dialogs/fovdialog.cpp - dialogs/locationdialog.cpp - dialogs/timedialog.cpp - dialogs/exportimagedialog.cpp - ) +set(kstars_dialogs_SRCS + dialogs/addcatdialog.cpp + dialogs/addlinkdialog.cpp + dialogs/detaildialog.cpp + dialogs/finddialog.cpp + dialogs/focusdialog.cpp + dialogs/fovdialog.cpp + dialogs/locationdialog.cpp + dialogs/timedialog.cpp + dialogs/exportimagedialog.cpp +) - set(kstars_dialogsui_SRCS - dialogs/addcatdialog.ui - dialogs/addlinkdialog.ui - dialogs/details_database.ui - dialogs/details_data.ui - dialogs/details_data_comet.ui - dialogs/details_links.ui - dialogs/details_log.ui - dialogs/details_position.ui - dialogs/finddialog.ui - dialogs/focusdialog.ui - dialogs/fovdialog.ui - dialogs/locationdialog.ui - dialogs/wizwelcome.ui - dialogs/wizlocation.ui - dialogs/wizdownload.ui - dialogs/wizdata.ui - dialogs/wizastrometry.ui - dialogs/newfov.ui - dialogs/exportimagedialog.ui - ) +set(kstars_dialogsui_SRCS + dialogs/addcatdialog.ui + dialogs/addlinkdialog.ui + dialogs/details_database.ui + dialogs/details_data.ui + dialogs/details_data_comet.ui + dialogs/details_links.ui + dialogs/details_log.ui + dialogs/details_position.ui + dialogs/finddialog.ui + dialogs/focusdialog.ui + dialogs/fovdialog.ui + dialogs/locationdialog.ui + dialogs/wizwelcome.ui + dialogs/wizlocation.ui + dialogs/wizdownload.ui + dialogs/wizdata.ui + dialogs/wizastrometry.ui + dialogs/newfov.ui + dialogs/exportimagedialog.ui +) - set(hips_SRCS - hips/healpix.cpp - hips/hipsrenderer.cpp - hips/scanrender.cpp - hips/pixcache.cpp - hips/urlfiledownload.cpp - hips/opships.cpp - ) +set(hips_SRCS + hips/healpix.cpp + hips/hipsrenderer.cpp + hips/scanrender.cpp + hips/pixcache.cpp + hips/urlfiledownload.cpp + hips/opships.cpp +) - set(hips_manager_SRCS - hips/hipsmanager.cpp - ) +set(hips_manager_SRCS + hips/hipsmanager.cpp +) - set(oal_SRCS - oal/log.cpp - oal/observer.cpp - oal/site.cpp - oal/session.cpp - oal/scope.cpp - oal/eyepiece.cpp - oal/filter.cpp - oal/observation.cpp - oal/lens.cpp - oal/equipmentwriter.cpp - oal/observeradd.cpp - oal/execute.cpp - ) +set(oal_SRCS + oal/log.cpp + oal/observer.cpp + oal/site.cpp + oal/session.cpp + oal/scope.cpp + oal/eyepiece.cpp + oal/filter.cpp + oal/observation.cpp + oal/lens.cpp + oal/equipmentwriter.cpp + oal/observeradd.cpp + oal/execute.cpp +) - set(printing_SRCS - printing/detailstable.cpp - printing/finderchart.cpp - printing/foveditordialog.cpp - printing/fovsnapshot.cpp - printing/kstarsdocument.cpp - printing/legend.cpp - printing/loggingform.cpp - printing/printingwizard.cpp - printing/pwizchartconfig.cpp - printing/pwizchartcontents.cpp - printing/pwizfovbrowse.cpp - printing/pwizfovconfig.cpp - printing/pwizfovmanual.cpp - printing/pwizfovsh.cpp - printing/pwizfovtypeselection.cpp - printing/pwizobjectselection.cpp - printing/pwizprint.cpp - printing/shfovexporter.cpp - printing/simplefovexporter.cpp - ) +set(printing_SRCS + printing/detailstable.cpp + printing/finderchart.cpp + printing/foveditordialog.cpp + printing/fovsnapshot.cpp + printing/kstarsdocument.cpp + printing/legend.cpp + printing/loggingform.cpp + printing/printingwizard.cpp + printing/pwizchartconfig.cpp + printing/pwizchartcontents.cpp + printing/pwizfovbrowse.cpp + printing/pwizfovconfig.cpp + printing/pwizfovmanual.cpp + printing/pwizfovsh.cpp + printing/pwizfovtypeselection.cpp + printing/pwizobjectselection.cpp + printing/pwizprint.cpp + printing/shfovexporter.cpp + printing/simplefovexporter.cpp +) - set(printingui_SRCS - printing/foveditordialog.ui - printing/pwizchartconfig.ui - printing/pwizchartcontents.ui - printing/pwizfovbrowse.ui - printing/pwizfovconfig.ui - printing/pwizfovmanual.ui - printing/pwizfovsh.ui - printing/pwizfovtypeselection.ui - printing/pwizobjectselection.ui - printing/pwizprint.ui - printing/pwizwelcome.ui - ) -endif(NOT BUILD_KSTARS_LITE) +set(printingui_SRCS + printing/foveditordialog.ui + printing/pwizchartconfig.ui + printing/pwizchartcontents.ui + printing/pwizfovbrowse.ui + printing/pwizfovconfig.ui + printing/pwizfovmanual.ui + printing/pwizfovsh.ui + printing/pwizfovtypeselection.ui + printing/pwizobjectselection.ui + printing/pwizprint.ui + printing/pwizwelcome.ui +) set( kstars_KCFG_SRCS Options.kcfgc ) set(libkstarscomponents_SRCS skycomponents/skylabeler.cpp skycomponents/highpmstarlist.cpp skycomponents/skymapcomposite.cpp skycomponents/skymesh.cpp skycomponents/linelistindex.cpp skycomponents/linelistlabel.cpp skycomponents/noprecessindex.cpp skycomponents/listcomponent.cpp skycomponents/pointlistcomponent.cpp skycomponents/solarsystemsinglecomponent.cpp skycomponents/solarsystemlistcomponent.cpp skycomponents/asteroidscomponent.cpp skycomponents/cometscomponent.cpp skycomponents/planetmoonscomponent.cpp skycomponents/solarsystemcomposite.cpp skycomponents/satellitescomponent.cpp skycomponents/starcomponent.cpp skycomponents/deepstarcomponent.cpp skycomponents/deepskycomponent.cpp skycomponents/catalogcomponent.cpp skycomponents/syncedcatalogcomponent.cpp skycomponents/constellationartcomponent.cpp skycomponents/constellationboundarylines.cpp skycomponents/constellationlines.cpp skycomponents/constellationnamescomponent.cpp skycomponents/supernovaecomponent.cpp skycomponents/coordinategrid.cpp skycomponents/equatorialcoordinategrid.cpp skycomponents/horizontalcoordinategrid.cpp skycomponents/localmeridiancomponent.cpp skycomponents/ecliptic.cpp skycomponents/equator.cpp skycomponents/artificialhorizoncomponent.cpp skycomponents/hipscomponent.cpp skycomponents/horizoncomponent.cpp skycomponents/milkyway.cpp skycomponents/skycomponent.cpp skycomponents/skycomposite.cpp skycomponents/starblock.cpp skycomponents/starblocklist.cpp skycomponents/starblockfactory.cpp skycomponents/culturelist.cpp skycomponents/flagcomponent.cpp skycomponents/targetlistcomponent.cpp ) -if(NOT BUILD_KSTARS_LITE) - LIST(APPEND libkstarscomponents_SRCS - #skycomponents/notifyupdatesui.cpp - ) -else(NOT BUILD_KSTARS_LITE) - set(libkstarstools_ui_SRCS +#LIST(APPEND libkstarscomponents_SRCS +# #skycomponents/notifyupdatesui.cpp +# ) + +IF (BUILD_KSTARS_LITE) + set(libkstarstools_ui_klite_SRCS tools/nameresolver.cpp ) -endif(NOT BUILD_KSTARS_LITE) +ENDIF () set(kstars_skyobjects_SRCS skyobjects/constellationsart.cpp skyobjects/deepskyobject.cpp # skyobjects/jupitermoons.cpp skyobjects/planetmoons.cpp skyobjects/ksasteroid.cpp skyobjects/kscomet.cpp skyobjects/ksmoon.cpp skyobjects/ksplanetbase.cpp skyobjects/ksplanet.cpp #skyobjects/kspluto.cpp skyobjects/kssun.cpp skyobjects/skyline.cpp skyobjects/skyobject.cpp skyobjects/skypoint.cpp skyobjects/starobject.cpp skyobjects/trailobject.cpp skyobjects/satellite.cpp skyobjects/satellitegroup.cpp skyobjects/supernova.cpp ) set(kstars_projection_SRCS projections/projector.cpp projections/lambertprojector.cpp projections/gnomonicprojector.cpp projections/stereographicprojector.cpp projections/orthographicprojector.cpp projections/azimuthalequidistantprojector.cpp projections/equirectangularprojector.cpp ) -set(kstars_extra_SRCS +set(kstars_extra_SRCS auxiliary/colorscheme.cpp auxiliary/dms.cpp auxiliary/cachingdms.cpp auxiliary/geolocation.cpp auxiliary/ksfilereader.cpp auxiliary/ksuserdb.cpp auxiliary/binfilehelper.cpp auxiliary/ksutils.cpp auxiliary/ksdssimage.cpp auxiliary/ksdssdownloader.cpp auxiliary/nonlineardoublespinbox.cpp auxiliary/profileinfo.cpp auxiliary/filedownloader.cpp auxiliary/kspaths.cpp auxiliary/QRoundProgressBar.cpp auxiliary/skyobjectlistmodel.cpp auxiliary/ksnotification.cpp auxiliary/QProgressIndicator.cpp time/simclock.cpp time/kstarsdatetime.cpp time/timezonerule.cpp ksnumbers.cpp kstarsdata.cpp texturemanager.cpp #to minimize number of indef KSTARS_LITE skypainter.cpp ) -if(NOT BUILD_KSTARS_LITE) - LIST(APPEND kstars_extra_SRCS - auxiliary/thememanager.cpp - auxiliary/schememanager.cpp - auxiliary/imageviewer.cpp - auxiliary/fov.cpp - auxiliary/thumbnailpicker.cpp - auxiliary/thumbnaileditor.cpp - auxiliary/imageexporter.cpp - auxiliary/kswizard.cpp - auxiliary/qcustomplot.cpp - kstarsdbus.cpp - kspopupmenu.cpp - ksalmanac.cpp - kstarsactions.cpp - kstarsinit.cpp - kstars.cpp - kstarssplash.cpp - skymap.cpp - skymapdrawabstract.cpp - skymapqdraw.cpp - skymapevents.cpp - skyqpainter.cpp - ) -endif(NOT BUILD_KSTARS_LITE) - -if(BUILD_KSTARS_LITE) - #Temporary solution to allow use of qml files from source dir DELETE - add_definitions( -DSOURCE_DIR=\"${kstars_SOURCE_DIR}\" ) - add_definitions(-DQML_IMPORT="${CMAKE_CURRENT_SOURCE_DIR}") - - set(kstarslite_SRCS - kstarslite.cpp - kstarsliteinit.cpp - skymaplite.cpp - skymapliteevents.cpp - #Wrappers - kstarslite/skypointlite.cpp - kstarslite/skyobjectlite.cpp - #ImageProvider - kstarslite/imageprovider.cpp - #Dialogs - kstarslite/dialogs/detaildialoglite.cpp - kstarslite/dialogs/finddialoglite.cpp - kstarslite/dialogs/locationdialoglite.cpp - #RootNode - kstarslite/skyitems/rootnode.cpp - kstarslite/skyitems/skyopacitynode.cpp - kstarslite/skyitems/typedeflite.h - #SkyItems - kstarslite/skyitems/skyitem.cpp - kstarslite/skyitems/planetsitem.cpp - kstarslite/skyitems/asteroidsitem.cpp - kstarslite/skyitems/cometsitem.cpp - kstarslite/skyitems/horizonitem.cpp - kstarslite/skyitems/labelsitem.cpp - kstarslite/skyitems/constellationnamesitem.cpp - kstarslite/skyitems/staritem.cpp - kstarslite/skyitems/deepstaritem.cpp - kstarslite/skyitems/deepskyitem.cpp - kstarslite/skyitems/constellationartitem.cpp - kstarslite/skyitems/satellitesitem.cpp - kstarslite/skyitems/supernovaeitem.cpp - kstarslite/skyitems/fovitem.cpp - kstarslite/skyitems/syncedcatalogitem.cpp - #Line - kstarslite/skyitems/lines/linesitem.cpp - kstarslite/skyitems/lines/equatoritem.cpp - kstarslite/skyitems/lines/eclipticitem.cpp - kstarslite/skyitems/lines/milkywayitem.cpp - #SkyNodes - kstarslite/skyitems/skynodes/planetnode.cpp - kstarslite/skyitems/skynodes/skynode.cpp - kstarslite/skyitems/skynodes/pointsourcenode.cpp - kstarslite/skyitems/skynodes/planetmoonsnode.cpp - kstarslite/skyitems/skynodes/horizonnode.cpp - kstarslite/skyitems/skynodes/labelnode.cpp - kstarslite/skyitems/skynodes/guidelabelnode.cpp - kstarslite/skyitems/skynodes/deepskynode.cpp - kstarslite/skyitems/skynodes/dsosymbolnode.cpp - kstarslite/skyitems/skynodes/skypolygonnode.cpp - kstarslite/skyitems/skynodes/constellationartnode.cpp - kstarslite/skyitems/skynodes/satellitenode.cpp - kstarslite/skyitems/skynodes/supernovanode.cpp - kstarslite/skyitems/skynodes/trixelnode.cpp - kstarslite/skyitems/skynodes/fovsymbolnode.cpp - #Nodes - kstarslite/skyitems/skynodes/nodes/pointnode.cpp - kstarslite/skyitems/skynodes/nodes/polynode.cpp - kstarslite/skyitems/skynodes/nodes/linenode.cpp - kstarslite/skyitems/skynodes/nodes/ellipsenode.cpp - kstarslite/skyitems/skynodes/nodes/rectnode.cpp - #Other - kstarslite/deviceorientation.cpp - ) +SET(kstars_extra_kstars_SRCS + auxiliary/thememanager.cpp + auxiliary/schememanager.cpp + auxiliary/imageviewer.cpp + auxiliary/fov.cpp + auxiliary/thumbnailpicker.cpp + auxiliary/thumbnaileditor.cpp + auxiliary/imageexporter.cpp + auxiliary/kswizard.cpp + auxiliary/qcustomplot.cpp + kstarsdbus.cpp + kspopupmenu.cpp + ksalmanac.cpp + kstarsactions.cpp + kstarsinit.cpp + kstars.cpp + kstarssplash.cpp + skymap.cpp + skymapdrawabstract.cpp + skymapqdraw.cpp + skymapevents.cpp + skyqpainter.cpp + ) - set(kstarslite_libtess_SRC - #libtess - libtess/gluos.h - libtess/priorityq-sort.h - libtess/sweep.c - libtess/tessmono.c - libtess/dict-list.h - libtess/glu.h - libtess/tessellate.c - libtess/dict.c - libtess/geom.c - libtess/memalloc.c - libtess/mesh.c - libtess/normal.c - libtess/priorityq.c - libtess/priorityq-heap.c - libtess/render.c - libtess/tess.c - ) +# Temporary solution to allow use of qml files from source dir DELETE +SET(KSTARSLITE_CPP_OPTIONS -DSOURCE_DIR=\"${kstars_SOURCE_DIR}\" -DQML_IMPORT="${CMAKE_CURRENT_SOURCE_DIR}") + +set(klite_SRCS + kstarslite.cpp + kstarsliteinit.cpp + skymaplite.cpp + skymapliteevents.cpp + #Wrappers + kstarslite/skypointlite.cpp + kstarslite/skyobjectlite.cpp + #ImageProvider + kstarslite/imageprovider.cpp + #Dialogs + kstarslite/dialogs/detaildialoglite.cpp + kstarslite/dialogs/finddialoglite.cpp + kstarslite/dialogs/locationdialoglite.cpp + #RootNode + kstarslite/skyitems/rootnode.cpp + kstarslite/skyitems/skyopacitynode.cpp + kstarslite/skyitems/typedeflite.h + #SkyItems + kstarslite/skyitems/skyitem.cpp + kstarslite/skyitems/planetsitem.cpp + kstarslite/skyitems/asteroidsitem.cpp + kstarslite/skyitems/cometsitem.cpp + kstarslite/skyitems/horizonitem.cpp + kstarslite/skyitems/labelsitem.cpp + kstarslite/skyitems/constellationnamesitem.cpp + kstarslite/skyitems/staritem.cpp + kstarslite/skyitems/deepstaritem.cpp + kstarslite/skyitems/deepskyitem.cpp + kstarslite/skyitems/constellationartitem.cpp + kstarslite/skyitems/satellitesitem.cpp + kstarslite/skyitems/supernovaeitem.cpp + kstarslite/skyitems/fovitem.cpp + kstarslite/skyitems/syncedcatalogitem.cpp + #Line + kstarslite/skyitems/lines/linesitem.cpp + kstarslite/skyitems/lines/equatoritem.cpp + kstarslite/skyitems/lines/eclipticitem.cpp + kstarslite/skyitems/lines/milkywayitem.cpp + #SkyNodes + kstarslite/skyitems/skynodes/planetnode.cpp + kstarslite/skyitems/skynodes/skynode.cpp + kstarslite/skyitems/skynodes/pointsourcenode.cpp + kstarslite/skyitems/skynodes/planetmoonsnode.cpp + kstarslite/skyitems/skynodes/horizonnode.cpp + kstarslite/skyitems/skynodes/labelnode.cpp + kstarslite/skyitems/skynodes/guidelabelnode.cpp + kstarslite/skyitems/skynodes/deepskynode.cpp + kstarslite/skyitems/skynodes/dsosymbolnode.cpp + kstarslite/skyitems/skynodes/skypolygonnode.cpp + kstarslite/skyitems/skynodes/constellationartnode.cpp + kstarslite/skyitems/skynodes/satellitenode.cpp + kstarslite/skyitems/skynodes/supernovanode.cpp + kstarslite/skyitems/skynodes/trixelnode.cpp + kstarslite/skyitems/skynodes/fovsymbolnode.cpp + #Nodes + kstarslite/skyitems/skynodes/nodes/pointnode.cpp + kstarslite/skyitems/skynodes/nodes/polynode.cpp + kstarslite/skyitems/skynodes/nodes/linenode.cpp + kstarslite/skyitems/skynodes/nodes/ellipsenode.cpp + kstarslite/skyitems/skynodes/nodes/rectnode.cpp + #Other + kstarslite/deviceorientation.cpp + ) - IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET_SOURCE_FILES_PROPERTIES(${kstarslite_libtess_SRC} PROPERTIES COMPILE_FLAGS "-Wno-error") - ENDIF () +set(kstarslite_libtess_SRC + #libtess + libtess/gluos.h + libtess/priorityq-sort.h + libtess/sweep.c + libtess/tessmono.c + libtess/dict-list.h + libtess/glu.h + libtess/tessellate.c + libtess/dict.c + libtess/geom.c + libtess/memalloc.c + libtess/mesh.c + libtess/normal.c + libtess/priorityq.c + libtess/priorityq-heap.c + libtess/render.c + libtess/tess.c + ) - #Qml files will be probably moved to user's data dir, but for use - #with QtCreator it is more convenient to have them here - set(kstarsliteqml_SRCS - kstarslite/qml/main.qml - kstarslite/qml/constants/Constants.qml - kstarslite/qml/modules/SkyMapLiteWrapper.qml - kstarslite/qml/modules/BottomMenu.qml - kstarslite/qml/modules/KSPage.qml - kstarslite/qml/modules/KSListView.qml - kstarslite/qml/modules/KSLabel.qml - kstarslite/qml/modules/KSText.qml - kstarslite/qml/modules/KSTabButton.qml - kstarslite/qml/modules/KSTab.qml - kstarslite/qml/modules/KSTabBarArrow.qml - kstarslite/qml/modules/KSTextField.qml - kstarslite/qml/modules/KSButton.qml - kstarslite/qml/modules/TopMenu.qml - kstarslite/qml/modules/helpers/TopMenuButton.qml - kstarslite/qml/modules/helpers/BottomMenuButton.qml - kstarslite/qml/modules/Splash.qml - kstarslite/qml/modules/helpers/TimeSpinBox.qml - kstarslite/qml/modules/TimePage.qml - #Popups - kstarslite/qml/modules/popups/ProjectionsPopup.qml - kstarslite/qml/modules/popups/FOVPopup.qml - kstarslite/qml/modules/popups/ColorSchemePopup.qml - #Menus - kstarslite/qml/modules/menus/ContextMenu.qml - #Helpers - kstarslite/qml/modules/helpers/PassiveNotification.qml - kstarslite/qml/modules/helpers/KSMenuItem.qml - kstarslite/qml/modules/helpers/TelescopeControl.qml - #Dialogs - kstarslite/qml/dialogs/FindDialog.qml - kstarslite/qml/dialogs/LocationDialog.qml - kstarslite/qml/dialogs/DetailsDialog.qml - - kstarslite/qml/dialogs/helpers/DetailsItem.qml - kstarslite/qml/dialogs/helpers/DetailsAddLink.qml - kstarslite/qml/dialogs/helpers/LocationEdit.qml - kstarslite/qml/dialogs/helpers/LocationLoading.qml - - kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml - kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml - #INDI - kstarslite/qml/indi/INDIControlPanel.qml - kstarslite/qml/indi/DevicePanel.qml - kstarslite/qml/indi/ImagePreview.qml - kstarslite/qml/indi/modules/MotionControl.qml - kstarslite/qml/indi/modules/Led.qml - kstarslite/qml/indi/modules/KSLed.qml - kstarslite/qml/indi/modules/Property.qml - kstarslite/qml/indi/modules/KSComboBox.qml - kstarslite/qml/indi/modules/KSButtonSwitch.qml - kstarslite/qml/indi/modules/KSCheckBox.qml - kstarslite/qml/indi/modules/KSINDIText.qml - kstarslite/qml/indi/modules/KSINDITextField.qml - kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml - #Tutorial - kstarslite/qml/modules/tutorial/TutorialPopup.qml - kstarslite/qml/modules/tutorial/TutorialExitPopup.qml - kstarslite/qml/modules/tutorial/TutorialStep1.qml - kstarslite/qml/modules/tutorial/TutorialStep2.qml - kstarslite/qml/modules/tutorial/TutorialStep3.qml - kstarslite/qml/modules/tutorial/TutorialStep4.qml - kstarslite/qml/modules/tutorial/TutorialStep5.qml - kstarslite/qml/modules/tutorial/TutorialPane.qml - ) - add_subdirectory(kstarslite/qml) - ADD_CUSTOM_TARGET(kstarsliteqml SOURCES ${kstarsliteqml_SRCS}) +IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + SET_SOURCE_FILES_PROPERTIES(${kstarslite_libtess_SRC} PROPERTIES COMPILE_FLAGS "-Wno-error") +ENDIF () - if(ANDROID) - add_subdirectory(kstarslite/res) - endif(ANDROID) +#Qml files will be probably moved to user's data dir, but for use +#with QtCreator it is more convenient to have them here +set(kstarsliteqml_SRCS + kstarslite/qml/main.qml + kstarslite/qml/constants/Constants.qml + kstarslite/qml/modules/SkyMapLiteWrapper.qml + kstarslite/qml/modules/BottomMenu.qml + kstarslite/qml/modules/KSPage.qml + kstarslite/qml/modules/KSListView.qml + kstarslite/qml/modules/KSLabel.qml + kstarslite/qml/modules/KSText.qml + kstarslite/qml/modules/KSTabButton.qml + kstarslite/qml/modules/KSTab.qml + kstarslite/qml/modules/KSTabBarArrow.qml + kstarslite/qml/modules/KSTextField.qml + kstarslite/qml/modules/KSButton.qml + kstarslite/qml/modules/TopMenu.qml + kstarslite/qml/modules/helpers/TopMenuButton.qml + kstarslite/qml/modules/helpers/BottomMenuButton.qml + kstarslite/qml/modules/Splash.qml + kstarslite/qml/modules/helpers/TimeSpinBox.qml + kstarslite/qml/modules/TimePage.qml + #Popups + kstarslite/qml/modules/popups/ProjectionsPopup.qml + kstarslite/qml/modules/popups/FOVPopup.qml + kstarslite/qml/modules/popups/ColorSchemePopup.qml + #Menus + kstarslite/qml/modules/menus/ContextMenu.qml + #Helpers + kstarslite/qml/modules/helpers/PassiveNotification.qml + kstarslite/qml/modules/helpers/KSMenuItem.qml + kstarslite/qml/modules/helpers/TelescopeControl.qml + #Dialogs + kstarslite/qml/dialogs/FindDialog.qml + kstarslite/qml/dialogs/LocationDialog.qml + kstarslite/qml/dialogs/DetailsDialog.qml + + kstarslite/qml/dialogs/helpers/DetailsItem.qml + kstarslite/qml/dialogs/helpers/DetailsAddLink.qml + kstarslite/qml/dialogs/helpers/LocationEdit.qml + kstarslite/qml/dialogs/helpers/LocationLoading.qml + + kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml + kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml + #INDI + kstarslite/qml/indi/INDIControlPanel.qml + kstarslite/qml/indi/DevicePanel.qml + kstarslite/qml/indi/ImagePreview.qml + kstarslite/qml/indi/modules/MotionControl.qml + kstarslite/qml/indi/modules/Led.qml + kstarslite/qml/indi/modules/KSLed.qml + kstarslite/qml/indi/modules/Property.qml + kstarslite/qml/indi/modules/KSComboBox.qml + kstarslite/qml/indi/modules/KSButtonSwitch.qml + kstarslite/qml/indi/modules/KSCheckBox.qml + kstarslite/qml/indi/modules/KSINDIText.qml + kstarslite/qml/indi/modules/KSINDITextField.qml + kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml + #Tutorial + kstarslite/qml/modules/tutorial/TutorialPopup.qml + kstarslite/qml/modules/tutorial/TutorialExitPopup.qml + kstarslite/qml/modules/tutorial/TutorialStep1.qml + kstarslite/qml/modules/tutorial/TutorialStep2.qml + kstarslite/qml/modules/tutorial/TutorialStep3.qml + kstarslite/qml/modules/tutorial/TutorialStep4.qml + kstarslite/qml/modules/tutorial/TutorialStep5.qml + kstarslite/qml/modules/tutorial/TutorialPane.qml + ) +add_subdirectory(kstarslite/qml) +ADD_CUSTOM_TARGET(kstarsliteqml SOURCES ${kstarsliteqml_SRCS}) -endif(BUILD_KSTARS_LITE) +if(ANDROID) + add_subdirectory(kstarslite/res) +endif(ANDROID) set(kstars_SRCS ${indi_SRCS} ${fits_SRCS} ${ekos_SRCS} - ${onlineparser_SRCS} ${libkstarswidgets_SRCS} ${libkstarscomponents_SRCS} ${libkstarstools_SRCS} ${kstars_extra_SRCS} - ${kstars_gl_SRCS} + ${kstars_extra_kstars_SRCS} ${kstars_projection_SRCS} ${xplanet_SRCS} ${kstars_options_SRCS} ${kstars_skyobjects_SRCS} ${kstars_dialogs_SRCS} ${hips_SRCS} - ${oal_SRCS} + ${oal_SRCS} ${printing_SRCS} #KStars Lite ${kstarslite_SRCS} - ${indi_lite_SRCS} # Generated files ${libkstarstools_ui_SRCS} ${libkstarswidgets_ui_SRCS} ) +set(kstarslite_SRCS + ${indi_klite_SRCS} + ${libkstarscomponents_SRCS} + ${kstars_extra_SRCS} + ${kstars_projection_SRCS} + ${kstars_skyobjects_SRCS} + + # KStars Lite sources + ${klite_SRCS} + # Generated files + ${libkstarstools_ui_klite_SRCS} +) + # Generate all the necessary QLoggingCategory files ecm_qt_declare_logging_category(kstars_SRCS HEADER kstars_debug.h IDENTIFIER KSTARS CATEGORY_NAME org.kde.kstars) ecm_qt_declare_logging_category(kstars_SRCS HEADER indi_debug.h IDENTIFIER KSTARS_INDI CATEGORY_NAME org.kde.kstars.indi) ecm_qt_declare_logging_category(kstars_SRCS HEADER fits_debug.h IDENTIFIER KSTARS_FITS CATEGORY_NAME org.kde.kstars.fits) ecm_qt_declare_logging_category(kstars_SRCS HEADER ekos_debug.h IDENTIFIER KSTARS_EKOS CATEGORY_NAME org.kde.kstars.ekos) ecm_qt_declare_logging_category(kstars_SRCS HEADER ekos_capture_debug.h IDENTIFIER KSTARS_EKOS_CAPTURE CATEGORY_NAME org.kde.kstars.ekos.capture) ecm_qt_declare_logging_category(kstars_SRCS HEADER ekos_focus_debug.h IDENTIFIER KSTARS_EKOS_FOCUS CATEGORY_NAME org.kde.kstars.ekos.focus) ecm_qt_declare_logging_category(kstars_SRCS HEADER ekos_align_debug.h IDENTIFIER KSTARS_EKOS_ALIGN CATEGORY_NAME org.kde.kstars.ekos.align) ecm_qt_declare_logging_category(kstars_SRCS HEADER ekos_guide_debug.h IDENTIFIER KSTARS_EKOS_GUIDE CATEGORY_NAME org.kde.kstars.ekos.guide) ecm_qt_declare_logging_category(kstars_SRCS HEADER ekos_mount_debug.h IDENTIFIER KSTARS_EKOS_MOUNT CATEGORY_NAME org.kde.kstars.ekos.mount) ecm_qt_declare_logging_category(kstars_SRCS HEADER ekos_scheduler_debug.h IDENTIFIER KSTARS_EKOS_SCHEDULER CATEGORY_NAME org.kde.kstars.ekos.scheduler) kconfig_add_kcfg_files(kstars_SRCS ${kstars_KCFG_SRCS}) +ecm_qt_declare_logging_category(kstarslite_SRCS HEADER kstars_debug.h IDENTIFIER KSTARS CATEGORY_NAME org.kde.kstars) +ecm_qt_declare_logging_category(kstarslite_SRCS HEADER fits_debug.h IDENTIFIER KSTARS_FITS CATEGORY_NAME org.kde.kstars.fits) + +kconfig_add_kcfg_files(kstarslite_SRCS ${kstars_KCFG_SRCS}) + IF (UNITY_BUILD) ENABLE_UNITY_BUILD(kstars kstars_SRCS 10 cpp) + ENABLE_UNITY_BUILD(kstarslite kstarslite_SRCS 10 cpp) ENDIF () -set(kstars_SRCS ${kstars_SRCS} ${fits2_SRCS} ${sep_SRCS} ${hips_manager_SRCS} ${kstarslite_libtess_SRC}) - -if(NOT BUILD_KSTARS_LITE) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.xml kstars.h KStars) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.SimClock.xml simclock.h SimClock) - - if (INDI_FOUND) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.INDI.xml indi/indidbus.h INDIDBus) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.xml ekos/ekosmanager.h EkosManager) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Capture.xml ekos/capture/capture.h Ekos::Capture) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Focus.xml ekos/focus/focus.h Ekos::Focus) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Guide.xml ekos/guide/guide.h Ekos::Guide) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Align.xml ekos/align/align.h Ekos::Align) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Mount.xml ekos/mount/mount.h Ekos::Mount) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Dome.xml ekos/auxiliary/dome.h Ekos::Dome) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Weather.xml ekos/auxiliary/weather.h Ekos::Weather) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.DustCap.xml ekos/auxiliary/dustcap.h Ekos::DustCap) - qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Scheduler.xml ekos/scheduler/scheduler.h Ekos::Scheduler) - endif(INDI_FOUND) - - ki18n_wrap_ui(kstars_SRCS - ${indiui_SRCS} - ${ui_SRCS} - ${fitsui_SRCS} - ${ekosui_SRCS} - ${xplanetui_SRCS} - ${kstars_optionsui_SRCS} - ${kstars_dialogsui_SRCS} - ${printingui_SRCS} - auxiliary/thumbnailpicker.ui - auxiliary/thumbnaileditor.ui - oal/observeradd.ui - oal/equipmentwriter.ui - oal/execute.ui - hips/opships.ui - hips/opshipsdisplay.ui - hips/opshipscache.ui - #skycomponents/notifyupdatesui.ui - ) -endif(NOT BUILD_KSTARS_LITE) +set(kstars_SRCS ${kstars_SRCS} ${fits2_SRCS} ${sep_SRCS} ${hips_manager_SRCS}) +set(kstarslite_SRCS ${kstarslite_SRCS} ${fits_klite_SRCS} ${fits2_klite_SRCS} ${kstarslite_libtess_SRC}) + +qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.xml kstars.h KStars) +qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.SimClock.xml simclock.h SimClock) + +if (INDI_FOUND) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.INDI.xml indi/indidbus.h INDIDBus) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.xml ekos/ekosmanager.h EkosManager) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Capture.xml ekos/capture/capture.h Ekos::Capture) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Focus.xml ekos/focus/focus.h Ekos::Focus) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Guide.xml ekos/guide/guide.h Ekos::Guide) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Align.xml ekos/align/align.h Ekos::Align) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Mount.xml ekos/mount/mount.h Ekos::Mount) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Dome.xml ekos/auxiliary/dome.h Ekos::Dome) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Weather.xml ekos/auxiliary/weather.h Ekos::Weather) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.DustCap.xml ekos/auxiliary/dustcap.h Ekos::DustCap) + qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Scheduler.xml ekos/scheduler/scheduler.h Ekos::Scheduler) +endif(INDI_FOUND) + +ki18n_wrap_ui(kstars_SRCS + ${indiui_SRCS} + ${ui_SRCS} + ${fitsui_SRCS} + ${ekosui_SRCS} + ${xplanetui_SRCS} + ${kstars_optionsui_SRCS} + ${kstars_dialogsui_SRCS} + ${printingui_SRCS} + auxiliary/thumbnailpicker.ui + auxiliary/thumbnaileditor.ui + oal/observeradd.ui + oal/equipmentwriter.ui + oal/execute.ui + hips/opships.ui + hips/opshipsdisplay.ui + hips/opshipscache.ui + #skycomponents/notifyupdatesui.ui +) add_library(KStarsLib STATIC ${kstars_SRCS}) -if(BUILD_KSTARS_LITE) - target_link_libraries(KStarsLib +if (BUILD_KSTARS_LITE) + add_library(KStarsLiteLib STATIC ${kstarslite_SRCS}) + target_link_libraries(KStarsLiteLib LibKSDataHandlers htmesh KF5::I18n KF5::Plotting KF5::ConfigGui Qt5::Gui Qt5::Sql Qt5::Qml Qt5::Quick Qt5::QuickControls2 Qt5::Positioning Qt5::Concurrent ${ZLIB_LIBRARIES} ) if (ANDROID) - target_link_libraries(KStarsLib Qt5::AndroidExtras) + target_link_libraries(KStarsLiteLib Qt5::AndroidExtras) endif () -else(BUILD_KSTARS_LITE) - target_link_libraries(KStarsLib - LibKSDataHandlers - htmesh - KF5::Crash - KF5::I18n - KF5::NewStuff - KF5::KIOFileWidgets - KF5::WidgetsAddons - KF5::Plotting - KF5::Notifications - Qt5::Gui - Qt5::PrintSupport - Qt5::Sql - Qt5::Svg - Qt5::Qml - Qt5::Quick - Qt5::Network - #Qt5::Positioning - Qt5::Concurrent - Qt5::WebSockets - ${ZLIB_LIBRARIES} - ) +endif () - if (Qt5Keychain_FOUND) - include_directories(KStarsLib PUBLIC ${QTKEYCHAIN_INCLUDE_DIRS}) - target_link_libraries(KStarsLib ${QTKEYCHAIN_LIBRARIES}) - endif(Qt5Keychain_FOUND) +target_link_libraries(KStarsLib + LibKSDataHandlers + htmesh + KF5::Crash + KF5::I18n + KF5::NewStuff + KF5::KIOFileWidgets + KF5::WidgetsAddons + KF5::Plotting + KF5::Notifications + Qt5::Gui + Qt5::PrintSupport + Qt5::Sql + Qt5::Svg + Qt5::Qml + Qt5::Quick + Qt5::Network + #Qt5::Positioning + Qt5::Concurrent + Qt5::WebSockets + ${ZLIB_LIBRARIES} + ) - if (Qt5DataVisualization_FOUND) - target_link_libraries(KStarsLib Qt5::DataVisualization) - endif(Qt5DataVisualization_FOUND) +if (Qt5Keychain_FOUND) + include_directories(KStarsLib PUBLIC ${QTKEYCHAIN_INCLUDE_DIRS}) + target_link_libraries(KStarsLib ${QTKEYCHAIN_LIBRARIES}) +endif(Qt5Keychain_FOUND) - if (KF5NotifyConfig_FOUND) - target_link_libraries(KStarsLib KF5::NotifyConfig) - endif(KF5NotifyConfig_FOUND) -endif(BUILD_KSTARS_LITE) + +if (Qt5DataVisualization_FOUND) + target_link_libraries(KStarsLib Qt5::DataVisualization) +endif(Qt5DataVisualization_FOUND) + +if (KF5NotifyConfig_FOUND) + target_link_libraries(KStarsLib KF5::NotifyConfig) +endif(KF5NotifyConfig_FOUND) if(NOT WIN32) target_link_libraries(KStarsLib m) endif(NOT WIN32) if (CFITSIO_FOUND) target_include_directories(KStarsLib PUBLIC ${CFITSIO_INCLUDE_DIR}) target_link_libraries(KStarsLib ${CFITSIO_LIBRARIES}) + if (BUILD_KSTARS_LITE) + target_include_directories(KStarsLiteLib PUBLIC ${CFITSIO_INCLUDE_DIR}) + target_link_libraries(KStarsLiteLib ${CFITSIO_LIBRARIES}) + endif() endif(CFITSIO_FOUND) if(INDI_FOUND) if (NOT ANDROID) find_package(Nova REQUIRED) include_directories(${NOVA_INCLUDE_DIR}) endif () ## Support Multiple Platforms. All Require INDI ## WIN32 Desktop: Requires INDI Qt5 Client + GSL ## WIN32 Lite: Requires INDI Qt5 Client ## Linux + MacOS Desktop: Requires INDI Client + GSL ## Linux + MacOS Lite: Requires INDI Qt5 Client ## Android: Requires INDI Qt5 Client built for Android - #if(BUILD_KSTARS_LITE) - #target_link_libraries(KStarsLib ${CMAKE_THREAD_LIBS_INIT}) - #else(BUILD_KSTARS_LITE) - if(NOT BUILD_KSTARS_LITE) - find_package(GSL REQUIRED) - include_directories(${GSL_INCLUDE_DIRS}) - target_link_libraries(KStarsLib ${GSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} KF5::Notifications) - endif(NOT BUILD_KSTARS_LITE) + find_package(GSL REQUIRED) + include_directories(${GSL_INCLUDE_DIRS}) + target_link_libraries(KStarsLib ${GSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} KF5::Notifications) if(WIN32 OR ANDROID) if(ANDROID) - add_definitions(-DUSE_QT5_INDI) - target_link_libraries(KStarsLib ${INDI_CLIENT_ANDROID_LIBRARIES} ${CFITSIO_LIBRARIES} ${LIBRAW_LIBRARIES}) + target_link_libraries(KStarsLiteLib ${INDI_CLIENT_ANDROID_LIBRARIES} ${CFITSIO_LIBRARIES} ${LIBRAW_LIBRARIES}) + target_compile_options(KStarsLiteLib PRIVATE ${KSTARSLITE_CPP_OPTIONS} -DUSE_QT5_INDI -DKSTARS_LITE) else(ANDROID) target_link_libraries(KStarsLib ${INDI_CLIENT_LIBRARIES} ${NOVA_LIBRARIES}) endif(ANDROID) else(WIN32 OR ANDROID) - if(BUILD_KSTARS_LITE) - add_definitions(-DUSE_QT5_INDI) - target_link_libraries(KStarsLib ${INDI_CLIENT_QT_LIBRARIES} ${NOVA_LIBRARIES} z) - else(BUILD_KSTARS_LITE) - target_link_libraries(KStarsLib ${INDI_CLIENT_LIBRARIES} ${NOVA_LIBRARIES} z) + if (BUILD_KSTARS_LITE) + target_link_libraries(KStarsLiteLib ${INDI_CLIENT_QT_LIBRARIES} ${NOVA_LIBRARIES} z) + target_compile_options(KStarsLiteLib PRIVATE ${KSTARSLITE_CPP_OPTIONS} -DUSE_QT5_INDI -DKSTARS_LITE) endif(BUILD_KSTARS_LITE) + target_link_libraries(KStarsLib ${INDI_CLIENT_LIBRARIES} ${NOVA_LIBRARIES} z) endif(WIN32 OR ANDROID) endif(INDI_FOUND) if(WCSLIB_FOUND) target_link_libraries(KStarsLib ${WCSLIB_LIBRARIES}) + if (BUILD_KSTARS_LITE) + target_link_libraries(KStarsLiteLib ${WCSLIB_LIBRARIES}) + endif() endif (WCSLIB_FOUND) if(LibRaw_FOUND) target_link_libraries(KStarsLib ${LibRaw_LIBRARIES}) + if (BUILD_KSTARS_LITE) + target_link_libraries(KStarsLiteLib ${LibRaw_LIBRARIES}) + endif() endif (LibRaw_FOUND) #FIXME Enable OpenGL Later #if( OPENGL_FOUND ) # target_link_libraries(KStarsLib # ${OPENGL_LIBRARIES} # ${QT_QTOPENGL_LIBRARY} # ) #endif( OPENGL_FOUND ) set (KSTARS_APP_SRCS main.cpp ) -if(NOT BUILD_KSTARS_LITE) # add icon to application sources ecm_add_app_icon(KSTARS_APP_SRCS ICONS ${CMAKE_CURRENT_SOURCE_DIR}/icons/16-apps-kstars.png ${CMAKE_CURRENT_SOURCE_DIR}/icons/32-apps-kstars.png ${CMAKE_CURRENT_SOURCE_DIR}/icons/48-apps-kstars.png ${CMAKE_CURRENT_SOURCE_DIR}/icons/64-apps-kstars.png ${CMAKE_CURRENT_SOURCE_DIR}/icons/128-apps-kstars.png ) qt5_add_resources(KSTARS_APP_SRCS data/kstars.qrc) -endif(NOT BUILD_KSTARS_LITE) if (CMAKE_TOOLCHAIN_FILE STREQUAL ${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake) add_library(kstars SHARED ${KSTARS_APP_SRCS}) add_dependencies(KStarsLib cfitsio indi raw) set(ANDROID_NDK $ENV{ANDROID_NDK}) # This hack is needed by a strange NDK bug. Some symbols are missing in locale.o (libc.a) at linking stage. But # if we force-link with a working libc.a from android-24, there will be duplicated symbols, some symbols will # conflict with libandroid_support.a what is also needed. # Workaround: Extract the needed locale.o from libc.a of android-24 and link KStars Lite with it. ADD_CUSTOM_TARGET(extract_locale_o COMMAND ar -xv ${ANDROID_NDK}/platforms/android-24/arch-arm/usr/lib/libc.a locale.o WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) ADD_DEPENDENCIES(kstars extract_locale_o) - target_link_libraries(kstars KStarsLib ${CMAKE_BINARY_DIR}/locale.o -lgnustl_static) + target_link_libraries(kstars KStarsLiteLib ${CMAKE_BINARY_DIR}/locale.o -lgnustl_static) else () - if(BUILD_KSTARS_LITE) + if (BUILD_KSTARS_LITE) add_executable(kstars_lite ${KSTARS_APP_SRCS}) - target_link_libraries(kstars_lite KStarsLib) - else() - add_executable(kstars ${KSTARS_APP_SRCS}) - target_link_libraries(kstars KStarsLib) + target_compile_options(kstars_lite PRIVATE ${KSTARSLITE_CPP_OPTIONS} -DUSE_QT5_INDI -DKSTARS_LITE) + target_link_libraries(kstars_lite KStarsLiteLib) endif() + add_executable(kstars ${KSTARS_APP_SRCS}) + target_link_libraries(kstars KStarsLib) endif () -if(NOT BUILD_KSTARS_LITE) - install(TARGETS kstars ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) - - ########### install files ############### - install(PROGRAMS org.kde.kstars.desktop DESTINATION ${KDE_INSTALL_APPDIR}) - install(FILES kstars.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR}) - install(FILES kstars.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR}) - if(INDI_FOUND) - #install(FILES ekos/mount/mountbox.qml DESTINATION ${KDE_INSTALL_DATADIR}/kstars/ekos/mount/qml) - #install(DIRECTORY ekos/mount/ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/ekos/mount/qml - # FILES_MATCHING PATTERN "*.png") - endif() -elseif (NOT ANDROID) +install(TARGETS kstars ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) + +########### install files ############### +install(PROGRAMS org.kde.kstars.desktop DESTINATION ${KDE_INSTALL_APPDIR}) +install(FILES kstars.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR}) +install(FILES kstars.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR}) +if(INDI_FOUND) +#install(FILES ekos/mount/mountbox.qml DESTINATION ${KDE_INSTALL_DATADIR}/kstars/ekos/mount/qml) +#install(DIRECTORY ekos/mount/ DESTINATION ${KDE_INSTALL_DATADIR}/kstars/ekos/mount/qml +# FILES_MATCHING PATTERN "*.png") +endif() + +if (NOT ANDROID AND BUILD_KSTARS_LITE) install(TARGETS kstars_lite ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) endif() diff --git a/kstars/auxiliary/ksnotification.cpp b/kstars/auxiliary/ksnotification.cpp index 45a9e4fbc..330cf0aeb 100644 --- a/kstars/auxiliary/ksnotification.cpp +++ b/kstars/auxiliary/ksnotification.cpp @@ -1,93 +1,96 @@ /* General KStars Notifications for desktop and lite version Copyright (C) 2016 Jasem Mutlaq (mutlaqja@ikarustech.com) This application is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ #include "ksnotification.h" #include "config-kstars.h" #ifdef KSTARS_LITE #include "kstarslite.h" #else #include #include #include -#endif #ifdef HAVE_INDI #ifdef HAVE_CFITSIO #include "kstars.h" #include "ekos/ekosmanager.h" #endif #endif +#endif // KSTARS_LITE namespace KSNotification { void error(const QString &message, const QString &title) { #ifdef KSTARS_LITE Q_UNUSED(title); KStarsLite::Instance()->notificationMessage(message); #else KMessageBox::error(nullptr, message, title); #endif } void sorry(const QString &message, const QString &title) { #ifdef KSTARS_LITE Q_UNUSED(title); KStarsLite::Instance()->notificationMessage(message); #else KMessageBox::sorry(nullptr, message, title); #endif } void info(const QString &message, const QString &title) { #ifdef KSTARS_LITE Q_UNUSED(title); KStarsLite::Instance()->notificationMessage(message); #else KMessageBox::information(nullptr, message, title); #endif } void transient(const QString &message, const QString &title) { #ifdef KSTARS_LITE Q_UNUSED(title); KStarsLite::Instance()->notificationMessage(message); #else QPointer msgBox = new QMessageBox(); msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setWindowTitle(title); msgBox->setText(message); msgBox->setModal(false); msgBox->setIcon(QMessageBox::Warning); msgBox->show(); #endif } void event(const QLatin1String &name, const QString &message, EventType type) { + Q_UNUSED(name); + Q_UNUSED(message); + Q_UNUSED(type); #ifndef KSTARS_LITE KNotification::event(name, message); #ifdef HAVE_INDI #ifdef HAVE_CFITSIO EkosManager *manager = KStars::Instance()->ekosManager(); if (manager) manager->announceEvent(message, type); #endif #endif #endif } }