Skip to content

Commit

Permalink
skip XRSound build if irrKlang libraries not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mschweiger committed Aug 10, 2021
1 parent 17c2db1 commit e3fff10
Showing 1 changed file with 45 additions and 37 deletions.
82 changes: 45 additions & 37 deletions Sound/XRSound/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,48 @@ else()
endif()
set(IRRKLANG_LIB "${IRRKLANG_LIB_DIR}/irrKlang.lib")

set(ASSET_DIR ${CMAKE_CURRENT_SOURCE_DIR}/XRSound/assets)
set(SOLUTION_DIR ${CMAKE_CURRENT_SOURCE_DIR}/XRSound/src)
set(IRRKLANG_DLL_DIR ${IRRKLANG_DIR})
# Deploy assets
file(GLOB config_files ${ASSET_DIR}/XRSound/*.cfg)

add_custom_target(XRSound_assets ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${ORBITER_BINARY_ROOT_DIR}/Doc
COMMAND ${CMAKE_COMMAND} -E make_directory ${ORBITER_BINARY_ROOT_DIR}/XRSound
COMMAND ${CMAKE_COMMAND} -E make_directory ${ORBITER_BINARY_SDK_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy ${config_files} ${ORBITER_BINARY_ROOT_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy ${ASSET_DIR}/XRSound/ReadMe.txt ${ORBITER_BINARY_ROOT_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy "${ASSET_DIR}/Doc/XRSound User Manual.pdf" ${ORBITER_BINARY_ROOT_DIR}/Doc/
COMMAND ${CMAKE_COMMAND} -E copy ${SOLUTION_DIR}/XRSoundLib/XRSound.h ${ORBITER_BINARY_SDK_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy ${IRRKLANG_BIN_DIR}/ikpMP3.dll ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${IRRKLANG_BIN_DIR}/ikpFlac.dll ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${IRRKLANG_BIN_DIR}/irrKlang.dll ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${ASSET_DIR}/XRSound/Default ${ORBITER_BINARY_ROOT_DIR}/XRSound/Default
)

install(DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/XRSound
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}
)
install(DIRECTORY ${ORBITER_BINARY_SDK_DIR}/XRSound
DESTINATION ${ORBITER_INSTALL_SDK_DIR}
)
install(DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/XRSound/Default
DESTINATION ${ORBITER_BINARY_ROOT_DIR}/XRSound
)
install(FILES "${ORBITER_BINARY_ROOT_DIR}/Doc/XRSound User Manual.pdf"
DESTINATION ${ORBITER_INSTALL_DOC_DIR}/
)
install(FILES ${ORBITER_BINARY_ROOT_DIR}/ikpMP3.dll ${ORBITER_BINARY_ROOT_DIR}/ikpFlac.dll ${ORBITER_BINARY_ROOT_DIR}/irrKlang.dll
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/
)

add_subdirectory(XRSound)
if(EXISTS ${IRRKLANG_LIB})

set(ASSET_DIR ${CMAKE_CURRENT_SOURCE_DIR}/XRSound/assets)
set(SOLUTION_DIR ${CMAKE_CURRENT_SOURCE_DIR}/XRSound/src)
set(IRRKLANG_DLL_DIR ${IRRKLANG_DIR})
# Deploy assets
file(GLOB config_files ${ASSET_DIR}/XRSound/*.cfg)

add_custom_target(XRSound_assets ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${ORBITER_BINARY_ROOT_DIR}/Doc
COMMAND ${CMAKE_COMMAND} -E make_directory ${ORBITER_BINARY_ROOT_DIR}/XRSound
COMMAND ${CMAKE_COMMAND} -E make_directory ${ORBITER_BINARY_SDK_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy ${config_files} ${ORBITER_BINARY_ROOT_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy ${ASSET_DIR}/XRSound/ReadMe.txt ${ORBITER_BINARY_ROOT_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy "${ASSET_DIR}/Doc/XRSound User Manual.pdf" ${ORBITER_BINARY_ROOT_DIR}/Doc/
COMMAND ${CMAKE_COMMAND} -E copy ${SOLUTION_DIR}/XRSoundLib/XRSound.h ${ORBITER_BINARY_SDK_DIR}/XRSound/
COMMAND ${CMAKE_COMMAND} -E copy ${IRRKLANG_BIN_DIR}/ikpMP3.dll ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${IRRKLANG_BIN_DIR}/ikpFlac.dll ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${IRRKLANG_BIN_DIR}/irrKlang.dll ${ORBITER_BINARY_ROOT_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${ASSET_DIR}/XRSound/Default ${ORBITER_BINARY_ROOT_DIR}/XRSound/Default
)

install(DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/XRSound
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}
)
install(DIRECTORY ${ORBITER_BINARY_SDK_DIR}/XRSound
DESTINATION ${ORBITER_INSTALL_SDK_DIR}
)
install(DIRECTORY ${ORBITER_BINARY_ROOT_DIR}/XRSound/Default
DESTINATION ${ORBITER_BINARY_ROOT_DIR}/XRSound
)
install(FILES "${ORBITER_BINARY_ROOT_DIR}/Doc/XRSound User Manual.pdf"
DESTINATION ${ORBITER_INSTALL_DOC_DIR}/
)
install(FILES ${ORBITER_BINARY_ROOT_DIR}/ikpMP3.dll ${ORBITER_BINARY_ROOT_DIR}/ikpFlac.dll ${ORBITER_BINARY_ROOT_DIR}/irrKlang.dll
DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/
)

add_subdirectory(XRSound)

else()

message(WARNING "irrKlang libraries not found: not building XRSound module.")

endif()

0 comments on commit e3fff10

Please sign in to comment.