diff --git a/.travis.yml b/.travis.yml index c3de132..b19b054 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,35 +13,52 @@ matrix: env: release_arch=Darwin-amd64-32 install: - git submodule update --init --recursive - - curl -o ./llvm.zip -L https://github.com/CICM/pd-faustgen/releases/download/v0.0.0/llvm-macos-x64.zip - - tar xzf ./llvm.zip && mv llvm-macos-x64 llvm + - curl -o ./llvm.tar.xz -L https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-darwin-apple.tar.xz + - tar xzf ./llvm.tar.xz && mv clang+llvm-9.0.0-x86_64-darwin-apple llvm script: - mkdir build && cd build - cmake .. -GXcode -DUSE_LLVM_CONFIG=off -DLLVM_DIR=./llvm/lib/cmake/llvm -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 - cmake --build . --config Release --target faustgen_tilde_project + before_deploy: + - cd $TRAVIS_BUILD_DIR + - cp -r faust/libraries external/libs + - cp -r src/ external/sources + - cp README.md external/README.txt + - cp LICENSE external/LICENSE.txt + - chmod 0444 external/.default.dsp + - curl -o ./external/faust-quick-reference.pdf http://faust.grame.fr/images/faust-quick-reference.pdf + - mv external faustgen~ + - zip -r "faustgen_tilde-$release_arch-sources.zip" faustgen~ - os: linux compiler: gcc + addons: + apt: + sources: ubuntu-toolchain-r-test + packages: g++-4.9 env: release_arch=Linux-amd64-32 install: + - export CXX=g++-4.9 + - export CC=gcc-4.9 - git submodule update --init --recursive - sudo apt-get install -y pkg-config libedit-dev - - curl -o ./llvm.tar.gz http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz - - tar xvf ./llvm.tar.gz && mv clang+llvm-5.0.0-linux-x86_64-ubuntu14.04 llvm + - curl -o ./llvm.tar.xz https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz + - tar xvf ./llvm.tar.xz && mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04 llvm script: - mkdir build && cd build - cmake .. -DCMAKE_C_FLAGS=-m64 -DUSE_LLVM_CONFIG=off -DLLVM_DIR=./llvm/lib/cmake/llvm -DCMAKE_BUILD_TYPE=Release - cmake --build . --config Release --target faustgen_tilde_project -before_deploy: -- cd $TRAVIS_BUILD_DIR -- cp -r faust/libraries external/libs -- cp -r src/ external/sources -- cp README.md external/README.txt -- cp LICENSE external/LICENSE.txt -- chmod 0444 external/.default.dsp -- curl -o ./external/faust-quick-reference.pdf http://faust.grame.fr/images/faust-quick-reference.pdf -- mv external faustgen~ -- zip -r "faustgen_tilde-$release_arch-sources.zip" faustgen~ + before_deploy: + - cd $TRAVIS_BUILD_DIR + - cp -r faust/libraries external/libs + - cp -r src/ external/sources + - cp README.md external/README.txt + - cp LICENSE external/LICENSE.txt + - chmod 0444 external/.default.dsp + - curl -o ./external/faust-quick-reference.pdf http://faust.grame.fr/images/faust-quick-reference.pdf + - mv external faustgen~ + - zip -r "faustgen_tilde-$release_arch-sources.zip" faustgen~ + - ./make-dist.sh deploy: provider: releases skip_cleanup: true @@ -51,8 +68,11 @@ deploy: name: ${TRAVIS_TAG} tag_name: ${TRAVIS_TAG} api_key: - secure: dT+n95s+gMM1iZ2G91S6zRKb/bQLxeOANy3AIh2PO/7cOCJ/MoFGjNv69qhn0B17RbPwrpbHjw+aXNS3BSuQ6uWzK6YT8Xr+vS45mIYxq/QTnyn+zWuAnzMFdu37WgGnuCau7X2tl99ia82acqt/sMKbFBWlufgudQVUtj34i8t2SuIteWT+wJ0N2V4evtvr1FnLazcbxCJFQFyw0lUrc3tMlm0rgB61lV7oESTfuEK9WCLFJyrXR9ar9Nvo22l/LVl6XsIQhpEH+/+WRTx/pa8aeM9iZzs7pYsRp5VZeezTfcPcBIL+S5Z2sKZNXf6SeWDXooR84T4WyONbNz7Io2+860VjUzSmYjr0Z9pveShApOjk3iwauwLU4bpJEuVKk4TTiDJ7eTX4JwcNvSS+kWxXUROTO6QZkkVTD/xCxAjr9BQVuts30xOXQ4D0EUaVAMLU9KNFNfqcZxqhtIihVKZgGOPzR2CqO/KgdL5aT4Ov6j1usSj32xhnzDhLEb1GVpW7TF2mzSq4Qqdesr8lhskrkPaim3SBwiqra9oqUK3qJcGysdZQX/dXgmZYBZnukvtxzV4MgE9QVSqAcUUDqxuxirg6ozHZe+OjaLuKhP+5vxr1BSUc+8o3jZbAaN17rCuPl1EDcv5QHQphwZSCPFhPzrv7kjbJMAhIQnPmSRE= - file: "faustgen_tilde-$release_arch-sources.zip" + secure: K5Fu30/Jahwit18UpJBti48aLE7Z1U3VmiZCgdnYBQHnNAyZ9g5IsILRegU9p7m1yY2AMQbl/eIybYDtfVldTSCdxEaeGta5Q+emV5TUzj/na9kNduZlXSaVgIzZ6rWtdRJQsaaBL7Q7F++o3AlDl6jvi8N41EbIpMy5Enkux4ZkGKvOftviBip5OTnkmM3MFZWGVOgnFV//DvMXBSLtHgSylSnq8jE++7DvyMlN6C9yZIGcBy7ZRpMGD7aqccCy2u41gQq286IQBPPfqmzcZOgC1s1jbM8+oD0Hl9e5LaA/D8tnrt2lZbfh5R+ULGgXd7BAGp/I/+ketCWEnMqg3bV1jTXglweIGmC+uTSAiu9hAfGW5DCzVYc4G15rnniy/HlXS7qCyTuow377HfqtRdqGe4lulSxvmIWGsCAgjXuXnaTSDR70Mer0g6bsNijDa5f28c68KCv9Kq6Oy8CMmGOAmUoO7Yp5y3jVUHlHpwxMukH35ScJaauEzzPqu0CbR/bx5+nGNIllkT7yzeOI+YMq6deLnakG/4iBqmWfgtTnTUDq1Q+hm+RtYjS0JQ5LKMKjMui+/UFSGZ1ZTer+NWhmL2sWXtYyYOPwLWY+AdDAHGOq386CsohMQ36seAiU3X5bC1icBK3tG93nrJEIucgVmDeAvsrHHX41FHW8dL4= + file_glob: true + file: + - "faustgen_tilde-$release_arch-sources.zip" + - '*.tar.gz' on: repo: CICM/pd-faustgen tags: true diff --git a/CMakeLists.txt b/CMakeLists.txt index 590c866..2767981 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,20 +13,6 @@ if(UNIX AND NOT APPLE) set(FAUST_LIBS "stdc++" CACHE STRING "FAUST LIBRARIES" FORCE) endif() -## For Windows use static runtime instead of default dynamic runtime -if(MSVC) - set(CMAKE_CXX_FLAGS_RELEASE "/MT" CACHE STRING "FORCE CXX FLAGS" FORCE) - set(CMAKE_C_FLAGS_RELEASE "/MT" CACHE STRING "FORCE C FLAGS" FORCE) - set(CMAKE_CXX_FLAGS_DEBUG "/MTd" CACHE STRING "FORCE CXX FLAGS" FORCE) - set(CMAKE_C_FLAGS_DEBUG "/MTd" CACHE STRING "FORCE C FLAGS" FORCE) - set(CompilerFlags - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE) - foreach(CompilerFlag ${CompilerFlags}) - string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") - endforeach() -endif() - include(FaustLib.cmake) ## Create Faust~ message(STATUS "faustgen~ external") diff --git a/ChangeLog.md b/ChangeLog.md index e140a98..e258af4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,7 @@ +### v0.1.2 +- Update Faust (2.72.2) +- Update LLVM (>= 9.0.0) + ### v0.1.1 - Fix the method to open the FAUST file on Windows when the path contains a space diff --git a/FaustLib.cmake b/FaustLib.cmake index b59f20e..047e334 100644 --- a/FaustLib.cmake +++ b/FaustLib.cmake @@ -1,15 +1,6 @@ ## Create Faust Lib message(STATUS "Faust Library") -## For Windows use static runtime instead of default dynamic runtime -if(MSVC) - set(CompilerFlags - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE) - foreach(CompilerFlag ${CompilerFlags}) - string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") - endforeach() -endif() ## Save the llvm directory and change it for subdirectory if(DEFINED LLVM_DIR) @@ -18,11 +9,12 @@ if(DEFINED LLVM_DIR) endif() ## Hardcoded targets for faust -set(INCLUDE_STATIC ON CACHE STRING "Include static library" FORCE) -set(INCLUDE_EXECUTABLE OFF CACHE STRING "Include runtime executable" FORCE) -set(INCLUDE_DYNAMIC OFF CACHE STRING "Include dynamic library" FORCE) -set(INCLUDE_OSC OFF CACHE STRING "Include Faust OSC library" FORCE) -set(INCLUDE_HTTP OFF CACHE STRING "Include Faust HTTPD library" FORCE) +set(MSVC_STATIC ON CACHE STRING "Use static runtimes with MSVC" FORCE) +set(INCLUDE_STATIC ON CACHE STRING "Include static library" FORCE) +set(INCLUDE_EXECUTABLE OFF CACHE STRING "Include runtime executable" FORCE) +set(INCLUDE_DYNAMIC OFF CACHE STRING "Include dynamic library" FORCE) +set(INCLUDE_OSC OFF CACHE STRING "Include Faust OSC library" FORCE) +set(INCLUDE_HTTP OFF CACHE STRING "Include Faust HTTPD library" FORCE) ## Hardcoded backends for faust set(ASMJS_BACKEND OFF CACHE STRING "Include ASMJS backend" FORCE) diff --git a/README.md b/README.md index 97dd411..652e82b 100644 --- a/README.md +++ b/README.md @@ -32,27 +32,27 @@ The **faustgen~** object is an external with the [FAUST](http://faust.grame.fr/a ## Compilation -The FAUST compiler requires LLVM 5.0.0 backend (or higher - 6.0.0). Once LLVM is installed on your machine, you can use CMake to generate a project that will compile both the FAUST library and the Pure Data external. Then you can use Deken to release the external. +The FAUST compiler requires LLVM 9.0.0 backend (or higher). Once LLVM is installed on your machine, you can use CMake to generate a project that will compile both the FAUST library and the Pure Data external. Then you can use Deken to release the external. #### Installing LLVM The fastest solution to install LLVM is to download the precompiled binaries from the [LLVM website](http://releases.llvm.org). For example, on the Travis CI for MacOS, we assume that the binaries are installed in the llvm folder at the root of the project: ``` -curl -o ./llvm.tar.gz http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz -tar zxvf ./llvm.tar.gz && mv clang+llvm-5.0.0-x86_64-apple-darwin llvm +curl -o ./llvm.tar.xz -L https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-darwin-apple.tar.xz +tar xzf ./llvm.tar.xz && mv clang+llvm-9.0.0-x86_64-darwin-apple llvm ``` or a for a linux system ``` -curl -o ./llvm.tar.gz http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz -tar xvf ./llvm.tar.gz && mv clang+llvm-5.0.0-linux-x86_64-ubuntu14.04 llvm +curl -o ./llvm.tar.gz https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz +tar xvf ./llvm.tar.gz && mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04 llvm ``` You can also use HomeBrew or MacPorts on macOS or APT on Linux the compilation of the sources last around 50 minutes and in this case, you change the LLVM_DIR with the proper location. On Windows, you must compile from sources using the static runtime library. Compiling LLVM with the Microsoft Visual Compiler requires to use the static runtime library, for example: ``` -cd llvm-6.0.0.src && mkdir build && cd build -cmake .. -G "Visual Studio 14 2015 Win64" -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT -DLLVM_BUILD_TESTS=Off -DCMAKE_INSTALL_PREFIX="./llvm" -Thost=x64 +cd llvm-9.0.0.src && mkdir build && cd build +cmake .. -G "Visual Studio 16 2019" -DLLVM_USE_CRT_DEBUG=MTd -DLLVM_USE_CRT_RELEASE=MT -DLLVM_BUILD_TESTS=Off -DCMAKE_INSTALL_PREFIX="./llvm" -Thost=x64 cmake --build . --target ALL_BUILD (--config Debug/Release) cmake --build . --target INSTALL (optional) ``` diff --git a/ToDoList.md b/ToDoList.md deleted file mode 100644 index fa17b59..0000000 --- a/ToDoList.md +++ /dev/null @@ -1,2 +0,0 @@ -- Mesure DSP time of the code -- Use automatic optimizations with compile options diff --git a/appveyor.yml b/appveyor.yml index f4313ce..9e0525e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -os: Visual Studio 2015 +os: Visual Studio 2019 environment: matrix: @@ -6,19 +6,18 @@ environment: # compiler: "Visual Studio 14 2015" # configuration: Debug - platform: x64 - compiler: "Visual Studio 14 2015 Win64" + compiler: "Visual Studio 16 2019" configuration: Release release_arch: "Windows-amd64-32" install: - git submodule update --init --recursive - - curl -L https://github.com/CICM/pd-faustgen/releases/download/v0.0.0/llvm-windows-x64-mt.zip -o llvm.zip + - curl -L https://github.com/CICM/pd-faustgen/releases/download/v0.0.0/llvm-9.0.0-windows-x64-mt.zip -o llvm.zip - 7z x llvm.zip - - rename llvm-windows-x64-mt llvm - curl http://faust.grame.fr/images/faust-quick-reference.pdf -o ./external/faust-quick-reference.pdf build_script: - mkdir build && cd build - - cmake .. -G "%compiler%" -DUSE_LLVM_CONFIG=off -DLLVM_DIR=./llvm/lib/cmake/llvm + - cmake .. -G "%compiler%" -A x64 -DUSE_LLVM_CONFIG=off -DLLVM_DIR=./llvm/lib/cmake/llvm - msbuild faustgen~.sln /nologo /p:config=%configuration% /p:plateform=%platform% after_build: - cd %APPVEYOR_BUILD_FOLDER% @@ -44,7 +43,7 @@ deploy: overwrite: true draft: true auth_token: - secure: 0Vv/0e24P2Oa/R/obFQBd824WDpAolXToTc1B0xOjM8TdXXkFdRkfRkPHDgCtoCR + secure: n/wNzOYdawEQPTt9OaxXu59bO9PKjKjzeZulk0yrmQduH6SLI7c0CduPQXBwjI1B artifact: /.*\.zip/ on: appveyor_repo_tag: true diff --git a/faust b/faust index 341bd3c..5c45bff 160000 --- a/faust +++ b/faust @@ -1 +1 @@ -Subproject commit 341bd3c562b4dcb9271a82bc939313613bc59244 +Subproject commit 5c45bff8f7e83969426e7036b186b7715c3ecda0 diff --git a/make-dist.sh b/make-dist.sh new file mode 100755 index 0000000..67ebe38 --- /dev/null +++ b/make-dist.sh @@ -0,0 +1,42 @@ +#! /bin/bash + +# Copyright (c) 2020 Albert Gräf . Distributed under the +# MIT license, please check the toplevel LICENSE file for details. + +# Create a self-contained distribution tarball from the source, including all +# the submodules. + +# Invoke this in the toplevel directory as `./make-dist.sh`. It will leave the +# tarball as pd-faustgen-.tar.gz in the toplevel directory. Temporary +# data is written to the pd-faustgen- directory, which is +# automatically deleted afterwards. The version number is extracted from +# src/faustgen_tilde.c, so make sure to keep that up-to-date. + +# NOTE: git and tar need to be installed to make this work. As a side-effect, +# all submodules will be checked out recursively, using `git submodule update +# --init --recursive`. + +# This may need adjusting if the file is edited and the macro name changes. +version=$(grep "#define FAUSTGEN_VERSION_STR" src/faustgen_tilde.c | sed 's|^#define *FAUSTGEN_VERSION_STR *"\(.*\)".*|\1|') + +# Distribution basename and name of the source tarball. +dist=pd-faustgen-$version +src=$dist.tar.gz + +# Make sure that the submodules are initialized. +git submodule update --init --recursive + +# List of submodules to include in the package. This requires git version +# 1.7.8 or later to work. +submodules=$(find . -mindepth 2 -name '.git' -type f -print | xargs grep -l "gitdir" | sed -e 's/^\.\///' -e 's/\.git$//') + +# Remove any left-over temp directory and previous tarball. +rm -rf $dist $src +# Grab the main source. +git archive --format=tar.gz --prefix=$dist/ HEAD | tar xfz - +# Grab the submodules. +for x in $submodules; do (cd $dist && git -C ../$x archive --format=tar.gz --prefix=$x HEAD | tar xfz -); done + +# Create the source tarball. +tar cfz $src $dist +rm -rf $dist diff --git a/pd.build b/pd.build index ed7591e..d1062a5 160000 --- a/pd.build +++ b/pd.build @@ -1 +1 @@ -Subproject commit ed7591eecb239970158bd2fa2550b63280a16e2d +Subproject commit d1062a5a4bbcc374c5e7570c9e5a99faa9c8dffa diff --git a/src/faust_tilde_options.c b/src/faust_tilde_options.c index a8be766..c2d923c 100644 --- a/src/faust_tilde_options.c +++ b/src/faust_tilde_options.c @@ -236,12 +236,3 @@ char const* faust_opt_manager_get_full_path(t_faust_opt_manager *x, char const* pd_error(x->f_owner, "faustgen~: invalid path or name"); return NULL; } - -void faust_opt_manager_print(t_faust_opt_manager const *x, char const log) -{ - size_t i; - for(i = 0; i < x->f_noptions; ++i) - { - logpost(x->f_owner, 2+log, " option %i: %s", (int)i, x->f_options[i]); - } -} diff --git a/src/faust_tilde_options.h b/src/faust_tilde_options.h index 9c657f6..da441e5 100644 --- a/src/faust_tilde_options.h +++ b/src/faust_tilde_options.h @@ -24,8 +24,6 @@ char const** faust_opt_manager_get_options(t_faust_opt_manager* x); char const* faust_opt_manager_get_full_path(t_faust_opt_manager* x, char const* name); -void faust_opt_manager_print(t_faust_opt_manager const *x, char const log); - char faust_opt_has_double_precision(t_faust_opt_manager const *x); #endif diff --git a/src/faust_tilde_ui.c b/src/faust_tilde_ui.c index 2dbc219..e878ad1 100644 --- a/src/faust_tilde_ui.c +++ b/src/faust_tilde_ui.c @@ -309,7 +309,7 @@ t_faust_ui_manager* faust_ui_manager_new(t_object* owner) ui_manager->f_glue.addHorizontalBargraph = (addHorizontalBargraphFun)faust_ui_manager_ui_add_bargraph; ui_manager->f_glue.addVerticalBargraph = (addVerticalBargraphFun)faust_ui_manager_ui_add_bargraph; - ui_manager->f_glue.addSoundFile = (addSoundFileFun)faust_ui_manager_ui_add_sound_file; + ui_manager->f_glue.addSoundfile = (addSoundfileFun)faust_ui_manager_ui_add_sound_file; ui_manager->f_glue.declare = (declareFun)faust_ui_manager_ui_declare; ui_manager->f_owner = owner; diff --git a/src/faustgen_tilde.c b/src/faustgen_tilde.c index 007025d..52fdc82 100644 --- a/src/faustgen_tilde.c +++ b/src/faustgen_tilde.c @@ -18,7 +18,7 @@ #include "faust_tilde_io.h" #include "faust_tilde_options.h" -#define FAUSTGEN_VERSION_STR "0.1.0" +#define FAUSTGEN_VERSION_STR "0.1.2" #define MAXFAUSTSTRING 4096 typedef struct _faustgen_tilde @@ -133,6 +133,10 @@ static void faustgen_tilde_compile_options(t_faustgen_tilde *x, t_symbol* s, int faustgen_tilde_compile(x); } +#ifdef _WIN32 +#include +#endif + static void faustgen_tilde_open_texteditor(t_faustgen_tilde *x) { if(x->f_dsp_instance) @@ -142,13 +146,23 @@ static void faustgen_tilde_open_texteditor(t_faustgen_tilde *x) char temp[MAXPDSTRING]; sys_bashfilename(faust_opt_manager_get_full_path(x->f_opt_manager, x->f_dsp_name->s_name), temp); sprintf(message, "\"%s\"", temp); + WinExec(message, SW_HIDE); + return; #elif __APPLE__ sprintf(message, "open -t %s", faust_opt_manager_get_full_path(x->f_opt_manager, x->f_dsp_name->s_name)); + if(system(message)) + { + + } + return; #else sprintf(message, "xdg-open %s", faust_opt_manager_get_full_path(x->f_opt_manager, x->f_dsp_name->s_name)); -#endif - system(message); + if(system(message)) + { + + } return; +#endif } pd_error(x, "faustgen~: no FAUST DSP file defined"); } @@ -205,7 +219,28 @@ static void faustgen_tilde_print(t_faustgen_tilde *x) { post("faustgen~: %s", faust_opt_manager_get_full_path(x->f_opt_manager, x->f_dsp_name->s_name)); faust_io_manager_print(x->f_io_manager, 0); - faust_opt_manager_print(x->f_opt_manager, 0); + if(x->f_dsp_factory) + { + char* text = NULL; + text = getCTarget(x->f_dsp_factory); + if(text) + { + if(strnlen(text, 1) > 0) + { + post(" target: %s", text); + } + free(text); + } + text = getCDSPFactoryCompileOptions(x->f_dsp_factory); + if(text) + { + if(strnlen(text, 1) > 0) + { + post(" options: %s", text); + } + free(text); + } + } faust_ui_manager_print(x->f_ui_manager, 0); } else