mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-13 04:17:11 +02:00
.github
bin
module
vendor
CPR
ConcurrentQueue
Fmt
JSMN
MaxmindDB
POCO
ApacheConnector
CppParser
CppUnit
Crypto
Data
Encodings
Foundation
cmake
include
samples
src
testsuite
src
CMakeLists.txt
Makefile
Makefile-Driver
Makefile-TestApp
Makefile-TestLibrary
TestApp_vs140.vcxproj
TestApp_vs140.vcxproj.filters
TestApp_vs150.vcxproj
TestApp_vs150.vcxproj.filters
TestApp_vs160.vcxproj
TestApp_vs160.vcxproj.filters
TestLibrary_vs140.vcxproj
TestLibrary_vs140.vcxproj.filters
TestLibrary_vs150.vcxproj
TestLibrary_vs150.vcxproj.filters
TestLibrary_vs160.vcxproj
TestLibrary_vs160.vcxproj.filters
TestSuite_vs140.vcxproj
TestSuite_vs140.vcxproj.filters
TestSuite_vs150.vcxproj
TestSuite_vs150.vcxproj.filters
TestSuite_vs160.vcxproj
TestSuite_vs160.vcxproj.filters
nonexistent.txt
testlibrary.opt
wcelibcex-1.0
CMakeLists.txt
Foundation_vs140.sln
Foundation_vs140.vcxproj
Foundation_vs140.vcxproj.filters
Foundation_vs150.sln
Foundation_vs150.vcxproj
Foundation_vs150.vcxproj.filters
Foundation_vs160.sln
Foundation_vs160.vcxproj
Foundation_vs160.vcxproj.filters
Makefile
extradirs
JSON
JWT
MongoDB
Net
NetSSL_OpenSSL
NetSSL_Win
PDF
PageCompiler
PocoDoc
ProGen
Redis
SevenZip
Util
XML
Zip
appveyor
build
cmake
contrib
doc
packaging
patches
release
travis
.gitattributes
.gitignore
.gitmodules
.travis.yml
CHANGELOG
CMakeLists.txt
CODE_OF_CONDUCT.md
CONTRIBUTING.md
CONTRIBUTORS
LICENSE
Makefile
NEWS
README
README.md
VERSION
appveyor.yml
build_cmake.cmd
build_cmake.sh
build_vs140.cmd
build_vs150.cmd
build_vs160.cmd
buildwin.cmd
buildwin.ps1
components
configure
cppignore.lnx
cppignore.win
env.bat
env.sh
libversion
SimpleIni
Squirrel
TinyDir
ZMQ
CMakeLists.txt
.gitignore
.gitmodules
CMakeLists.txt
LICENSE
README.md
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
74 lines
3.1 KiB
CMake
74 lines
3.1 KiB
CMake
set(TESTUNIT "Foundation-testrunner")
|
|
|
|
# Sources
|
|
file(GLOB SRCS_G "src/*.cpp")
|
|
file(GLOB SRCS_G_REMOVE
|
|
src/TestApp.cpp
|
|
src/TestApp_WINCE.cpp
|
|
src/TestLibrary.cpp
|
|
src/TestPlugin.cpp
|
|
)
|
|
list(REMOVE_ITEM SRCS_G ${SRCS_G_REMOVE})
|
|
POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G})
|
|
|
|
# Headers
|
|
file(GLOB_RECURSE HDRS_G "src/*.h")
|
|
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G})
|
|
|
|
# WinDriver depends on WinTestRunner which depends on MFC, and we don't want that
|
|
POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
|
src/WinDriver.cpp
|
|
)
|
|
|
|
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
|
src/WinCEDriver.cpp
|
|
)
|
|
|
|
add_executable(Foundation-testrunner ${TEST_SRCS})
|
|
if(ANDROID)
|
|
add_test(
|
|
NAME Foundation
|
|
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
|
COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} "-DTEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/data;${CMAKE_BINARY_DIR}/bin/TestApp;${CMAKE_BINARY_DIR}/bin/TestLibrary.so" -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Foundation-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake
|
|
)
|
|
else()
|
|
add_test(
|
|
NAME Foundation
|
|
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
|
COMMAND Foundation-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all
|
|
)
|
|
set_tests_properties(Foundation PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") # The SharedLibaryTest has to look for shared libraries in the working directory
|
|
set_property(TEST Foundation APPEND PROPERTY ENVIRONMENT "PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:$ENV{PATH}") # The ProcessTest has to look for the TestApp in the working directory
|
|
set_property(TEST Foundation APPEND PROPERTY ENVIRONMENT "POCO_BASE=${CMAKE_SOURCE_DIR}")
|
|
# The test is run in the runtime directory. So the test data is copied there too
|
|
add_custom_command(
|
|
TARGET Foundation-testrunner POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/data
|
|
)
|
|
endif()
|
|
|
|
target_link_libraries(Foundation-testrunner PUBLIC Poco::Foundation CppUnit)
|
|
if(UNIX AND NOT ANDROID)
|
|
target_link_libraries(Foundation-testrunner PUBLIC pthread)
|
|
endif(UNIX AND NOT ANDROID)
|
|
|
|
# TestApp
|
|
if(WINCE)
|
|
add_executable(TestApp src/TestApp_WINCE.cpp)
|
|
set_target_properties(TestApp PROPERTIES LINK_FLAGS "/ENTRY:wmainCRTStartup")
|
|
else()
|
|
add_executable(TestApp src/TestApp.cpp)
|
|
endif()
|
|
# The test is run in the runtime directory. So the TestApp is built there too because it is used by the tests
|
|
set_target_properties(TestApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
target_link_libraries(TestApp PUBLIC Poco::Foundation)
|
|
|
|
# TestLibrary
|
|
add_library(TestLibrary SHARED src/TestLibrary.cpp src/TestPlugin.cpp src/TestPlugin.h)
|
|
set_target_properties(TestLibrary PROPERTIES PREFIX "" DEBUG_POSTFIX "") # The test requires the library named TestLibrary. By default it is prefixed with lib.
|
|
# The test is run in the runtime directory. So the TestLibrary is built there too because it is used by the tests
|
|
set_target_properties(TestLibrary PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
target_link_libraries(TestLibrary PUBLIC Poco::Foundation)
|
|
|
|
add_dependencies(Foundation-testrunner TestApp TestLibrary)
|