Switching to linux for development of pglab.

Switched from qmake to cmake. Code changes to make it compile.
This commit is contained in:
Eelke Klein 2017-08-23 08:10:01 +02:00
parent dd9906dbd8
commit 04723a289b
142 changed files with 124 additions and 83 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.swp

110
CMakeLists.txt Normal file
View file

@ -0,0 +1,110 @@
cmake_minimum_required(VERSION 3.1.0)
project(pglaball)
#include(CheckCXXCompilerFlag)
find_package(PkgConfig REQUIRED)
# Check for standard to use
#set(CMAKE_CXX_STANDARD 14)
include(CheckCXXCompilerFlag)
# Check for standard to use
check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
if(HAVE_FLAG_STD_CXX17)
# Have -std=c++17, use it
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
else()
check_cxx_compiler_flag(-std=c++1z HAVE_FLAG_STD_CXX1Z)
if(HAVE_FLAG_STD_CXX1Z)
# Have -std=c++1z, use it
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z")
else()
# And so on and on...
endif()
endif()
add_compile_options( -Wall -fpic -march=native )
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
pkg_check_modules(Botan REQUIRED botan-2)
include_directories( ${Botan_INCLUDE_DIRS} )
pkg_check_modules(Pq REQUIRED libpq)
include_directories( ${Pq_INCLUDE_DIRS} )
find_package(Qt5Widgets 5.7 REQUIRED)
include_directories( ${Qt5Widgets_INCLUDE_DIRS} )
find_package(fmt 4.0 REQUIRED)
include_directories( ${fmt_INCLUDE_DIRS} )
#find_package(Boost 1.62 REQUIRED) # COMPONENTS program_options REQUIRED )
#include_directories( ${Boost_INCLUDE_DIRS} )
add_library(core STATIC
core/BackupFormatModel.cpp
core/CsvWriter.cpp
core/my_boost_assert_handler.cpp
core/PasswordManager.cpp
core/SqlLexer.cpp)
add_executable(pglab
pglab/ASyncDBConnection.cpp
pglab/ASyncWindow.cpp
pglab/BackupDialog.cpp
pglab/BackupRestore.cpp
pglab/ConnectionConfig.cpp
pglab/ConnectionList.cpp
pglab/ConnectionListModel.cpp
pglab/ConnectionManagerWindow.cpp
pglab/DatabaseInspectorWidget.cpp
pglab/DatabasesTableModel.cpp
pglab/DatabaseWindow.cpp
pglab/ExplainTreeModelItem.cpp
pglab/jsoncpp.cpp
pglab/main.cpp
pglab/MainWindow.cpp
pglab/MasterController.cpp
pglab/OpenDatabase.cpp
pglab/ParamListModel.cpp
pglab/ParamTypeDelegate.cpp
pglab/PgAuthIdContainer.cpp
pglab/PgAuthId.cpp
pglab/PgClass.cpp
pglab/PgDatabaseContainer.cpp
pglab/PgDatabase.cpp
pglab/PgNamespace.cpp
pglab/PgsqlConn.cpp
pglab/PgsqlDatabaseCatalogue.cpp
pglab/Pgsql_Params.cpp
pglab/Pgsql_Result.cpp
pglab/Pgsql_Row.cpp
pglab/Pgsql_Value.cpp
pglab/PgTypeContainer.cpp
pglab/PgType.cpp
pglab/ProcessStdioWidget.cpp
pglab/QueryExplainModel.cpp
pglab/QueryResultModel.cpp
pglab/QueryTab.cpp
pglab/RolesTableModel.cpp
pglab/ServerWindow.cpp
pglab/sqlhighlighter.cpp
pglab/sqlparser.cpp
pglab/SqlSyntaxHighlighter.cpp
pglab/stopwatch.cpp
pglab/tsqueue.cpp
pglab/tuplesresultwidget.cpp
pglab/typeselectionitemmodel.cpp
pglab/util.cpp
pglab/waithandlelist.cpp
pglab/win32event.cpp
)
target_include_directories(pglab PUBLIC
./core
)

