CMakeLists.txt 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. set (CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-parameter -Werror ${PLATFORM_FLAGS}")
  34. set (CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Werror ${PLATFORM_FLAGS}")
  35. add_definitions (-DNO_DECIMAL -DFAST_RDOP)
  36. SET ( CMAKE_EXE_LINKER_FLAGS "-mmacosx-version-min=10.4")
  37. if (PPU_ISPAL)
  38. add_definitions (-DISPAL)
  39. else (PPU_ISPAL)
  40. add_definitions (-DISNTSC)
  41. endif (PPU_ISPAL)
  42. if (Q6502_DEBUGGER)
  43. add_definitions (-DDEBUG)
  44. endif (Q6502_DEBUGGER)
  45. if (USE_SOUND)
  46. add_definitions (-DUSE_SOUND)
  47. endif (USE_SOUND)
  48. if (DETECT_BUS_CONFLICT)
  49. add_definitions (-DDETECT_BUS_CONFLICT)
  50. endif (DETECT_BUS_CONFLICT)
  51. if (USE_EFENCE)
  52. if (CMAKE_BUILD_TYPE MATCHES Release)
  53. SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Debug info is forced" FORCE)
  54. else(CMAKE_BUILD_TYPE)
  55. SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Debug info is forced" FORCE)
  56. endif(CMAKE_BUILD_TYPE)
  57. endif (USE_EFENCE)
  58. if (USE_PROFILING)
  59. if (CMAKE_BUILD_TYPE MATCHES Rel)
  60. SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Debug info is forced" FORCE)
  61. else(CMAKE_BUILD_TYPE MATCHES Rel)
  62. SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Debug info is forced" FORCE)
  63. endif(CMAKE_BUILD_TYPE MATCHES Rel)
  64. set(CMAKE_C_FLAGS -pg)
  65. endif (USE_PROFILING)
  66. if (APPLE)
  67. include_directories(BEFORE /usr/include)
  68. endif (APPLE)
  69. #if the CPU is LSB set the define
  70. if (CMAKE_SYSTEM_PROCESSOR MATCHES i386 OR CMAKE_SYSTEM_PROCESSOR MATCHES [aA][rR][mM])
  71. add_definitions (-DLSB_FIRST)
  72. endif (CMAKE_SYSTEM_PROCESSOR MATCHES i386 OR CMAKE_SYSTEM_PROCESSOR MATCHES [aA][rR][mM])
  73. #Add release mode extra C Flags
  74. set (CMAKE_C_FLAGS_RELEASE "-fomit-frame-pointer -funroll-loops -Wall ${CMAKE_C_FLAGS_RELEASE}")
  75. set (CMAKE_C_FLAGS_RELWITHDEBINFO "-fomit-frame-pointer -funroll-loops -Wall ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
  76. add_subdirectory(apu)
  77. add_subdirectory(corecpu)
  78. add_subdirectory(mappersmanager)
  79. add_subdirectory(memorymanager)
  80. add_subdirectory(pluginsmanager)
  81. add_subdirectory(ppu)
  82. if (TARGET_TI68k)
  83. add_subdirectory(os/ti68k)
  84. elseif (APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  85. add_subdirectory(os/macos)
  86. elseif (UNIX)
  87. add_subdirectory(os/unix)
  88. else (TARGET_TI68k)
  89. #So we target UNIX like OS
  90. add_subdirectory(os/win32)
  91. endif (TARGET_TI68k)
  92. add_library (main main.c paddle.c NESCarts.c)
  93. add_executable(tines main.c)
  94. set(CMAKE_FIND_FRAMEWORK LAST)
  95. find_library(ALLEGROLIB allegro)
  96. find_library(PTHREADLIB pthread)
  97. if (USE_EFENCE)
  98. find_library(EFENCELIB efence)
  99. target_link_libraries(tines ${EFENCELIB})
  100. endif (USE_EFENCE)
  101. if (USE_ALLEGRO)
  102. target_link_libraries(tines debug alld-main)
  103. # target_link_libraries(tines)
  104. if (APPLE)
  105. find_library(COCOALIB Cocoa)
  106. target_link_libraries(tines ${COCOALIB})
  107. endif (APPLE)
  108. endif (USE_ALLEGRO)
  109. target_link_libraries(tines main apu corecpu mappermanager memorymanager pluginsmanager ppu oslib ${ALLEGROLIB} ${PTHREADLIB})