Skip to content

Commit

Permalink
Convert EMSCRIPTEN build target to an OBJECT library
Browse files Browse the repository at this point in the history
Previously, the EMSCRIPTEN build target was an executable, which is not ideal for modular code reuse. Changing it to an OBJECT library facilitates better modularization and allows for more flexibility in linking with other targets. This update preserves existing library settings and options.
  • Loading branch information
matthew-mccall committed Aug 29, 2024
1 parent ecc8f6e commit bbe8b49
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@ set(OasisC_SOURCES
src/Divide.cpp)

if (DEFINED EMSCRIPTEN)
add_executable(OasisC ${OasisC_SOURCES})
target_link_libraries(OasisC PUBLIC embind)
target_link_options(OasisC PUBLIC
--no-entry
"-sSINGLE_FILE"
"-sEXPORTED_RUNTIME_METHODS=ccall,cwrap"
"-sENVIRONMENT='web'"
"--emit-tsd OasisC.d.ts")
add_library(OasisC OBJECT ${OasisC_SOURCES})
else ()
add_library(OasisC ${OasisC_SOURCES})
endif ()
Expand Down

0 comments on commit bbe8b49

Please sign in to comment.