diff --git a/TinyORM.pro b/TinyORM.pro index 200665f81..c47630967 100644 --- a/TinyORM.pro +++ b/TinyORM.pro @@ -15,6 +15,8 @@ tinyMinRecQt = 5.15.2 # Make minimum toolchain version a requirement load(tiny_toolchain_requirement) +# The staticlib option check +load(tiny_staticlib_check) # Subprojects # --- diff --git a/drivers/common/common.pro b/drivers/common/common.pro index d546db115..2582c77ad 100644 --- a/drivers/common/common.pro +++ b/drivers/common/common.pro @@ -4,11 +4,6 @@ QT -= gui TEMPLATE = lib TARGET = TinyDrivers -# Variables to target the correct build folder -# --- - -include($$TINYORM_SOURCE_TREE/qmake/support/variables.pri) - # Common for static/shared libraries # --- @@ -20,6 +15,11 @@ include($$TINYORM_SOURCE_TREE/qmake/common/libraries.pri) DEFINES *= QT_ASCII_CAST_WARNINGS DEFINES *= QT_NO_CAST_FROM_ASCII +# Variables to target the correct build folder +# --- + +include($$TINYORM_SOURCE_TREE/qmake/support/variables.pri) + # TinyDrivers configuration # --- # It must be before the common/common.pri because of constants resolving @@ -126,13 +126,6 @@ win32-msvc:CONFIG(debug, debug|release) { load(tiny_system_includepath) tiny_add_system_includepath($$quote($$TINYORM_SOURCE_TREE/include/)) -build_loadable_drivers: \ -tiny_is_building_driver(mysql): \ - tiny_add_system_includepath( \ - $$quote($$TINYORM_SOURCE_TREE/drivers/mysql/include/) \ - $$quote($$TINYORM_SOURCE_TREE/drivers/mysql/include_private/) \ - ) - # Auto-configuration # --- diff --git a/qmake/TinyOrm.pri b/qmake/TinyOrm.pri index 1c06deb0f..d0a799f3b 100644 --- a/qmake/TinyOrm.pri +++ b/qmake/TinyOrm.pri @@ -93,10 +93,8 @@ disable_tom: DEFINES *= TINYORM_DISABLE_TOM load(tiny_system_includepath) tiny_is_building_drivers(): \ - tiny_add_system_includepath( \ - $$quote($$TINYORM_SOURCE_TREE/drivers/common/include/) \ - $$quote($$TINYORM_SOURCE_TREE/drivers/mysql/include/) \ - ) + tiny_add_system_includepath( \ + $$quote($$TINYORM_SOURCE_TREE/drivers/common/include/)) tiny_add_system_includepath($$quote($$TINYORM_SOURCE_TREE/include/)) diff --git a/qmake/features/disable_orm.prf b/qmake/features/disable_orm.prf index bac762464..f0bc822ed 100644 --- a/qmake/features/disable_orm.prf +++ b/qmake/features/disable_orm.prf @@ -1,2 +1,8 @@ +load(tiny_drivers) + +# Nothing to do, TinyDrivers doesn't use this CONFIG option +tiny_is_drivers_target(): \ + return() + CONFIG *= disable_orm DEFINES *= TINYORM_DISABLE_ORM diff --git a/qmake/features/disable_tom.prf b/qmake/features/disable_tom.prf index ce27c8c70..3f5bde6a6 100644 --- a/qmake/features/disable_tom.prf +++ b/qmake/features/disable_tom.prf @@ -1,2 +1,8 @@ +load(tiny_drivers) + +# Nothing to do, TinyDrivers doesn't use this CONFIG option +tiny_is_drivers_target(): \ + return() + CONFIG *= disable_tom DEFINES *= TINYORM_DISABLE_TOM diff --git a/qmake/features/tiny_drivers.prf b/qmake/features/tiny_drivers.prf index 0aa5b272b..a15f46337 100644 --- a/qmake/features/tiny_drivers.prf +++ b/qmake/features/tiny_drivers.prf @@ -121,10 +121,31 @@ defineTest(tiny_is_building_driver) { } # Check TinyDrivers build type CONFIG options. -defineTest(tiny_drivers_check_build_types): \ +defineTest(tiny_drivers_check_build_types) { + !build_pass: \ if(build_shared_drivers:if(build_loadable_drivers|build_static_drivers)) | \ if(build_loadable_drivers:if(build_shared_drivers|build_static_drivers)) | \ if(build_static_drivers:if(build_shared_drivers|build_loadable_drivers)): \ error( "More TinyDrivers build types defined in the CONFIG options, only one of\ these 'build_shared/loadable/static_drivers' CONFIG options can be\ defined at a time." ) + + !build_pass: \ + CONFIG(static, dll|shared|static|staticlib): \ + if(build_shared_drivers|build_loadable_drivers): \ + error( "The 'build_shared/loadable_drivers' TinyDrivers build types can't be used\ + with the 'static' CONFIG option, please use the 'build_static_drivers'\ + CONFIG option." ) +} + +# Determine whether the current TARGET is TinyDrivers-related. +defineTest(tiny_is_drivers_target) { + tiny_is_building_drivers(): \ + if(equals(TARGET, TinyDrivers) | \ + equals(TARGET, TinyMySql)): \ + # equals(TARGET, TinyPostgres) | \ + # equals(TARGET, TinySQLite)): \ + return(true) + + return(false) +} diff --git a/qmake/features/tiny_staticlib_check.prf b/qmake/features/tiny_staticlib_check.prf new file mode 100644 index 000000000..580bcde5c --- /dev/null +++ b/qmake/features/tiny_staticlib_check.prf @@ -0,0 +1,7 @@ +!build_pass: \ +CONFIG(staticlib, dll|shared|static|staticlib): \ +if(build_tests|tom_example|tiny_is_building_drivers()): \ + error( "The 'staticlib' can't be used with executables, the build will fail because\ + it will produce some executable, please use the CONFIG += static instead,\ + if you want to build all libraries as static library archives and link\ + against static libraries." ) diff --git a/qmake/features/tom_example.prf b/qmake/features/tom_example.prf index 9977a12b2..677fb7689 100644 --- a/qmake/features/tom_example.prf +++ b/qmake/features/tom_example.prf @@ -1,2 +1,8 @@ +load(tiny_drivers) + +# Nothing to do, TinyDrivers doesn't use this CONFIG option +tiny_is_drivers_target(): \ + return() + CONFIG *= tom_example DEFINES *= TINYORM_TOM_EXAMPLE diff --git a/qmake/tom.pri b/qmake/tom.pri index 6d7ab0901..6ff0f9055 100644 --- a/qmake/tom.pri +++ b/qmake/tom.pri @@ -119,10 +119,8 @@ unset(tinyRcIncludepath) load(tiny_system_includepath) tiny_is_building_drivers(): \ - tiny_add_system_includepath( \ - $$quote($$TINYORM_SOURCE_TREE/drivers/common/include/) \ - $$quote($$TINYORM_SOURCE_TREE/drivers/mysql/include/) \ - ) + tiny_add_system_includepath( \ + $$quote($$TINYORM_SOURCE_TREE/drivers/common/include/)) tiny_add_system_includepath( \ $$quote($$TINYORM_SOURCE_TREE/include/) \