Warning, /education/kalzium/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 3.16)
0002 
0003 # KDE Application Version, managed by release script
0004 set(RELEASE_SERVICE_VERSION_MAJOR "23")
0005 set(RELEASE_SERVICE_VERSION_MINOR "03")
0006 set(RELEASE_SERVICE_VERSION_MICRO "70")
0007 set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
0008 
0009 project(kalzium VERSION ${RELEASE_SERVICE_VERSION})
0010 
0011 set(QT_MIN_VERSION "5.15.2")
0012 set(KF5_MIN_VERSION "5.90.0")
0013 set(KDE_COMPILERSETTINGS_LEVEL "5.82")
0014 
0015 set(CMAKE_CXX_STANDARD 17)
0016 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0017 
0018 find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
0019 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${kalzium_SOURCE_DIR}/cmake/modules)
0020 
0021 include(KDEInstallDirs)
0022 include(KDECompilerSettings NO_POLICY_SCOPE)
0023 include(KDECMakeSettings)
0024 include(FeatureSummary)
0025 include(ECMInstallIcons)
0026 include(ECMMarkNonGuiExecutable)
0027 include(CheckIncludeFiles)
0028 include(ECMAddAppIcon)
0029 include(ECMSetupVersion)
0030 include(ECMQtDeclareLoggingCategory)
0031 include(GenerateExportHeader)
0032 include(KDEGitCommitHooks)
0033 include(KDEClangFormat)
0034 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.c)
0035 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
0036 
0037 
0038 find_package(Gettext REQUIRED)
0039 find_package(PythonInterp REQUIRED)
0040 find_package(PkgConfig)
0041 find_package(OpenBabel3 3.1)
0042 if(NOT ${OpenBabel3_FOUND})
0043     find_package(OpenBabel2)
0044 endif()
0045 if (QT_MAJOR_VERSION STREQUAL "5")
0046     find_package(AvogadroLibs)
0047 endif()
0048 find_package(Eigen3 CONFIG)
0049 find_package(OCaml)
0050 find_package(Libfacile)
0051 
0052 pkg_check_modules(CHEMICAL_MIME_DATA chemical-mime-data)
0053 check_include_files(ieeefp.h HAVE_IEEEFP_H)
0054 
0055 # create configuration file
0056 set(HAVE_FACILE ${LIBFACILE_FOUND})
0057 set(HAVE_OPENBABEL3 ${OpenBabel3_FOUND})
0058 set(HAVE_OPENBABEL2 ${OPENBABEL2_FOUND})
0059 if(HAVE_OPENBABEL2 OR HAVE_OPENBABEL3)
0060     set(HAVE_OPENBABEL 1)
0061 endif()
0062 set(HAVE_EIGEN ${EIGEN3_FOUND})
0063 if (QT_MAJOR_VERSION STREQUAL "6")
0064     set(HAVE_AVOGADRO FALSE)
0065 else()
0066     set(HAVE_AVOGADRO ${AvogadroLibs_FOUND})
0067 endif()
0068 
0069 if(HAVE_OPENBABEL3)
0070     set(OPENBABEL_INCLUDE_DIR ${OpenBabel3_INCLUDE_DIRS})
0071     set(OPENBABEL_LIBRARIES ${OpenBabel3_LIBRARIES})
0072 elseif(HAVE_OPENBABEL2)
0073     set(OPENBABEL_INCLUDE_DIR ${OPENBABEL2_INCLUDE_DIR})
0074     set(OPENBABEL_LIBRARIES ${OPENBABEL2_LIBRARIES})
0075 endif()
0076 
0077 configure_file(
0078    ${CMAKE_CURRENT_SOURCE_DIR}/config-kalzium.h.cmake
0079    ${CMAKE_CURRENT_BINARY_DIR}/config-kalzium.h
0080 )
0081 
0082 include_directories(${AvogadroLibs_INCLUDE_DIRS})
0083 
0084 find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS
0085     Core
0086     Gui
0087     Svg
0088     Widgets
0089     Xml
0090 )
0091 
0092 if (QT_MAJOR_VERSION STREQUAL "6")
0093     find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS Core5Compat StateMachine)
0094 else()
0095     find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED COMPONENTS Script)
0096 endif()
0097 
0098 find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
0099     Archive
0100     Config
0101     CoreAddons
0102     DocTools
0103     I18n
0104     Parts
0105     Plotting
0106     UnitConversion
0107     WidgetsAddons
0108 )
0109 
0110 ecm_setup_version("5.0.0"
0111     VARIABLE_PREFIX KALZIUMLIB
0112 )
0113 
0114 add_definitions(
0115     -DQT_NO_URL_CAST_FROM_STRING
0116 )
0117 if(MSVC)
0118     # for correctly linking openbabel:
0119     # see https://www.mail-archive.com/openbabel-devel@lists.sourceforge.net/msg01975.html
0120     add_definitions(-DUSING_DYNAMIC_LIBS)
0121 endif()
0122 
0123 if (HAVE_OPENBABEL AND AvogadroLibs_FOUND AND EIGEN3_FOUND)
0124   find_package(Qt${QT_MAJOR_VERSION}OpenGL ${QT_MIN_VERSION} REQUIRED)
0125   find_package(KF5NewStuff ${KF5_MIN_VERSION} REQUIRED)
0126   # avoid compilerwarnings about redefinitions
0127   # todo: use check_function_exits() ?
0128   message(STATUS "Kalzium molecular editor enabled")
0129   if (WIN32)
0130     add_definitions(-DHAVE_SNPRINTF -DHAVE_STRCASECMP -DHAVE_STRNCASECMP)
0131   endif ()
0132   add_subdirectory(compoundviewer)
0133 else ()
0134   message(STATUS "Kalzium molecular editor disabled")
0135 endif ()
0136 
0137 add_subdirectory(doc)
0138 add_subdirectory(src)
0139 add_subdirectory(data)
0140 add_subdirectory(libscience)
0141 
0142 ki18n_install(po)
0143 if (KF5DocTools_FOUND)
0144     kdoctools_install(po)
0145 endif()
0146 install(FILES org.kde.kalzium.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
0147 
0148 ecm_qt_install_logging_categories(
0149         EXPORT KALZIUM
0150         FILE kalzium.categories
0151         DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
0152         )
0153 
0154 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)