/CMakeLists.txt

http://game-music-emu.googlecode.com/ · CMake · 91 lines · 58 code · 20 blank · 13 comment · 18 complexity · a77b7f75f14586f47ab65b7e9f9a39af MD5 · raw file

  1. # CMake project definition file.
  2. project(libgme)
  3. include (CheckCXXCompilerFlag)
  4. set(GME_VERSION 0.6.0 CACHE INTERNAL "libgme Version")
  5. # 2.6+ always assumes FATAL_ERROR, but 2.4 and below don't.
  6. # Of course, 2.4 might work, in which case you're welcome to drop
  7. # down the requirement, but I can't test that.
  8. cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
  9. # Default emulators to build (all of them! ;)
  10. if (NOT DEFINED USE_GME_AY)
  11. SET(USE_GME_AY 1 CACHE BOOL "Enable support for Spectrum ZX music emulation")
  12. endif()
  13. if (NOT DEFINED USE_GME_GBS)
  14. SET(USE_GME_GBS 1 CACHE BOOL "Enable support for Game Boy music emulation")
  15. endif()
  16. if (NOT DEFINED USE_GME_GYM)
  17. SET(USE_GME_GYM 1 CACHE BOOL "Enable Sega MegaDrive/Genesis music emulation")
  18. endif()
  19. if (NOT DEFINED USE_GME_HES)
  20. SET(USE_GME_HES 1 CACHE BOOL "Enable PC Engine/TurboGrafx-16 music emulation")
  21. endif()
  22. if (NOT DEFINED USE_GME_KSS)
  23. SET(USE_GME_KSS 1 CACHE BOOL "Enable MSX or other Z80 systems music emulation")
  24. endif()
  25. if (NOT DEFINED USE_GME_NSF)
  26. SET(USE_GME_NSF 1 CACHE BOOL "Enable NES NSF music emulation")
  27. endif()
  28. if (NOT DEFINED USE_GME_NSFE)
  29. SET(USE_GME_NSFE 1 CACHE BOOL "Enable NES NSFE and NSF music emulation")
  30. endif()
  31. if (NOT DEFINED USE_GME_SAP)
  32. SET(USE_GME_SAP 1 CACHE BOOL "Enable Atari SAP music emulation")
  33. endif()
  34. if (NOT DEFINED USE_GME_SPC)
  35. SET(USE_GME_SPC 1 CACHE BOOL "Enable SNES SPC music emulation")
  36. endif()
  37. if (NOT DEFINED USE_GME_VGM)
  38. SET(USE_GME_VGM 1 CACHE BOOL "Enable Sega VGM/VGZ music emulation")
  39. endif()
  40. if (USE_GME_NSFE AND NOT USE_GME_NSF)
  41. MESSAGE(" -- NSFE support requires NSF, enabling NSF support. --")
  42. SET(USE_GME_NSF 1 CACHE BOOL "Enable NES NSF music emulation" FORCE)
  43. endif()
  44. # Check for GCC "visibility" support.
  45. if (CMAKE_COMPILER_IS_GNUCXX)
  46. check_cxx_compiler_flag (-fvisibility=hidden __LIBGME_TEST_VISIBILITY)
  47. set (ENABLE_VISIBILITY OFF)
  48. if (__LIBGME_TEST_VISIBILITY)
  49. # get the gcc version
  50. exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)
  51. string (REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
  52. # gcc <4.1 had poor support for symbol visibility
  53. if ((${_gcc_version} VERSION_GREATER "4.1") OR (${_gcc_version} VERSION_EQUAL "4.1"))
  54. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
  55. set (ENABLE_VISIBILITY ON)
  56. add_definitions (-DLIBGME_VISIBILITY)
  57. # GCC >= 4.2 also correctly supports making inline members have hidden
  58. # visibility by default.
  59. if ((${_gcc_version} VERSION_GREATER "4.2") OR (${_gcc_version} VERSION_EQUAL "4.2"))
  60. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
  61. endif()
  62. endif()
  63. endif() # test visibility
  64. endif (CMAKE_COMPILER_IS_GNUCXX)
  65. # Cache this result
  66. set( LIBGME_HAVE_GCC_VISIBILITY ${ENABLE_VISIBILITY} CACHE BOOL "GCC support for hidden visibility")
  67. # Shared library defined here
  68. add_subdirectory(gme)
  69. # EXCLUDE_FROM_ALL adds build rules but keeps it out of default build
  70. add_subdirectory(player EXCLUDE_FROM_ALL)
  71. add_subdirectory(demo EXCLUDE_FROM_ALL)