Files
basis_universal/webgl/transcoder/CMakeLists.txt
Preston Tamkin 39b5c5bc42 Modularize emscripten build.
By default, emscripten's generated javascript modules lives in the global object "Module'.

This makes it impossible to load multiple emscripten modules on the same page.

In attempt to avoid namespace collision, this change modularizes the emscripten build so the Module is instead called 'BASIS'.

Many target applications for Basis are likely to already be using other emscripten modules.

Testing:

The existing webgl/(texture|gltf) pages have been updated to use the new name and seem to operate as before
2019-06-11 23:42:49 -07:00

22 lines
690 B
CMake

cmake_minimum_required(VERSION 3.0)
project(basisu_transcoder_js)
if (EMSCRIPTEN)
set(CMAKE_CXX_STANDARD 11)
add_executable(basis_transcoder.js
../../transcoder/basisu_transcoder.cpp
basis_wrappers.cpp
)
target_compile_definitions(basis_transcoder.js PRIVATE NDEBUG BASISD_SUPPORT_BC7=0)
target_compile_options(basis_transcoder.js PRIVATE -O3)
target_include_directories(basis_transcoder.js PRIVATE ../../transcoder)
set_target_properties(basis_transcoder.js PROPERTIES
OUTPUT_NAME "basis_transcoder"
SUFFIX ".js"
LINK_FLAGS "--bind -s ALLOW_MEMORY_GROWTH=1 -O3 -s ASSERTIONS=0 -s MALLOC=emmalloc -s MODULARIZE=1 -s EXPORT_NAME=BASIS ")
endif()