Skip to content

Commit 832e0c9

Browse files
update build
1 parent e62868a commit 832e0c9

File tree

4 files changed

+38
-41
lines changed

4 files changed

+38
-41
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,13 @@ jobs:
5050

5151
- name: Set up environment (Windows)
5252
if: runner.os == 'Windows'
53-
#uses: microsoft/setup-msbuild@v1.3.1
54-
uses: ilammy/msvc-dev-cmd@v1
55-
with:
56-
arch: x64
53+
uses: microsoft/setup-msbuild@v1.3.1
5754

5855
- name: Compute cache key
5956
id: cache-key
6057
shell: bash
6158
run: |
62-
echo "hash=${{ hashFiles(format('z3-{0}/**/*.*', steps.z3version.outputs.version_from_tag)) }}" >> $GITHUB_OUTPUT
59+
echo "hash=${{ hashFiles('.github/workflows/*.yaml', 'scripts/build.sh', format('z3-{0}/**/*.*', steps.z3version.outputs.version_from_tag)) }}" >> $GITHUB_OUTPUT
6360
6461
- name: Use cache key
6562
shell: bash

scripts/build.sh

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,46 +59,38 @@ else
5959
fi
6060

6161
###################################################################################################################
62-
# Move into Z3 dir
62+
# Move into Z3 dir, create build folder, and move into build folder
6363
###################################################################################################################
6464
cd "$Z3_DIR"
65+
mkdir -p "$BUILD_DIR"
66+
cd "$BUILD_DIR"
6567

6668
###################################################################################################################
67-
# Run python config script
69+
# Configure build system
6870
###################################################################################################################
6971
echo ""
70-
echo "[INFO] Attempting to bootstrap build via 'python'"
72+
echo "[INFO] Attempting to configure build system"
7173
echo ""
72-
if [[ "$PLATFORM" == "win32" ]]; then
73-
python scripts/mk_make.py --staticlib --single-threaded -x
74-
elif [[ "$PLATFORM" == "darwin" || "$PLATFORM" == "linux" ]]; then
75-
python scripts/mk_make.py --staticlib --single-threaded
76-
else
77-
echo ""
78-
echo "[ERROR] : Unrecognized platform"
79-
echo ""
80-
exit 1
81-
fi
8274

83-
###################################################################################################################
84-
# Move into build folder
85-
###################################################################################################################
86-
cd "$BUILD_DIR"
75+
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DZ3_BUILD_LIBZ3_SHARED=false ../
8776

8877
###################################################################################################################
8978
# Run 'make'
9079
###################################################################################################################
9180
echo ""
92-
echo "[INFO] Attempting to run build via 'make'"
81+
echo "[INFO] Attempting build"
9382
echo ""
94-
if [[ "$OSTYPE" == "msys" ]]; then
95-
nmake
96-
elif [[ "$OSTYPE" == "darwin"* ]]; then
97-
# Mac, use 'sysctl -n hw.logicalcpu' to get number of logical cores
98-
make -j$(sysctl -n hw.logicalcpu)
83+
if [[ "$PLATFORM" == "win32" ]]; then
84+
cmake --build . -- -m:"$NUMBER_OF_PROCESSORS"
85+
elif [[ "$PLATFORM" == "darwin" ]]; then
86+
cmake --build . -- -j$(sysctl -n hw.logicalcpu)
87+
elif [[ "$PLATFORM" == "linux" ]]; then
88+
cmake --build . --config Release -- -j$(nproc)
9989
else
100-
# Linux, use nproc to get number of logical cores.
101-
make -j$(nproc)
90+
echo ""
91+
echo "[ERROR] Unrecognized platform encountered while attempting to build"
92+
echo ""
93+
exit 1
10294
fi
10395

10496
###################################################################################################################
@@ -118,16 +110,28 @@ mkdir -p "$ARCHIVE_BIN_DIR"
118110
echo ""
119111
echo "[INFO] Copying build files into archive"
120112
echo ""
113+
121114
# Copy license
122115
echo " - Copying LICENSE"
123116
cp "$Z3_DIR/LICENSE.txt" "$ARCHIVE_DIR"
117+
124118
# Copy lib
125-
echo " - Copying libz3.a"
126-
cp "$BUILD_DIR/libz3.a" "$ARCHIVE_BIN_DIR"
119+
echo " - Copying libz3"
120+
if [[ "$PLATFORM" == "win32" ]]; then
121+
cp "$BUILD_DIR/libz3.lib" "$ARCHIVE_BIN_DIR"
122+
elif [[ "$PLATFORM" == "darwin" || "$PLATFORM" == "linux" ]]; then
123+
cp "$BUILD_DIR/libz3.a" "$ARCHIVE_BIN_DIR"
124+
else
125+
echo ""
126+
echo "[ERROR] Unrecognized platform encountered while copying libz3"
127+
echo ""
128+
exit 1
129+
fi
130+
127131
# Copy headers
128132
# I chose these headers bc that is what the official build provides.
129133
echo " - Copying header files"
130-
cp "$Z3_DIR/src/util/z3_version.h" "$ARCHIVE_INCLUDE_DIR"
134+
cp "$Z3_DIR/build/src/util/z3_version.h" "$ARCHIVE_INCLUDE_DIR"
131135
cp "$Z3_DIR/src/api/z3_v1.h" "$ARCHIVE_INCLUDE_DIR"
132136
cp "$Z3_DIR/src/api/z3_spacer.h" "$ARCHIVE_INCLUDE_DIR"
133137
cp "$Z3_DIR/src/api/z3_rcf.h" "$ARCHIVE_INCLUDE_DIR"
@@ -141,3 +145,6 @@ cp "$Z3_DIR/src/api/z3_api.h" "$ARCHIVE_INCLUDE_DIR"
141145
cp "$Z3_DIR/src/api/z3_algebraic.h" "$ARCHIVE_INCLUDE_DIR"
142146
cp "$Z3_DIR/src/api/z3.h" "$ARCHIVE_INCLUDE_DIR"
143147
cp "$Z3_DIR/src/api/c++/z3++.h" "$ARCHIVE_INCLUDE_DIR"
148+
149+
###################################################################################################################
150+
###################################################################################################################

z3-4.15.2/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ src/api/python/z3/z3consts.py
8181
src/api/python/z3/z3core.py
8282
src/ast/pattern/database.h
8383
src/util/version.h
84-
#src/util/z3_version.h
84+
src/util/z3_version.h
8585
src/api/java/Native.cpp
8686
src/api/java/Native.java
8787
src/api/java/enumerations/*.java

z3-4.15.2/src/util/z3_version.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)