Compare commits
6 Commits
main
...
bddb6df3ee
| Author | SHA1 | Date | |
|---|---|---|---|
| bddb6df3ee | |||
| 7ec346b5a5 | |||
| b631f4200e | |||
| 0bbac662f4 | |||
| b3718c211f | |||
| fd32b85554 |
@ -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,24 @@ 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)
|
||||
configure_file(CoreConfig.h.in CoreConfig.h)
|
||||
|
||||
add_library(GenericCore STATIC
|
||||
set(TS_FILES ${TARGET_APP}_en_US.ts)
|
||||
|
||||
add_library(${TARGET_APP} STATIC
|
||||
genericcore.cpp
|
||||
genericcore.h
|
||||
${TS_FILES}
|
||||
)
|
||||
|
||||
target_link_libraries(GenericCore PRIVATE Qt${QT_VERSION_MAJOR}::Core)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
target_compile_definitions(GenericCore PRIVATE GENERICCORE_LIBRARY)
|
||||
target_link_libraries(${TARGET_APP} PRIVATE Qt${QT_VERSION_MAJOR}::Core)
|
||||
|
||||
target_compile_definitions(${TARGET_APP} PRIVATE ${TARGET_APP}_LIBRARY)
|
||||
|
||||
if(COMMAND qt_create_translation)
|
||||
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||
|
||||
2
CoreConfig.h.in
Normal file
2
CoreConfig.h.in
Normal file
@ -0,0 +1,2 @@
|
||||
#define CORE_NAME "${PROJECT_NAME}"
|
||||
#define CORE_VERSION "${PROJECT_VERSION}"
|
||||
@ -1,3 +1,18 @@
|
||||
#include "genericcore.h"
|
||||
|
||||
GenericCore::GenericCore() {}
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
|
||||
#include "CoreConfig.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
GenericCore::GenericCore() { qDebug() << "Creating core..."; }
|
||||
|
||||
GenericCore::~GenericCore() { qDebug() << "Destroying core..."; }
|
||||
|
||||
QString GenericCore::toString() const {
|
||||
return QString("%1 (Version %2)").arg(CORE_NAME).arg(CORE_VERSION);
|
||||
}
|
||||
|
||||
void GenericCore::sayHello() const { qDebug() << "Hello from the core!"; }
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
#ifndef GENERICCORE_H
|
||||
#define GENERICCORE_H
|
||||
|
||||
class GenericCore
|
||||
{
|
||||
class QString;
|
||||
|
||||
class GenericCore {
|
||||
public:
|
||||
GenericCore();
|
||||
~GenericCore();
|
||||
|
||||
QString toString() const;
|
||||
void sayHello() const;
|
||||
};
|
||||
|
||||
#endif // GENERICCORE_H
|
||||
|
||||
Reference in New Issue
Block a user