Move tests to own CMakeLists.txt files which fixes circular dependency

This commit is contained in:
Mahmood(Thunder07) 2018-01-12 02:12:00 +00:00
parent e6c6fd4118
commit 3b38c4cfef
6 changed files with 159 additions and 74 deletions

View file

@ -72,6 +72,14 @@ if(BUILD_PLAY)
endif(TARGET_PLATFORM_WIN32)
endif(BUILD_PLAY)
enable_testing()
add_subdirectory(tools/AutoTest/)
add_subdirectory(tools/McServTest/)
add_subdirectory(tools/VuTest/)
if(BUILD_PSFPLAYER)
add_subdirectory(tools/PsfPlayer)
endif(BUILD_PSFPLAYER)

View file

@ -77,39 +77,6 @@ if (NOT TARGET CodeGen)
endif()
list(APPEND PROJECT_LIBS CodeGen)
if(TARGET_PLATFORM_WIN32)
if (NOT TARGET Nuanceur)
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/../../Nuanceur/build_cmake
${CMAKE_CURRENT_BINARY_DIR}/Nuanceur
)
endif()
list(APPEND PROJECT_LIBS Nuanceur)
if (NOT TARGET Framework_Win32)
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/../../Framework/build_cmake/FrameworkWin32
${CMAKE_CURRENT_BINARY_DIR}/Framework_Win32
)
endif()
list(APPEND PROJECT_LIBS Framework_Win32)
#If building for Windows XP, we need to use the provided d3dcompiler since it's not available in the SDK
if(CMAKE_GENERATOR_TOOLSET MATCHES "_xp$")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../Dependencies/d3dcompiler_winxp/Include)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND PROJECT_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/../../Dependencies/d3dcompiler_winxp/Lib/x64/d3dcompiler.lib)
else()
list(APPEND PROJECT_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/../../Dependencies/d3dcompiler_winxp/Lib/x86/d3dcompiler.lib)
endif()
else()
list(APPEND PROJECT_LIBS d3dcompiler)
endif()
list(APPEND PROJECT_LIBS comctl32 uxtheme opengl32 glu32 dinput8 d3d9 vfw32 winmm gdiplus Boost::date_time)
endif()
if(NOT TARGET Boost::boost)
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/../../Dependencies/boost-cmake
@ -486,39 +453,3 @@ endif()
if(TARGET_PLATFORM_WIN32)
add_precompiled_header(PlayCore Pch.h FORCEINCLUDE SOURCE_CXX Pch.cpp)
endif()
list(APPEND PROJECT_LIBS PlayCore)
enable_testing()
add_executable(autotest
../tools/AutoTest/JUnitTestReportWriter.cpp
../tools/AutoTest/Main.cpp
)
target_link_libraries(autotest ${PROJECT_LIBS})
add_executable(McServTest
../tools/McServTest/AppConfig.cpp
../tools/McServTest/GameTestSheet.cpp
../tools/McServTest/Main.cpp
)
target_link_libraries(McServTest ${PROJECT_LIBS})
add_test(NAME McServTest
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../tools/McServTest
COMMAND McServTest
)
add_executable(VuTest
../tools/VuTest/AddTest.cpp
../tools/VuTest/FlagsTest2.cpp
../tools/VuTest/FlagsTest.cpp
../tools/VuTest/Main.cpp
../tools/VuTest/TestVm.cpp
../tools/VuTest/TriAceTest.cpp
../tools/VuTest/VuAssembler.cpp
)
target_link_libraries(VuTest ${PROJECT_LIBS})
add_test(NAME VuTest
COMMAND VuTest
)

View file

@ -28,11 +28,13 @@ if(NOT TARGET gsh_opengl)
endif()
list(INSERT PROJECT_LIBS 0 gsh_opengl)
add_library(gsh_opengl_win32 STATIC
GSH_OpenGL_SettingsWnd.cpp
GSH_OpenGLWin32.cpp
)
target_link_libraries(gsh_opengl_win32 PUBLIC Boost::boost Framework glew_s)
if (NOT TARGET gsh_opengl_win32)
add_library(gsh_opengl_win32 STATIC
GSH_OpenGL_SettingsWnd.cpp
GSH_OpenGLWin32.cpp
)
target_link_libraries(gsh_opengl_win32 PUBLIC Boost::boost Framework glew_s)
endif()
list(APPEND PROJECT_LIBS gsh_opengl_win32)
#If building for Windows XP, we need to use the provided d3dcompiler since it's not available in the SDK

