2019-05-07 13:02:55 +02:00
|
|
|
# libcalamares is the non-GUI part of Calamares, which includes handling
|
|
|
|
# translations, configurations, logging, utilities, global storage, and (non-GUI) jobs.
|
|
|
|
|
2020-05-14 01:05:37 +02:00
|
|
|
add_definitions( -DDLLEXPORT_PRO )
|
2014-06-04 16:35:26 +02:00
|
|
|
|
2014-06-26 14:18:32 +02:00
|
|
|
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h )
|
2014-06-04 18:19:05 +02:00
|
|
|
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../calamares/CalamaresVersion.h.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h )
|
2014-06-04 16:35:26 +02:00
|
|
|
|
2019-05-10 14:04:36 +02:00
|
|
|
set( OPTIONAL_PRIVATE_LIBRARIES "" )
|
2019-05-10 16:57:50 +02:00
|
|
|
set( OPTIONAL_PUBLIC_LIBRARIES "" )
|
2019-05-10 14:04:36 +02:00
|
|
|
|
2014-06-04 16:35:26 +02:00
|
|
|
set( libSources
|
2016-09-25 03:20:50 +02:00
|
|
|
CppJob.cpp
|
2014-07-21 17:08:06 +02:00
|
|
|
GlobalStorage.cpp
|
2014-06-27 15:34:05 +02:00
|
|
|
Job.cpp
|
2019-03-17 18:25:35 +01:00
|
|
|
JobExample.cpp
|
2014-06-04 16:35:26 +02:00
|
|
|
JobQueue.cpp
|
2014-07-10 12:08:43 +02:00
|
|
|
ProcessJob.cpp
|
2018-04-05 10:31:13 +02:00
|
|
|
Settings.cpp
|
2019-05-10 14:04:36 +02:00
|
|
|
|
|
|
|
# GeoIP services
|
|
|
|
geoip/Interface.cpp
|
|
|
|
geoip/GeoIPJSON.cpp
|
|
|
|
geoip/Handler.cpp
|
|
|
|
|
2019-05-10 12:45:54 +02:00
|
|
|
# Locale-data service
|
2019-05-10 17:46:20 +02:00
|
|
|
locale/Label.cpp
|
|
|
|
locale/LabelModel.cpp
|
2019-05-10 12:45:54 +02:00
|
|
|
locale/Lookup.cpp
|
2019-11-26 11:19:30 +01:00
|
|
|
locale/TimeZone.cpp
|
2019-08-04 22:56:41 +02:00
|
|
|
locale/TranslatableConfiguration.cpp
|
2019-05-10 14:04:36 +02:00
|
|
|
|
2020-01-24 22:53:14 +01:00
|
|
|
# Modules
|
|
|
|
modulesystem/InstanceKey.cpp
|
2020-03-31 22:56:42 +02:00
|
|
|
modulesystem/Module.cpp
|
2020-03-31 22:13:30 +02:00
|
|
|
modulesystem/Requirement.cpp
|
2020-03-31 23:13:13 +02:00
|
|
|
modulesystem/RequirementsChecker.cpp
|
2020-04-02 21:33:07 +02:00
|
|
|
modulesystem/RequirementsModel.cpp
|
2020-01-29 16:03:50 +01:00
|
|
|
|
2019-08-20 15:25:37 +02:00
|
|
|
# Network service
|
|
|
|
network/Manager.cpp
|
|
|
|
|
2019-05-10 12:45:54 +02:00
|
|
|
# Partition service
|
2019-06-20 11:35:46 +02:00
|
|
|
partition/Mount.cpp
|
2019-05-08 19:23:07 +02:00
|
|
|
partition/PartitionSize.cpp
|
2019-06-19 12:14:49 +02:00
|
|
|
partition/Sync.cpp
|
2019-05-10 12:45:54 +02:00
|
|
|
|
|
|
|
# Utility service
|
2014-07-29 20:18:02 +02:00
|
|
|
utils/CalamaresUtilsSystem.cpp
|
2018-01-15 11:59:44 +01:00
|
|
|
utils/CommandList.cpp
|
2019-04-29 12:22:24 +02:00
|
|
|
utils/Dirs.cpp
|
2020-01-29 16:03:50 +01:00
|
|
|
utils/Entropy.cpp
|
2014-06-18 18:05:04 +02:00
|
|
|
utils/Logger.cpp
|
2019-08-12 15:52:59 +02:00
|
|
|
utils/PluginFactory.cpp
|
2014-11-11 12:42:37 +01:00
|
|
|
utils/Retranslator.cpp
|
2019-04-29 12:48:01 +02:00
|
|
|
utils/String.cpp
|
2019-07-02 22:08:36 +02:00
|
|
|
utils/UMask.cpp
|
2019-04-29 11:36:04 +02:00
|
|
|
utils/Variant.cpp
|
2019-04-29 12:04:55 +02:00
|
|
|
utils/Yaml.cpp
|
2014-06-04 16:35:26 +02:00
|
|
|
)
|
2019-08-08 16:47:14 +02:00
|
|
|
set( _kdsagSources
|
2017-09-18 14:59:53 +02:00
|
|
|
kdsingleapplicationguard/kdsingleapplicationguard.cpp
|
|
|
|
kdsingleapplicationguard/kdsharedmemorylocker.cpp
|
|
|
|
kdsingleapplicationguard/kdtoolsglobal.cpp
|
|
|
|
kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp
|
2014-06-04 16:35:26 +02:00
|
|
|
)
|
2019-08-08 16:47:14 +02:00
|
|
|
set( kdsagSources "" )
|
|
|
|
foreach( _s ${_kdsagSources} )
|
|
|
|
list( APPEND kdsagSources ${CMAKE_SOURCE_DIR}/3rdparty/${_s} )
|
|
|
|
endforeach()
|
2017-09-21 10:53:09 +02:00
|
|
|
mark_thirdparty_code( ${kdsagSources} )
|
2014-06-04 16:35:26 +02:00
|
|
|
|
2017-09-19 16:46:55 +02:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|
2014-07-16 16:07:32 +02:00
|
|
|
|
2019-05-10 14:04:36 +02:00
|
|
|
### OPTIONAL Python support
|
|
|
|
#
|
|
|
|
#
|
2014-07-16 16:07:32 +02:00
|
|
|
if( WITH_PYTHON )
|
2019-05-10 14:04:36 +02:00
|
|
|
list( APPEND libSources
|
2014-07-18 14:27:59 +02:00
|
|
|
PythonHelper.cpp
|
2014-07-16 16:07:32 +02:00
|
|
|
PythonJob.cpp
|
2014-07-17 17:52:02 +02:00
|
|
|
PythonJobApi.cpp
|
2014-07-16 16:07:32 +02:00
|
|
|
)
|
2017-09-25 16:33:48 +02:00
|
|
|
set_source_files_properties( PythonJob.cpp
|
2017-09-25 17:08:09 +02:00
|
|
|
PROPERTIES COMPILE_FLAGS "${SUPPRESS_BOOST_WARNINGS}"
|
2017-09-25 16:33:48 +02:00
|
|
|
)
|
2014-07-16 16:07:32 +02:00
|
|
|
|
|
|
|
include_directories(${PYTHON_INCLUDE_DIRS})
|
|
|
|
link_directories(${PYTHON_LIBRARIES})
|
|
|
|
|
|
|
|
include_directories(${Boost_INCLUDE_DIRS})
|
|
|
|
link_directories(${Boost_LIBRARY_DIRS})
|
|
|
|
|
2019-05-10 14:04:36 +02:00
|
|
|
list( APPEND OPTIONAL_PRIVATE_LIBRARIES
|
2014-07-16 16:07:32 +02:00
|
|
|
${PYTHON_LIBRARIES}
|
|
|
|
${Boost_LIBRARIES}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-05-10 14:04:36 +02:00
|
|
|
### OPTIONAL GeoIP XML support
|
|
|
|
#
|
|
|
|
#
|
2019-04-30 22:53:26 +02:00
|
|
|
find_package(Qt5 COMPONENTS Xml)
|
|
|
|
if( Qt5Xml_FOUND )
|
2019-05-10 14:04:36 +02:00
|
|
|
list( APPEND libSources geoip/GeoIPXML.cpp )
|
2019-05-10 16:57:50 +02:00
|
|
|
list( APPEND OPTIONAL_PUBLIC_LIBRARIES Qt5::Network Qt5::Xml )
|
2019-04-30 22:53:26 +02:00
|
|
|
endif()
|
|
|
|
|
2019-06-13 12:12:47 +02:00
|
|
|
### OPTIONAL KPMcore support
|
|
|
|
#
|
|
|
|
#
|
|
|
|
find_package( KPMcore 3.3 )
|
|
|
|
set_package_properties(
|
|
|
|
KPMcore PROPERTIES
|
2019-06-14 23:57:07 +02:00
|
|
|
URL "https://invent.kde.org/kde/kpmcore"
|
|
|
|
DESCRIPTION "KDE Partitioning library"
|
|
|
|
TYPE RECOMMENDED
|
2019-06-13 12:12:47 +02:00
|
|
|
PURPOSE "For partitioning service"
|
|
|
|
)
|
|
|
|
|
|
|
|
if ( KPMcore_FOUND )
|
|
|
|
find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore
|
|
|
|
find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore
|
|
|
|
|
2020-03-16 22:25:55 +01:00
|
|
|
if( KPMcore_VERSION VERSION_GREATER_EQUAL "4.2" )
|
|
|
|
add_definitions(
|
|
|
|
-DWITH_KPMCORE42API
|
|
|
|
-DWITH_KPMCORE4API
|
|
|
|
) # kpmcore 4.2 with new API
|
|
|
|
elseif( KPMcore_VERSION VERSION_GREATER_EQUAL "4.0" )
|
2019-06-14 23:57:07 +02:00
|
|
|
add_definitions( -DWITH_KPMCORE4API ) # kpmcore 4 with new API
|
|
|
|
elseif( KPMcore_VERSION VERSION_GREATER "3.3.70" )
|
|
|
|
message( FATAL_ERROR "KPMCore beta versions ${KPMcore_VERSION} not supported" )
|
2019-06-13 12:12:47 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
include_directories( ${KPMCORE_INCLUDE_DIR} )
|
|
|
|
list( APPEND libSources
|
2019-06-13 14:55:43 +02:00
|
|
|
partition/FileSystem.cpp
|
2019-06-13 21:40:34 +02:00
|
|
|
partition/KPMManager.cpp
|
2019-06-13 12:12:47 +02:00
|
|
|
partition/PartitionIterator.cpp
|
2019-06-13 14:41:33 +02:00
|
|
|
partition/PartitionQuery.cpp
|
2019-06-13 12:12:47 +02:00
|
|
|
)
|
|
|
|
list( APPEND OPTIONAL_PRIVATE_LIBRARIES kpmcore )
|
|
|
|
endif()
|
|
|
|
|
2019-05-10 14:04:36 +02:00
|
|
|
### LIBRARY
|
|
|
|
#
|
|
|
|
#
|
2019-05-10 12:45:54 +02:00
|
|
|
add_library( calamares SHARED ${libSources} ${kdsagSources} )
|
2014-07-17 17:52:02 +02:00
|
|
|
set_target_properties( calamares
|
2014-06-04 18:19:05 +02:00
|
|
|
PROPERTIES
|
2018-03-01 12:37:52 +01:00
|
|
|
VERSION ${CALAMARES_VERSION_SHORT}
|
|
|
|
SOVERSION ${CALAMARES_VERSION_SHORT}
|
2014-06-04 16:35:26 +02:00
|
|
|
)
|
2019-04-17 12:19:12 +02:00
|
|
|
calamares_automoc( calamares )
|
2014-06-04 16:35:26 +02:00
|
|
|
|
2014-07-17 17:52:02 +02:00
|
|
|
target_link_libraries( calamares
|
2018-04-05 10:31:13 +02:00
|
|
|
LINK_PRIVATE
|
|
|
|
${OPTIONAL_PRIVATE_LIBRARIES}
|
|
|
|
LINK_PUBLIC
|
2020-02-17 15:01:05 +01:00
|
|
|
yamlcpp
|
2018-04-05 10:31:13 +02:00
|
|
|
Qt5::Core
|
2019-08-08 14:31:25 +02:00
|
|
|
KF5::CoreAddons
|
2019-05-10 16:57:50 +02:00
|
|
|
${OPTIONAL_PUBLIC_LIBRARIES}
|
2014-06-04 16:35:26 +02:00
|
|
|
)
|
|
|
|
|
2014-07-17 17:52:02 +02:00
|
|
|
install( TARGETS calamares
|
2014-06-04 16:35:26 +02:00
|
|
|
EXPORT CalamaresLibraryDepends
|
2018-03-01 12:37:52 +01:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2018-02-19 10:23:56 +01:00
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2014-06-04 16:35:26 +02:00
|
|
|
)
|
|
|
|
|
2018-03-01 12:37:52 +01:00
|
|
|
# Make symlink lib/calamares/libcalamares.so to lib/libcalamares.so.VERSION so
|
|
|
|
# lib/calamares can be used as module path for the Python interpreter.
|
|
|
|
install( CODE "
|
|
|
|
file( MAKE_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" )
|
|
|
|
execute_process( COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ../libcalamares.so.${CALAMARES_VERSION_SHORT} libcalamares.so WORKING_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" )
|
|
|
|
")
|
|
|
|
|
2014-06-04 16:35:26 +02:00
|
|
|
# Install header files
|
|
|
|
file( GLOB rootHeaders "*.h" )
|
2014-06-04 18:19:05 +02:00
|
|
|
file( GLOB kdsingleapplicationguardHeaders "kdsingleapplicationguard/*.h" )
|
2014-06-06 16:00:42 +02:00
|
|
|
file( GLOB utilsHeaders "utils/*.h" )
|
2014-06-04 16:35:26 +02:00
|
|
|
|
2014-06-26 14:18:32 +02:00
|
|
|
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h DESTINATION include/libcalamares )
|
2014-06-04 16:35:26 +02:00
|
|
|
install( FILES ${rootHeaders} DESTINATION include/libcalamares )
|
2014-06-04 18:19:05 +02:00
|
|
|
install( FILES ${kdsingleapplicationguardHeaders} DESTINATION include/libcalamares/kdsingleapplicationguard )
|
2014-06-06 16:00:42 +02:00
|
|
|
install( FILES ${utilsHeaders} DESTINATION include/libcalamares/utils )
|
2019-05-10 14:04:36 +02:00
|
|
|
|
|
|
|
### TESTING
|
|
|
|
#
|
|
|
|
#
|
2020-02-17 15:05:00 +01:00
|
|
|
calamares_add_test(
|
|
|
|
libcalamarestest
|
|
|
|
SOURCES
|
|
|
|
utils/Tests.cpp
|
|
|
|
)
|
2020-02-07 13:49:06 +01:00
|
|
|
|
2020-02-17 15:05:00 +01:00
|
|
|
calamares_add_test(
|
|
|
|
libcalamarestestpaths
|
|
|
|
SOURCES
|
|
|
|
utils/TestPaths.cpp
|
|
|
|
)
|
2020-02-07 13:49:06 +01:00
|
|
|
|
2020-02-17 15:05:00 +01:00
|
|
|
calamares_add_test(
|
|
|
|
geoiptest
|
|
|
|
SOURCES
|
|
|
|
geoip/GeoIPTests.cpp
|
|
|
|
${geoip_src}
|
|
|
|
)
|
|
|
|
|
|
|
|
calamares_add_test(
|
|
|
|
libcalamarespartitiontest
|
|
|
|
SOURCES
|
|
|
|
partition/Tests.cpp
|
|
|
|
)
|
|
|
|
|
2020-04-22 15:38:42 +02:00
|
|
|
if( KPMcore_FOUND )
|
|
|
|
calamares_add_test(
|
|
|
|
libcalamarespartitionkpmtest
|
|
|
|
SOURCES
|
|
|
|
partition/KPMTests.cpp
|
2020-04-23 11:45:12 +02:00
|
|
|
LIBRARIES
|
|
|
|
${OPTIONAL_PRIVATE_LIBRARIES}
|
2020-04-22 15:38:42 +02:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-02-17 15:05:00 +01:00
|
|
|
calamares_add_test(
|
|
|
|
libcalamareslocaletest
|
|
|
|
SOURCES
|
|
|
|
locale/Tests.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
calamares_add_test(
|
|
|
|
libcalamaresnetworktest
|
|
|
|
SOURCES
|
|
|
|
network/Tests.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
calamares_add_test(
|
|
|
|
libcalamaresmodulesystemtest
|
|
|
|
SOURCES
|
|
|
|
modulesystem/Tests.cpp
|
|
|
|
)
|
2019-04-30 22:53:26 +02:00
|
|
|
|
2020-04-22 15:38:42 +02:00
|
|
|
# This is not an actual test, it's a test / demo application
|
|
|
|
# for experimenting with GeoIP.
|
|
|
|
add_executable( test_geoip geoip/test_geoip.cpp ${geoip_src} )
|
|
|
|
target_link_libraries( test_geoip calamares Qt5::Network yamlcpp )
|
|
|
|
calamares_automoc( test_geoip )
|