Skip to content

Commit dbed93f

Browse files
committed
Merge branch 'main' into leanPrinter
2 parents adb2aef + 25e52a4 commit dbed93f

File tree

254 files changed

+5113
-1694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+5113
-1694
lines changed

.github/actions/install-dependencies/action.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ runs:
3030
flex \
3131
libfl-dev \
3232
flexc++
33-
python3 -m pip install pexpect setuptools toml
33+
python3 -m pip install --user pexpect setuptools toml
3434
# Make ImageVersion accessible as env.image_version. Environment
3535
# variables of the runner are not automatically imported:
3636
#
@@ -73,7 +73,7 @@ runs:
7373
pkgconfig \
7474
flex \
7575
gnu-sed
76-
python3 -m pip install pexpect setuptools toml
76+
python3 -m pip install --user pexpect setuptools toml
7777
# Make ImageVersion accessible as env.image_version. Environment
7878
# variables of the runner are not automatically imported:
7979
#
@@ -91,9 +91,10 @@ runs:
9191
run: |
9292
echo "::group::Install software for Python bindings"
9393
python3 -m pip install -q --upgrade pip
94-
python3 -m pip install pytest scikit-build
94+
python3 -m pip install --user pytest scikit-build
9595
python3 -m pytest --version
96-
python3 -m pip install Cython==0.29.*
96+
python3 -m pip install --user Cython==0.29.*
97+
# Add binary path of user site-packages to PATH
9798
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
9899
echo "::endgroup::"
99100
@@ -103,8 +104,8 @@ runs:
103104
run: |
104105
echo "::group::Install software for Python packaging"
105106
python3 -m pip install -q --upgrade pip
106-
python3 -m pip install twine
107-
python3 -m pip install -U urllib3 requests
107+
python3 -m pip install --user twine
108+
python3 -m pip install --user -U urllib3 requests
108109
echo "::endgroup::"
109110
110111
- name: Install software for documentation
@@ -113,7 +114,7 @@ runs:
113114
run: |
114115
echo "::group::Install software for documentation"
115116
sudo apt-get install -y doxygen python3-docutils python3-jinja2
116-
python3 -m pip install \
117+
python3 -m pip install --user \
117118
sphinxcontrib-bibtex sphinx-tabs sphinx-rtd-theme breathe \
118119
sphinxcontrib-programoutput
119120
echo "::endgroup::"

.github/workflows/docs_upload.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,28 @@ jobs:
8080
echo "HASH=$HASH" >> $GITHUB_ENV
8181
echo "ISRELEASE=$ISRELEASE" >> $GITHUB_ENV
8282
83+
- name: Update versions
84+
continue-on-error: true
85+
run: |
86+
python3 -m pip install beautifulsoup4 lxml
87+
88+
eval $(ssh-agent -s)
89+
ssh-add - <<< "${{ secrets.CVC5_DOCS_RELEASE_TOKEN }}"
90+
91+
git clone git@github.com:cvc5/docs.git target-releases/
92+
93+
TARGET_DIR=
94+
if [ "$ISRELEASE" = true ]; then
95+
TARGET_DIR=target-releases/$NAME
96+
else
97+
TARGET_DIR=target-releases/cvc5-main
98+
fi
99+
cp -r docs-new "${TARGET_DIR}"
100+
pushd target-releases/
101+
python3 genversions.py
102+
popd
103+
cp -rf "${TARGET_DIR}" docs-new
104+
83105
- name: Update docs
84106
continue-on-error: true
85107
run: |
@@ -115,19 +137,11 @@ jobs:
115137
continue-on-error: true
116138
run: |
117139
if [ "$ISRELEASE" = true ]; then
118-
python3 -m pip install beautifulsoup4 lxml
119-
120-
eval $(ssh-agent -s)
121-
ssh-add - <<< "${{ secrets.CVC5_DOCS_RELEASE_TOKEN }}"
122-
123-
git clone git@github.com:cvc5/docs.git target-releases/
124-
cp -r docs-new target-releases/$NAME
125140
cd target-releases/
126141
127142
rm -f latest
128143
ln -s $NAME latest
129144
130-
python3 genversions.py
131145
git add .
132146
133147
git commit -m "Update docs for $NAME"

CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,29 @@ option(BUILD_DOCS "Build Api documentation")
132132
cvc5_option(STATIC_BINARY "Link against static system libraries \
133133
(enabled by default for static builds)")
134134

135+
# Custom flags for WebAssembly compilation
136+
set(WASM_FLAGS "" CACHE STRING "Link flags for the WebAssembly binary generation")
137+
set(WASM "OFF" CACHE STRING "Use a specific extension for WebAssembly compilation")
138+
139+
# Make sure no other available value will be assigned to this variable
140+
if(NOT(WASM STREQUAL "WASM" OR WASM STREQUAL "JS" OR WASM STREQUAL "HTML" OR WASM STREQUAL "OFF"))
141+
message(FATAL_ERROR "${WASM} is not a valid wasm flag value.")
142+
endif()
143+
144+
if(WASM STREQUAL "OFF")
145+
set(WASM_FLAGS "")
146+
set(CONFIGURE_CMD_WRAPPER "")
147+
# If it's a wasm compilation, but isn't using the right flags
148+
elseif(BUILD_SHARED_LIBS OR NOT(STATIC_BINARY) OR NOT(ENABLE_AUTO_DOWNLOAD))
149+
message(FATAL_ERROR "Use --static, --static-binary and --auto-download flags for WebAssembly compilation. GMP will not compile with shared libraries.")
150+
else()
151+
set(CONFIGURE_CMD_WRAPPER emconfigure)
152+
set(TOOLCHAIN_PREFIX wasm64-unknown-emscripten)
153+
string(TOLOWER ".${WASM}" WASM_EXTENSION)
154+
set(CMAKE_EXECUTABLE_SUFFIX ${WASM_EXTENSION})
155+
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${WASM_FLAGS}")
156+
endif()
157+
135158
#-----------------------------------------------------------------------------#
136159
# Internal cmake variables
137160

INSTALL.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,56 @@ The built binary ``cvc5.exe`` is located in ``<build_dir>/bin`` and the cvc5
5454
library can be found in ``<build_dir>/lib``.
5555

5656

57+
WebAssembly Compilation
58+
^^^^^^^^^^^^^^^^^^^^^^^^
59+
60+
Compiling cvc5 to WebAssembly needs the Emscripten SDK (version 3.1.18 or
61+
latter). Setting up emsdk can be done as follows:
62+
63+
.. code:: bash
64+
65+
git clone https://github.com/emscripten-core/emsdk.git
66+
cd emsdk
67+
./emsdk install <version> # <version> = '3.1.18' is preferable, but
68+
# <version> = 'latest' has high chance of working
69+
./emsdk activate <version>
70+
source ./emsdk_env.sh # Activate PATH and other environment variables in the
71+
# current terminal. Whenever Emscripten is going to be
72+
# used this command needs to be called before because
73+
# emsdk doesn't insert the binaries paths directly in
74+
# the system PATH variable.
75+
76+
Refer to the `emscripten dependencies list <https://emscripten.org/docs/getting_started/downloads.html#platform-specific-notes>`_
77+
to ensure that all required dependencies are installed on the system.
78+
79+
Then, in the cvc5 directory:
80+
81+
.. code:: bash
82+
83+
./configure.sh --static --static-binary --auto-download --wasm=<value> --wasm-flags='<emscripten flags>' <configure options...>
84+
85+
cd <build_dir> # default is ./build
86+
make # use -jN for parallel build with N threads
87+
88+
``--wasm`` can take three values: ``WASM`` (will generate the wasm file for cvc5), ``JS``
89+
(not only the wasm, but the .js glue code for web integration) and ``HTML`` (both
90+
the last two files and also an .html file which supports the run of the glue
91+
code).
92+
93+
``--wasm-flags`` take a string wrapped by a single quote containing the
94+
`emscripten flags <https://github.com/emscripten-core/emscripten/blob/main/src/settings.js>`_,
95+
which modifies how the wasm and glue code are built and how they behave. An ``-s``
96+
should precede each flag.
97+
98+
For example, to generate modularized glue code, use:
99+
100+
.. code:: bash
101+
102+
./configure.sh --static --static-binary --auto-download --wasm=JS --wasm-flags='-s MODULARIZE' --name=prod
103+
104+
cd prod
105+
make # use -jN for parallel build with N threads
106+
57107
Build dependencies
58108
------------------
59109

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ This file contains a summary of important user-visible changes.
66
of the solver version.
77
- Support for bit-vector overflow detection operators:
88
* `BITVECTOR_UADDO` unsigned addition overflow detection
9+
* `BITVECTOR_SADDO` signed addition overflow detection
910
* `BITVECTOR_UMULO` unsigned multiplication overflow detection
1011
* `BITVECTOR_SMULO` signed multiplication overflow detection
12+
* `BITVECTOR_USUBO` unsigned subtraction overflow detection
13+
* `BITVECTOR_SSUBO` signed subtraction overflow detection
14+
* `BITVECTOR_SDIVO` signed division overflow detection
15+
16+
- Support for Web Assembly compilation using Emscripten.
1117

1218
**Changes**
1319

THANKS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,7 @@ Thanks to:
5454
- Fabian Wolff in 2016 for fixing several spelling mistakes.
5555

5656
- Justin Xu for contributing to refactoring CVC4's preprocessing infrastructure.
57+
58+
- Vinicius Braga Freire for a modification in the proof printer for dot format,
59+
allowing the clusterization of the proof into logic groups. Furthermore,for
60+
implementing a built-in Web Assembly compilation method in 2022.

cmake/FindANTLR3.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ if(NOT ANTLR3_FOUND_SYSTEM)
127127
<INSTALL_DIR>/share/config.sub
128128
<SOURCE_DIR>/config.sub
129129
CONFIGURE_COMMAND
130-
<SOURCE_DIR>/configure
130+
${CONFIGURE_CMD_WRAPPER} <SOURCE_DIR>/configure
131131
${compilers}
132132
--with-pic
133133
--disable-antlrdebug

cmake/FindGMP.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ if(NOT GMP_FOUND_SYSTEM)
113113
URL_HASH SHA1=2dcf34d4a432dbe6cce1475a835d20fe44f75822
114114
CONFIGURE_COMMAND
115115
${CONFIGURE_ENV}
116-
<SOURCE_DIR>/configure
116+
${CONFIGURE_CMD_WRAPPER} <SOURCE_DIR>/configure
117117
${LINK_OPTS}
118118
--prefix=<INSTALL_DIR>
119119
--with-pic

cmake/FindPoly.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ if(NOT Poly_FOUND_SYSTEM)
156156
sed -i.orig
157157
"s,add_subdirectory(test/polyxx),add_subdirectory(test/polyxx EXCLUDE_FROM_ALL),g"
158158
<SOURCE_DIR>/CMakeLists.txt
159+
COMMAND
160+
# LibPoly declares a variable `enabled_count` whose value is only written
161+
# and never read. Newer versions of Clang throw a warning for this, which
162+
# aborts the compilation when -Wall is enabled.
163+
sed -i.orig
164+
"/enabled_count/d"
165+
<SOURCE_DIR>/src/upolynomial/factorization.c
159166
${POLY_PATCH_CMD}
160167
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
161168
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>

configure.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ Optional Path to Optional Packages:
6969
CMake Options (Advanced)
7070
-DVAR=VALUE manually add CMake options
7171
72+
Wasm Options
73+
--wasm=VALUE set compilation extension for WebAssembly <WASM, JS or HTML>
74+
--wasm-flags='STR' Emscripten flags used in the WebAssembly binary compilation
75+
7276
EOF
7377
exit 0
7478
}
@@ -134,6 +138,9 @@ ipo=default
134138

