CMakeLists.txt 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #
  2. # TI-NES CMake
  3. #
  4. # Created by Manoel TRAPIER.
  5. # Copyright (c) 2003-2008 986Corp. All rights reserved.
  6. #
  7. # $LastChangedDate$
  8. # $Author$
  9. # $HeadURL$
  10. # $Revision$
  11. include_directories($(TINES_SOURCE_DIR)/include)
  12. ##########################
  13. # Configurations variables
  14. ##########################
  15. set(PPU_ISPAL OFF CACHE BOOL "When switch to ON the PPU is in PAL mode, else it will act as a NTSC one.")
  16. set(Q6502_DEBUGGER OFF CACHE BOOL "Activate the Quick6502 debugger?")
  17. set(USE_SOUND OFF CACHE BOOL "Activate the sound?")
  18. set(DETECT_BUS_CONFLICT OFF CACHE BOOL "Activate the bus conflit detector? (Could slow down the emulator a lot.)")
  19. set(USE_EFENCE OFF CACHE BOOL "Use electricfence memory debugger?")
  20. set(USE_PROFILING OFF CACHE BOOL "Use profiling tools? (Will slow down a lot.)")
  21. set(USE_ALLEGRO ON CACHE BOOL "Use Allegro backend" FORCE)
  22. IF(NOT CMAKE_BUILD_TYPE)
  23. SET(CMAKE_BUILD_TYPE Debug CACHE STRING
  24. "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
  25. FORCE)
  26. ENDIF(NOT CMAKE_BUILD_TYPE)
  27. if (APPLE)
  28. SET (CMAKE_FIND_FRAMEWORK LAST)
  29. endif (APPLE)
  30. ##########################
  31. # Link & Compile flags
  32. ##########################
  33. add_definitions (-DNO_DECIMAL -DFAST_RDOP)
  34. SET ( CMAKE_EXE_LINKER_FLAGS "-mmacosx-version-min=10.4")
  35. if (PPU_ISPAL)
  36. add_definitions (-DISPAL)
  37. else (PPU_ISPAL)
  38. add_definitions (-DISNTSC)
  39. endif (PPU_ISPAL)
  40. if (Q6502_DEBUGGER)
  41. add_definitions (-DDEBUG)
  42. endif (Q6502_DEBUGGER)
  43. if (USE_SOUND)
  44. add_definitions (-DUSE_SOUND)
  45. endif (USE_SOUND)
  46. if (DETECT_BUS_CONFLICT)
  47. add_definitions (-DDETECT_BUS_CONFLICT)
  48. endif (DETECT_BUS_CONFLICT)
  49. if (USE_EFENCE)
  50. if (CMAKE_BUILD_TYPE MATCHES Release)
  51. SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Debug info is forced" FORCE)
  52. else(CMAKE_BUILD_TYPE)
  53. SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Debug info is forced" FORCE)
  54. endif(CMAKE_BUILD_TYPE)
  55. endif (USE_EFENCE)
  56. if (USE_PROFILING)
  57. if (CMAKE_BUILD_TYPE MATCHES Rel)
  58. SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Debug info is forced" FORCE)
  59. else(CMAKE_BUILD_TYPE MATCHES Rel)
  60. SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Debug info is forced" FORCE)
  61. endif(CMAKE_BUILD_TYPE MATCHES Rel)
  62. set(CMAKE_C_FLAGS -pg)
  63. endif (USE_PROFILING)
  64. if (APPLE)
  65. include_directories(BEFORE /usr/include)
  66. endif (APPLE)
  67. #if the CPU is LSB set the define
  68. if (CMAKE_SYSTEM_PROCESSOR MATCHES i386 OR CMAKE_SYSTEM_PROCESSOR MATCHES [aA][rR][mM])
  69. add_definitions (-DLSB_FIRST)
  70. endif (CMAKE_SYSTEM_PROCESSOR MATCHES i386 OR CMAKE_SYSTEM_PROCESSOR MATCHES [aA][rR][mM])
  71. #Add release mode extra C Flags
  72. set (CMAKE_C_FLAGS_RELEASE "-fomit-frame-pointer -funroll-loops -Wall ${CMAKE_C_FLAGS_RELEASE}")
  73. set (CMAKE_C_FLAGS_RELWITHDEBINFO "-fomit-frame-pointer -funroll-loops -Wall ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
  74. add_subdirectory(apu)
  75. add_subdirectory(corecpu)
  76. add_subdirectory(mappersmanager)
  77. add_subdirectory(memorymanager)
  78. add_subdirectory(pluginsmanager)
  79. add_subdirectory(ppu)
  80. if (TARGET_TI68k)
  81. add_subdirectory(os/ti68k)
  82. elseif (APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  83. add_subdirectory(os/macos)
  84. elseif (UNIX)
  85. add_subdirectory(os/win32)
  86. else (TARGET_TI68k)
  87. #So we target UNIX like OS
  88. add_subdirectory(os/unix)
  89. endif (TARGET_TI68k)
  90. add_library (main main.c paddle.c NESCarts.c)
  91. add_executable(tines main.c)
  92. set(CMAKE_FIND_FRAMEWORK LAST)
  93. find_library(ALLEGROLIB allegro)
  94. find_library(PTHREADLIB pthread)
  95. if (USE_EFENCE)
  96. find_library(EFENCELIB efence)
  97. target_link_libraries(tines ${EFENCELIB})
  98. endif (USE_EFENCE)
  99. if (USE_ALLEGRO)
  100. target_link_libraries(tines debug alld-main)
  101. target_link_libraries(tines optimized alleg-main)
  102. if (APPLE)
  103. find_library(COCOALIB Cocoa)
  104. target_link_libraries(tines ${COCOALIB})
  105. endif (APPLE)
  106. endif (USE_ALLEGRO)
  107. target_link_libraries(tines main apu corecpu mappermanager memorymanager pluginsmanager ppu oslib ${ALLEGROLIB} ${PTHREADLIB})