diff options
| author | Mat M <mathew1800@gmail.com> | 2017-05-23 02:08:58 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-23 02:08:58 -0400 |
| commit | b7cc4d73dc7828a3889d137ea549f6d36de0a563 (patch) | |
| tree | 59c20d631f8aad82946604791751ef8378ebf24a /Source | |
| parent | 3f437337a104727fb03b20259f3d8c8f2be278f1 (diff) | |
| parent | 974ada25e4c611be91eacdc0a2c177ca3ee1fc3f (diff) | |
Merge pull request #5469 from ligfx/cmakecleanupunittests
CMake: various cleanups for UnitTests
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/UnitTests/CMakeLists.txt | 43 | ||||
| -rw-r--r-- | Source/UnitTests/StubHost.cpp (renamed from Source/UnitTests/TestUtils/StubHost.cpp) | 0 | ||||
| -rw-r--r-- | Source/UnitTests/TestUtils/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | Source/UnitTests/UnitTests.vcxproj | 3 |
4 files changed, 22 insertions, 33 deletions
diff --git a/Source/UnitTests/CMakeLists.txt b/Source/UnitTests/CMakeLists.txt index a884724444..18bae340a7 100644 --- a/Source/UnitTests/CMakeLists.txt +++ b/Source/UnitTests/CMakeLists.txt @@ -1,29 +1,26 @@ -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 +enable_testing() +add_custom_target(unittests) +add_custom_command(TARGET unittests POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND}) + +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> ) - target_link_libraries(Test_${target} ${LIBS}) - add_dependencies(unittests Test_${target}) - add_test(NAME ${target} COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Tests/${target}) + 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(TestUtils) - add_subdirectory(Common) add_subdirectory(Core) add_subdirectory(VideoCommon) diff --git a/Source/UnitTests/TestUtils/StubHost.cpp b/Source/UnitTests/StubHost.cpp index 1519af27a6..1519af27a6 100644 --- a/Source/UnitTests/TestUtils/StubHost.cpp +++ b/Source/UnitTests/StubHost.cpp diff --git a/Source/UnitTests/TestUtils/CMakeLists.txt b/Source/UnitTests/TestUtils/CMakeLists.txt deleted file mode 100644 index 79424a42a6..0000000000 --- a/Source/UnitTests/TestUtils/CMakeLists.txt +++ /dev/null @@ -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}") diff --git a/Source/UnitTests/UnitTests.vcxproj b/Source/UnitTests/UnitTests.vcxproj index 9c91baf8c0..27cc4992d0 100644 --- a/Source/UnitTests/UnitTests.vcxproj +++ b/Source/UnitTests/UnitTests.vcxproj @@ -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>
\ No newline at end of file +</Project> |
