CMakeLists.txt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #
  2. # peTI-NESulator CMake
  3. #
  4. # Created by Manoël TRAPIER.
  5. # Copyright (c) 2003-2018 986-Studio. All rights reserved.
  6. #
  7. # $LastChangedDate$
  8. # $Author$
  9. # $HeadURL$
  10. # $Revision$
  11. ##########################
  12. # Configurations variables
  13. ##########################
  14. set(PPU_ISPAL OFF CACHE BOOL "When switch to ON the PPU is in PAL mode, else it will act as a NTSC one.")
  15. set(Q6502_DEBUGGER OFF CACHE BOOL "Activate the Quick6502 debugger?")
  16. set(USE_SOUND OFF CACHE BOOL "Activate the sound?")
  17. set(DETECT_BUS_CONFLICT OFF CACHE BOOL "Activate the bus conflit detector? (Could slow down the emulator a lot.)")
  18. set(USE_EFENCE OFF CACHE BOOL "Use electricfence memory debugger?")
  19. set(USE_PROFILING OFF CACHE BOOL "Use profiling tools? (Will slow down a lot.)")
  20. set(USE_ALLEGRO ON CACHE BOOL "Use Allegro backend")
  21. option(COVERALLS "Generate coveralls data" OFF)
  22. ##########################
  23. # Link & Compile flags
  24. ##########################
  25. set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Werror ${PLATFORM_FLAGS}")
  26. set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Werror ${PLATFORM_FLAGS}")
  27. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/external/coveralls-cmake/cmake)
  28. add_executable(petines main.c paddle.c NESCarts.c)
  29. add_definitions(-DNO_DECIMAL)
  30. if (PPU_ISPAL)
  31. add_definitions(-DISPAL)
  32. else (PPU_ISPAL)
  33. add_definitions(-DISNTSC)
  34. endif (PPU_ISPAL)
  35. if (Q6502_DEBUGGER)
  36. add_definitions(-DDEBUG)
  37. endif (Q6502_DEBUGGER)
  38. if (USE_SOUND)
  39. add_definitions(-DUSE_SOUND)
  40. endif (USE_SOUND)
  41. if (DETECT_BUS_CONFLICT)
  42. add_definitions(-DDETECT_BUS_CONFLICT)
  43. endif (DETECT_BUS_CONFLICT)
  44. if (USE_PROFILING)
  45. if (CMAKE_BUILD_TYPE MATCHES Rel)
  46. SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Debug info is forced" FORCE)
  47. else (CMAKE_BUILD_TYPE MATCHES Rel)
  48. SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Debug info is forced" FORCE)
  49. endif (CMAKE_BUILD_TYPE MATCHES Rel)
  50. set(CMAKE_C_FLAGS -pg)
  51. endif (USE_PROFILING)
  52. if (COVERALLS)
  53. add_definitions(-DRUN_COVERAGE)
  54. include(Coveralls)
  55. coveralls_turn_on_coverage()
  56. endif ()
  57. include_directories(include)
  58. add_subdirectory(apu)
  59. add_subdirectory(corecpu)
  60. add_subdirectory(mappersmanager)
  61. add_subdirectory(memorymanager)
  62. add_subdirectory(pluginsmanager)
  63. add_subdirectory(ppu)
  64. if (TARGET_TI68k)
  65. add_subdirectory(os/ti68k)
  66. elseif (WIN32)
  67. add_subdirectory(os/win32)
  68. else (TARGET_TI68k)
  69. add_subdirectory(os/unix)
  70. endif (TARGET_TI68k)
  71. #find_library(PTHREADLIB pthread)
  72. if (COVERALLS)
  73. set(COVERAGE_SRCS src/main.c src/paddle.c src/NESCarts.c ${COVERAGE_SRCS})
  74. # Create the coveralls target.
  75. coveralls_setup(
  76. "${COVERAGE_SRCS}" # The source files.
  77. ON # If we should upload.
  78. ) # (Optional) Alternate project cmake module path.
  79. endif ()
  80. target_link_libraries(petines apu corecpu mappermanager memorymanager pluginsmanager ppu oslib)# ${PTHREADLIB})
  81. add_test(NAME petines_test_1 COMMAND $<TARGET_FILE:petines> ${PROJECT_SOURCE_DIR}/data/bad_apple_2.nes)
  82. add_test(NAME petines_test_2 COMMAND $<TARGET_FILE:petines> ${PROJECT_SOURCE_DIR}/data/trollburner_demo.nes)