135139
glpk_dir=default
136140

141+
wasm=default
142+
wasm_flags=""
143+
137144
#--------------------------------------------------------------------------#
138145

139146
cmake_opts=""
@@ -272,6 +279,12 @@ do
272279
--dep-path) die "missing argument to $1 (try -h)" ;;
273280
--dep-path=*) dep_path="${dep_path};${1##*=}" ;;
274281

282+
--wasm) wasm=WASM ;;
283+
--wasm=*) wasm="${1##*=}" ;;
284+
285+
--wasm-flags) die "missing argument to $1 (try -h)" ;;
286+
--wasm-flags=*) wasm_flags="${1#*=}" ;;
287+
275288
-D*) cmake_opts="${cmake_opts} $1" ;;
276289

277290
-*) die "invalid option '$1' (try -h)";;
@@ -370,9 +383,18 @@ fi
370383
&& cmake_opts="$cmake_opts -DCMAKE_INSTALL_PREFIX=$install_prefix"
371384
[ -n "$program_prefix" ] \
372385
&& cmake_opts="$cmake_opts -DPROGRAM_PREFIX=$program_prefix"
386+
[ "$wasm" != default ] \
387+
&& cmake_opts="$cmake_opts -DWASM=$wasm"
373388

374389
root_dir=$(pwd)
375390

391+
cmake_wrapper=
392+
cmake_opts=($cmake_opts)
393+
if [ "$wasm" == "WASM" ] || [ "$wasm" == "JS" ] || [ "$wasm" == "HTML" ] ; then
394+
cmake_wrapper=emcmake
395+
cmake_opts=(${cmake_opts[@]} -DWASM_FLAGS="${wasm_flags}")
396+
fi
397+
376398
# The cmake toolchain can't be changed once it is configured in $build_dir.
377399
# Thus, remove $build_dir and create an empty directory.
378400
[ $win64 = ON ] && [ -e "$build_dir" ] && rm -r "$build_dir"
@@ -383,5 +405,5 @@ cd "$build_dir"
383405

384406
[ -e CMakeCache.txt ] && rm CMakeCache.txt
385407
build_dir_escaped=$(echo "$build_dir" | sed 's/\//\\\//g')
386-
cmake "$root_dir" $cmake_opts 2>&1 | \
408+
$cmake_wrapper cmake "$root_dir" "${cmake_opts[@]}" 2>&1 | \
387409
sed "s/^Now just/Now change to '$build_dir_escaped' and/"

0 commit comments

Comments
 (0)