Skip to content

Commit

Permalink
Update CMakeLists.txt to support Emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
danoli3 authored Feb 15, 2024
1 parent 8e42eef commit 91201e0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,24 @@ if (FMT_TEST)
add_subdirectory(test)
endif ()

if(EMSCRIPTEN)
set(FMT_WASM_SOURCES
${FMT_SOURCES}
${FMT_HEADERS}
)
add_executable(fmt_wasm
${FMT_WASM_SOURCES}
)
target_include_directories(fmt_wasm PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
set_target_properties(fmt_wasm PROPERTIES COMPILE_FLAGS "-Os -s SIDE_MODULE=1 ")
set_target_properties(fmt_wasm PROPERTIES LINK_FLAGS "-Os -s WASM=1 -s SIDE_MODULE=1 -s STANDALONE_WASM --no-entry")
set(CMAKE_EXECUTABLE_SUFFIX ".wasm")

endif()


# Control fuzzing independent of the unit tests.
if (FMT_FUZZ)
add_subdirectory(test/fuzzing)
Expand Down

0 comments on commit 91201e0

Please sign in to comment.