View file

@ -1,6 +0,0 @@
#include "Core.h"
Core::Core()
{
}

View file

@ -1,12 +0,0 @@
#ifndef CORE_H
#define CORE_H
class Core
{
public:
Core();
};
#endif // CORE_H

View file

@ -1,4 +1,4 @@
#include "csvwriter.h" #include "CsvWriter.h"
CsvWriter::CsvWriter() CsvWriter::CsvWriter()
{} {}

View file

@ -13,7 +13,6 @@
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include "Core.h"
using namespace Botan; using namespace Botan;

View file

@ -1,45 +0,0 @@
#-------------------------------------------------
#
# Project created by QtCreator 2017-02-26T10:51:14
#
#-------------------------------------------------
QT -= gui
TARGET = core
TEMPLATE = lib
CONFIG += staticlib c++14
INCLUDEPATH += C:\prog\include C:\VSproj\boost_1_63_0
DEFINES += WIN32_LEAN_AND_MEAN NOMINMAX
#LIBS += /LIBPATH:C:\VSproj\boost_1_63_0\stage\lib /LIBPATH:c:\prog\lib\ libpq.lib fmt.lib User32.lib ws2_32.lib
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += Core.cpp \
my_boost_assert_handler.cpp \
SqlLexer.cpp \
PasswordManager.cpp \
CsvWriter.cpp \
BackupFormatModel.cpp
HEADERS += Core.h \
PasswordManager.h \
SqlLexer.h \
ScopeGuard.h \
CsvWriter.h \
BackupFormatModel.h
unix {
target.path = /usr/lib
INSTALLS += target
}

View file

View file

@ -1,6 +1,6 @@
#include "asyncdbconnection.h" #include "ASyncDBConnection.h"
#include "waithandlelist.h" #include "waithandlelist.h"
#include "scopeguard.h" #include "ScopeGuard.h"
#include <chrono> #include <chrono>
ASyncDBConnection::ASyncDBConnection() ASyncDBConnection::ASyncDBConnection()

View file

@ -4,7 +4,7 @@
#include "PgsqlConn.h" #include "PgsqlConn.h"
#include "Pgsql_Params.h" #include "Pgsql_Params.h"
#include "win32event.h" #include "win32event.h"
#include "connectionconfig.h" #include "ConnectionConfig.h"
#include <QElapsedTimer> #include <QElapsedTimer>
#include <functional> #include <functional>
#include <mutex> #include <mutex>

View file

@ -2,7 +2,7 @@
#include <functional> #include <functional>
#include <string> #include <string>
#include <pgsql/libpq-fe.h> #include <libpq-fe.h>
#include <cassert> #include <cassert>
#include <QString> #include <QString>

View file

@ -3,7 +3,7 @@
#include <vector> #include <vector>
#include <QString> #include <QString>
#include <pgsql/libpq-fe.h> #include <libpq-fe.h>
#include "Pgsql_declare.h" #include "Pgsql_declare.h"
namespace Pgsql { namespace Pgsql {

View file

@ -21,7 +21,7 @@ namespace Pgsql {
operator short() const; operator short() const;
operator int() const; operator int() const;
operator Oid() const; operator Oid() const;
operator __int64() const; operator long long() const;
operator bool() const; operator bool() const;
private: private:
const char *m_val; const char *m_val;

View file

@ -1,7 +1,7 @@
#ifndef PGSQL_DECLARE_H #ifndef PGSQL_DECLARE_H
#define PGSQL_DECLARE_H #define PGSQL_DECLARE_H
#include <pgsql/libpq-fe.h> #include <libpq-fe.h>
namespace Pgsql { namespace Pgsql {

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

Some files were not shown because too many files have changed in this diff Show more