1. spencercw
  2. gb_emulator

Commits

spencercw  committed 5c75482

Add tests to CMake build.

  • Participants
  • Parent commits 2dab36d
  • Branches default

Comments (0)

Files changed (6)

File CMakeLists.txt

View file
 add_subdirectory(gb_emulator)
 add_subdirectory(gb_emulator_main)
 add_subdirectory(gb_net)
+add_subdirectory(tests)
 add_subdirectory(third_party)

File tests/CMakeLists.txt

View file
+add_subdirectory(emulator_tests)

File tests/emulator_tests/CMakeLists.txt

View file
+include_directories("${PROJECT_SOURCE_DIR}/gb_emulator/include")
+include_directories("${PROJECT_SOURCE_DIR}/third_party/gmock/include")
+include_directories("${PROJECT_SOURCE_DIR}/third_party/gtest/include")
+
+add_definitions(-DUNICODE -D_UNICODE)
+
+# Set warning level
+if(MSVC)
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX")
+elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
+endif()
+
+add_executable(emulator_tests
+	cpu_test.cpp
+	main.cpp)
+target_link_libraries(emulator_tests
+	gb_emulator
+	gmock
+	gtest)

File third_party/CMakeLists.txt

View file
 add_subdirectory(argtable)
 add_subdirectory(glew)
+add_subdirectory(gmock)
+add_subdirectory(gtest)
 add_subdirectory(hqx)
 add_subdirectory(protobuf)

File third_party/gmock/CMakeLists.txt

View file
+include_directories(".")
+include_directories("include")
+include_directories("${PROJECT_SOURCE_DIR}/third_party/gtest/include")
+
+add_definitions(-DUNICODE -D_UNICODE)
+
+set(GMOCK_INCLUDES
+	include/gmock/gmock-actions.h
+	include/gmock/gmock-cardinalities.h
+	include/gmock/gmock-generated-actions.h
+	include/gmock/gmock-generated-actions.h.pump
+	include/gmock/gmock-generated-function-mockers.h
+	include/gmock/gmock-generated-function-mockers.h.pump
+	include/gmock/gmock-generated-matchers.h
+	include/gmock/gmock-generated-matchers.h.pump
+	include/gmock/gmock-generated-nice-strict.h
+	include/gmock/gmock-generated-nice-strict.h.pump
+	include/gmock/gmock-matchers.h
+	include/gmock/gmock-more-actions.h
+	include/gmock/gmock-spec-builders.h
+	include/gmock/gmock.h)
+set(GMOCK_INCLUDES_INTERNAL
+	include/gmock/internal/gmock-generated-internal-utils.h
+	include/gmock/internal/gmock-generated-internal-utils.h.pump
+	include/gmock/internal/gmock-internal-utils.h
+	include/gmock/internal/gmock-port.h)
+set(GMOCK_SRCS
+	src/gmock-cardinalities.cc
+	src/gmock-internal-utils.cc
+	src/gmock-matchers.cc
+	src/gmock-spec-builders.cc
+	src/gmock.cc)
+
+source_group("Header Files" FILES ${GMOCK_INCLUDES})
+source_group("Header Files\\internal" FILES ${GMOCK_INCLUDES_INTERNAL})
+source_group("Source Files" FILES ${GMOCK_SRCS})
+
+add_library(gmock
+	${GMOCK_INCLUDES}
+	${GMOCK_INCLUDES_INTERNAL}
+	${GMOCK_SRCS})

File third_party/gtest/CMakeLists.txt

View file
+include_directories(".")
+include_directories("include")
+
+add_definitions(-DUNICODE -D_UNICODE)
+
+set(GTEST_INCLUDES
+	include/gtest/gtest-death-test.h
+	include/gtest/gtest-message.h
+	include/gtest/gtest-param-test.h
+	include/gtest/gtest-param-test.h.pump
+	include/gtest/gtest-printers.h
+	include/gtest/gtest-spi.h
+	include/gtest/gtest-test-part.h
+	include/gtest/gtest-typed-test.h
+	include/gtest/gtest.h
+	include/gtest/gtest_pred_impl.h
+	include/gtest/gtest_prod.h)
+set(GTEST_INCLUDES_INTERNAL
+	include/gtest/internal/gtest-death-test-internal.h
+	include/gtest/internal/gtest-filepath.h
+	include/gtest/internal/gtest-internal.h
+	include/gtest/internal/gtest-linked_ptr.h
+	include/gtest/internal/gtest-param-util-generated.h
+	include/gtest/internal/gtest-param-util-generated.h.pump
+	include/gtest/internal/gtest-param-util.h
+	include/gtest/internal/gtest-port.h
+	include/gtest/internal/gtest-string.h
+	include/gtest/internal/gtest-tuple.h
+	include/gtest/internal/gtest-tuple.h.pump
+	include/gtest/internal/gtest-type-util.h
+	include/gtest/internal/gtest-type-util.h.pump)
+set(GTEST_SRCS
+	src/gtest-death-test.cc
+	src/gtest-filepath.cc
+	src/gtest-internal-inl.h
+	src/gtest-port.cc
+	src/gtest-printers.cc
+	src/gtest-test-part.cc
+	src/gtest-typed-test.cc
+	src/gtest.cc)
+
+source_group("Header Files" FILES ${GTEST_INCLUDES})
+source_group("Header Files\\internal" FILES ${GTEST_INCLUDES_INTERNAL})
+source_group("Source Files" FILES ${GTEST_SRCS})
+
+add_library(gtest
+	${GTEST_INCLUDES}
+	${GTEST_INCLUDES_INTERNAL}
+	${GTEST_SRCS})