diff --git a/.gitmodules b/.gitmodules index bc4fe37..d87f973 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "external/glfw"] path = external/glfw url = https://github.com/glfw/glfw.git +[submodule "external/coveralls-cmake"] + path = external/coveralls-cmake + url = https://github.com/JoakimSoderberg/coveralls-cmake.git diff --git a/.travis.yml b/.travis.yml index ca51ce4..508fc37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ git: compiler: - clang - gcc -script: mkdir build && cd build && cmake -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . && cmake --build . --target coveralls +script: mkdir build && cd build && cmake -DUSE_ALLEGRO=OFF -DUSE_PROFILING=ON -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . && cmake --build . --target coveralls install: true addons: diff --git a/external/coveralls-cmake b/external/coveralls-cmake new file mode 160000 index 0000000..e37d5b8 --- /dev/null +++ b/external/coveralls-cmake @@ -0,0 +1 @@ +Subproject commit e37d5b8674dab235185b07ad9208c88d84f81823 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d929cd7..fdc3df9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,6 +22,8 @@ set(USE_PROFILING OFF CACHE BOOL "Use profiling tools? (Will slow down a lot.)") set(USE_ALLEGRO ON CACHE BOOL "Use Allegro backend") +option(COVERALLS "Generate coveralls data" OFF) + ########################## # Link & Compile flags ########################## @@ -29,6 +31,8 @@ set(USE_ALLEGRO ON CACHE BOOL "Use Allegro backend") set (CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-parameter -Werror ${PLATFORM_FLAGS}") set (CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Werror ${PLATFORM_FLAGS}") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/external/coveralls-cmake/cmake) + add_definitions (-DNO_DECIMAL) if (PPU_ISPAL) @@ -59,6 +63,11 @@ if (USE_PROFILING) set(CMAKE_C_FLAGS -pg) endif (USE_PROFILING) +if (COVERALLS) + include(Coveralls) + coveralls_turn_on_coverage() +endif() + include_directories(include) add_subdirectory(apu) @@ -79,5 +88,16 @@ endif (TARGET_TI68k) find_library(PTHREADLIB pthread) +if (COVERALLS) + set(COVERAGE_SRCS src/main.c src/paddle.c src/NESCarts.c ${COVERAGE_SRCS}) + + # Create the coveralls target. + coveralls_setup( + "${COVERAGE_SRCS}" # The source files. + ON # If we should upload. + ) # (Optional) Alternate project cmake module path. +endif() + + add_executable(tines main.c paddle.c NESCarts.c) -target_link_libraries(tines apu corecpu mappermanager memorymanager pluginsmanager ppu oslib ${PTHREADLIB}) \ No newline at end of file +target_link_libraries(tines apu corecpu mappermanager memorymanager pluginsmanager ppu oslib ${PTHREADLIB}) diff --git a/src/corecpu/CMakeLists.txt b/src/corecpu/CMakeLists.txt index c561f3b..9041ee4 100644 --- a/src/corecpu/CMakeLists.txt +++ b/src/corecpu/CMakeLists.txt @@ -9,4 +9,8 @@ # $HeadURL$ # $Revision$ -add_library(corecpu corecpu.c) \ No newline at end of file +if (COVERALLS) + set(COVERAGE_SRCS src/corecpu/corecpu.c ${COVERAGE_SRCS} PARENT_SCOPE) +endif() + +add_library(corecpu corecpu.c) diff --git a/src/mappersmanager/CMakeLists.txt b/src/mappersmanager/CMakeLists.txt index da1e1b5..2f80973 100644 --- a/src/mappersmanager/CMakeLists.txt +++ b/src/mappersmanager/CMakeLists.txt @@ -10,4 +10,9 @@ # $Revision$ file(GLOB mappers_list mappers/*.c) -add_library(mappermanager utils.c manager.c ${mappers_list} ) \ No newline at end of file + +if (COVERALLS) + set(COVERAGE_SRCS src/mappersmanager/manager.c src/mappersmanager/utils.c ${COVERAGE_SRCS} PARENT_SCOPE) +endif() + +add_library(mappermanager utils.c manager.c ${mappers_list} ) diff --git a/src/memorymanager/CMakeLists.txt b/src/memorymanager/CMakeLists.txt index d1a2c87..5d2ceb2 100644 --- a/src/memorymanager/CMakeLists.txt +++ b/src/memorymanager/CMakeLists.txt @@ -9,4 +9,8 @@ # $HeadURL$ # $Revision$ -add_library(memorymanager memory.c) \ No newline at end of file +if (COVERALLS) + set(COVERAGE_SRCS src/memorymanager/memory.c ${COVERAGE_SRCS} PARENT_SCOPE) +endif() + +add_library(memorymanager memory.c) diff --git a/src/os/unix/CMakeLists.txt b/src/os/unix/CMakeLists.txt index bc2b215..b199b18 100644 --- a/src/os/unix/CMakeLists.txt +++ b/src/os/unix/CMakeLists.txt @@ -9,6 +9,11 @@ # $HeadURL$ # $Revision$ +if (COVERALLS) + set(COVERAGE_SRCS src/os/unix/loadfile.c src/os/unix/graphics.c src/os/unix/sound.c src/os/unix/io.c ${COVERAGE_SRCS} PARENT_SCOPE) +endif() + + add_library(oslib loadfile.c graphics.c sound.c io.c) target_link_libraries(oslib glfw ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY}) diff --git a/src/pluginsmanager/CMakeLists.txt b/src/pluginsmanager/CMakeLists.txt index a0b0965..8ae184a 100644 --- a/src/pluginsmanager/CMakeLists.txt +++ b/src/pluginsmanager/CMakeLists.txt @@ -10,4 +10,9 @@ # $Revision$ file(GLOB plugins_list plugins/*.c) -add_library(pluginsmanager manager.c ${plugins_list}) \ No newline at end of file + +if (COVERALLS) + set(COVERAGE_SRCS src/pluginsmanager/manager.c ${COVERAGE_SRCS} PARENT_SCOPE) +endif() + +add_library(pluginsmanager manager.c ${plugins_list}) diff --git a/src/ppu/CMakeLists.txt b/src/ppu/CMakeLists.txt index c3b40b6..6d39434 100644 --- a/src/ppu/CMakeLists.txt +++ b/src/ppu/CMakeLists.txt @@ -10,4 +10,10 @@ # $Revision$ file(GLOB ppu_debug_list debug/*.c) -add_library(ppu ppu.c ppu.memory.c ${ppu_debug_list}) \ No newline at end of file + +if (COVERALLS) + set(COVERAGE_SRCS src/ppu/ppu.c src/ppu/ppu.memory.c ${COVERAGE_SRCS} PARENT_SCOPE) +endif() + + +add_library(ppu ppu.c ppu.memory.c ${ppu_debug_list})