I've tried building libFLAC++ for a while now using emscripten. I added
# FLAC/CMakeLists.txt
if(DEFINED EMSCRIPTEN)
target_link_options(FLAC++ PRIVATE
--emit-tsd "./interface.d.ts"
)
endif()
And I built using
emcmake cmake ../flac -DINSTALL_MANPAGES=OFF -DWITH_OGG=OFF -DBUILD_SHARED_LIBS=ON
emmake make
And that seems to successfully build the executable exports, but libFLAC++
is still built as a .a
static library. So when I try to build
emcc libFLAC++.a -lembind --emit-tsd "./interface.d.ts"
The generated a.out.js
seems incorrect, and the only typing that is generated is
// TypeScript bindings for emscripten-generated code. Automatically generated at compile time.
declare namespace RuntimeExports {
let HEAPF32: any;
let HEAPF64: any;
let HEAP_DATA_VIEW: any;
let HEAP8: any;
let HEAPU8: any;
let HEAP16: any;
let HEAPU16: any;
let HEAP32: any;
let HEAPU32: any;
let HEAP64: any;
let HEAPU64: any;
}
interface WasmModule {
}
export type MainModule = WasmModule & typeof RuntimeExports;
set(CMAKE_EXECUTABLE_SUFFIX ".html")
# or
set(CMAKE_EXECUTABLE_SUFFIX ".js")
# or
set(CMAKE_EXECUTABLE_SUFFIX ".ts")
Is completely unrelated and does nothing.
Same with changing CMAKE_SHARED_LIBRARY_SUFFIX
and CMAKE_STATIC_LIBRARY_SUFFIX