Refactored calamares_bin into calamares_bin and libcalamaresui.

Now linking with -Wl,--no-undefined!
Moved find_package KF5 from the root CMakeLists.txt to the partitioning
module where it belongs. KF5 deps should be limited to plugins.
Lots of random fixage to make stuff link.
Removed CalamaresApplication reference from Settings.
Removed the use of AbstractPage, we don't need it right now.
This commit is contained in:
Teo Mrnjavac 2014-07-03 18:00:40 +02:00
parent 1efb4f1101
commit 4ec72f4afb
32 changed files with 81 additions and 45 deletions

View File

@ -1,7 +1,7 @@
project( calamares )
cmake_minimum_required( VERSION 2.8.12 )
set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wl,--no-undefined" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wl,--no-undefined" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wl,--fatal-warnings -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type" )
if( CMAKE_COMPILER_IS_GNUCXX )
@ -19,7 +19,6 @@ cmake_policy( SET CMP0043 OLD )
find_package( Qt5 5.3.0 CONFIG REQUIRED Core Gui Widgets LinguistTools )
find_package( YamlCpp 0.5.1 REQUIRED )
find_package( KF5 CONFIG REQUIRED CoreAddons )
###
### Calamares application info

View File

@ -10,13 +10,13 @@ function(calamares_add_library)
set(LIBRARY_NAME ${NAME})
# message("*** Arguments for ${LIBRARY_NAME}")
# message("Sources: ${LIBRARY_SOURCES}")
# message("Link libraries: ${LIBRARY_LINK_LIBRARIES}")
# message("UI: ${LIBRARY_UI}")
# message("TARGET_TYPE: ${LIBRARY_TARGET_TYPE}")
# message("EXPORT_MACRO: ${LIBRARY_EXPORT_MACRO}")
# message("NO_INSTALL: ${LIBRARY_NO_INSTALL}")
message("*** Arguments for ${LIBRARY_NAME}")
message("Sources: ${LIBRARY_SOURCES}")
message("Link libraries: ${LIBRARY_LINK_LIBRARIES}")
message("UI: ${LIBRARY_UI}")
message("TARGET_TYPE: ${LIBRARY_TARGET_TYPE}")
message("EXPORT_MACRO: ${LIBRARY_EXPORT_MACRO}")
message("NO_INSTALL: ${LIBRARY_NO_INSTALL}")
set(target ${LIBRARY_NAME})

View File

@ -8,12 +8,13 @@ include_directories( ${CMAKE_CURRENT_LIST_DIR} )
# library
add_subdirectory( libcalamares )
add_subdirectory( libcalamaresui )
# application
add_subdirectory( calamares )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/calamares )
include_directories( ${CMAKE_CURRENT_LIST_DIR}/calamares )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/libcalamaresui )
include_directories( ${CMAKE_CURRENT_LIST_DIR}/libcalamaresui )
# plugins
add_subdirectory( modules )

View File

@ -10,13 +10,6 @@ set( calamaresSources
main.cpp
CalamaresApplication.cpp
CalamaresWindow.cpp
Settings.cpp
ViewManager.cpp
YamlUtils.cpp
modulesystem/Module.cpp
modulesystem/ModuleManager.cpp
modulesystem/ViewModule.cpp
progresstree/CategoryItem.cpp
progresstree/ProgressTreeDelegate.cpp
@ -24,11 +17,6 @@ set( calamaresSources
progresstree/ProgressTreeModel.cpp
progresstree/ProgressTreeView.cpp
progresstree/ViewStepItem.cpp
utils/CalamaresUtilsGui.cpp
viewpages/ViewStep.cpp
viewpages/AbstractPage.cpp
)
set( calamaresUi
@ -41,6 +29,7 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}/../libcalamares
../libcalamares
../libcalamaresui
)
include( GNUInstallDirs )
@ -68,6 +57,7 @@ qt5_use_modules( calamares_bin Core Widgets )
target_link_libraries( calamares_bin
${LINK_LIBRARIES}
${CALAMARES_LIBRARIES}
calamaresui
Qt5::Core
Qt5::Widgets
yaml-cpp

View File

@ -20,12 +20,13 @@
#include "CalamaresWindow.h"
#include "CalamaresVersion.h"
#include "modulesystem/ModuleManager.h"
#include "progresstree/ProgressTreeView.h"
#include "progresstree/ProgressTreeModel.h"
#include "Settings.h"
#include "modulesystem/ModuleManager.h"
#include "utils/CalamaresUtils.h"
#include "utils/Logger.h"
#include "Settings.h"
#include "ViewManager.h"
@ -108,7 +109,7 @@ CalamaresApplication::mainWindow()
void
CalamaresApplication::initSettings()
{
new Calamares::Settings( this );
new Calamares::Settings( isDebug(), this );
}

View File

@ -22,7 +22,7 @@
#include "../CalamaresWindow.h"
#include "ViewStepItem.h"
#include "ProgressTreeModel.h"
#include "../ViewManager.h"
#include "ViewManager.h"
#include <QAbstractItemView>
#include <QPainter>

View File

@ -20,22 +20,33 @@
namespace Calamares
{
JobQueue* JobQueue::s_instance = nullptr;
JobQueue*
JobQueue::instance()
{
return s_instance;
}
JobQueue::JobQueue( QObject* parent )
: QObject( parent )
{
}
void
JobQueue::enqueue( const Calamares::job_ptr& job )
{
}
void
JobQueue::enqueue( const QList< job_ptr >& jobs )
{
}
} // namespace Calamares

View File

@ -0,0 +1,30 @@
set( CALAMARESUI_LIBRARY_TARGET calamaresui )
list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_SOURCES
modulesystem/Module.cpp
modulesystem/ModuleManager.cpp
modulesystem/ViewModule.cpp
utils/CalamaresUtilsGui.cpp
utils/YamlUtils.cpp
viewpages/AbstractPage.cpp
viewpages/ViewStep.cpp
Settings.cpp
ViewManager.cpp
)
list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_UI
)
calamares_add_library( ${CALAMARESUI_LIBRARY_TARGET}
SOURCES ${${CALAMARESUI_LIBRARY_TARGET}_SOURCES}
UI ${${CALAMARESUI_LIBRARY_TARGET}_UI}
EXPORT_MACRO UIDLLEXPORT_PRO
LINK_LIBRARIES
yaml-cpp
EXPORT CalamaresLibraryDepends
VERSION ${CALAMARES_VERSION_SHORT}
)

