Skip to content

Commit e6076f5

Browse files
committed
Add usage instructions to the README
1 parent bc296db commit e6076f5

File tree

1 file changed

+50
-9
lines changed

1 file changed

+50
-9
lines changed

README.md

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ ScalaZ3 for Z3 version 4.3.2 can be found in the branch `Z3-4.3.2`.
88
Switch to the branch `2.9.x` for Scala 2.9 support (Z3 version 4.3.2).
99

1010
Compiling ScalaZ3
11-
=================
11+
-----------------
1212

1313
You should have Java and SBT 0.13.x installed.
1414

15-
Mac & Unix
16-
----------
15+
### Mac & Unix
1716

1817
Run
1918

@@ -28,10 +27,9 @@ For testing, run
2827

2928
sbt +test
3029

31-
Windows
32-
-------
30+
### Windows
3331

34-
### Prerequisites
32+
#### Prerequisites
3533

3634
Install Visual Studio Community edition 2015
3735
Make sure to have the following:
@@ -52,7 +50,7 @@ We were able to successfully package and test ScalaZ3 with the MinGW 64bit compi
5250
Esception: seh
5351
Build revision: 2
5452

55-
### Packaging instructions
53+
#### Packaging instructions
5654

5755
Open the native x64 command prompt (available in the start menu under the Visual Studio folder)
5856

@@ -63,7 +61,7 @@ Now navigate to the scalaz3 folder and type:
6361
The JAR files will be in `target/scala-2.XX/scalaz3_2.XX-3.0.jar` and will contain the shared library
6462
dependencies.
6563

66-
### Test your package.
64+
#### Test your package.
6765

6866
Run
6967

@@ -73,4 +71,47 @@ If this does not work, check that `lib-bin/scalaz3.dll` is a correctly set up 64
7371

7472
dumpbin /headers lib-bin/scalaz3.dll | findstr machine
7573

76-
The output should be (x64). If you encounter any other issue, please let us know.
74+
The output should be (x64). If you encounter any other issue, please let us know.
75+
76+
Using ScalaZ3
77+
-------------
78+
79+
### On a single operating system / architecture
80+
81+
Create a folder named `unmanaged` at the same level as your `build.sbt` file, and copy the JAR file in `target/scala-2.XX/scalaz3_2.XX-3.0.jar` into it.
82+
83+
Then add, the following lines to your `build.sbt` file:
84+
85+
```scala
86+
unmanagedJars in Compile += {
87+
baseDirectory.value / "unmanaged" / s"scalaz3_${scalaBinaryVersion.value}-3.0.jar"
88+
}
89+
```
90+
91+
### On multiple operating systems / architectures
92+
93+
If you want to use ScalaZ3 in a project which must support various operating systems and architectures, you will have to compile ScalaZ3 on each of those systems/architectures, following the instructions above.
94+
95+
Make sure to name the resulting JAR files as `scalaz3-[osName]-[osArch]-[scalaBinaryVersion].jar`, where:
96+
97+
- `[osName]` is one of: `mac`, `win`, `unix`.
98+
- `[osArch]` corresponds to `System.getProperty("sun.arch.data.model")`, ie. `x64`, `fds`, etc.
99+
- `[scalaBinaryVersion]` is one of: `2.11`, `2.12`, `2.13`.
100+
101+
Create a folder named `unmanaged` at the same level as your `build.sbt` file, and copy the aforementioned JAR files into it.
102+
103+
Add the following lines to your `build.sbt` file:
104+
105+
```scala
106+
val osInf = Option(System.getProperty("os.name")).getOrElse("")
107+
108+
val isUnix = osInf.indexOf("nix") >= 0 || osInf.indexOf("nux") >= 0
109+
val isWindows = osInf.indexOf("Win") >= 0
110+
val isMac = osInf.indexOf("Mac") >= 0
111+
112+
val osName = if (isWindows) "win" else if (isMac) "mac" else "unix"
113+
114+
unmanagedJars in Compile += {
115+
baseDirectory.value / "unmanaged" / s"scalaz3-$osName-$osArch-${scalaBinaryVersion.value}.jar"
116+
}
117+
```

0 commit comments

Comments
 (0)