Code Monkey home page Code Monkey logo

wrappers's Issues

config.nims hack prevents using `nim c somewrapper` from outside nimterop repo

soloud wrapper relies on cpp files, and it works when running from inside wrappers repo because of config.nims hack which redefines the linker; however it'll fail if main profile file is outside this repo since that config file won't be applied anymore and you'll get:

Undefined symbols for architecture x86_64:
  "std::terminate()", referenced from:
      ___clang_call_terminate in soloud.cpp.o
      ___clang_call_terminate in soloud_bus.cpp.o
...

workaround

  • use nim cpp
  • copy over/pass on cmdline the linker flags from config.nims

proposal

  • build soloud into a shared library (or static lib, or both)
  • optionally, maybe use the soloud-recommended build (which requires using genie, another dependency...)
  • remove linker hack in wrappers/config.nims
  • remove linker hack in nimterop/config.nims

discussion: individual formula layout

Why not soloud.nim? Every directory will have wrapper.nim this way.

goals

  • a formula should be easy to import for client code, eg: import soloud
  • everything related to a formula should be self-contained in either a single file or a single dir but (preferably...) not both, eg not:
soloud.nim
./soloud/

https://github.com/dlang/phobos/blob/master/std/range/package.d

  • formulas should be able to evolve from single file to directory without breaking client code

proposal 1 (requires nim compiler support)

proposal 2 (without nim compiler support)

when upgrading from a single file foo.d to a directory foo/, we can do this:

  • before:
# in foo.nim:
# wrapper code goes here
  • after:
# in foo.nim:
# only 2 lines, eg:
import foo/wrapper
export wrapper

# in foo/wrapper.nim
# wrapper code goes here

# in foo/demo.nim
# demo code goes here

# etc: additional files specific to formula can be added

appveyor timed out

https://ci.appveyor.com/project/genotrance/wrappers/builds/22042563/job/7ki4r4i0xt0a5ali/messages
Build execution time has reached the maximum allowed time for your plan (60 minutes).

how's that even possible?

maybe it's a 1-off thing, let's see

Build started
git clone -q https://github.com/nimterop/wrappers.git /home/appveyor/projects/wrappers
git fetch -q origin +refs/pull/14/merge:
git checkout -qf FETCH_HEAD
Restoring build cache
Cache '/home/appveyor/binaries' - Restored
Running "install" scripts
set -e
set -u
if [ ! -e /home/appveyor/binaries ]; then echo $NIM_VERSION && mkdir /home/appveyor/binaries && cd /home/appveyor/binaries && curl -s -o nim-$NIM_VERSION.tar.xz https://nim-lang.org/download/nim-$NIM_VERSION.tar.xz && tar xJf nim-$NIM_VERSION.tar.xz && cd nim-$NIM_VERSION && sh build.sh && bin/nim c -d:release koch && ./koch boot -d:release && ./koch nimble -d:release; fi
export PATH=/home/appveyor/binaries/nim-$NIM_VERSION/bin:~/.nimble/bin:$PATH
cd $APPVEYOR_BUILD_FOLDER
Running "build_script" scripts
nimble install -y
  Verifying dependencies for [email protected]
    Prompt: No local packages.json found, download it from internet? -> [forced yes]
Downloading Official package list
    Success Package list downloaded.
 Installing cligen@>= 0.9.17
Downloading https://github.com/c-blake/cligen.git using git
  Verifying dependencies for [email protected]
 Installing [email protected]
   Success: cligen installed successfully.
 Installing nimterop@>= 0.1.0
Downloading https://github.com/genotrance/nimterop using git
  Verifying dependencies for [email protected]
 Installing regex@>= 0.10.0

replace all imports by relative imports to avoid conflicts

replace all imports by relative imports to avoid conflicts, eg in case multiple versions of wrappers are installed

proposal 1

robust but annoying as you need to compute relative paths for each import

import wrapperspkg/foo
=>
import "../../" / wrapperspkg/foo

proposal 2

implement support in Nim for:

import wrapperspkg/foo
=>
import root/wrapperspkg/foo # root of nimble pkg containing this file

which extends the existing special syntax import pkg/foo/bar

alternative names:
tpkg (ie: this pkg)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.