1 cmake_minimum_required(VERSION 2.6)
4 set(CMAKE_MODULE_PATH "${alure_SOURCE_DIR}/cmake")
6 include(CheckCXXCompilerFlag)
8 find_package(OpenAL REQUIRED)
10 include_directories(${alure_SOURCE_DIR}/include/AL ${alure_SOURCE_DIR}/src ${alure_BINARY_DIR} ${OPENAL_INCLUDE_DIR})
12 option(ALURE_USE_RTTI "Enable run-time type information" OFF)
14 check_cxx_compiler_flag(-std=c++11 HAVE_STD_CXX11)
16 set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
19 check_cxx_compiler_flag(-Wall HAVE_WALL_SWITCH)
21 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
23 check_cxx_compiler_flag(-Wextra HAVE_WEXTRA_SWITCH)
24 if(HAVE_WEXTRA_SWITCH)
25 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
28 if(NOT ALURE_USE_RTTI)
29 check_cxx_compiler_flag(-fno-rtti HAVE_NO_RTTI_SWITCH)
30 if(HAVE_NO_RTTI_SWITCH)
31 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
33 check_cxx_compiler_flag(/GR- HAVE_GRX_SWITCH)
35 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
41 set(alure_srcs src/devicemanager.cpp
50 set(alure_libs ${OPENAL_LIBRARY})
56 include_directories(${OGG_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR})
57 set(alure_libs ${alure_libs} ${VORBIS_LIBRARIES} ${OGG_LIBRARIES})
58 set(alure_srcs ${alure_srcs} src/decoders/vorbisfile.cpp)
59 set(HAVE_VORBISFILE 1)
64 include_directories(${OGG_INCLUDE_DIR} ${FLAC_INCLUDE_DIR})
65 set(alure_libs ${alure_libs} ${FLAC_LIBRARIES} ${OGG_LIBRARIES})
66 set(alure_srcs ${alure_srcs} src/decoders/flac.cpp)
72 include_directories(${OGG_INCLUDE_DIR} ${OPUS_INCLUDE_DIR})
73 set(alure_libs ${alure_libs} ${OPUS_LIBRARIES} ${OGG_LIBRARIES})
74 set(alure_srcs ${alure_srcs} src/decoders/opusfile.cpp)
81 include_directories(${SNDFILE_INCLUDE_DIRS})
82 set(alure_libs ${alure_libs} ${SNDFILE_LIBRARIES})
83 set(alure_srcs ${alure_srcs} src/decoders/sndfile.cpp)
84 set(HAVE_LIBSNDFILE 1)
89 include_directories(${MPG123_INCLUDE_DIRS})
90 set(alure_libs ${alure_libs} ${MPG123_LIBRARIES})
91 set(alure_srcs ${alure_srcs} src/decoders/mpg123.cpp)
97 "${alure_SOURCE_DIR}/config.h.in"
98 "${alure_BINARY_DIR}/config.h")
101 add_library(alure2 SHARED ${alure_srcs})
102 target_link_libraries(alure2 ${alure_libs})
104 add_library(alure2_s STATIC ${alure_srcs})
105 set_property(TARGET alure2_s APPEND PROPERTY COMPILE_DEFINITIONS ALURE_STATIC_LIB)
108 add_executable(alure-enum examples/alure-enum.cpp)
109 target_link_libraries(alure-enum alure2)
111 add_executable(alure-play examples/alure-play.cpp)
112 target_link_libraries(alure-play alure2)
114 add_executable(alure-stream examples/alure-stream.cpp)
115 target_link_libraries(alure-stream alure2)
117 add_executable(alure-reverb examples/alure-reverb.cpp)
118 target_link_libraries(alure-reverb alure2)
120 add_executable(alure-hrtf examples/alure-hrtf.cpp)
121 target_link_libraries(alure-hrtf alure2)
125 add_executable(alure-physfs examples/alure-physfs.cpp)
126 set_property(TARGET alure-physfs APPEND PROPERTY INCLUDE_DIRECTORIES "${PHYSFS_INCLUDE_DIR}")
127 target_link_libraries(alure-physfs alure2 "${PHYSFS_LIBRARY}")
132 add_executable(alure-dumb examples/alure-dumb.cpp)
133 set_property(TARGET alure-dumb APPEND PROPERTY INCLUDE_DIRECTORIES "${DUMB_INCLUDE_DIRS}")
134 target_link_libraries(alure-dumb alure2 "${DUMB_LIBRARIES}")
138 if(NOT DEFINED LIB_SUFFIX)
142 install(TARGETS alure2 alure2_s
143 RUNTIME DESTINATION bin
144 LIBRARY DESTINATION "lib${LIB_SUFFIX}"
145 ARCHIVE DESTINATION "lib${LIB_SUFFIX}"