CMakeLists.txt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. cmake_minimum_required (VERSION 2.6)
  2. project (OXYGINESOUND)
  3. set(OXYGINESOUND_INCLUDE_DIRS
  4. ${CMAKE_CURRENT_SOURCE_DIR}/src
  5. ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/tremor/Tremor
  6. ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/libogg/include
  7. )
  8. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  9. message(status ${OXYGINESOUND_INCLUDE_DIRS})
  10. set(OXYGINESOUND_DEFINITIONS
  11. -DOXYGINE_SOUND=1)
  12. set(SRC
  13. src/sound/ResSound.cpp
  14. src/sound/ResSound.h
  15. src/sound/Sound.h
  16. src/sound/SoundInstance.cpp
  17. src/sound/SoundInstance.h
  18. src/sound/SoundPlayer.cpp
  19. src/sound/SoundPlayer.h
  20. src/sound/SoundSystem.cpp
  21. src/sound/SoundSystem.h
  22. src/sound/null/SoundSystemNull.cpp
  23. src/sound/null/SoundSystemNull.h
  24. src/sound/null/SoundNull.cpp
  25. src/sound/null/SoundNull.h
  26. src/sound/null/SoundHandleNull.cpp
  27. src/sound/null/SoundHandleNull.h
  28. )
  29. if(EMSCRIPTEN)
  30. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  31. set(SRC ${SRC}
  32. src/sound/emscripten/SoundSystemEmscripten.h
  33. src/sound/emscripten/SoundSystemEmscripten.cpp
  34. src/sound/emscripten/SoundHandleEmscripten.h
  35. src/sound/emscripten/SoundHandleEmscripten.cpp
  36. src/sound/emscripten/SoundEmscripten.h
  37. src/sound/emscripten/SoundEmscripten.cpp
  38. )
  39. else(EMSCRIPTEN)
  40. add_subdirectory(dependencies/tremor tremor)
  41. set (SRC ${SRC}
  42. src/sound/OggStream.cpp
  43. src/sound/OggStream.h
  44. src/sound/MemoryStream.cpp
  45. src/sound/MemoryStream.h
  46. src/sound/WavStream.cpp
  47. src/sound/WavStream.h
  48. src/sound/oal/SoundHandleOAL.cpp
  49. src/sound/oal/SoundHandleOAL.h
  50. src/sound/oal/SoundOAL.cpp
  51. src/sound/oal/SoundOAL.h
  52. src/sound/oal/SoundSystemOAL.cpp
  53. src/sound/oal/SoundSystemOAL.h
  54. src/sound/oal/StreamingSoundHandleOAL.cpp
  55. src/sound/oal/StreamingSoundHandleOAL.h
  56. src/sound/oal/StaticSoundHandleOAL.cpp
  57. src/sound/oal/StaticSoundHandleOAL.h
  58. src/sound/oal/StaticStreamOAL.cpp
  59. src/sound/oal/StaticStreamOAL.h
  60. )
  61. endif(EMSCRIPTEN)
  62. add_library(oxygine-sound STATIC ${SRC})
  63. if(EMSCRIPTEN)
  64. set(OXYGINESOUND_LIBS
  65. oxygine-sound)
  66. set(linkFlags "-Wno-warn-absolute-paths")
  67. set_target_properties(oxygine-sound PROPERTIES LINK_FLAGS "${linkFlags}")
  68. else(EMSCRIPTEN)
  69. set(OXYGINESOUND_INCLUDE_DIRS ${OXYGINESOUND_INCLUDE_DIRS}
  70. ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/openal/include)
  71. if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  72. set(OXYGINESOUND_LIBS oxygine-sound -lopenal tremor -logg)
  73. else()
  74. set(LIBOGG libogg_static)
  75. if (MSVC)
  76. if(NOT (MSVC_VERSION LESS 1900))
  77. set(LIBOGG ${LIBOGG}_vs2013)
  78. endif()
  79. endif()
  80. set(OXYGINESOUND_LIBS
  81. ${CMAKE_CURRENT_SOURCE_DIR}/libs/win32/OpenAL32.lib
  82. ${CMAKE_CURRENT_SOURCE_DIR}/libs/win32/${LIBOGG}.lib
  83. tremor
  84. oxygine-sound)
  85. endif()
  86. endif(EMSCRIPTEN)
  87. include_directories(${OXYGINESOUND_INCLUDE_DIRS})
  88. target_link_libraries(oxygine-sound -lopenal)
  89. target_link_libraries(oxygine-sound -logg)
  90. #target_link_libraries(oxyginemagicparticles)
  91. set(OXYGINESOUND_INCLUDE_DIRS
  92. ${CMAKE_CURRENT_SOURCE_DIR}/src)
  93. set(OXYGINESOUND_INCLUDE_DIRS ${OXYGINESOUND_INCLUDE_DIRS} PARENT_SCOPE)
  94. set(OXYGINESOUND_LIBS ${OXYGINESOUND_LIBS} PARENT_SCOPE)
  95. set(OXYGINESOUND_DEFINITIONS ${OXYGINESOUND_DEFINITIONS} PARENT_SCOPE)