View file

@ -0,0 +1,86 @@
cmake_minimum_required(VERSION 3.5)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/../../../Dependencies/cmake-modules
${CMAKE_MODULE_PATH}
)
include(Header)
project(AutoTest)
if (NOT TARGET PlayCore)
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/../../Source/
${CMAKE_CURRENT_BINARY_DIR}/Source
)
endif()
if(TARGET_PLATFORM_WIN32)
add_definitions(-DGLEW_STATIC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-D_LIB)
add_definitions(-D_UNICODE -DUNICODE)
if(NOT TARGET gsh_opengl)
add_subdirectory(
../../Source/gs/GSH_OpenGL
../../Source/gs/GSH_OpenGL
)
endif()
list(APPEND PROJECT_LIBS gsh_opengl)
if (NOT TARGET Framework_Win32)
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/../../../Framework/build_cmake/FrameworkWin32
${CMAKE_CURRENT_BINARY_DIR}/Framework_Win32
)
endif()
list(APPEND PROJECT_LIBS Framework_Win32)
#If building for Windows XP, we need to use the provided d3dcompiler since it's not available in the SDK
if(CMAKE_GENERATOR_TOOLSET MATCHES "_xp$")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../Dependencies/d3dcompiler_winxp/Include)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND PROJECT_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/../../../Dependencies/d3dcompiler_winxp/Lib/x64/d3dcompiler.lib)
else()
list(APPEND PROJECT_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/../../../Dependencies/d3dcompiler_winxp/Lib/x86/d3dcompiler.lib)
endif()
else()
list(APPEND PROJECT_LIBS d3dcompiler)
endif()
list(APPEND PROJECT_LIBS comctl32 uxtheme opengl32 glu32 dinput8 d3d9 vfw32 winmm gdiplus Boost::date_time)
if(NOT TARGET gsh_opengl_win32)
add_library(gsh_opengl_win32 STATIC
../../Source/ui_win32/GSH_OpenGL_SettingsWnd.cpp
../../Source/ui_win32/GSH_OpenGLWin32.cpp
)
target_link_libraries(gsh_opengl_win32 Boost::boost glew_s gsh_opengl)
endif()
list(APPEND PROJECT_LIBS gsh_opengl_win32)
if (NOT TARGET Nuanceur)
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/../../../Nuanceur/build_cmake
${CMAKE_CURRENT_BINARY_DIR}/Nuanceur
)
endif()
list(APPEND PROJECT_LIBS Nuanceur)
if(NOT TARGET gsh_d3d9)
add_library(gsh_d3d9 STATIC
../../Source/ui_win32/GSH_Direct3D9.cpp
../../Source/ui_win32/GSH_Direct3D9_Shader.cpp
../../Source/ui_win32/GSH_Direct3D9_Texture.cpp
)
target_link_libraries(gsh_d3d9 Boost::boost ZLIB::ZLIB Nuanceur)
endif()
list(APPEND PROJECT_LIBS gsh_d3d9)
endif()
add_executable(autotest
JUnitTestReportWriter.cpp
Main.cpp
)
target_link_libraries(autotest PlayCore ${PROJECT_LIBS})

View file

@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.5)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/../../../Dependencies/cmake-modules
${CMAKE_MODULE_PATH}
)
include(Header)
project(McServTest)
if (NOT TARGET PlayCore)
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/../../Source/
${CMAKE_CURRENT_BINARY_DIR}/Source
)
endif()
add_executable(McServTest
AppConfig.cpp
GameTestSheet.cpp
Main.cpp
)
target_link_libraries(McServTest PlayCore)
add_test(NAME McServTest
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND McServTest
)

View file

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.5)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/../../../Dependencies/cmake-modules
${CMAKE_MODULE_PATH}
)
include(Header)
project(VuTest)
if (NOT TARGET PlayCore)
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/../../Source/
${CMAKE_CURRENT_BINARY_DIR}/Source
)
endif()
add_executable(VuTest
AddTest.cpp
FlagsTest2.cpp
FlagsTest.cpp
Main.cpp
TestVm.cpp
TriAceTest.cpp
VuAssembler.cpp
)
target_link_libraries(VuTest PlayCore)
add_test(NAME VuTest
COMMAND VuTest
)