Merge pull request #14 from QuasarApp/CI

Added support the BIGINT_TESTS macross
This commit is contained in:
Andrei Yankovich 2021-04-07 10:33:42 +03:00 committed by GitHub
commit 5fc8657cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 17 deletions

View File

@ -19,13 +19,34 @@ include(CMake/QuasarAppCITargets.cmake)
# Add sub directories
add_subdirectory(src)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core QUIET)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core QUIET)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
if (NOT DEFINED BIGINT_TESTS)
set(BIGINT_TESTS ON)
if(${QT_VERSION_MAJOR})
if (DEFINED TARGET_PLATFORM_TOOLCHAIN)
if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32")
set(BIGINT_TESTS OFF)
endif()
endif()
if (ANDROID)
set(BIGINT_TESTS OFF)
endif()
if (NOT QT_VERSION_MAJOR)
set(BIGINT_TESTS OFF)
endif()
endif()
if (BIGINT_TESTS)
add_subdirectory(tests)
endif(${QT_VERSION_MAJOR})
else()
message("The ${PROJECT_NAME} tests is disabled.")
endif()
initAll()

14
GMP.pro
View File

@ -11,17 +11,7 @@ CONFIG += ordered
SUBDIRS += \
src
gcc {
lessThan (QT_MINOR_VERSION, 12) {
message(disable tests!)
} else {
include($$PWD/tests/test.pri)
message(enabled tests!)
SUBDIRS += tests
SUBDIRS += tests
tests.file = tests/tests.pro
}
}
src.file = src/GMP.pro
QMAKE_EXTRA_TARGETS += \
test

View File

@ -25,7 +25,7 @@ file(GLOB SOURCE_CPP
)
add_executable(${CURRENT_PROJECT} ${SOURCE_CPP})
target_link_libraries(${CURRENT_PROJECT} PRIVATE Qt::Core Qt::Test QtBigint)
target_link_libraries(${CURRENT_PROJECT} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test QtBigint)
target_include_directories(${CURRENT_PROJECT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
initTests()