mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-05-02 06:29:54 -05:00
enhanced TinyOrm.pri and tom.pri
They can now also set up include directories and link against the TinyORM library. It's accomplished by the TINYORM_BUILD_TREE variable. - also updated all examples in the documentation - manually tried to recompile all the examples on all supported platforms - enhanced tiny_version_numbers.prf, throw error when the version file was not found or when the parsing failed - used qmake/common.pri in the TinyOrm.pri and tom.pri, the consequences are that the user can use eg "CONFIG += disable_orm" and all others supported qmake configurations on his own project, so if the TinyORM was compiled with some set of flags then the same set of flags has to be used on the compiled project, CMake is doing this automatically of course - added Configure using .qmake.conf to the hello world example
This commit is contained in:
@@ -153,35 +153,35 @@ To paste a source code correctly in `vim`, press <kbd>Shift</kbd> + <kbd>p</kbd>
|
||||
|
||||
And paste the following code.
|
||||
|
||||
```
|
||||
#include <QDebug>
|
||||
#include <QDebug>
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <qt_windows.h>
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
# include <qt_windows.h>
|
||||
#endif
|
||||
|
||||
#include <orm/db.hpp>
|
||||
#include <orm/db.hpp>
|
||||
|
||||
int main(int /*unused*/, char */*unused*/[])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
// SetConsoleOutputCP(1250);
|
||||
#endif
|
||||
using Orm::DB;
|
||||
|
||||
// Ownership of a shared_ptr()
|
||||
auto manager = DB::create({
|
||||
{"driver", "QSQLITE"},
|
||||
{"database", qEnvironmentVariable("DB_DATABASE", "HelloWorld.sqlite3")},
|
||||
{"check_database_exists", true},
|
||||
});
|
||||
int main(int /*unused*/, char */*unused*/[])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
// SetConsoleOutputCP(1250);
|
||||
#endif
|
||||
|
||||
auto posts = DB::select("select * from posts");
|
||||
// Ownership of a shared_ptr()
|
||||
auto manager = DB::create({
|
||||
{"driver", "QSQLITE"},
|
||||
{"database", qEnvironmentVariable("DB_DATABASE", "HelloWorld.sqlite3")},
|
||||
{"check_database_exists", true},
|
||||
});
|
||||
|
||||
while(posts.next())
|
||||
qDebug() << posts.value("id").toULongLong() << posts.value("name").toString();
|
||||
}
|
||||
```
|
||||
auto posts = DB::select("select * from posts");
|
||||
|
||||
while(posts.next())
|
||||
qDebug() << posts.value("id").toULongLong() << posts.value("name").toString();
|
||||
}
|
||||
|
||||
### CMake project
|
||||
|
||||
@@ -387,93 +387,26 @@ vim HelloWorld.pro
|
||||
To paste a source code correctly in `vim`, press <kbd>Shift</kbd> + <kbd>p</kbd>.
|
||||
:::
|
||||
|
||||
<Tabs groupId={shell} name='tinyorm-on-path'>
|
||||
<TabItem value={pwsh} label={pwsh_label}>
|
||||
|
||||
```qmake
|
||||
QT *= core sql
|
||||
QT -= gui
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
CONFIG *= console c++2a strict_c++ warn_on utf8_source link_prl hide_symbols silent
|
||||
CONFIG -= c++11 app_bundle
|
||||
|
||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
|
||||
|
||||
DEFINES *= QT_NO_CAST_TO_ASCII
|
||||
DEFINES *= QT_NO_CAST_FROM_BYTEARRAY
|
||||
DEFINES *= QT_USE_QSTRINGBUILDER
|
||||
DEFINES *= QT_STRICT_ITERATORS
|
||||
|
||||
SOURCES += \
|
||||
main.cpp
|
||||
|
||||
# Link against TinyORM library
|
||||
# ---
|
||||
TINY_MAIN_DIR = $$quote($$PWD/../../TinyORM)
|
||||
TINY_TINYORM_BUILDS_DIR = $$quote($$TINY_MAIN_DIR/TinyOrm-builds-qmake)
|
||||
SOURCES += $$PWD/main.cpp
|
||||
|
||||
# Configure TinyORM library
|
||||
include($$TINY_MAIN_DIR/TinyORM/qmake/TinyOrm.pri)
|
||||
|
||||
# TinyORM header files
|
||||
INCLUDEPATH += $$quote($$TINY_MAIN_DIR/TinyORM/include/)
|
||||
|
||||
# TinyORM library path
|
||||
LIBS += $$quote(-L$$TINY_TINYORM_BUILDS_DIR/build-TinyOrm-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug/src/debug/)
|
||||
LIBS += -lTinyOrm
|
||||
|
||||
# vcpkg - range-v3 and tabulate
|
||||
# ---
|
||||
INCLUDEPATH += $$quote(../../../../vcpkg/installed/x64-windows/include/)
|
||||
# vcpkg - range-v3
|
||||
win32-msvc: \
|
||||
INCLUDEPATH += $$quote($$TINY_VCPKG_INSTALLED/x64-windows/include/)
|
||||
mingw: \
|
||||
QMAKE_CXXFLAGS += -isystem $$shell_quote($$TINY_VCPKG_INSTALLED/x64-mingw-dynamic/include/)
|
||||
unix:!macx: \
|
||||
QMAKE_CXXFLAGS += -isystem $$shell_quote($$TINY_VCPKG_INSTALLED/x64-linux/include/)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value={bash} label={bash_label}>
|
||||
|
||||
```qmake
|
||||
QT *= core sql
|
||||
QT -= gui
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
CONFIG *= console c++2a strict_c++ warn_on utf8_source link_prl hide_symbols silent
|
||||
CONFIG -= c++11 app_bundle
|
||||
|
||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
|
||||
|
||||
DEFINES *= QT_NO_CAST_TO_ASCII
|
||||
DEFINES *= QT_NO_CAST_FROM_BYTEARRAY
|
||||
DEFINES *= QT_USE_QSTRINGBUILDER
|
||||
DEFINES *= QT_STRICT_ITERATORS
|
||||
|
||||
SOURCES += \
|
||||
main.cpp
|
||||
|
||||
# Link against TinyORM library
|
||||
# ---
|
||||
TINY_MAIN_DIR = $$quote($$PWD/../../TinyORM)
|
||||
TINY_TINYORM_BUILDS_DIR = $$quote($$TINY_MAIN_DIR/TinyOrm-builds-qmake)
|
||||
|
||||
# Configure TinyORM library
|
||||
include($$TINY_MAIN_DIR/TinyORM/qmake/TinyOrm.pri)
|
||||
|
||||
# TinyORM header files
|
||||
QMAKE_CXXFLAGS += -isystem $$shell_quote($$TINY_MAIN_DIR/TinyORM/include/)
|
||||
|
||||
# TinyORM library path
|
||||
LIBS += $$quote(-L$$TINY_TINYORM_BUILDS_DIR/build-TinyOrm-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug/src/debug/)
|
||||
LIBS += -lTinyOrm
|
||||
|
||||
# vcpkg - range-v3 and tabulate
|
||||
# ---
|
||||
QMAKE_CXXFLAGS += -isystem $$shell_quote(../../../../vcpkg/installed/x64-linux/include/)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
:::caution
|
||||
The exact [folders structure](building-tinyorm.mdx#folders-structure) is crucial in this example because the paths to the `TinyORM` source and build folders are relative.
|
||||
:::
|
||||
@@ -484,6 +417,22 @@ On Linux `-isystem` marks the directory as a system directory, it prevents warni
|
||||
On Windows you can use `QMAKE_CXXFLAGS_WARN_ON = -external:anglebrackets -external:W0`, it applies a warning level 0 to the angel bracket includes; `#include <file>`.
|
||||
:::
|
||||
|
||||
#### Configure using .qmake.conf
|
||||
|
||||
Create `.qmake.conf` in the `HelloWorld` project root folder with the following content.
|
||||
|
||||
```qmake
|
||||
TINY_MAIN_DIR = $$clean_path($$PWD/../../TinyORM)
|
||||
# Name of this qmake variable is crucial
|
||||
TINYORM_BUILD_TREE = $$quote($$TINY_MAIN_DIR/TinyOrm-builds-qmake/build-TinyOrm-Desktop_Qt_6_2_4_MSVC2019_64bit-Debug)
|
||||
# vcpkg - range-v3
|
||||
TINY_VCPKG_INSTALLED = $$clean_path($$PWD/../../../vcpkg/installed)
|
||||
```
|
||||
|
||||
:::info
|
||||
Configuring with the `.qmake.conf` file has one big advantage that is that you do not have to modify the project files.
|
||||
:::
|
||||
|
||||
### Build Hello world {#build-hello-world-qmake}
|
||||
|
||||
:::tip
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
|
||||
- [Introduction](#introduction)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [vcpkg.json manifest](#vcpkg-json-manifest)
|
||||
- [Migrations with CMake](#migrations-with-cmake)
|
||||
- [Source code](#source-code)
|
||||
- [CMake project](#cmake-project)
|
||||
@@ -63,6 +64,34 @@ Working MySQL database server as the `tom` migrations currently provides support
|
||||
|
||||
Install required dependencies and build the `TinyORM` library with the `tom` (it's enabled by default) as is described [here](building-hello-world.mdx#install-dependencies) and [here](building-tinyorm.mdx).
|
||||
|
||||
### vcpkg.json manifest {#vcpkg-json-manifest}
|
||||
|
||||
Create a `vcpkg.json` file with the following content. `CMake` example below uses this method.
|
||||
|
||||
```bash
|
||||
cd tom
|
||||
vim vcpkg.json
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
||||
"name": "tom",
|
||||
"version-semver": "0.1.0",
|
||||
"description": "Tom console for TinyORM.",
|
||||
"maintainers": "Silver Zachara <silver.zachara@gmail.com>",
|
||||
"supports": "!(uwp | arm | android | emscripten)",
|
||||
"dependencies": [
|
||||
"range-v3",
|
||||
"tabulate"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
:::note
|
||||
Only `CMake` via the `toolchain file` supports this method.
|
||||
:::
|
||||
|
||||
## Migrations with CMake
|
||||
|
||||
Let's start in the `tom` project folder.
|
||||
@@ -235,8 +264,9 @@ set(CMAKE_AUTOMOC ON)\n
|
||||
# ---\n
|
||||
set(Tom_ns tom)
|
||||
set(Tom_target tom)\n
|
||||
set(TinyOrmSourceDir "${convertToCmakeEnvVariable(pwsh, applicationFolderPath(pwsh))}/TinyORM/TinyORM")
|
||||
set(TinyOrmBuildDir "${convertToCmakeEnvVariable(pwsh, applicationFolderPath(pwsh))}/TinyORM/TinyORM-builds-cmake/build-debug")\n
|
||||
file(REAL_PATH "../../TinyORM" TinyMainDir)\n
|
||||
set(TinyOrmSourceDir "\${TinyMainDir}/TinyORM")
|
||||
set(TinyOrmBuildDir "\${TinyMainDir}/TinyORM-builds-cmake/build-debug")\n
|
||||
# TinyORM CMake modules (needed to set the executable version and RC file on Windows)
|
||||
list(APPEND CMAKE_MODULE_PATH "\${TinyOrmSourceDir}/cmake/CommonModules")\n
|
||||
# build tree
|
||||
@@ -318,8 +348,9 @@ set(CMAKE_AUTOMOC ON)\n
|
||||
# ---\n
|
||||
set(Tom_ns tom)
|
||||
set(Tom_target tom)\n
|
||||
set(TinyOrmSourceDir "${convertToCmakeEnvVariable(bash, applicationFolderPath(bash))}/TinyORM/TinyORM")
|
||||
set(TinyOrmBuildDir "${convertToCmakeEnvVariable(bash, applicationFolderPath(bash))}/TinyORM/TinyORM-builds-cmake/build-debug")\n
|
||||
file(REAL_PATH "../../TinyORM" TinyMainDir)\n
|
||||
set(TinyOrmSourceDir "\${TinyMainDir}/TinyORM")
|
||||
set(TinyOrmBuildDir "\${TinyMainDir}/TinyORM-builds-cmake/build-debug")\n
|
||||
# TinyORM CMake modules (needed to set the executable version and RC file on Windows)
|
||||
list(APPEND CMAKE_MODULE_PATH "\${TinyOrmSourceDir}/cmake/CommonModules")\n
|
||||
# build tree
|
||||
@@ -524,9 +555,6 @@ vim tom.pro
|
||||
To paste a source code correctly in `vim`, press <kbd>Shift</kbd> + <kbd>p</kbd>.
|
||||
:::
|
||||
|
||||
<Tabs groupId={shell} name='tinyorm-on-path'>
|
||||
<TabItem value={pwsh} label={pwsh_label}>
|
||||
|
||||
```qmake
|
||||
QT *= core sql
|
||||
QT -= gui
|
||||
@@ -534,73 +562,27 @@ QT -= gui
|
||||
TEMPLATE = app
|
||||
TARGET = tom
|
||||
|
||||
# TinyTom application specific configuration
|
||||
# ---
|
||||
|
||||
CONFIG *= console
|
||||
|
||||
# Configure TinyORM library for the migrations purposes
|
||||
include($$TINY_MAIN_DIR/TinyORM/qmake/tom.pri)
|
||||
|
||||
# TinyTom application defines
|
||||
# ---
|
||||
|
||||
DEFINES += PROJECT_TOM
|
||||
|
||||
# TinyTom application header and source files
|
||||
# ---
|
||||
|
||||
SOURCES += $$PWD/main.cpp
|
||||
|
||||
# Database migrations
|
||||
include($$PWD/database/migrations.pri)
|
||||
|
||||
# vcpkg - range-v3 and tabulate
|
||||
# ---
|
||||
|
||||
INCLUDEPATH += $$quote(../../../../vcpkg/installed/x64-windows/include/)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value={bash} label={bash_label}>
|
||||
|
||||
```qmake
|
||||
QT *= core sql
|
||||
QT -= gui
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = tom
|
||||
|
||||
# TinyTom application specific configuration
|
||||
# ---
|
||||
|
||||
CONFIG *= console
|
||||
|
||||
# Configure TinyORM library for the migrations purposes
|
||||
include($$TINY_MAIN_DIR/TinyORM/qmake/tom.pri)
|
||||
|
||||
# TinyTom application defines
|
||||
# ---
|
||||
|
||||
DEFINES += PROJECT_TOM
|
||||
|
||||
# TinyTom application header and source files
|
||||
# ---
|
||||
|
||||
SOURCES += $$PWD/main.cpp
|
||||
|
||||
# Database migrations
|
||||
include($$PWD/database/migrations.pri)
|
||||
|
||||
# vcpkg - range-v3 and tabulate
|
||||
# ---
|
||||
|
||||
QMAKE_CXXFLAGS += -isystem $$shell_quote(../../../../vcpkg/installed/x64-linux/include/)
|
||||
win32-msvc: \
|
||||
INCLUDEPATH += $$quote($$TINY_VCPKG_INSTALLED/x64-windows/include/)
|
||||
mingw: \
|
||||
QMAKE_CXXFLAGS += -isystem $$shell_quote($$TINY_VCPKG_INSTALLED/x64-mingw-dynamic/include/)
|
||||
unix:!macx: \
|
||||
QMAKE_CXXFLAGS += -isystem $$shell_quote($$TINY_VCPKG_INSTALLED/x64-linux/include/)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
:::caution
|
||||
The exact [folders structure](building-tinyorm.mdx#folders-structure) is crucial in this example because the paths to the `TinyORM` source and build folders are relative.
|
||||
:::
|
||||
@@ -615,17 +597,22 @@ On Windows you can use `QMAKE_CXXFLAGS_WARN_ON = -external:anglebrackets -extern
|
||||
|
||||
To correctly set a file properties as the version, description, ... you have to provide the path to the `TinyORM` qmake features (`.prf` files) which handle this correctly, this path is provided by the `QMAKEFEATURES` variable and can be set only in the `.qmake.conf` file.
|
||||
|
||||
Create `.qmake.conf` with following content.
|
||||
Create `.qmake.conf` in the `tom` application root folder with the following content.
|
||||
|
||||
```qmake
|
||||
TINY_MAIN_DIR = $$clean_path($$PWD/../../TinyORM)
|
||||
TINYORM_SOURCE_TREE = $$quote($$TINY_MAIN_DIR/TinyORM)
|
||||
# Name of this qmake variable is crucial
|
||||
TINYORM_BUILD_TREE = $$quote($$TINY_MAIN_DIR/TinyOrm-builds-qmake/build-TinyOrm-Desktop_Qt_6_2_4_MSVC2019_64bit-Debug)
|
||||
# vcpkg - range-v3 and tabulate
|
||||
TINY_VCPKG_INSTALLED = $$clean_path($$PWD/../../../vcpkg/installed)
|
||||
|
||||
QMAKEFEATURES *= $$quote($$TINYORM_SOURCE_TREE/qmake/features)
|
||||
QMAKEFEATURES *= $$quote($$TINY_MAIN_DIR/TinyORM/qmake/features)
|
||||
```
|
||||
|
||||
:::info
|
||||
Configuring with the `.qmake.conf` file has one big advantage that is that you do not have to modify the project files.
|
||||
:::
|
||||
|
||||
#### Migrations source files
|
||||
|
||||
Create `database/migrations.pri` file and paste the following code.
|
||||
|
||||
@@ -595,13 +595,13 @@ Important `qmake` options.
|
||||
|
||||
### Consume TinyOrm library <small>(qmake)</small> {#consume-tinyorm-library-qmake}
|
||||
|
||||
A basic [`TinyOrm.pri`](https://github.com/silverqx/TinyORM/blob/main/qmake/TinyOrm.pri) file is available to simplify the integration of the `TinyORM` library into your application. This file sets up basic qmake variables that are needed by `TinyORM`. You can or don't have to use it.
|
||||
A basic [`TinyOrm.pri`](https://github.com/silverqx/TinyORM/blob/main/qmake/TinyOrm.pri) file is available to simplify the integration of the `TinyORM` library into your application. This file sets up basic qmake variables that are needed by `TinyORM`. You can use it to configure the `TinyORM` library.
|
||||
|
||||
```qmake
|
||||
include($$PWD/../../TinyORM/TinyORM/qmake/TinyOrm.pri)
|
||||
```
|
||||
|
||||
Or you can set it up manually.
|
||||
Or you can configure `TinyORM` library manually.
|
||||
|
||||
```qmake
|
||||
# TinyORM configuration
|
||||
@@ -612,7 +612,7 @@ CONFIG *= c++2a strict_c++ warn_on utf8_source link_prl hide_symbols silent
|
||||
# TinyORM defines
|
||||
# ---
|
||||
|
||||
# Link with the shared library
|
||||
# Link against the shared library
|
||||
CONFIG(shared, dll|shared|static|staticlib) | \
|
||||
CONFIG(dll, dll|shared|static|staticlib): \
|
||||
DEFINES *= TINYORM_LINKING_SHARED
|
||||
@@ -624,6 +624,14 @@ CONFIG(release, debug|release): \
|
||||
# Log queries with a time measurement in debug build
|
||||
CONFIG(release, debug|release): \
|
||||
DEFINES *= TINYORM_NO_DEBUG_SQL
|
||||
|
||||
# TinyTom defines
|
||||
# ---
|
||||
|
||||
# Release build
|
||||
CONFIG(release, debug|release): DEFINES += TINYTOM_NO_DEBUG
|
||||
# Debug build
|
||||
CONFIG(debug, debug|release): DEFINES *= TINYTOM_DEBUG
|
||||
```
|
||||
|
||||
And of course you have to set the `INCLUDEPATH` and `LIBS`.
|
||||
|
||||
@@ -1293,7 +1293,6 @@ TINYORM_END_COMMON_NAMESPACE
|
||||
// CUR 0.1.0 vs 0.1.0.0 Product/FileVersion, investigate, also check versions in pc, prl, ... silverqx
|
||||
// CUR enable QT_ASCII_CAST_WARNINGS silverqx
|
||||
// CUR enable QT_NO_CAST_FROM_ASCII silverqx
|
||||
// CUR autoconfigure qmake with qmake/TinyOrm.pri and TINY_ROOT_DIR and TINY_TINYORM_BUILDS_DIR silverqx
|
||||
// BUG qmake MinGW UCRT64 clang static build duplicit symbols, this is MinGW bug silverqx
|
||||
// BUG qmake MinGW UCRT64 clang shared build with inline_constants cause crashes of 50% of tests, this will be MinGW clang or clang bug, on unix it works without problems silverqx
|
||||
// BUG cmake MinGW UCRT64 clang static build builds, but cause problem with inline_constants ; shared build with inline_constants cause crashes of 50% of tests, like bug above, this will be MinGW clang or clang bug, on unix it works without problems silverqx
|
||||
|
||||
+30
-25
@@ -1,40 +1,45 @@
|
||||
# TinyORM configuration
|
||||
TINYORM_SOURCE_TREE = $$clean_path($$quote($$PWD/..))
|
||||
TINYTOM_SOURCE_TREE = $$quote($$TINYORM_SOURCE_TREE/tom)
|
||||
|
||||
# Qt Common Configuration
|
||||
# ---
|
||||
|
||||
QT *= core sql
|
||||
CONFIG *= c++2a strict_c++ warn_on utf8_source link_prl hide_symbols silent
|
||||
|
||||
# Use extern constants for shared build
|
||||
CONFIG(shared, dll|shared|static|staticlib) | \
|
||||
CONFIG(dll, dll|shared|static|staticlib): \
|
||||
# Support override because inline_constants can be used in the shared build too
|
||||
!inline_constants: \
|
||||
CONFIG *= extern_constants
|
||||
CONFIG *= link_prl
|
||||
|
||||
# Archive library build
|
||||
else: \
|
||||
CONFIG += inline_constants
|
||||
include($$TINYORM_SOURCE_TREE/qmake/common.pri)
|
||||
|
||||
# TinyORM defines
|
||||
# Configure TinyORM library
|
||||
# ---
|
||||
# everything else is defined in the qmake/common.pri
|
||||
|
||||
# Link with the shared library
|
||||
# Link against the shared library
|
||||
CONFIG(shared, dll|shared|static|staticlib) | \
|
||||
CONFIG(dll, dll|shared|static|staticlib): \
|
||||
DEFINES *= TINYORM_LINKING_SHARED
|
||||
|
||||
# Release build
|
||||
CONFIG(release, debug|release): \
|
||||
DEFINES *= TINYORM_NO_DEBUG
|
||||
# Disable the ORM-related source code
|
||||
disable_orm: DEFINES *= TINYORM_DISABLE_ORM
|
||||
# Disable the tom-related source code
|
||||
disable_tom: DEFINES *= TINYORM_DISABLE_TOM
|
||||
|
||||
# Log queries with a time measurement in debug build
|
||||
CONFIG(release, debug|release): \
|
||||
DEFINES *= TINYORM_NO_DEBUG_SQL
|
||||
|
||||
# TinyTom related defines
|
||||
# Link against TinyORM library
|
||||
# ---
|
||||
|
||||
# Release build
|
||||
CONFIG(release, debug|release): DEFINES += TINYTOM_NO_DEBUG
|
||||
# Debug build
|
||||
CONFIG(debug, debug|release): DEFINES *= TINYTOM_DEBUG
|
||||
!isEmpty(TINYORM_SOURCE_TREE): \
|
||||
exists($$TINYORM_SOURCE_TREE): \
|
||||
win32-msvc: \
|
||||
INCLUDEPATH *= \
|
||||
$$quote($$TINYORM_SOURCE_TREE/include/) \
|
||||
$$quote($$TINYTOM_SOURCE_TREE/include/)
|
||||
else: \
|
||||
QMAKE_CXXFLAGS += \
|
||||
-isystem $$shell_quote($$TINYORM_SOURCE_TREE/include/) \
|
||||
-isystem $$shell_quote($$TINYTOM_SOURCE_TREE/include/)
|
||||
|
||||
!isEmpty(TINYORM_BUILD_TREE): \
|
||||
exists($$TINYORM_BUILD_TREE): {
|
||||
LIBS += $$quote(-L$$clean_path($$TINYORM_BUILD_TREE)/src$${TINY_RELEASE_TYPE}/)
|
||||
LIBS += -lTinyOrm
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ win32-clang-g++: {
|
||||
# Common Configuration ( also for tests )
|
||||
# ---
|
||||
|
||||
CONFIG *= c++2a strict_c++ warn_on utf8_source hide_symbols silent
|
||||
CONFIG *= c++2a strict_c++ warn_on utf8_source hide_symbols
|
||||
CONFIG -= c++11 app_bundle
|
||||
|
||||
# Qt defines
|
||||
|
||||
@@ -20,7 +20,9 @@ defineTest(tiny_version_numbers) {
|
||||
error( "HEADERS does not contain a version header file version.hpp, needed\
|
||||
in the tiny_version_numbers.prf." )
|
||||
|
||||
versionFileContent = $$cat($$quote($$absolute_path($$versionHeader)), lines)
|
||||
versionHeader = $$clean_path($$absolute_path($$versionHeader))
|
||||
|
||||
versionFileContent = $$cat($$quote($$versionHeader), lines)
|
||||
versionTokens = MAJOR MINOR BUGFIX BUILD STATUS
|
||||
regexpTokens = $$join(versionTokens, '|')
|
||||
regexp = "_($${regexpTokens}) +([0-9]+|\"-{1}\w+\")"
|
||||
@@ -28,6 +30,9 @@ defineTest(tiny_version_numbers) {
|
||||
versionList =
|
||||
hasStatus = false
|
||||
|
||||
isEmpty(versionFileContent)|isEmpty(versionLines): \
|
||||
error( "Parse of the '$$versionHeader' version file failed." )
|
||||
|
||||
for(versionLine, versionLines) {
|
||||
splittedLine = $$split(versionLine, ' ')
|
||||
versionNumber = $$take_last(splittedLine)
|
||||
|
||||
+19
-7
@@ -12,13 +12,18 @@ include($$TINYORM_SOURCE_TREE/qmake/common.pri)
|
||||
|
||||
# Configure TinyORM library
|
||||
# ---
|
||||
# everything other is defined in the qmake/common.pri
|
||||
# everything else is defined in the qmake/common.pri
|
||||
|
||||
# Link with the shared library
|
||||
# Link against the shared library
|
||||
CONFIG(shared, dll|shared|static|staticlib) | \
|
||||
CONFIG(dll, dll|shared|static|staticlib): \
|
||||
DEFINES *= TINYORM_LINKING_SHARED
|
||||
|
||||
# Disable the ORM-related source code
|
||||
disable_orm: DEFINES *= TINYORM_DISABLE_ORM
|
||||
# Disable the tom-related source code
|
||||
disable_tom: DEFINES *= TINYORM_DISABLE_TOM
|
||||
|
||||
# File version
|
||||
# ---
|
||||
|
||||
@@ -37,18 +42,25 @@ mingw: tinyRcIncludepath += $$quote($$TINYTOM_SOURCE_TREE/resources/)
|
||||
|
||||
load(tiny_resource_and_manifest)
|
||||
tiny_resource_and_manifest( \
|
||||
$$tinyRcIncludepath, $$TINYTOM_SOURCE_TREE/resources, tom, TomExample \
|
||||
$$tinyRcIncludepath, $$TINYTOM_SOURCE_TREE/resources, tom, Tom \
|
||||
)
|
||||
|
||||
# Link against TinyORM library
|
||||
# ---
|
||||
|
||||
INCLUDEPATH *= \
|
||||
$$quote($$TINYORM_SOURCE_TREE/include/) \
|
||||
$$quote($$TINYTOM_SOURCE_TREE/include/) \
|
||||
!isEmpty(TINYORM_SOURCE_TREE): \
|
||||
exists($$TINYORM_SOURCE_TREE): \
|
||||
win32-msvc: \
|
||||
INCLUDEPATH *= \
|
||||
$$quote($$TINYORM_SOURCE_TREE/include/) \
|
||||
$$quote($$TINYTOM_SOURCE_TREE/include/)
|
||||
else: \
|
||||
QMAKE_CXXFLAGS += \
|
||||
-isystem $$shell_quote($$TINYORM_SOURCE_TREE/include/) \
|
||||
-isystem $$shell_quote($$TINYTOM_SOURCE_TREE/include/)
|
||||
|
||||
!isEmpty(TINYORM_BUILD_TREE): \
|
||||
exists($$TINYORM_BUILD_TREE): {
|
||||
LIBS += $$quote(-L$$TINYORM_BUILD_TREE/src$${TINY_RELEASE_TYPE}/)
|
||||
LIBS += $$quote(-L$$clean_path($$TINYORM_BUILD_TREE)/src$${TINY_RELEASE_TYPE}/)
|
||||
LIBS += -lTinyOrm
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user