From 083d747302600711e61553c49aae88ccd89f12cb Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 16 Sep 2019 22:00:59 +0300 Subject: [PATCH] V.js: on linux -lm is needed --- .travis.yml | 28 ++++++++++++++++++++++++---- compiler/cc.v | 5 +++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 942bedc685..4cfcfb9ed7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,10 @@ matrix: dist: xenial sudo: required addons: + snaps: + - name: node + channel: latest/edge + confinement: classic apt: sources: - ubuntu-toolchain-r-test @@ -75,11 +79,27 @@ script: ./v test v fi - | - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then + if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then + ## aliases do not work for some reason in travis, just use full commands :-| + echo "Nodejs version:" + snap run node --version # Build hi.js - echo "println('Hello from V.js')" > hi.js - ./v -o hi.js hi.v && node hi.js - + echo "fn main(){ println('Hello from V.js') }" > hi.v + ./v -o hi.js hi.v + snap run node hi.js + fi + - | + if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then + echo "Nodejs version:" + node --version + # Build hi.js + echo "fn main(){ println('Hello from V.js') }" > hi.v + ./v -o hi.js hi.v + ## the node on osx requires --harmony-class-fields for now + node --harmony-class-fields hi.js + fi + - | + if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then # Build Vid git clone https://github.com/vlang/vid cd vid && ../v -debug -o vid . diff --git a/compiler/cc.v b/compiler/cc.v index 03d3e17d10..702982734a 100644 --- a/compiler/cc.v +++ b/compiler/cc.v @@ -168,6 +168,11 @@ fn (v mut V) cc() { a << ' -ldl ' } } + + if v.os == .js && os.user_os() == 'linux' { + a << '-lm' + } + if v.os == .windows { a << '-DUNICODE -D_UNICODE' }