diff --git a/CMakeLists.txt b/CMakeLists.txt index 58aaaa9c43..67424f11b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 # 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,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} + $ + ) + 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) diff --git a/Source/UnitTests/TestUtils/StubHost.cpp b/Source/UnitTests/StubHost.cpp similarity index 100% rename from Source/UnitTests/TestUtils/StubHost.cpp rename to 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 @@ + @@ -111,4 +112,4 @@ - \ No newline at end of file +