Skip to content

Commit

Permalink
WASM: Optionally include ZLIB
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaikh-Ubaid committed Aug 25, 2022
1 parent 92b5d31 commit 2925474
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,21 @@ set(LPYTHON_BUILD_TO_WASM no
if (LPYTHON_BUILD_TO_WASM)
set(HAVE_BUILD_TO_WASM yes)
SET(WITH_WHEREAMI no)
SET(WITH_ZLIB no)
add_definitions("-DHAVE_BUILD_TO_WASM=1")
endif()

if (WITH_WHEREAMI)
add_definitions("-DHAVE_WHEREAMI=1")
endif()

# Find ZLIB with our custom finder before including LLVM since the finder for LLVM
# might search for ZLIB again and find the shared libraries instead of the static ones
find_package(StaticZLIB REQUIRED)
if (WITH_ZLIB)
add_definitions("-DHAVE_ZLIB=1")

# Find ZLIB with our custom finder before including LLVM since the finder for LLVM
# might search for ZLIB again and find the shared libraries instead of the static ones
find_package(StaticZLIB REQUIRED)
endif()

# LLVM
set(WITH_LLVM no CACHE BOOL "Build with LLVM support")
Expand Down
7 changes: 6 additions & 1 deletion src/lpython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ if (WITH_XEUS)
)
endif()
add_library(lpython_lib ${SRC})
target_link_libraries(lpython_lib asr lpython_runtime_static ZLIB::ZLIB)
target_link_libraries(lpython_lib asr lpython_runtime_static)

if (WITH_ZLIB)
target_link_libraries(lpython_lib ZLIB::ZLIB)
endif()

target_include_directories(lpython_lib BEFORE PUBLIC ${lpython_SOURCE_DIR}/src)
target_include_directories(lpython_lib BEFORE PUBLIC ${lpython_BINARY_DIR}/src)
if (WITH_XEUS)
Expand Down

0 comments on commit 2925474

Please sign in to comment.