CMakeLists.txt 3.1 KB

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