fluidsynth-emscripten icon indicating copy to clipboard operation
fluidsynth-emscripten copied to clipboard

Standardise dependency management with vcpkg

Open MengLinMaker opened this issue 1 year ago • 1 comments

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_LIBS for wasm build.
  • Do not build if dependencies cannot be found - for consistent build.

MengLinMaker avatar Oct 04 '24 01:10 MengLinMaker

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.

jet2jet avatar Oct 08 '24 11:10 jet2jet