mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-01-09 12:30:16 -06:00
qmake/cmake inline/extern constants edge cases
Enhanced qmake/cmake builds during testing of all Win32 build types. - throw fatal error for unsupported build types - cmake do not show INLINE_CONSTANTS option for MinGW clang shared build because it causes crashes
This commit is contained in:
@@ -63,11 +63,6 @@ feature_option(BUILD_SHARED_LIBS
|
||||
feature_option(BUILD_TESTS
|
||||
"Build Qt tests" OFF
|
||||
)
|
||||
feature_option_dependent(INLINE_CONSTANTS
|
||||
"Use inline constants instead of extern constants in the shared build. \
|
||||
OFF is highly recommended for the shared build; is always ON for the static build" OFF
|
||||
"BUILD_SHARED_LIBS" ON
|
||||
)
|
||||
# TODO make it also dependend on NOT isMultiConfig silverqx
|
||||
# Depends on tiny_init_cmake_variables_pre() call
|
||||
feature_option_dependent(MATCH_EQUAL_EXPORTED_BUILDTREE
|
||||
@@ -84,6 +79,14 @@ feature_option(VERBOSE_CONFIGURE
|
||||
"Show information about PACKAGES_FOUND and PACKAGES_NOT_FOUND in the configure \
|
||||
output" OFF
|
||||
)
|
||||
# MinGW clang shared build crashes with inline constants
|
||||
if(NOT MINGW OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR NOT BUILD_SHARED_LIBS)
|
||||
feature_option_dependent(INLINE_CONSTANTS
|
||||
"Use inline constants instead of extern constants in the shared build. \
|
||||
OFF is highly recommended for the shared build; is always ON for the static build" OFF
|
||||
"BUILD_SHARED_LIBS" ON
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(MATCH_EQUAL_EXPORTED_BUILDTREE)
|
||||
|
||||
@@ -102,6 +105,9 @@ OFF to disable /MP completely.")
|
||||
tiny_init_cmake_variables()
|
||||
tiny_init_tiny_variables()
|
||||
|
||||
# Throw a fatal error for unsupported environments
|
||||
tiny_check_unsupported_build()
|
||||
|
||||
# TinyORM library header and source files
|
||||
# ---
|
||||
|
||||
|
||||
@@ -194,3 +194,13 @@ macro(tiny_set_rc_flags)
|
||||
set(TINY_RC_FLAGS_BACKUP "${ARGN}")
|
||||
|
||||
endmacro()
|
||||
|
||||
# Throw a fatal error for unsupported environments
|
||||
function(tiny_check_unsupported_build)
|
||||
|
||||
if(MINGW AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT BUILD_SHARED_LIBS)
|
||||
message(FATAL_ERROR "MinGW clang static build is not supported, problem with \
|
||||
inline constants :/.")
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
@@ -164,11 +164,15 @@ ${CMAKE_BINARY_DIR}/tests/auto/utils${TINY_PATH_SEPARATOR}$ENV{PATH}")
|
||||
|
||||
# Specifies which global constant types will be used
|
||||
if(BUILD_SHARED_LIBS AND NOT INLINE_CONSTANTS)
|
||||
set(TINY_EXTERN_CONSTANTS ON CACHE INTERNAL
|
||||
"Determine whether the project will be built with extern constants")
|
||||
set(tinyExternConstants ON)
|
||||
message(VERBOSE "Using extern constants")
|
||||
else()
|
||||
set(TINY_EXTERN_CONSTANTS OFF CACHE INTERNAL
|
||||
"Determine whether the project will be built with extern constants")
|
||||
set(tinyExternConstants OFF)
|
||||
message(VERBOSE "Using inline constants")
|
||||
endif()
|
||||
set(TINY_EXTERN_CONSTANTS ${tinyExternConstants} CACHE INTERNAL
|
||||
"Determine whether ${TinyOrm_target} library will be built with extern or inline \
|
||||
constants")
|
||||
unset(tinyExternConstants)
|
||||
|
||||
endmacro()
|
||||
|
||||
@@ -103,6 +103,7 @@ namespace Relations {
|
||||
// CUR enable QT_ASCII_CAST_WARNINGS silverqx
|
||||
// CUR autoconfigure qmake with qmake/TinyOrm.pri and TINY_ROOT_DIR and TINY_TINYORM_BUILDS_DIR silverqx
|
||||
// CUR rename export_global.hpp to export_common.hpp silverqx
|
||||
// CUR RC file and manifest for tests silverqx
|
||||
/*! Base model class. */
|
||||
template<typename Derived, AllRelationsConcept ...AllRelations>
|
||||
class Model :
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
# Unsupported build types
|
||||
# ---
|
||||
win32-clang-g++: {
|
||||
CONFIG(static, dll|shared|static|staticlib) | \
|
||||
CONFIG(staticlib, dll|shared|static|staticlib): \
|
||||
error( "MinGW clang static build is not supported, contains a problem with\
|
||||
duplicit symbols, you can try to fix it :)." )
|
||||
}
|
||||
|
||||
# Common Configuration ( also for tests )
|
||||
# ---
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
win32-clang-g++: {
|
||||
CONFIG(shared, dll|shared|static|staticlib) | \
|
||||
CONFIG(dll, dll|shared|static|staticlib): \
|
||||
error( "inline constants (inline_constants CONFIG option) cause crashes with\
|
||||
an shared library on MinGW clang, please use\
|
||||
\"CONFIG += extern_constants\" instead." )
|
||||
}
|
||||
|
||||
CONFIG -= extern_constants
|
||||
DEFINES -= TINYORM_EXTERN_CONSTANTS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user