Compare commits

...

3 Commits

3 changed files with 24 additions and 26 deletions

View File

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(GenericCore LANGUAGES CXX)
set(TARGET_APP "GenericCore")
project(${TARGET_APP} VERSION 0.0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
@ -8,20 +9,20 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core LinguistTools)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core LinguistTools)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core LinguistTools)
set(TS_FILES GenericCore_en_US.ts)
set(TS_FILES ${TARGET_APP}_en_US.ts)
add_library(GenericCore STATIC
add_library(${TARGET_APP} STATIC
genericcore.cpp
genericcore.h
${TS_FILES}
)
target_link_libraries(GenericCore PRIVATE Qt${QT_VERSION_MAJOR}::Core)
target_link_libraries(${TARGET_APP} PRIVATE Qt${QT_VERSION_MAJOR}::Core)
target_compile_definitions(GenericCore PRIVATE GENERICCORE_LIBRARY)
target_compile_definitions(${TARGET_APP} PRIVATE ${TARGET_APP}_LIBRARY)
if(COMMAND qt_create_translation)
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})

View File

@ -1,19 +1,14 @@
#include "genericcore.h"
#include <iostream>
#include <QDebug>
#include <QString>
using namespace std;
GenericCore::GenericCore()
{
cout << "Creating core..." << endl;
}
GenericCore::GenericCore() { qDebug() << "Creating core..."; }
GenericCore::~GenericCore()
{
cout << "Destroying core..." << endl;
}
GenericCore::~GenericCore() { qDebug() << "Destroying core..."; }
void GenericCore::sayHello() const
{
cout << "Hello from the core!" << endl;
}
QString GenericCore::toString() const { return QString("GenericCore (Version x.y.z)"); }
void GenericCore::sayHello() const { qDebug() << "Hello from the core!"; }

View File

@ -1,13 +1,15 @@
#ifndef GENERICCORE_H
#define GENERICCORE_H
class GenericCore
{
public:
GenericCore();
~GenericCore();
class QString;
void sayHello() const;
class GenericCore {
public:
GenericCore();
~GenericCore();
QString toString() const;
void sayHello() const;
};
#endif // GENERICCORE_H
#endif // GENERICCORE_H