fluidsynth-emscripten
fluidsynth-emscripten copied to clipboard
Standardise dependency management with vcpkg
Merging correct branch, initially #10.
Successfully building libsndfile for issue https://github.com/jet2jet/fluidsynth-emscripten/issues/9
The CMakeLists.txt is currently written to succeed despite not finding packages. Ideally it should fail when a package is not found. Why build for something if it lacks the feature we want?
VCPKG provides ".pc" files required by pkg_check_modules()
I've added CMakePresets.json to simplify build scripts in makefile.
Effect of changes:
- Require VCPKG dependency installation to build consistency between computers.
- Disable most features by default - except
BUILD_SHARED_LIBSfor wasm build. - Do not build if dependencies cannot be found - for consistent build.
Thanks for the PR. I successfully built libfluidsynth.js with libsndfile.
In my environment, it is necessary to run commands like this:
mkdir build-with-sndfile # or any directory name
cd build-with-sndfile
# These two lines seem to be necessary for vcpkg to detect compilers correctly
export CC=emcc
export CXX=em++
cmake -DCMAKE_TOOLCHAIN_FILE=<path-to-vcpkg>/scripts/buildsystems/vcpkg.cmake -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=<path-to-emscripten>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -Denable-aufile=off -Denable-oss=off -Denable-libsndfile=on -DCMAKE_BUILD_TYPE=Release ..
If you can, please write building instruction (with vcpkg) to README.md.