Skip to content

Commit

Permalink
Abort if nim != 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vitreo12 committed Mar 29, 2024
1 parent d9da9f5 commit b105a96
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.2

1) Abort if using a nim version != 1.6.0.

## 0.4.1

1) Remove the use of `nm` to check the presence of `perform` / `sample` blocks.
Expand Down
27 changes: 2 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,7 @@ Also, a basic syntax highlighting [VSCode](https://code.visualstudio.com/) plugi
1) [nim](https://nim-lang.org/)
2) [git](https://git-scm.com/)

### **Linux**

Refer to your distribution's package manager and make sure you've got `nim` and `git` installed.

### **MacOS**

To install dependencies on MacOS it is suggested to use a package manager like [brew](https://brew.sh/).

After `brew` has been installed, run the following command in the `Terminal` app to install `nim`:

brew install nim

Then, make sure that the `~/.nimble/bin` directory is set in your shell `$PATH`.
If using bash (the default shell in MacOS), you can simply run this command:

echo 'export PATH=$PATH:~/.nimble/bin' >> ~/.bash_profile

### **Windows:**

To install dependencies on Windows it is suggested to use a package manager like [chocolatey](https://community.chocolatey.org/).

After `chocolatey` has been installed, open `PowerShell` as administrator and run this command to install `nim` and `git`:

choco install nim git -y
Note that `omni` only supports `nim` version 1.6.0. It is recommended to install it via [choosenim](https://github.com/dom96/choosenim).

## **Installation**

Expand All @@ -59,7 +36,7 @@ Run `omni -h` to get help on all the available flags.

When running the `omni` compiler, the output is either a static or shared library (depending on the `--lib` flag). Along with it, an `omni.h` file (depending on the `--exportHeader` flag) containing all the callable functions in the shared/static library will be exported.

omni ~/.nimble/pkgs/omni-0.4.1/examples/OmniSaw.omni -o:./
omni ~/.nimble/pkgs/omni-0.4.2/examples/OmniSaw.omni -o:./

This command will compile an antialiased sawtooth oscillator (part of the examples) to a shared library (`libOmniSaw.so/dylib/dll`), together with a header file (`omni.h`), in the current folder.

Expand Down
7 changes: 7 additions & 0 deletions omni.nim
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,15 @@ proc parseAndPrintCompilationString(msg : string) : bool =

return false

proc isCorrectNimVersion(): bool =
let (nimVersion, _) = execCmdEx("nim --version")
return nimVersion.contains("1.6.0")

#Actual compiler
proc omni_single_file(is_multi : bool = false, fileFullPath : string, outName : string = "", outDir : string = "", lib : string = "shared", architecture : string = "native", compiler : string = default_compiler, performBits : string = "32/64", wrapper : string = "", define : seq[string] = @[], importModule : seq[string] = @[], passNim : seq[string] = @[],exportHeader : bool = true, exportIO : bool = false, silent : bool = false) : int =
if not isCorrectNimVersion():
printError("Invalid nim version. Only 1.6.0 is currently supported. Switch your active nim compiler with choosenim.")
return 1

var
omniFile = splitFile(fileFullPath)
Expand Down
2 changes: 1 addition & 1 deletion omni.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

version = "0.4.1"
version = "0.4.2"
author = "Francesco Cameli"
description = "omni is a DSL for low-level audio programming."
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion omni_lang/omni_lang.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

version = "0.4.1"
version = "0.4.2"
author = "Francesco Cameli"
description = "omni_lang"
license = "MIT"
Expand Down

0 comments on commit b105a96

Please sign in to comment.