diff --git a/CMakeLists.txt b/CMakeLists.txt index f13207c7f..de5bd68eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,425 +1,435 @@ PROJECT(kstars CXX C) set (KStars_VERSION_MAJOR 2) set (KStars_VERSION_MINOR 8) set (KStars_VERSION_REVISION 9) 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(BUILD_KSTARS_LITE AND ANDROID) +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(ANDROID) + 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) + endif() find_package(Qt5 5.7 REQUIRED COMPONENTS Gui Qml Quick QuickControls2 Xml Svg Sql Network Positioning Concurrent ${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) endif() include(ExternalProject) include(ECMInstallIcons) include(ECMAddAppIcon) include(KDEInstallDirs) include(MacroBoolTo01) include(ECMQtDeclareLoggingCategory) -if(NOT ANDROID) +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(ANDROID) + 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) 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 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(BUILD_KSTARS_LITE) - if(ANDROID) - 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 -p0 < ${CMAKE_SOURCE_DIR}/android/3rdparty/cfitsio.patch" - CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - BUILD_COMMAND make cfitsio - BUILD_IN_SOURCE 1 - INSTALL_COMMAND "") - - set(CFITSIO_INCLUDE_DIR ${CMAKE_BINARY_DIR}/android/3rdparty/cfitsio) - set(CFITSIO_LIBRARIES ${CMAKE_BINARY_DIR}/android/3rdparty/cfitsio/libcfitsio.a) - else() - find_package(CFitsio REQUIRED) +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() - find_package(CFitsio) + 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_SOURCE_DIR}/android/toolchain-android.cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \\ + 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 -DCMAKE_AR=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar \\ - -DQT_ANDROID=${QT_ANDROID} -DCFITSIO_DIR=${CMAKE_BINARY_DIR}/android/3rdparty/cfitsio + -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.5.0) 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 && mv -f LibRaw-cmake-master/* . && patch -p0 < ${CMAKE_SOURCE_DIR}/android/3rdparty/libraw.patch" - CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/android/toolchain-android.cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DENABLE_OPENMP=OFF -DENABLE_LCMS=OFF + 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 -lgnustl_static) + 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) MACRO_BOOL_TO_01(XPLANET_FOUND HAVE_XPLANET) set_package_properties(Xplanet PROPERTIES DESCRIPTION "Renders an image of all the major planets and most satellites" URL "http://xplanet.sourceforge.net" TYPE OPTIONAL PURPOSE "Gives KStars support for xplanet.") ## Astrometry.net find_package(AstrometryNet) MACRO_BOOL_TO_01(ASTROMETRYNET_FOUND HAVE_ASTROMETRYNET) set_package_properties(AstrometryNet PROPERTIES DESCRIPTION "Astrometrics Library" URL "http://www.astrometry.net" TYPE OPTIONAL PURPOSE "Support for plate solving in KStars.") ## 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() 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") # 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 (ANDROID) +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/android/3rdparty/cfitsio.patch b/android/3rdparty/cfitsio.patch index 5afe9d693..49aa5b8b9 100644 --- a/android/3rdparty/cfitsio.patch +++ b/android/3rdparty/cfitsio.patch @@ -1,41 +1,46 @@ ---- CMakeLists.txt.orig 2017-05-20 13:30:52.859404414 +0300 -+++ CMakeLists.txt 2017-05-20 13:28:38.682343341 +0300 -@@ -1,6 +1,6 @@ - PROJECT(CFITSIO) - CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) -- -+include(${CMAKE_TOOLCHAIN_FILE}) - # Allow the developer to select if Dynamic or Static libraries are built - OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) - OPTION (USE_PTHREADS "Thread-safe build (using pthreads)" OFF) -@@ -59,8 +59,8 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c749abb..051960d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,6 +22,10 @@ ENDIF() + + #add_subdirectory (src) + ++IF(${CMAKE_TOOLCHAIN_FILE} MATCHES ".*toolchain-android.cmake") ++ include(${CMAKE_TOOLCHAIN_FILE}) ++ENDIF() ++ + SET (LIB_TYPE STATIC) + IF (BUILD_SHARED_LIBS) + SET (LIB_TYPE SHARED) +@@ -59,8 +63,6 @@ TARGET_LINK_LIBRARIES(${LIB_NAME} m ${PTHREADS_LIBRARY} ) SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION}) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_DESTINATION}) -install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) -+#install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_DESTINATION}) -+#install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) ENABLE_TESTING() ---- fitscore.c.orig 2017-05-20 13:33:54.887384468 +0300 -+++ fitscore.c 2017-05-20 13:08:19.014783064 +0300 -@@ -9230,7 +9230,7 @@ +diff --git a/fitscore.c b/fitscore.c +index 4c90df0..5e59cc1 100644 +--- a/fitscore.c ++++ b/fitscore.c +@@ -9230,7 +9230,7 @@ int ffc2rr(const char *cval, /* I - string representation of the value */ if (!decimalpt) { /* only do this once for efficiency */ lcc = localeconv(); /* set structure containing local decimal point symbol */ - decimalpt = *(lcc->decimal_point); +// decimalpt = *(lcc->decimal_point); } errno = 0; -@@ -9300,7 +9300,7 @@ +@@ -9300,7 +9300,7 @@ int ffc2dd(const char *cval, /* I - string representation of the value */ if (!decimalpt) { /* only do this once for efficiency */ lcc = localeconv(); /* set structure containing local decimal point symbol */ - decimalpt = *(lcc->decimal_point); +// decimalpt = *(lcc->decimal_point); } errno = 0; diff --git a/android/3rdparty/libraw.patch b/android/3rdparty/libraw.patch index 34caa673d..a8b50bc91 100644 --- a/android/3rdparty/libraw.patch +++ b/android/3rdparty/libraw.patch @@ -1,79 +1,78 @@ ---- CMakeLists.txt.orig 2017-05-20 20:42:17.997533874 +0300 -+++ CMakeLists.txt 2017-05-20 20:43:31.245445501 +0300 -@@ -26,6 +26,8 @@ - - PROJECT(libraw) - -+include(${CMAKE_TOOLCHAIN_FILE}) -+ - # ================================================================================================== - # Library version info extraction - -@@ -114,10 +116,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 47f3869..f5df332 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -114,9 +114,16 @@ INCLUDE(MacroLogFeature) INCLUDE(MacroOptionalFindPackage) INCLUDE(MacroJPEG) -+IF (ANDROID) -+ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/android-hack) -+ENDIF () ++IF(${CMAKE_TOOLCHAIN_FILE} MATCHES ".*toolchain-android.cmake") ++ include(${CMAKE_TOOLCHAIN_FILE}) ++ENDIF() ++INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/android-hack) + # Math library check - IF(NOT WIN32) -- FIND_LIBRARY(MATH_LIBRARY m) -+# FIND_LIBRARY(MATH_LIBRARY m) -+ set(MATH_LIBRARY -lm) +-IF(NOT WIN32) ++IF(${CMAKE_TOOLCHAIN_FILE} MATCHES ".*toolchain-android.cmake") ++ set(MATH_LIBRARY -lm) # toolchain-android.cmake can't find libm.so ++ELSEIF(NOT WIN32) + FIND_LIBRARY(MATH_LIBRARY m) ENDIF() - # LCMS version 1 and 2 library check +diff --git a/android-hack/swab.h b/android-hack/swab.h new file mode 100644 index 0000000..061c61e --- /dev/null -+++ android-hack/swab.h ++++ b/android-hack/swab.h @@ -0,0 +1,6 @@ + +#pragma once + +#include + +void swab(const void *from, void*to, ssize_t n); ---- internal/dcraw_common.cpp -+++ internal/dcraw_common.cpp -@@ -21,6 +21,24 @@ - for more information +diff --git a/internal/dcraw_common.cpp b/internal/dcraw_common.cpp +index 608641a..0f991e4 100644 +--- a/internal/dcraw_common.cpp ++++ b/internal/dcraw_common.cpp +@@ -19,6 +19,24 @@ it under the terms of the one of two licenses as you choose: */ + +#ifdef ANDROID +#include + +#include +#include + +void swab(const void *from, void*to, ssize_t n) +{ + ssize_t i; + + if (n < 0) + return; + + for (i = 0; i < (n/2)*2; i += 2) + *((uint16_t*)to+i) = __arch__swab16(*((uint16_t*)from+i)); +} +#endif + #include #define CLASS LibRaw:: #include "libraw/libraw_types.h" ---- src/libraw_cxx.cpp 2016-05-14 09:53:59.000000000 +0300 -+++ src/libraw_cxx.cpp 2017-04-18 15:01:21.806381052 +0300 -@@ -19,6 +19,10 @@ +diff --git a/src/libraw_cxx.cpp b/src/libraw_cxx.cpp +index c977302..2112ba8 100644 +--- a/src/libraw_cxx.cpp ++++ b/src/libraw_cxx.cpp +@@ -16,6 +16,10 @@ it under the terms of the one of two licenses as you choose: */ +#if ANDROID +#include +#endif + #include #include #include diff --git a/android/apk/AndroidManifest.xml b/android/apk/AndroidManifest.xml index a1a2922a1..9e6757121 100644 --- a/android/apk/AndroidManifest.xml +++ b/android/apk/AndroidManifest.xml @@ -1,39 +1,39 @@ - + diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt index 137f85999..03f7d0f82 100644 --- a/kstars/CMakeLists.txt +++ b/kstars/CMakeLists.txt @@ -1,1078 +1,1079 @@ 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 ) 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 (fits_SRCS fitsviewer/fitshistogram.cpp fitsviewer/fitsdata.cpp fitsviewer/fitsview.cpp fitsviewer/fitslabel.cpp fitsviewer/fitsviewer.cpp fitsviewer/fitstab.cpp fitsviewer/fitsdebayer.cpp fitsviewer/opsfits.cpp ) set (fits_bayer_SRCS fitsviewer/bayer.c ) 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) IF (CFITSIO_FOUND AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) SET_SOURCE_FILES_PROPERTIES(fitsviewer/bayer.c PROPERTIES COMPILE_FLAGS "-Wno-cast-align") ENDIF () if (INDI_FOUND) if(BUILD_KSTARS_LITE) set (fits_SRCS fitsviewer/fitsdata.cpp ) set (fits_bayer_SRCS fitsviewer/bayer.c ) include_directories(${CFITSIO_INCLUDE_DIR}) include_directories(${NOVA_INCLUDE_DIR}) set (indi_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 ) 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 ) 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 ) 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 ) endif(CFITSIO_FOUND) endif(BUILD_KSTARS_LITE) include_directories(${INDI_INCLUDE_DIR}) endif (INDI_FOUND) if(NOT BUILD_KSTARS_LITE) if(WCSLIB_FOUND) include_directories( ${WCSLIB_INCLUDE_DIR} ) endif(WCSLIB_FOUND) if(XPLANET_FOUND) set(xplanet_SRCS xplanet/opsxplanet.cpp ) set(xplanetui_SRCS xplanet/opsxplanet.ui ) endif(XPLANET_FOUND) ########### 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 ) 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/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 ) ki18n_wrap_ui(libkstarswidgets_ui_SRCS # widgets/genericcalendarwidget.ui widgets/unitspinboxwidget.ui ) 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_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_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_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(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( 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 tools/nameresolver.cpp ) endif(NOT BUILD_KSTARS_LITE) 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 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/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/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(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 ) 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 () #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(ANDROID) add_subdirectory(kstarslite/res) endif(ANDROID) endif(BUILD_KSTARS_LITE) set(kstars_SRCS ${indi_SRCS} ${fits_SRCS} ${ekos_SRCS} ${onlineparser_SRCS} ${libkstarswidgets_SRCS} ${libkstarscomponents_SRCS} ${libkstarstools_SRCS} ${kstars_extra_SRCS} ${kstars_gl_SRCS} ${kstars_projection_SRCS} ${xplanet_SRCS} ${kstars_options_SRCS} ${kstars_skyobjects_SRCS} ${kstars_dialogs_SRCS} ${hips_SRCS} ${oal_SRCS} ${printing_SRCS} #KStars Lite ${kstarslite_SRCS} ${indi_lite_SRCS} # Generated files ${libkstarstools_ui_SRCS} ${libkstarswidgets_ui_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}) IF (UNITY_BUILD) ENABLE_UNITY_BUILD(kstars kstars_SRCS 10 cpp) ENDIF () set(kstars_SRCS ${kstars_SRCS} ${fits_bayer_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) add_library(KStarsLib STATIC ${kstars_SRCS}) if(BUILD_KSTARS_LITE) target_link_libraries(KStarsLib 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) 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 ${ZLIB_LIBRARIES} ) if (KF5NotifyConfig_FOUND) target_link_libraries(KStarsLib KF5::NotifyConfig) endif(KF5NotifyConfig_FOUND) endif(BUILD_KSTARS_LITE) 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}) 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) if(WIN32 OR ANDROID) if(ANDROID) add_definitions(-DUSE_QT5_INDI) target_link_libraries(KStarsLib ${INDI_CLIENT_ANDROID_LIBRARIES} ${CFITSIO_LIBRARIES} ${LIBRAW_LIBRARIES}) 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) endif(BUILD_KSTARS_LITE) endif(WIN32 OR ANDROID) endif(INDI_FOUND) if(WCSLIB_FOUND) target_link_libraries(KStarsLib ${WCSLIB_LIBRARIES}) endif (WCSLIB_FOUND) if(LibRaw_FOUND) target_link_libraries(KStarsLib ${LibRaw_LIBRARIES}) 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 (ANDROID) +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) else () 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() endif(NOT BUILD_KSTARS_LITE) diff --git a/kstars/main.cpp b/kstars/main.cpp index a69462a82..63dcc5f78 100644 --- a/kstars/main.cpp +++ b/kstars/main.cpp @@ -1,328 +1,329 @@ /*************************************************************************** main.cpp - K Desktop Planetarium ------------------- begin : Mon Feb 5 01:11:45 PST 2001 copyright : (C) 2001 by Jason Harris email : jharris@30doradus.org ***************************************************************************/ /*************************************************************************** * * * 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 #include #include #include +#include #ifdef KSTARS_LITE #include "kstarslite.h" #include #else #include #include #include #include #include #include "kstars.h" #include "skymap.h" #endif //DELETE! #include "projections/projector.h" #include "kspaths.h" #include "kstarsdata.h" #include "ksutils.h" #include "kstarsdatetime.h" #include "simclock.h" #include "ksnumbers.h" #include "version.h" #include "Options.h" #include "kstars_debug.h" #ifndef KSTARS_LITE static const char description[] = I18N_NOOP("Desktop Planetarium"); static const char notice[] = I18N_NOOP("Some images in KStars are for non-commercial use only. See README.images."); #endif -int main(int argc, char *argv[]) #if defined(Q_OS_ANDROID) // __attribute__ is needed because clang-based linking removes the main() symbol from the shared library on Android -__attribute__ ((visibility ("default"))) +Q_DECL_EXPORT #endif +int main(int argc, char *argv[]) { #ifdef KSTARS_LITE QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QApplication app(argc, argv); #ifdef Q_OS_OSX //Note, this function will return true on OS X if the data directories are good to go. If not, quit with error code 1! if (!KSUtils::copyDataFolderFromAppBundleIfNeeded()) { KMessageBox::sorry(0, i18n("Sorry, without a KStars Data Directory, KStars cannot operate. Exiting program now.")); return 1; } #endif app.setApplicationVersion(KSTARS_VERSION); /** * enable high dpi support */ app.setAttribute(Qt::AA_UseHighDpiPixmaps, true); KLocalizedString::setApplicationDomain("kstars"); #ifndef KSTARS_LITE KCrash::initialize(); KAboutData aboutData("kstars", i18n("KStars"), KSTARS_VERSION, i18n(description), KAboutLicense::GPL, "2001-" + QString::number(QDate::currentDate().year()) + i18n("(c), The KStars Team"), i18nc("Build number followed by copyright notice", "Build: %1\n\n%2", KSTARS_BUILD_TS, notice), "http://edu.kde.org/kstars"); aboutData.addAuthor(i18n("Jason Harris"), i18n("Original Author"), "jharris@30doradus.org", "http://www.30doradus.org"); aboutData.addAuthor(i18n("Jasem Mutlaq"), i18n("Current Maintainer"), "mutlaqja@ikarustech.com", "http://www.indilib.org"); // Active developers aboutData.addAuthor(i18n("Akarsh Simha"), QString(), "akarsh@kde.org", "http://www.ph.utexas.edu/~asimha"); aboutData.addAuthor(i18n("Robert Lancaster"), i18n("FITSViewer Improvements. KStars OSX Port"), "rlancaste@gmail.com"); aboutData.addAuthor(i18n("Csaba Kertesz"), QString(), "csaba.kertesz@gmail.com", ""); // Inactive developers aboutData.addAuthor(i18n("Artem Fedoskin"), i18n("KStars Lite"), "afedoskin3@gmail.com"); aboutData.addAuthor(i18n("James Bowlin"), QString(), "bowlin@mindspring.com"); aboutData.addAuthor(i18n("Pablo de Vicente"), QString(), "pvicentea@wanadoo.es"); aboutData.addAuthor(i18n("Thomas Kabelmann"), QString(), "tk78@gmx.de"); aboutData.addAuthor(i18n("Heiko Evermann"), QString(), "heiko@evermann.de", "http://www.evermann.de"); aboutData.addAuthor(i18n("Carsten Niehaus"), QString(), "cniehaus@gmx.de"); aboutData.addAuthor(i18n("Mark Hollomon"), QString(), "mhh@mindspring.com"); aboutData.addAuthor(i18n("Alexey Khudyakov"), QString(), "alexey.skladnoy@gmail.com"); aboutData.addAuthor(i18n("Médéric Boquien"), QString(), "mboquien@free.fr"); aboutData.addAuthor(i18n("Jérôme Sonrier"), QString(), "jsid@emor3j.fr.eu.org"); aboutData.addAuthor(i18n("Prakash Mohan"), QString(), "prakash.mohan@kdemail.net"); aboutData.addAuthor(i18n("Victor Cărbune"), QString(), "victor.carbune@kdemail.net"); aboutData.addAuthor(i18n("Henry de Valence"), QString(), "hdevalence@gmail.com"); aboutData.addAuthor(i18n("Samikshan Bairagya"), QString(), "samikshan.bairagya@kdemail.net"); aboutData.addAuthor(i18n("Rafał Kułaga"), QString(), "rl.kulaga@gmail.com"); aboutData.addAuthor(i18n("Rishab Arora"), QString(), "ra.rishab@gmail.com"); // Contributors aboutData.addCredit(i18n("Valery Kharitonov"), i18n("Converted labels containing technical terms to links to documentation")); aboutData.addCredit(i18n("Ana-Maria Constantin"), i18n("Technical documentation on Astronomy and KStars")); aboutData.addCredit(i18n("Andrew Stepanenko"), i18n("Guiding code based on lin_guider")); aboutData.addCredit(i18n("Nuno Pinheiro"), i18n("Artwork")); aboutData.addCredit(i18n("Utkarsh Simha"), i18n("Improvements to observation plan execution, star hopper etc.")); aboutData.addCredit(i18n("Daniel Holler"), i18n("Extensive testing and suggestions for Ekos/INDI.")); aboutData.addCredit(i18n("Stephane Lucas"), i18n("Extensive testing and suggestions for Ekos Scheduler. KStars OSX Port")); aboutData.addCredit(i18n("Yuri Fabirovsky"), i18n("Splash screen for both regular KStars and KStars Lite.")); aboutData.addCredit(i18n("Jamie Smith"), i18n("KStars OSX Port.")); KAboutData::setApplicationData(aboutData); QCommandLineParser parser; aboutData.setupCommandLine(&parser); parser.setApplicationDescription(aboutData.shortDescription()); parser.addVersionOption(); parser.addHelpOption(); //parser.addHelpOption(INSERT_DESCRIPTION_HERE); parser.addOption(QCommandLineOption("dump", i18n("Dump sky image to file."), "file")); parser.addOption(QCommandLineOption("script", i18n("Script to execute."), "file")); parser.addOption(QCommandLineOption("width", i18n("Width of sky image."), "value")); parser.addOption(QCommandLineOption("height", i18n("Height of sky image."), "value")); parser.addOption(QCommandLineOption("date", i18n("Date and time."), "string")); parser.addOption(QCommandLineOption("paused", i18n("Start with clock paused."))); // urls to open parser.addPositionalArgument(QStringLiteral("urls"), i18n("FITS file(s) to open."), QStringLiteral("[urls...]")); parser.process(app); aboutData.processCommandLine(&parser); if (parser.isSet("dump")) { qCDebug(KSTARS) << "Dumping sky image"; //parse filename and image format const char *format = "PNG"; QString fname = parser.value("dump"); QString ext = fname.mid(fname.lastIndexOf(".") + 1); if (ext.toLower() == "png") { format = "PNG"; } else if (ext.toLower() == "jpg" || ext.toLower() == "jpeg") { format = "JPG"; } else if (ext.toLower() == "gif") { format = "GIF"; } else if (ext.toLower() == "pnm") { format = "PNM"; } else if (ext.toLower() == "bmp") { format = "BMP"; } else { qCWarning(KSTARS) << i18n("Could not parse image format of %1; assuming PNG.", fname); } //parse width and height bool ok(false); int w(0), h(0); w = parser.value("width").toInt(&ok); if (ok) h = parser.value("height").toInt(&ok); if (!ok) { qCWarning(KSTARS) << "Unable to parse arguments Width: " << parser.value("width") << " Height: " << parser.value("height"); return 1; } KStarsData *dat = KStarsData::Create(); QObject::connect(dat, SIGNAL(progressText(QString)), dat, SLOT(slotConsoleMessage(QString))); dat->initialize(); //Set Geographic Location dat->setLocationFromOptions(); //Set color scheme dat->colorScheme()->loadFromConfig(); //set clock now that we have a location: //Check to see if user provided a date/time string. If not, use current CPU time QString datestring = parser.value("date"); KStarsDateTime kdt; if (!datestring.isEmpty()) { if (datestring.contains("-")) //assume ISODate format { if (datestring.contains(":")) //also includes time { //kdt = QDateTime::fromString( datestring, QDateTime::ISODate ); kdt = KStarsDateTime(QDateTime::fromString(datestring, Qt::ISODate)); } else //string probably contains date only { //kdt.setDate( QDate::fromString( datestring, Qt::ISODate ) ); kdt.setDate(QDate::fromString(datestring, Qt::ISODate)); kdt.setTime(QTime(0, 0, 0)); } } else //assume Text format for date string { kdt = dat->geo()->LTtoUT(KStarsDateTime(QDateTime::fromString(datestring, Qt::TextDate))); } if (!kdt.isValid()) { qCWarning(KSTARS) << i18n("Supplied date string is invalid: %1. Using CPU date/time instead.", datestring); kdt = KStarsDateTime::currentDateTimeUtc(); } } else { kdt = KStarsDateTime::currentDateTimeUtc(); } dat->clock()->setUTC(kdt); SkyMap *map = SkyMap::Create(); map->resize(w, h); QPixmap sky(w, h); dat->setFullTimeUpdate(); dat->updateTime(dat->geo(), map != nullptr); SkyPoint dest(Options::focusRA(), Options::focusDec()); map->setDestination(dest); map->destination()->EquatorialToHorizontal(dat->lst(), dat->geo()->lat()); map->setFocus(map->destination()); map->focus()->EquatorialToHorizontal(dat->lst(), dat->geo()->lat()); //Execute the specified script QString scriptfile = parser.value("script"); if (!scriptfile.isEmpty()) { if (dat->executeScript(scriptfile, map)) { std::cout << i18n("Script executed.").toUtf8().data() << std::endl; } else { qCWarning(KSTARS) << i18n("Could not execute script."); } } qApp->processEvents(); map->setupProjector(); map->exportSkyImage(&sky); qApp->processEvents(); if (!sky.save(fname, format)) qCWarning(KSTARS) << "Unable to save image: " << fname; else qCDebug(KSTARS) << "Saved to file: %1" << fname; delete map; delete dat; return 0; } //Try to parse the given date string QString datestring = parser.value("date"); if (!datestring.isEmpty() && !KStarsDateTime::fromString(datestring).isValid()) { qWarning() << i18n("Using CPU date/time instead."); datestring.clear(); } #endif // Create writable data dir if it does not exist QDir writableDir; writableDir.mkdir(KSPaths::writableLocation(QStandardPaths::GenericDataLocation)); #ifndef KSTARS_LITE KStars::createInstance(true, !parser.isSet("paused"), datestring); // no session.. just start up normally const QStringList urls = parser.positionalArguments(); // take arguments if (!urls.isEmpty()) { foreach (const QString &url, urls) { const QUrl u = QUrl::fromUserInput(url, QDir::currentPath()); KStars::Instance()->openFITS(u); } } QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit())); app.exec(); #else KStarsLite::createInstance(true); app.exec(); #endif return 0; } diff --git a/android/3rdparty/cfitsio.patch b/xxx similarity index 53% copy from android/3rdparty/cfitsio.patch copy to xxx index 5afe9d693..49aa5b8b9 100644 --- a/android/3rdparty/cfitsio.patch +++ b/xxx @@ -1,41 +1,46 @@ ---- CMakeLists.txt.orig 2017-05-20 13:30:52.859404414 +0300 -+++ CMakeLists.txt 2017-05-20 13:28:38.682343341 +0300 -@@ -1,6 +1,6 @@ - PROJECT(CFITSIO) - CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) -- -+include(${CMAKE_TOOLCHAIN_FILE}) - # Allow the developer to select if Dynamic or Static libraries are built - OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) - OPTION (USE_PTHREADS "Thread-safe build (using pthreads)" OFF) -@@ -59,8 +59,8 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c749abb..051960d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,6 +22,10 @@ ENDIF() + + #add_subdirectory (src) + ++IF(${CMAKE_TOOLCHAIN_FILE} MATCHES ".*toolchain-android.cmake") ++ include(${CMAKE_TOOLCHAIN_FILE}) ++ENDIF() ++ + SET (LIB_TYPE STATIC) + IF (BUILD_SHARED_LIBS) + SET (LIB_TYPE SHARED) +@@ -59,8 +63,6 @@ TARGET_LINK_LIBRARIES(${LIB_NAME} m ${PTHREADS_LIBRARY} ) SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION} SOVERSION ${${PROJECT_NAME}_MAJOR_VERSION}) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_DESTINATION}) -install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) -+#install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_DESTINATION}) -+#install(FILES ${H_FILES} DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) ENABLE_TESTING() ---- fitscore.c.orig 2017-05-20 13:33:54.887384468 +0300 -+++ fitscore.c 2017-05-20 13:08:19.014783064 +0300 -@@ -9230,7 +9230,7 @@ +diff --git a/fitscore.c b/fitscore.c +index 4c90df0..5e59cc1 100644 +--- a/fitscore.c ++++ b/fitscore.c +@@ -9230,7 +9230,7 @@ int ffc2rr(const char *cval, /* I - string representation of the value */ if (!decimalpt) { /* only do this once for efficiency */ lcc = localeconv(); /* set structure containing local decimal point symbol */ - decimalpt = *(lcc->decimal_point); +// decimalpt = *(lcc->decimal_point); } errno = 0; -@@ -9300,7 +9300,7 @@ +@@ -9300,7 +9300,7 @@ int ffc2dd(const char *cval, /* I - string representation of the value */ if (!decimalpt) { /* only do this once for efficiency */ lcc = localeconv(); /* set structure containing local decimal point symbol */ - decimalpt = *(lcc->decimal_point); +// decimalpt = *(lcc->decimal_point); } errno = 0;