# Note: # All conf.pri.example files (they are 4) contain a lot of commented code, personally, # I wouldn't say I like these comments, especially after the Auto-configuration feature # was added. # But these comments show all possible alternatives to configure TinyORM project so # you can quickly find out what you can use. # Choose any method you like and remove the rest of commented code. # Auto-configuration # --- # The Auto-configuration feature and tiny_dotenv qmake CONFIG were added in the TinyORM v0.34.0. # These new features allow us to auto-configure TinyORM project, and with their help, # the conf.pri files can be skipped entirely. # # The Auto-configuration feature is designed to find the vcpkg and MySQL installations, and # tiny_dotenv to include the .env and .env.$$QMAKE_PLATFORM files in the project's root folder. # These new features can be configured using qmake and environment variables, and they # also contain some guessing logic if these variables are not defined. # # These are qmake and environment variables that affect the Auto-configuration feature: # # - TINY_VCPKG_ROOT - Path to the vcpkg installation folder. # If not defined, then it tries to use the VCPKG_ROOT environment # variable. # - TINY_VCPKG_TRIPLET - The vcpkg triplet to use (vcpkg/installed/$$TINY_VCPKG_TRIPLET/). # If not defined, then it tries to guess the vcpkg triplet based # on the current compiler and OS (based on the QMAKESPEC), and # as the last thing, it tries to use the VCPKG_DEFAULT_TRIPLET # environment variable. # - TINY_MYSQL_ROOT - Path to the MySQL installation folder. # If not defined, then it tries to guess the MySQL installation folder: # $$(ProgramFiles)/MySQL/MySQL Server (9.0|8.4|8.3|8.2|8.1|8.0|5.7)/) # # You can set these variables in the .env (recommended) or conf.pri files, # in the .qmake.conf file (or wherever you want), or as environment variables. # # These variables will be set after auto-configuration is done: # # - TINY_VCPKG_INCLUDE - Path to the vcpkg include folder (vcpkg/installed//include/). # - TINY_MYSQL_INCLUDE - Path to the MySQL include folder (MySQL Server 9.0/include/). # - TINY_MYSQL_LIB - Path to the MySQL lib folder (MySQL Server 9.0/lib/). # # The TINY_MYSQL_INCLUDE and TINY_MYSQL_LIB are only set on win32 platform except mingw. # .env and .env.$$TINY_DOTENV_PLATFORM (tiny_dotenv feature) # --- # # This feature allows us to define the .env and .env.$$TINY_DOTENV_PLATFORM files # in the project's root folder. These files are loaded as early as possible so you can # affect the qmake configuration process. On the other hand, the conf.pri files are # loaded as late as possible, and they can be used to override the qmake configuration. # # The .env file is included first and is included on all platforms. # # There is only one requirement for this feature to work correctly, and that is to set # the TINY_DOTENV_ROOT qmake variable to the project's root folder. This variable is # already set in the .qmake.conf file for the TinyORM project. # # Then the following names are taken into account: .env, .env.win32, .env.unix, .env.mingw # Tom migrations # --- # Default migrations path as the string for the make:migration command # The path can be absolute or relative (to the pwd at runtime) # It will look like this on the cmd. line: -DTINYTOM_MIGRATIONS_DIR="/" # If the path doesn't contain a space then the \" is not needed # Will be stringified in the tom/application.cpp #DEFINES += TINYTOM_MIGRATIONS_DIR="\"database/migrations\"" # Default models path as the string for the make:model command #DEFINES += TINYTOM_MODELS_DIR="\"database/models\"" # Default seeders path as the string for the make:seeder command #DEFINES += TINYTOM_SEEDERS_DIR="\"database/seeders\"" # Dependencies include and library paths # --- # MySQL C library # Arch - pacman -S mariadb-libs # Gentoo - emerge dev-db/mysql (package.use: -server -perl) # Ubuntu - apt install libmysqlclient-dev # range-v3 library (header only) # Arch - pacman -S range-v3 # Gentoo - emerge dev-cpp/range-v3 # Ubuntu - apt install librange-v3-dev # ccache # Arch - pacman -S ccache # Gentoo - emerge dev-util/ccache # Ubuntu - apt install ccache disable_autoconf { # load(private/tiny_system_includepath) load(private/tiny_find_packages) } # MinGW win32-g++|win32-clang-g++ { # Enable ccache wrapper # CONFIG *= ccache # Prefer LLD linker for Clang # CONFIG *= use_lld_linker does not work on MinGW clang: QMAKE_LFLAGS *= -fuse-ld=lld # Nothing to do, auto-configuration is enabled !disable_autoconf: return() # Includes and Libraries # vcpkg - range-v3 and tabulate tiny_find_vcpkg() # tiny_find_vcpkg($$quote(C:/msys64/home/xyz/Code/vcpkg/), x64-mingw-dynamic) # tiny_add_system_includepath(\ # $$quote(C:/msys64/home/xyz/Code/vcpkg/installed/x64-mingw-dynamic/include/)) # MariaDB C library # On MSYS2 there is only the MariaDB C library (no MySQL C library) mysql_ping { # Find the MySQL C library and add it on system include path and library path tiny_find_mysql() # Shared build - find with the pkg-config (preferred) # CONFIG(shared, dll|shared|static|staticlib) | \ # CONFIG(dll, dll|shared|static|staticlib) { # !link_pkgconfig_off { # CONFIG *= link_pkgconfig # PKGCONFIG *= libmariadb # } # else: \ # LIBS_PRIVATE += -lmariadb # } # # Static build # else: \ # if(CONFIG(static, dll|shared|static|staticlib) | \ # CONFIG(staticlib, dll|shared|static|staticlib)): \ # LIBS_PRIVATE += -lmariadb.dll # Or add manually (use only one method, above or this manual method) # # For shared build # LIBS_PRIVATE += -lmariadb # # For static build # LIBS_PRIVATE += -lmariadb.dll } } # Windows (excluding MinGW) else:win32-msvc|win32-clang-msvc { # Enable ccache wrapper # CONFIG *= ccache # Nothing to do, auto-configuration is enabled !disable_autoconf: return() # Explicitly specify the MySQL root installation path using the $$TINY_MYSQL_ROOT # !disable_autoconf { # # Used in the tiny_find_mysql() # TINY_MYSQL_ROOT = $$quote($$(ProgramFiles)/MySQL/MySQL Server 9.0/) # return() # } # Includes and Libraries # vcpkg - range-v3 and tabulate tiny_find_vcpkg() # tiny_find_vcpkg($$quote(E:/xyz/vcpkg/), x64-windows) # tiny_add_system_includepath($$quote(E:/xyz/vcpkg/installed/x64-windows/include/)) # MySQL C library mysql_ping { # Find the MySQL C library and add it on system include path and library path tiny_find_mysql() # tiny_find_mysql($$quote($$(ProgramFiles)/MySQL/MySQL Server 9.0/)) # tiny_add_system_includepath(\ # $$quote(C:/Program Files/MySQL/MySQL Server 9.0/include/)) # LIBS_PRIVATE += $$quote(-LC:/Program Files/MySQL/MySQL Server 9.0/lib/) # LIBS_PRIVATE += -llibmysql } } # Unix else:unix { # Prefer LLD linker for Clang clang: CONFIG *= use_lld_linker else: CONFIG *= use_gold_linker # Or use the mold linker # QMAKE_LFLAGS *= -fuse-ld=mold # Nothing to do, auto-configuration is enabled !disable_autoconf: return() # Includes and Libraries # vcpkg - range-v3 and tabulate tiny_find_vcpkg() # tiny_find_vcpkg($$quote(/home/xyz/Code/c/vcpkg/installed/x64-linux/include/), \ # x64-linux) # tiny_add_system_includepath(\ # $$quote(/home/xyz/Code/c/vcpkg/installed/x64-linux/include/)) # MySQL C library mysql_ping { # Find the MySQL C library and add it on system include path and library path tiny_find_mysql() # Find with pkg-config (preferred) # !link_pkgconfig_off { # CONFIG *= link_pkgconfig # # Pick only one # PKGCONFIG *= mysqlclient ## PKGCONFIG *= libmariadb # } # else: \ # # Pick only one # LIBS_PRIVATE += -lmysqlclient ## LIBS_PRIVATE += -lmariadb # Or add manually (use only one method, above or this manual method) # Pick only one # LIBS_PRIVATE += -lmysqlclient # LIBS_PRIVATE += -lmariadb } }