PageRenderTime 22ms CodeModel.GetById 10ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

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