View File

@ -18,10 +18,9 @@
#include "Settings.h"
#include "CalamaresApplication.h"
#include "utils/CalamaresUtils.h"
#include "utils/Logger.h"
#include "YamlUtils.h"
#include "utils/YamlUtils.h"
#include <QDir>
#include <QFile>
@ -41,11 +40,11 @@ Settings::instance()
}
Settings::Settings( QObject* parent )
Settings::Settings( bool debugMode, QObject* parent )
: QObject( parent )
{
QFileInfo settingsFile( CalamaresUtils::appDataDir().absoluteFilePath( "settings.conf" ) );
if ( APP->isDebug() )
if ( debugMode )
{
QFileInfo localFile( QDir( QDir::currentPath() ).absoluteFilePath( "settings.conf" ) );
if ( localFile.exists() && localFile.isReadable() )
@ -72,7 +71,7 @@ Settings::Settings( QObject* parent )
// If we're running in debug mode, we assume we might also be
// running from the build dir, so we add a maximum priority
// module search path in the build dir.
if ( APP->isDebug() )
if ( debugMode )
{
QString buildDirModules = QDir::current().absolutePath() +
QDir::separator() + "src" +

View File

@ -19,6 +19,8 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include "UiDllMacro.h"
#include <QObject>
#include <QStringList>
@ -26,11 +28,11 @@
namespace Calamares
{
class Settings : public QObject
class UIDLLEXPORT Settings : public QObject
{
Q_OBJECT
public:
explicit Settings( QObject *parent = nullptr );
explicit Settings( bool debugMode, QObject *parent = nullptr );
static Settings* instance();
//TODO: load from JSON then emit ready

View File

@ -19,7 +19,7 @@
#include "Module.h"
#include "ViewModule.h"
#include "YamlUtils.h"
#include "utils/YamlUtils.h"
#include "utils/Logger.h"
#include <yaml-cpp/yaml.h>

View File

@ -1,4 +1,4 @@
include_directories( ${PROJECT_BINARY_DIR}/src/calamares )
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
calamares_add_plugin( greeting
TYPE viewmodule
EXPORT_MACRO PLUGINDLLEXPORT_PRO
@ -9,5 +9,7 @@ calamares_add_plugin( greeting
UI
LINK_LIBRARIES
${CALAMARES_LIBRARIES}
calamaresui
${CALAMARESUI_LIBRARIES}
SHARED_LIB
)

View File

@ -1,4 +1,5 @@
include_directories( ${PROJECT_BINARY_DIR}/src/calamares )
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
calamares_add_plugin( locale
TYPE viewmodule
EXPORT_MACRO PLUGINDLLEXPORT_PRO
@ -11,6 +12,6 @@ calamares_add_plugin( locale
timezonewidget/localeglobal.cpp
UI
LINK_LIBRARIES
${CALAMARES_LIBRARIES}
calamaresui
SHARED_LIB
)

View File

@ -1,8 +1,10 @@
if( WITH_PARTITIONMANAGER )
find_package( KF5 CONFIG REQUIRED CoreAddons )
add_definitions( -DCALAMARES )
include_directories( ${PROJECT_BINARY_DIR}/src/calamares )
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
calamares_add_plugin( partition
TYPE viewmodule
EXPORT_MACRO PLUGINDLLEXPORT_PRO
@ -22,7 +24,7 @@ calamares_add_plugin( partition
PartitionPage.ui
LINK_LIBRARIES
calapm
${CALAMARES_LIBRARIES}
calamaresui
KF5::CoreAddons
SHARED_LIB
)
@ -37,7 +39,6 @@ set( partview_SRCS
PartitionModel.cpp
PartitionPage.cpp
PMUtils.cpp
${calamares_SOURCE_DIR}/viewpages/AbstractPage.cpp
main.cpp
)
qt5_wrap_ui( partview_SRCS

View File

@ -33,7 +33,7 @@
#include <QPointer>
PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
: Calamares::AbstractPage( parent )
: QWidget( parent )
, m_ui( new Ui_PartitionPage )
, m_core( core )
{

View File

@ -19,8 +19,7 @@
#ifndef PARTITIONPAGE_H
#define PARTITIONPAGE_H
#include "viewpages/AbstractPage.h"
#include <QWidget>
#include <QScopedPointer>
class PartitionCoreModule;
@ -28,7 +27,7 @@ class Ui_PartitionPage;
class DeviceModel;
class PartitionPage : public Calamares::AbstractPage
class PartitionPage : public QWidget
{
Q_OBJECT
public: