diff --git a/CMakeLists.txt b/CMakeLists.txt index b01571e93..5e166d357 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,13 +6,23 @@ set(PRIMESIEVE_SOVERSION "11.0.0") # Build options ###################################################### option(BUILD_PRIMESIEVE "Build primesieve binary" ON) -option(BUILD_SHARED_LIBS "Build shared libprimesieve" ON) option(BUILD_STATIC_LIBS "Build static libprimesieve" ON) option(BUILD_DOC "Build C/C++ API documentation" OFF) option(BUILD_MANPAGE "Regenerate man page using a2x" OFF) option(BUILD_EXAMPLES "Build example programs" OFF) option(BUILD_TESTS "Build test programs" OFF) +# By default we enable building the shared libprimesieve library. +# However, the Emscripten WebAssembly compiler does not +# support shared libraries, hence we disable building the +# shared libprimesieve when using Emscripten. +get_property(SHARED_LIBS_SUPPORTED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) +if(SHARED_LIBS_SUPPORTED) + option(BUILD_SHARED_LIBS "Build shared libprimesieve" ON) +else() + option(BUILD_SHARED_LIBS "Build shared libprimesieve" OFF) +endif() + option(WITH_MULTIARCH "Enable runtime dispatching to fastest supported CPU instruction set" ON) option(WITH_MSVC_CRT_STATIC "Link primesieve.lib with /MT instead of the default /MD" OFF) diff --git a/ChangeLog b/ChangeLog index 1970bdc09..37bac9170 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Changes in version 11.0, 16/10/2022 +Changes in version 11.0, 02/12/2022 =================================== The primesieve major version has been increased from 8 to 11 in order @@ -22,6 +22,7 @@ primesieve_skipto(iter, start, stop) excludes the start number requires up to 2x less start number corrections (e.g. start-1) compared to primesieve_skipto(). +* CMakeLists.txt: Improve Emscripten WebAssembly support. * iterator.cpp: Add new primesieve::iterator::jump_to(). * iterator.cpp: Fix use after free in primesieve::iterator::clear(). * iterator-c.cpp: Add new primesieve_jump_to().