From e6e4ee1da88f507f36bad503cd329b31eaadccac Mon Sep 17 00:00:00 2001 From: arturo Date: Thu, 21 Mar 2019 19:21:27 +0100 Subject: [PATCH] Emscripten ci docker (#6260) --- .travis.yml | 19 ++++++++++------ .../src/ofxEmscriptenURLFileLoader.cpp | 4 ++-- libs/openFrameworks/utils/ofURLFileLoader.cpp | 6 +++++ scripts/ci/emscripten/build.sh | 22 +++++-------------- scripts/ci/emscripten/install.sh | 13 ----------- 5 files changed, 25 insertions(+), 39 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92d1bf584ca..1611a992afb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: c++ compiler: gcc sudo: true -cache: ccache env: global: secure: LBTN8d1hS7ocrqDwxLQqU0tfK3FMCXBI8q1yASEjtkp/v5HEyFkbj22H4jXZ20SkpCTlIG2L6i/fU3d6KzJUzTFuxkQEWsnjkj4jAhxGEWRsT1RV6VcUPQDGLHapXwTy+ZYgMNxE7aAdQaBskPHdVzAhjrzlTwVuKp6KjFn+kMU= @@ -15,6 +14,7 @@ matrix: dist: trusty sudo: required env: TARGET="linux64" + cache: ccache addons: apt: sources: @@ -46,6 +46,7 @@ matrix: sudo: required dist: trusty env: TARGET="linuxarmv6l" + cache: ccache - os: linux @@ -64,32 +65,34 @@ matrix: sudo: required dist: trusty env: TARGET="emscripten" - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - libstdc++6 + services: + - docker + before_install: + - docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash - os: osx osx_image: xcode9.4 compiler: clang env: TARGET="osx" + cache: ccache - os: osx osx_image: xcode9.4 compiler: clang env: TARGET="osx" OPT="makefiles" + cache: ccache - os: osx osx_image: xcode9.4 compiler: clang env: TARGET="ios" + cache: ccache - os: osx osx_image: xcode9.4 compiler: clang env: TARGET="tvos" + cache: ccache - os: linux language: android @@ -151,6 +154,8 @@ script: fi - if [ "$TARGET" = "osx" ] && [ "$OPT" = "makefiles" ]; then scripts/ci/$TARGET/run_tests.sh; + elif [ "$TARGET" = "emscripten" ]; then + docker exec -it emscripten sh -c "scripts/ci/$TARGET/build.sh $OPT"; else scripts/ci/$TARGET/build.sh $OPT; fi diff --git a/addons/ofxEmscripten/src/ofxEmscriptenURLFileLoader.cpp b/addons/ofxEmscripten/src/ofxEmscriptenURLFileLoader.cpp index a2a71f56e65..ac112436872 100644 --- a/addons/ofxEmscripten/src/ofxEmscriptenURLFileLoader.cpp +++ b/addons/ofxEmscripten/src/ofxEmscriptenURLFileLoader.cpp @@ -43,12 +43,12 @@ int ofxEmscriptenURLFileLoader::saveAsync(const string & url, const std::filesy return 0; } -ofHttpResponse handleRequest(const ofHttpRequest & request){ +ofHttpResponse ofxEmscriptenURLFileLoader::handleRequest(const ofHttpRequest & request){ ofLogWarning() << "handleRequest is still not implemented on emscripten"; return ofHttpResponse(); } -int handleRequestAsync(const ofHttpRequest & request){ +int ofxEmscriptenURLFileLoader::handleRequestAsync(const ofHttpRequest & request){ ofLogWarning() << "handleRequest is still not implemented on emscripten"; return -1; } diff --git a/libs/openFrameworks/utils/ofURLFileLoader.cpp b/libs/openFrameworks/utils/ofURLFileLoader.cpp index 7c4df5d7311..ba587384d66 100644 --- a/libs/openFrameworks/utils/ofURLFileLoader.cpp +++ b/libs/openFrameworks/utils/ofURLFileLoader.cpp @@ -279,6 +279,12 @@ ofURLFileLoader::ofURLFileLoader() :impl(new ofURLFileLoaderImpl){} #endif +#ifdef TARGET_EMSCRIPTEN +#include "ofxEmscriptenURLFileLoader.h" +ofURLFileLoader::ofURLFileLoader() +:impl(new ofxEmscriptenURLFileLoader){} +#endif + ofHttpResponse ofURLFileLoader::get(const string& url){ return impl->get(url); } diff --git a/scripts/ci/emscripten/build.sh b/scripts/ci/emscripten/build.sh index 3d84e9cd78e..cdf5358714f 100755 --- a/scripts/ci/emscripten/build.sh +++ b/scripts/ci/emscripten/build.sh @@ -6,8 +6,8 @@ ROOT=${TRAVIS_BUILD_DIR:-"$( cd "$(dirname "$0")/../../.." ; pwd -P )"} # the "proper" way does not work currently: #export CXXFLAGS="$(CXXFLAGS) --param ftrack-macro-expansion=0" #CUSTOMFLAGS="-ftrack-macro-expansion=0" -source ~/emscripten-sdk/emsdk_env.sh -source $ROOT/scripts/ci/ccache.sh +# source ~/emscripten-sdk/emsdk_env.sh +# source $ROOT/scripts/ci/ccache.sh echo "**** Building OF core ****" cd $ROOT @@ -28,33 +28,21 @@ cp scripts/templates/linux64/config.make examples/templates/allAddonsExample/ cd examples/templates/allAddonsExample/ sed -i s/ofxOsc// addons.make sed -i s/ofxNetwork// addons.make -#sed -i s/ofxSvg// addons.make sed -i s/ofxKinect// addons.make sed -i s/ofxThreadedImageLoader// addons.make -#sed -i s/ofxAssimpModelLoader// addons.make -#sed -i s/ofxGui// addons.make -#sed -i s/ofxXmlSettings// addons.make -#sed -i s/ofxOpenCv// addons.make +sed -i s/ofxPoco// addons.make sed -i "s/#include \"ofxOsc.h\"//" src/ofApp.h sed -i "s/#include \"ofxNetwork.h\"//" src/ofApp.h -#sed -i "s/#include \"ofxSvg.h\"//" src/ofApp.h sed -i "s/#include \"ofxKinect.h\"//" src/ofApp.h sed -i "s/#include \"ofxThreadedImageLoader.h\"//" src/ofApp.h -#sed -i "s/#include \"ofxAssimpModelLoader.h\"//" src/ofApp.h -#sed -i "s/#include \"ofxGui.h\"//" src/ofApp.h -#sed -i "s/#include \"ofxXmlSettings.h\"//" src/ofApp.h -#sed -i "s/#include \"ofxOpenCv.h\"//" src/ofApp.h +sed -i "s/#include \"ofxXmlPoco.h\"//" src/ofApp.h sed -i "s/ofxTCPClient client;//" src/ofApp.h sed -i "s/ofxTCPServer server;//" src/ofApp.h sed -i "s/ofxOscSender osc_sender;//" src/ofApp.h -#sed -i "s/ofxSVG svg;//" src/ofApp.h sed -i "s/ofxKinect kinect;//" src/ofApp.h sed -i "s/ofxThreadedImageLoader .*;//" src/ofApp.h -#sed -i "s/ofxAssimpModelLoader .*;//" src/ofApp.h -#sed -i "s/ofxPanel .*;//" src/ofApp.h -#sed -i "s/ofxXmlSettings .*;//" src/ofApp.h -#sed -i "s/ofxCv.* .*;//" src/ofApp.h +sed -i "s/ofxXmlPoco .*;//" src/ofApp.h emmake make Debug # USE_CCACHE=1 diff --git a/scripts/ci/emscripten/install.sh b/scripts/ci/emscripten/install.sh index f27a9db88c7..800f317377a 100755 --- a/scripts/ci/emscripten/install.sh +++ b/scripts/ci/emscripten/install.sh @@ -1,22 +1,9 @@ #!/bin/bash -#set -e -#set -o pipefail -# trap any script errors and exit trap "trapError" ERR -SUDO= - trapError() { echo echo " ^ Received error ^" exit 1 } -cp scripts/ci/emscripten/.emscripten ~/ -sed -i "s|%HOME%|${HOME}|g" ~/.emscripten -cd ~/ -git clone https://github.com/urho3d/emscripten-sdk -cd emscripten-sdk -# ./emsdk update-tags -# ./emsdk install latest -./emsdk activate latest