stuff-from-scratch/test/CMakeLists.txt
2022-11-11 09:14:41 +00:00

81 lines
2.2 KiB
CMake

add_library(test_utils STATIC
test_utils/TestCase.h
test_utils/TestCaseRunner.cpp
)
target_include_directories(test_utils PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/test_utils"
)
list(APPEND TestFiles
audio/TestAudioWriter.cpp
audio/TestMidiReader.cpp
core/TestBinaryStream.cpp
core/TestTomlReader.cpp
compiler/TestLexer.cpp
compiler/TestTemplatingEngine.cpp
compression/TestStreamCompressor.cpp
database/TestDatabase.cpp
fonts/TestFontReader.cpp
graphics/TestRasterizer.cpp
image/TestPngReader.cpp
image/TestPngWriter.cpp
network/TestNetworkManagerClient.cpp
network/TestNetworkManagerServer.cpp
publishing/TestPdfWriter.cpp
web/TestMarkdownParser.cpp
web/TestXmlParser.cpp)
if (${HAS_FFMPEG})
list(APPEND TestFiles
video/TestVideoDecoder.cpp
)
endif()
if (${HAS_WAYLAND})
list(APPEND TestFiles
windows/TestWaylandWindow.cpp
)
endif()
set(OpenGL_GL_PREFERENCE "GLVND")
find_package(OpenGL QUIET)
if (OpenGL_FOUND)
list(APPEND TestFiles
graphics/TestOpenGlRendering.cpp
)
endif()
find_package(PkgConfig)
pkg_check_modules(DBUS dbus-1)
if (DBUS_FOUND)
include_directories(${DBUS_INCLUDE_DIRS})
link_directories(${DBUS_LIBRARY_DIRS})
list(APPEND TestFiles
ipc/TestDbus.cpp
)
endif()
if(UNIX)
find_package(Freetype QUIET)
if(Freetype_FOUND)
list(APPEND TestFiles
fonts/TestFreeTypeFontEngine.cpp
)
endif()
endif()
foreach(TestFile ${TestFiles})
cmake_path(GET TestFile FILENAME TestFileName)
cmake_path(GET TestFileName STEM TestName)
add_executable(${TestName} ${TestFile})
target_link_libraries(${TestName} PUBLIC core compiler compression fonts network image publishing video database geometry audio graphics web client test_utils ${DBUS_LIBRARIES})
set_property(TARGET ${TestName} PROPERTY FOLDER test)
endforeach()
add_executable(test_runner test_runner.cpp)
target_link_libraries(test_runner PUBLIC core fonts network database geometry audio graphics web client)