Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ jobs:
- run: nimble install -y
- run: testament p "tests/t*.nim"
- run: nimble test
- run: nimble gendoc

4 changes: 1 addition & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ jobs:

- uses: jiro4989/setup-nim-action@v2
with:
# TODO use 2.2.0 when it's released - gendoc is broken om 2.0.8
nim-version: devel
use-nightlies: true
nim-version: stable
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: nimble install -y
- name: Set CI config github
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/docstest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
pull_request:
branches:
- master
push:
branches:
- devel
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup nim
uses: jiro4989/setup-nim-action@v2
with:
nim-version: stable
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: nimble install -y
- run: nimble gendoc

13 changes: 2 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# Trick to ignore extension-less binaries
# Ignore all
*

# Unignore all with extensions
!*.*

# Unignore all dirs
!*/

htmldocs

docs/
!docs/index.html
bin
testresults/
nimcache/
4 changes: 1 addition & 3 deletions config.nims
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
when not compiles(nimVersion):
const nimVersion = (major: NimMajor, minor: NimMinor, patch: NimPatch)

when nimVersion >= (1, 3, 3):
# https://github.com/nim-lang/Nim/commit/9502e39b634eea8e04f07ddc110b466387f42322
switch("backend", "cpp")
switch("backend", "cpp")

when defined(macosx):
switch("cc", "gcc")
21 changes: 6 additions & 15 deletions cppstl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export std_complex
import cppstl/std_pair
export std_pair

when not defined(cpp):
{.error: "C++ backend required to use STL wrapper".}
# std=c++11 at least needed
# {.passC: "-std=c++11".}

## Nim wrapper for C++ STL :
## * ``std::vector`` mapped to ``CppVector``
## * ``std::basic_string`` mapped to ``CppBasicString``
Expand All @@ -32,17 +37,6 @@ runnableExamples:
stdstr.replace(startportion, endportion, "QW")
assert stdstr == "QWERTYUIOP"

runnableExamples:
import cppstl
import math
var vec = initCppVector[float64]()
for i in 0..<5:
vec.push_back(sqrt(i.float64))
assert vec[0] == sqrt 0.0
assert vec[1] == sqrt 1.0
assert vec[2] == sqrt 2.0
assert vec[3] == sqrt 3.0

runnableExamples:
import cppstl
import complex
Expand All @@ -51,7 +45,4 @@ runnableExamples:
assert conj_z.real == z.real
assert conj_z.imag == -z.imag

when not defined(cpp):
{.error: "C++ backend required to use STL wrapper".}
# std=c++11 at least needed
# {.passC: "-std=c++11".}

1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!DOCTYPE HTML>

<html>

<head>
Expand Down
11 changes: 10 additions & 1 deletion tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
bin
# Trick to ignore extension-less binary
# *
# !*.*

bin/
# List of tests
tstring
tvector
tcomplex
tpair
tsmart_ptrs
tdestructor_codegen_bug
3 changes: 2 additions & 1 deletion tests/config.nims
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
switch("path", "$projectDir/..")
# switch("cc", "clang")
switch("backend", "cpp")
switch("cc", "gcc")
when not defined(testing):
switch("outdir", "tests/bin")

switch("cc", "gcc")