-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
The title says it all. Instead of having to manually build libsndfile on the cmd line, we can simply have cmake do it for us.
Here is the snippet of code that needs to be added:
Note, I would make a PR for this but I've already made some changes to the source code and I feel like this is such a small change that doesn't warrant a full PR. Perhaps one of the main contributors of the project can eventually add this to main stream? This does make the config times a big bigger, and the logs aren't as clean anymore, but imo it beats having to do it manually. Anyways, feel free to modify this if it doesn't comply without vision!
# ---------------- libdmusic ----------------
# Disable unused utilities
set(DMUSIC_BUILD_UTILS OFF CACHE BOOL "" FORCE)
set(DMUSIC_BUILD_DMRENDER OFF CACHE BOOL "" FORCE)
set(DMUSIC_BUILD_DMPLAY OFF CACHE BOOL "" FORCE)
set(DMUSIC_BUILD_DLS2SF OFF CACHE BOOL "" FORCE)
set(DMUSIC_BUILD_SAMPLEDUMP OFF CACHE BOOL "" FORCE)
if(MSVC)
set(SNDFILE_INSTALL_DIR ${CMAKE_BINARY_DIR})
set(SNDFILE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/lib/libdmusic/utils/dls2sf/lib/libsndfile)
set(SNDFILE_BUILD_DIR ${CMAKE_BINARY_DIR}/build-libsndfile)
message(STATUS "Building bundled libsndfile...")
file(MAKE_DIRECTORY ${SNDFILE_BUILD_DIR})
execute_process(
COMMAND ${CMAKE_COMMAND}
-D CMAKE_INSTALL_PREFIX=${SNDFILE_INSTALL_DIR}
${SNDFILE_SOURCE_DIR}
WORKING_DIRECTORY ${SNDFILE_BUILD_DIR}
RESULT_VARIABLE result
)
if(result)
message(FATAL_ERROR "Failed configuring libsndfile")
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} --build . --target install --config Release
WORKING_DIRECTORY ${SNDFILE_BUILD_DIR}
RESULT_VARIABLE result
)
if(result)
message(FATAL_ERROR "Failed building libsndfile")
endif()
list(PREPEND CMAKE_PREFIX_PATH ${SNDFILE_INSTALL_DIR})
endif()
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/libdmusic)
include_directories(${CMAKE_SOURCE_DIR}/lib/libdmusic/include)
target_link_libraries(engine dmusic)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels