Merge pull request #5469 from ligfx/cmakecleanupunittests
CMake: various cleanups for UnitTests
This commit is contained in:
commit
b7cc4d73dc
|
@ -806,13 +806,11 @@ include_directories("${PROJECT_BINARY_DIR}/Source/Core")
|
|||
message(STATUS "Using static gtest from Externals")
|
||||
add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL)
|
||||
|
||||
enable_testing()
|
||||
add_custom_target(unittests)
|
||||
add_custom_command(TARGET unittests POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND})
|
||||
|
||||
########################################
|
||||
# Process Dolphin source now that all setup is complete
|
||||
#
|
||||
add_subdirectory(Source)
|
||||
|
||||
|
||||
########################################
|
||||
# Install shared data files
|
||||
#
|
||||
|
|
|
@ -1,28 +1,25 @@
|
|||
set(LIBS core gtest_main)
|
||||
if(APPLE)
|
||||
list(APPEND LIBS ${FOUNDATION_LIBRARY} ${CORESERV_LIBRARY})
|
||||
endif()
|
||||
if(ANDROID)
|
||||
set(LIBS ${LIBS} android log)
|
||||
endif()
|
||||
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Tests)
|
||||
macro(add_dolphin_test target srcs)
|
||||
# Since this is a Core dependency, it can't be linked as a library and has
|
||||
# to be linked as an object file. Otherwise CMake inserts the library after
|
||||
# core, but before other core dependencies like videocommon which also use
|
||||
# Host_ functions.
|
||||
set(srcs2 ${srcs} ${CMAKE_SOURCE_DIR}/Source/UnitTests/TestUtils/StubHost.cpp ${ARGN})
|
||||
add_executable(Test_${target} EXCLUDE_FROM_ALL ${srcs2})
|
||||
set_target_properties(Test_${target} PROPERTIES
|
||||
OUTPUT_NAME Tests/${target}
|
||||
FOLDER Tests
|
||||
)
|
||||
target_link_libraries(Test_${target} ${LIBS})
|
||||
add_dependencies(unittests Test_${target})
|
||||
add_test(NAME ${target} COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Tests/${target})
|
||||
endmacro()
|
||||
enable_testing()
|
||||
add_custom_target(unittests)
|
||||
add_custom_command(TARGET unittests POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND})
|
||||
|
||||
add_subdirectory(TestUtils)
|
||||
string(APPEND CMAKE_RUNTIME_OUTPUT_DIRECTORY "/Tests")
|
||||
|
||||
# Since this is a Core dependency, it can't be linked as a normal library.
|
||||
# Otherwise CMake inserts the library after core, but before other core
|
||||
# dependencies like videocommon which also use Host_ functions, which makes the
|
||||
# GNU linker complain.
|
||||
add_library(unittests_stubhost OBJECT StubHost.cpp)
|
||||
|
||||
macro(add_dolphin_test target)
|
||||
add_executable(${target} EXCLUDE_FROM_ALL
|
||||
${ARGN}
|
||||
$<TARGET_OBJECTS:unittests_stubhost>
|
||||
)
|
||||
set_target_properties(${target} PROPERTIES FOLDER Tests)
|
||||
target_link_libraries(${target} core gtest_main)
|
||||
add_dependencies(unittests ${target})
|
||||
add_test(NAME ${target} COMMAND ${target})
|
||||
endmacro()
|
||||
|
||||
add_subdirectory(Common)
|
||||
add_subdirectory(Core)
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
set(SRCS
|
||||
# Do not add StubHost.cpp here - it is added manually via add_dolphin_test.
|
||||
)
|
||||
|
||||
set(LIBS
|
||||
)
|
||||
|
||||
# TODO: uncomment when there is actually something here.
|
||||
#add_dolphin_library(testutils "${SRCS}" "${LIBS}")
|
|
@ -60,6 +60,7 @@
|
|||
<ClCompile Include="$(ExternalsDir)gtest\src\gtest-all.cc" />
|
||||
<ClCompile Include="$(ExternalsDir)gtest\src\gtest_main.cc" />
|
||||
<!--Lump all of the tests (and supporting code) into one binary-->
|
||||
<ClCompile Include="*.cpp" />
|
||||
<ClCompile Include="*\*.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -111,4 +112,4 @@
|
|||
<!--This is only executed via msbuild, VS test runner automatically does this-->
|
||||
<Exec Command="$(TargetPath)" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
Loading…
Reference in New Issue