Skip to content

Commit

Permalink
adapt for pyodide built
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
  • Loading branch information
NikolajBjorner committed Nov 20, 2024
1 parent 012fc1b commit 10d9c81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pyodide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
cd src/api/python
CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CXXFLAG="${CXXFLAGS}" ~/env/bin/pyodide build --exports whole_archive
env:
CFLAGS: "-fexceptions -s DISABLE_EXCEPTION_CATCHING=0 -pthread -s USE_PTHREADS=1 -g2 -s SAFE_HEAP=0 -s PTHREAD_POOL_SIZE=0 -s PTHREAD_POOL_SIZE_STRICT=0"
LDFLAGS: "-fexceptions -s WASM_BIGINT -s -pthread -s USE_PTHREADS=1"
CXXFLAGS: "-fexceptions -pthread -s USE_PTHREADS=1 -s DISABLE_EXCEPTION_CATCHING=0"
CFLAGS: "-fexceptions -s DISABLE_EXCEPTION_CATCHING=0 -pthread -s USE_PTHREADS=1 -g2 -s SAFE_HEAP=0 -s PTHREAD_POOL_SIZE=0 -s PTHREAD_POOL_SIZE_STRICT=0 -latomic"
LDFLAGS: "-fexceptions -s WASM_BIGINT -s -pthread -s USE_PTHREADS=1 -latomic"
CXXFLAGS: "-fexceptions -pthread -s USE_PTHREADS=1 -s DISABLE_EXCEPTION_CATCHING=0 -latomic"

- name: Setup env-pyodide
run: |
Expand Down
5 changes: 4 additions & 1 deletion src/api/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class LibError(Exception):
SRC_DIR = SRC_DIR_LOCAL if os.path.exists(SRC_DIR_LOCAL) else SRC_DIR_REPO

IS_SINGLE_THREADED = False
ENABLE_LTO = True

IS_PYODIDE = 'PYODIDE_ROOT' in os.environ and os.environ.get('_PYTHON_HOST_PLATFORM', '').startswith('emscripten')

Expand All @@ -43,6 +44,7 @@ class LibError(Exception):
build_env['CXXFLAGS'] = build_env.get('CXXFLAGS', '') + " -fexceptions"
build_env['LDFLAGS'] = build_env.get('LDFLAGS', '') + " -fexceptions"
IS_SINGLE_THREADED = True
ENABLE_LTO = False
# build with pthread doesn't work. The WASM bindings are also single threaded.

else:
Expand Down Expand Up @@ -122,6 +124,7 @@ def _z3_version():

def _configure_z3():
global IS_SINGLE_THREADED
global ENABLE_LTO
# bail out early if we don't need to do this - it forces a rebuild every time otherwise
if os.path.exists(BUILD_DIR):
return
Expand All @@ -136,7 +139,7 @@ def _configure_z3():
'CMAKE_BUILD_TYPE' : 'Release',
'Z3_BUILD_EXECUTABLE' : True,
'Z3_BUILD_LIBZ3_SHARED' : True,
'Z3_LINK_TIME_OPTIMIZATION' : True,
'Z3_LINK_TIME_OPTIMIZATION' : ENABLELTO,
'WARNINGS_AS_ERRORS' : 'SERIOUS_ONLY',
# Disable Unwanted Options
'Z3_USE_LIB_GMP' : False, # Is default false in python build
Expand Down

0 comments on commit 10d9c81

Please sign in to comment.