Skip to content

Commit

Permalink
Merge pull request #9 from CICM/dev/v0.1.2
Browse files Browse the repository at this point in the history
Dev/v0.1.2
  • Loading branch information
pierreguillot authored Aug 4, 2020
2 parents 569140a + 20c1b59 commit 9e2aaea
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 77 deletions.
52 changes: 36 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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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3X5bC1icBK3tG93nrJEIucgVmDeAvsrHHX41FHW8dL4=
file_glob: true
file:
- "faustgen_tilde-$release_arch-sources.zip"
- '*.tar.gz'
on:
repo: CICM/pd-faustgen
tags: true
14 changes: 0 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
20 changes: 6 additions & 14 deletions FaustLib.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
Expand Down
2 changes: 0 additions & 2 deletions ToDoList.md

This file was deleted.

11 changes: 5 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
os: Visual Studio 2015
os: Visual Studio 2019

environment:
matrix:
#- platform: Win32
# 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%
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion faust
Submodule faust updated 1441 files
42 changes: 42 additions & 0 deletions make-dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#! /bin/bash

# Copyright (c) 2020 Albert Gräf <aggraef@gmail.com>. 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-<version>.tar.gz in the toplevel directory. Temporary
# data is written to the pd-faustgen-<version> 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
2 changes: 1 addition & 1 deletion pd.build
Submodule pd.build updated 5 files
+2 −0 pd.cmake
+0 −0 x64/pd.def
+ x64/pd.lib
+0 −0 x86/pd.def
+ x86/pd.lib
9 changes: 0 additions & 9 deletions src/faust_tilde_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
2 changes: 0 additions & 2 deletions src/faust_tilde_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/faust_tilde_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
43 changes: 39 additions & 4 deletions src/faustgen_tilde.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <windows.h>
#endif

static void faustgen_tilde_open_texteditor(t_faustgen_tilde *x)
{
if(x->f_dsp_instance)
Expand All @@ -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");
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9e2aaea

Please sign in to comment.