From 8e0dde8f8502a1662ce011953b939dbbcf3ff08e Mon Sep 17 00:00:00 2001 From: Stephane Letz Date: Mon, 23 Sep 2024 22:54:28 +0200 Subject: [PATCH] Formatting. --- build/CMakeLists.txt | 458 +++++++++++++-------------- build/emcc/CMakeLists.txt | 14 +- build/misc/msvc_static_runtime.cmake | 1 - build/wasmglue/CMakeLists.txt | 42 +-- embedded/faustgen/CMakeLists.txt | 154 ++++----- 5 files changed, 330 insertions(+), 339 deletions(-) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index d4606e9b76..b5427e7f6f 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -5,16 +5,16 @@ project (faust) # versions management set (VERSION 2.75.8) macro (get_major_minor_patch version) - string( REGEX REPLACE "([0-9]*)\\.([0-9]*)\\.([0-9]*)" "\\1" VERSION_MAJOR ${version} ) - string( REGEX REPLACE "([0-9]*)\\.([0-9]*)\\.([0-9]*)" "\\2" VERSION_MINOR ${version} ) - string( REGEX REPLACE "([0-9]*)\\.([0-9]*)\\.([0-9]*)" "\\3" VERSION_PATCH ${version} ) + string( REGEX REPLACE "([0-9]*)\\.([0-9]*)\\.([0-9]*)" "\\1" VERSION_MAJOR ${version} ) + string( REGEX REPLACE "([0-9]*)\\.([0-9]*)\\.([0-9]*)" "\\2" VERSION_MINOR ${version} ) + string( REGEX REPLACE "([0-9]*)\\.([0-9]*)\\.([0-9]*)" "\\3" VERSION_PATCH ${version} ) endmacro() get_major_minor_patch( ${VERSION} ) set (SOVERS ${VERSION_MAJOR}) message (STATUS "Configuring version ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") if (NOT DEFINED LIBSDIR) - set ( LIBSDIR lib) + set ( LIBSDIR lib) endif() get_filename_component(ROOT ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) @@ -26,25 +26,25 @@ set (CMAKE_CXX_STANDARD 17) ####################################### # Output options -option ( UNIVERSAL "Compiles and combines x86_64 and arm64 architectures [MacOS]" off ) -option ( IOS "Compiles for iOS" off ) -option ( USE_LLVM_CONFIG "Force use off llvm-config" on ) -option ( INCLUDE_EXECUTABLE "Include runtime executable" on ) -option ( INCLUDE_STATIC "Include static library" off ) -option ( INCLUDE_DYNAMIC "Include dynamic library" off ) -option ( INCLUDE_OSC "Include Faust OSC library" on ) -option ( INCLUDE_HTTP "Include Faust HTTPD library" on ) -option ( INCLUDE_ITP "Include Faust Machine library" off ) -option ( INCLUDE_EMCC "Include emcc targets" on ) -option ( INCLUDE_WASM_GLUE "Include wasm glue targets" on ) -option ( MSVC_STATIC "Use static runtimes with MSVC" off) -option ( SELF_CONTAINED_LIBRARY "Don't search system architecture files." off) +option ( UNIVERSAL "Compiles and combines x86_64 and arm64 architectures [MacOS]" off ) +option ( IOS "Compiles for iOS" off ) +option ( USE_LLVM_CONFIG "Force use off llvm-config" on ) +option ( INCLUDE_EXECUTABLE "Include runtime executable" on ) +option ( INCLUDE_STATIC "Include static library" off ) +option ( INCLUDE_DYNAMIC "Include dynamic library" off ) +option ( INCLUDE_OSC "Include Faust OSC library" on ) +option ( INCLUDE_HTTP "Include Faust HTTPD library" on ) +option ( INCLUDE_ITP "Include Faust Machine library" off ) +option ( INCLUDE_EMCC "Include emcc targets" on ) +option ( INCLUDE_WASM_GLUE "Include wasm glue targets" on ) +option ( MSVC_STATIC "Use static runtimes with MSVC" off) +option ( SELF_CONTAINED_LIBRARY "Don't search system architecture files." off) option ( LINK_LLVM_STATIC "Link LLVM statically" off ) ####################################### # Check output options if (UNIVERSAL AND NOT APPLE) - message(WARNING "UNIVERSAL option is only available on MacOS or iOS") + message(WARNING "UNIVERSAL option is only available on MacOS or iOS") endif() #################################### @@ -55,257 +55,253 @@ file (GLOB HH ${SRCDIR}/*.hh ${SRCDIR}/*/*.hh ${SRCDIR}/generator/fir/*.hh) #################################### # include directories set (FAUST_INC ${SRCDIR} - ${SRCDIR}/boxes ${SRCDIR}/documentator ${SRCDIR}/draw - ${SRCDIR}/errors ${SRCDIR}/evaluate ${SRCDIR}/extended - ${SRCDIR}/FaustAlgebra - ${SRCDIR}/DirectedGraph - ${SRCDIR}/interval - ${SRCDIR}/generator - ${SRCDIR}/generator/c - ${SRCDIR}/generator/cpp - ${SRCDIR}/generator/dlang - ${SRCDIR}/generator/csharp - ${SRCDIR}/generator/fir - ${SRCDIR}/generator/julia - ${SRCDIR}/generator/interpreter - ${SRCDIR}/generator/rust - ${SRCDIR}/generator/cmajor - ${SRCDIR}/generator/vhdl - ${SRCDIR}/normalize ${SRCDIR}/parallelize ${SRCDIR}/parser - ${SRCDIR}/patternmatcher ${SRCDIR}/propagate ${SRCDIR}/signals - ${SRCDIR}/tlib ${SRCDIR}/transform ${SRCDIR}/utils - ${SRCDIR}/draw/device ${SRCDIR}/draw/schema - ${SRCDIR}/../architecture /usr/local/include) - + ${SRCDIR}/boxes ${SRCDIR}/documentator ${SRCDIR}/draw + ${SRCDIR}/errors ${SRCDIR}/evaluate ${SRCDIR}/extended + ${SRCDIR}/FaustAlgebra + ${SRCDIR}/DirectedGraph + ${SRCDIR}/interval + ${SRCDIR}/generator + ${SRCDIR}/generator/c + ${SRCDIR}/generator/cpp + ${SRCDIR}/generator/dlang + ${SRCDIR}/generator/csharp + ${SRCDIR}/generator/fir + ${SRCDIR}/generator/julia + ${SRCDIR}/generator/interpreter + ${SRCDIR}/generator/rust + ${SRCDIR}/generator/cmajor + ${SRCDIR}/generator/vhdl + ${SRCDIR}/normalize ${SRCDIR}/parallelize ${SRCDIR}/parser + ${SRCDIR}/patternmatcher ${SRCDIR}/propagate ${SRCDIR}/signals + ${SRCDIR}/tlib ${SRCDIR}/transform ${SRCDIR}/utils + ${SRCDIR}/draw/device ${SRCDIR}/draw/schema + ${SRCDIR}/../architecture /usr/local/include) #################################### # LLVM include (misc/llvm.cmake) if (INCLUDE_LLVM ) - if ((NOT DEFINED LLVM_LIBS AND NOT MSVC) - OR NOT DEFINED LLVM_LIB_DIR - OR NOT DEFINED LLVM_INCLUDE_DIRS - OR (DEFINED LLVM_INCLUDE_DIRS AND LLVM_INCLUDE_DIRS MATCHES "^$") - OR NOT DEFINED LLVM_PACKAGE_VERSION - OR (NOT DEFINED LLVM_DEFINITIONS AND NOT MSVC)) - - if(USE_LLVM_CONFIG) - llvm_config() - else() - llvm_cmake() - endif() - - endif() - - string (REGEX REPLACE "([0-9]+)\\.[0-9]+.*" "\\1" LLVM_MAJOR_VERSION ${LLVM_PACKAGE_VERSION}) - string (REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" LLVM_MINOR_VERSION ${LLVM_PACKAGE_VERSION}) - if(LLVM_MAJOR_VERSION GREATER 9) - set(LLVM_VERSION "LLVM_${LLVM_MAJOR_VERSION}0") - else() - set(LLVM_VERSION "LLVM_${LLVM_MAJOR_VERSION}${LLVM_MINOR_VERSION}") - endif() - - # note that LLVM_LIB_DIR is not a definition that comes with find_package(LLVM) - if (NOT DEFINED LLVM_LIB_DIR) - set(LLVM_LIB_DIR "${LLVM_INCLUDE_DIRS}/../lib") - message(STATUS "LLVM_LIB_DIR set to: ${LLVM_LIB_DIR}") - endif() - - message(STATUS "LLVM_VERSION: ${LLVM_VERSION}") - message(STATUS "LLVM_LIBS: ${LLVM_LIBS}") - message(STATUS "LLVM_SYS_LIBS: ${LLVM_SYS_LIBS}") - message(STATUS "LLVM_LIB_DIR: ${LLVM_LIB_DIR}") - message(STATUS "LLVM_INCLUDE_DIRS: ${LLVM_INCLUDE_DIRS}") - message(STATUS "LLVM_DEFINITIONS: ${LLVM_DEFINITIONS}") - message(STATUS "LINK_LLVM_STATIC: ${LINK_LLVM_STATIC}") - - # the declarations below are redundant but necessary to cope with different cmake behaviors on different platforms - set (TMP ${SRCDIR}/generator/llvm) -if (NOT MSVC) - set_property(SOURCE ${TMP}/llvm_dsp_aux.cpp ${TMP}/llvm_dynamic_dsp_aux.cpp APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-rtti ${LLVM_DEFINITIONS}") - set_property(SOURCE ${TMP}/llvm_dsp_aux.cpp ${TMP}/llvm_dynamic_dsp_aux.cpp APPEND_STRING PROPERTY CMAKE_CXX_FLAGS "-fno-rtti ${LLVM_DEFINITIONS}") -endif() + if ((NOT DEFINED LLVM_LIBS AND NOT MSVC) + OR NOT DEFINED LLVM_LIB_DIR + OR NOT DEFINED LLVM_INCLUDE_DIRS + OR (DEFINED LLVM_INCLUDE_DIRS AND LLVM_INCLUDE_DIRS MATCHES "^$") + OR NOT DEFINED LLVM_PACKAGE_VERSION + OR (NOT DEFINED LLVM_DEFINITIONS AND NOT MSVC)) + + if(USE_LLVM_CONFIG) + llvm_config() + else() + llvm_cmake() + endif() - set (FAUST_LIBS ${FAUST_LIBS} ${LLVM_LD_FLAGS} ${LLVM_LIBS}) - - set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DLLVM_VERSION="${LLVM_PACKAGE_VERSION}" -DLLVM_BUILD_UNIVERSAL) + endif() - if("${LLVM_PACKAGE_VERSION}" VERSION_GREATER_EQUAL 10) + string (REGEX REPLACE "([0-9]+)\\.[0-9]+.*" "\\1" LLVM_MAJOR_VERSION ${LLVM_PACKAGE_VERSION}) + string (REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" LLVM_MINOR_VERSION ${LLVM_PACKAGE_VERSION}) + if(LLVM_MAJOR_VERSION GREATER 9) + set(LLVM_VERSION "LLVM_${LLVM_MAJOR_VERSION}0") + else() + set(LLVM_VERSION "LLVM_${LLVM_MAJOR_VERSION}${LLVM_MINOR_VERSION}") + endif() + + # note that LLVM_LIB_DIR is not a definition that comes with find_package(LLVM) + if (NOT DEFINED LLVM_LIB_DIR) + set(LLVM_LIB_DIR "${LLVM_INCLUDE_DIRS}/../lib") + message(STATUS "LLVM_LIB_DIR set to: ${LLVM_LIB_DIR}") + endif() + + message(STATUS "LLVM_VERSION: ${LLVM_VERSION}") + message(STATUS "LLVM_LIBS: ${LLVM_LIBS}") + message(STATUS "LLVM_SYS_LIBS: ${LLVM_SYS_LIBS}") + message(STATUS "LLVM_LIB_DIR: ${LLVM_LIB_DIR}") + message(STATUS "LLVM_INCLUDE_DIRS: ${LLVM_INCLUDE_DIRS}") + message(STATUS "LLVM_DEFINITIONS: ${LLVM_DEFINITIONS}") + message(STATUS "LINK_LLVM_STATIC: ${LINK_LLVM_STATIC}") + + # the declarations below are redundant but necessary to cope with different cmake behaviors on different platforms + set (TMP ${SRCDIR}/generator/llvm) + if (NOT MSVC) + set_property(SOURCE ${TMP}/llvm_dsp_aux.cpp ${TMP}/llvm_dynamic_dsp_aux.cpp APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-rtti ${LLVM_DEFINITIONS}") + set_property(SOURCE ${TMP}/llvm_dsp_aux.cpp ${TMP}/llvm_dynamic_dsp_aux.cpp APPEND_STRING PROPERTY CMAKE_CXX_FLAGS "-fno-rtti ${LLVM_DEFINITIONS}") + endif() + + set (FAUST_LIBS ${FAUST_LIBS} ${LLVM_LD_FLAGS} ${LLVM_LIBS}) + + set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DLLVM_VERSION="${LLVM_PACKAGE_VERSION}" -DLLVM_BUILD_UNIVERSAL) + + if("${LLVM_PACKAGE_VERSION}" VERSION_GREATER_EQUAL 10) set (CMAKE_CXX_STANDARD 17) - endif() + endif() endif() #################################### # platform dependent settings if (WIN32 AND MSVC_STATIC) - include (misc/msvc_static_runtime.cmake) + include (misc/msvc_static_runtime.cmake) endif() if(APPLE) - if(IOS) - set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "iphoneos") - set (CMAKE_OSX_ARCHITECTURES "arm64 armv7 armv7s") - set (CMAKE_OSX_SYSROOT "iphoneos") - set (CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 8.0) - else() - set (MACSDK /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk) - if (EXISTS ${MACSDK}) - set (CMAKE_OSX_SYSROOT ${MACSDK}) - else() - message ("WARNING No SDK at ${MACSDK}") - endif() - if (UNIVERSAL) - message (STATUS "Compiles an universal binary") - set (CMAKE_OSX_ARCHITECTURES x86_64 arm64) - set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DLLVM_BUILD_UNIVERSAL) - endif() - link_directories(/opt/local/lib) - endif() + if(IOS) + set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "iphoneos") + set (CMAKE_OSX_ARCHITECTURES "arm64 armv7 armv7s") + set (CMAKE_OSX_SYSROOT "iphoneos") + set (CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 8.0) + else() + set (MACSDK /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk) + if (EXISTS ${MACSDK}) + set (CMAKE_OSX_SYSROOT ${MACSDK}) + else() + message ("WARNING No SDK at ${MACSDK}") + endif() + if (UNIVERSAL) + message (STATUS "Compiles an universal binary") + set (CMAKE_OSX_ARCHITECTURES x86_64 arm64) + set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DLLVM_BUILD_UNIVERSAL) + endif() + link_directories(/opt/local/lib) + endif() elseif(WIN32 OR MSYS) - if (NOT MSVC) - set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DWIN32 -D__MINGW32__) - endif() - set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES) - set (FAUST_LIBS ${FAUST_LIBS} Ws2_32) #.lib) + if (NOT MSVC) + set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DWIN32 -D__MINGW32__) + endif() + set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES) + set (FAUST_LIBS ${FAUST_LIBS} Ws2_32) #.lib) elseif(NOT ANDROID) - set (FAUST_LIBS -lpthread ${FAUST_LIBS}) + set (FAUST_LIBS -lpthread ${FAUST_LIBS}) endif() #################################### # compiler dependent settings if (MSVC) - set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DMSVisualStudio) + set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DMSVisualStudio) else() - set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DLIBDIR="${LIBSDIR}") - #set(CMAKE_CXX_FLAGS_DEBUG "-g -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-overloaded-virtual -Wshadow") - set(CMAKE_CXX_FLAGS_DEBUG "-g -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-overloaded-virtual -Wshadow") - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-overloaded-virtual") + set (FAUST_DEFINITIONS ${FAUST_DEFINITIONS} -DLIBDIR="${LIBSDIR}") + #set(CMAKE_CXX_FLAGS_DEBUG "-g -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-overloaded-virtual -Wshadow") + set(CMAKE_CXX_FLAGS_DEBUG "-g -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-overloaded-virtual -Wshadow") + set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fvisibility=hidden -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-overloaded-virtual") endif() - #################################### # Add the different targets #################################### if (INCLUDE_EXECUTABLE) - add_executable(faust ${SRC} ${HH}) - target_compile_definitions (faust PRIVATE ${FAUST_DEFINITIONS}) - if(INCLUDE_LLVM) - target_link_directories(faust PRIVATE "${LLVM_LIB_DIR}") - endif() - target_include_directories (faust PRIVATE ${FAUST_INC} ${LLVM_INCLUDE_DIRS}) - target_link_libraries (faust PRIVATE ${FAUST_LIBS}) - scan_backends (faust COMPILER) - set_target_properties(faust PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BINDIR}) - set_target_properties(faust PROPERTIES COMPILE_FLAGS -DFAUST_EXE) - set (INSTALL_TARGETS faust) + add_executable(faust ${SRC} ${HH}) + target_compile_definitions (faust PRIVATE ${FAUST_DEFINITIONS}) + if(INCLUDE_LLVM) + target_link_directories(faust PRIVATE "${LLVM_LIB_DIR}") + endif() + target_include_directories (faust PRIVATE ${FAUST_INC} ${LLVM_INCLUDE_DIRS}) + target_link_libraries (faust PRIVATE ${FAUST_LIBS}) + scan_backends (faust COMPILER) + set_target_properties(faust PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BINDIR}) + set_target_properties(faust PROPERTIES COMPILE_FLAGS -DFAUST_EXE) + set (INSTALL_TARGETS faust) endif() # static faust library if (INCLUDE_STATIC) - add_library(staticlib STATIC ${SRC} ${HH}) - target_compile_definitions (staticlib PRIVATE ${FAUST_DEFINITIONS}) - if(INCLUDE_LLVM) - target_link_directories(staticlib PRIVATE "${LLVM_LIB_DIR}") - endif() - target_include_directories (staticlib PRIVATE ${FAUST_INC} ${LLVM_INCLUDE_DIRS}) - target_link_libraries (staticlib PRIVATE ${FAUST_LIBS}) - set_target_properties(staticlib PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR} - LIBRARY_OUTPUT_DIRECTORY ${LIBDIR} - ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${LIBDIR} - LIBRARY_OUTPUT_DIRECTORY_RELEASE ${LIBDIR}) - if (MSVC) - set_target_properties(staticlib PROPERTIES OUTPUT_NAME libfaust) - elseif (IOS) - set_target_properties(staticlib PROPERTIES OUTPUT_NAME faust.ios) - else() - set_target_properties(staticlib PROPERTIES OUTPUT_NAME faust) - endif() - set_target_properties(staticlib PROPERTIES COMPILE_FLAGS -DFAUST_LIB - POSITION_INDEPENDENT_CODE ON) - set (INSTALL_TARGETS ${INSTALL_TARGETS} staticlib) - scan_backends (staticlib STATIC) - if (INCLUDE_LLVM) - if (WIN32) - set (MAKELIBCMD Make.llvm.static.bat) - else() - set (MAKELIBCMD make -f Make.llvm.static) - endif() - add_custom_command(TARGET staticlib POST_BUILD + add_library(staticlib STATIC ${SRC} ${HH}) + target_compile_definitions (staticlib PRIVATE ${FAUST_DEFINITIONS}) + if(INCLUDE_LLVM) + target_link_directories(staticlib PRIVATE "${LLVM_LIB_DIR}") + endif() + target_include_directories (staticlib PRIVATE ${FAUST_INC} ${LLVM_INCLUDE_DIRS}) + target_link_libraries (staticlib PRIVATE ${FAUST_LIBS}) + set_target_properties(staticlib PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR} + LIBRARY_OUTPUT_DIRECTORY ${LIBDIR} + ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${LIBDIR} + LIBRARY_OUTPUT_DIRECTORY_RELEASE ${LIBDIR}) + if (MSVC) + set_target_properties(staticlib PROPERTIES OUTPUT_NAME libfaust) + elseif (IOS) + set_target_properties(staticlib PROPERTIES OUTPUT_NAME faust.ios) + else() + set_target_properties(staticlib PROPERTIES OUTPUT_NAME faust) + endif() + set_target_properties(staticlib PROPERTIES COMPILE_FLAGS -DFAUST_LIB + POSITION_INDEPENDENT_CODE ON) + set (INSTALL_TARGETS ${INSTALL_TARGETS} staticlib) + scan_backends (staticlib STATIC) + if (INCLUDE_LLVM) + if (WIN32) + set (MAKELIBCMD Make.llvm.static.bat) + else() + set (MAKELIBCMD make -f Make.llvm.static) + endif() + add_custom_command(TARGET staticlib POST_BUILD COMMAND ${MAKELIBCMD} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Embed LLVM static libraries with libfaust" ) endif() - endif() # dynamic faust library if (INCLUDE_DYNAMIC) - add_library(dynamiclib SHARED ${SRC} ${HH}) - target_compile_definitions (dynamiclib PRIVATE ${FAUST_DEFINITIONS}) - if(INCLUDE_LLVM) - target_link_directories(dynamiclib PRIVATE "${LLVM_LIB_DIR}") - endif() - target_include_directories (dynamiclib PRIVATE ${FAUST_INC} ${LLVM_INCLUDE_DIRS}) - # set (FAUST_LIBS /usr/local/lib/libmir.a ${FAUST_LIBS}) - target_link_libraries (dynamiclib PRIVATE ${FAUST_LIBS}) - if (WIN32 OR MSYS) - enable_language(RC) - set_target_properties(dynamiclib PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR} - RUNTIME_OUTPUT_DIRECTORY ${LIBDIR}) - set_target_properties(dynamiclib PROPERTIES OUTPUT_NAME faust) - target_sources (faust PRIVATE ${ROOT}/windows/faust.rc) - target_sources (dynamiclib PRIVATE ${ROOT}/windows/faustdll.rc) - else() - if (IOS) - set_target_properties(dynamiclib PROPERTIES OUTPUT_NAME faust.ios) - else() - set_target_properties(dynamiclib PROPERTIES OUTPUT_NAME faust) - endif() - set_target_properties(dynamiclib PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${LIBDIR}) - set_target_properties(dynamiclib PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${LIBDIR} - VERSION ${VERSION} - SOVERSION ${SOVERS}) - endif() - set_target_properties(dynamiclib PROPERTIES COMPILE_FLAGS -DFAUST_LIB) - scan_backends (dynamiclib DYNAMIC) -# set (INSTALL_TARGETS ${INSTALL_TARGETS} dynamiclib) + add_library(dynamiclib SHARED ${SRC} ${HH}) + target_compile_definitions (dynamiclib PRIVATE ${FAUST_DEFINITIONS}) + if(INCLUDE_LLVM) + target_link_directories(dynamiclib PRIVATE "${LLVM_LIB_DIR}") + endif() + target_include_directories (dynamiclib PRIVATE ${FAUST_INC} ${LLVM_INCLUDE_DIRS}) + # set (FAUST_LIBS /usr/local/lib/libmir.a ${FAUST_LIBS}) + target_link_libraries (dynamiclib PRIVATE ${FAUST_LIBS}) + if (WIN32 OR MSYS) + enable_language(RC) + set_target_properties(dynamiclib PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR} + RUNTIME_OUTPUT_DIRECTORY ${LIBDIR}) + set_target_properties(dynamiclib PROPERTIES OUTPUT_NAME faust) + target_sources (faust PRIVATE ${ROOT}/windows/faust.rc) + target_sources (dynamiclib PRIVATE ${ROOT}/windows/faustdll.rc) + else() + if (IOS) + set_target_properties(dynamiclib PROPERTIES OUTPUT_NAME faust.ios) + else() + set_target_properties(dynamiclib PROPERTIES OUTPUT_NAME faust) + endif() + set_target_properties(dynamiclib PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${LIBDIR}) + set_target_properties(dynamiclib PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${LIBDIR} + VERSION ${VERSION} + SOVERSION ${SOVERS}) + endif() + set_target_properties(dynamiclib PROPERTIES COMPILE_FLAGS -DFAUST_LIB) + scan_backends (dynamiclib DYNAMIC) +# set (INSTALL_TARGETS ${INSTALL_TARGETS} dynamiclib) endif() # self contained library if (SELF_CONTAINED_LIBRARY) - add_definitions( -DFAUST_SELF_CONTAINED_LIB ) + add_definitions( -DFAUST_SELF_CONTAINED_LIB ) endif() #################################### # add sub projects (emcc, osclib, interpreter) #################################### if (${CMAKE_GENERATOR} STREQUAL Xcode OR ${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC OR IOS) - set (INCLUDE_EMCC off) - set (INCLUDE_WASM_GLUE off) + set (INCLUDE_EMCC off) + set (INCLUDE_WASM_GLUE off) endif() if (INCLUDE_EMCC) - add_subdirectory (emcc) + add_subdirectory (emcc) endif() if (INCLUDE_WASM_GLUE) - add_subdirectory (wasmglue) + add_subdirectory (wasmglue) endif() if (INCLUDE_OSC OR OSCDYNAMIC) - add_subdirectory (osc) - set (SUBTARGETS ${SUBTARGETS} osc) + add_subdirectory (osc) + set (SUBTARGETS ${SUBTARGETS} osc) endif() if (INCLUDE_HTTP OR HTTPDYNAMIC) - add_subdirectory (http) - set (SUBTARGETS ${SUBTARGETS} http) + add_subdirectory (http) + set (SUBTARGETS ${SUBTARGETS} http) endif() if (INCLUDE_ITP OR ITPDYNAMIC) - add_subdirectory (interp) - set (SUBTARGETS ${SUBTARGETS} faustmachine) + add_subdirectory (interp) + set (SUBTARGETS ${SUBTARGETS} faustmachine) endif() - #################################### # install section #################################### @@ -320,11 +316,11 @@ message (STATUS "Include targets: ${INSTALL_TARGETS} ${SUBTARGETS}") #################################### # install the faust compiler and libraries if (PACK) - set (CMAKE_INSTALL_PREFIX .) + set (CMAKE_INSTALL_PREFIX .) endif() install ( TARGETS ${INSTALL_TARGETS} - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIBSDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIBSDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/faust @@ -332,20 +328,19 @@ install ( TARGETS ${INSTALL_TARGETS} if (INCLUDE_DYNAMIC) install ( TARGETS dynamiclib - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIBSDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIBSDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIBSDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIBSDIR} ) endif() - #################################### # install the faust with llvm library if (INCLUDE_STATIC AND INCLUDE_LLVM) if (WIN32) - set (LFWITHLLVM ${LIBDIR}/libfaustwithllvm.lib) + set (LFWITHLLVM ${LIBDIR}/libfaustwithllvm.lib) else() - set (LFWITHLLVM ${LIBDIR}/libfaustwithllvm.a) + set (LFWITHLLVM ${LIBDIR}/libfaustwithllvm.a) endif() install ( FILES ${LFWITHLLVM} DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIBSDIR} @@ -354,29 +349,28 @@ install ( ) endif() - #################################### # install headers install ( DIRECTORY ${ARCHDIRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/faust FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PATTERN ".DS_Store" EXCLUDE PATTERN "*.o" EXCLUDE ) install ( - FILES ${ARCHINC}/misc.h ${ARCHINC}/sound-file.h ${ARCHINC}/export.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/faust + FILES ${ARCHINC}/misc.h ${ARCHINC}/sound-file.h ${ARCHINC}/export.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/faust PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) install ( - FILES ${SRCDIR}/generator/libfaust.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/faust/dsp + FILES ${SRCDIR}/generator/libfaust.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/faust/dsp PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) # the file below is part of the httpd lib but installed even if the lib is not part of the config # this is due to the fact that faust -i will try to read it (depending on the architecture file) install ( - FILES ${ARCHDIR}/httpdlib/src/include/HTTPDControler.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/faust/gui + FILES ${ARCHDIR}/httpdlib/src/include/HTTPDControler.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/faust/gui PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) @@ -384,7 +378,7 @@ install ( # install faust2xxx tools file (GLOB FAUST2XXX ${ROOT}/tools/faust2appls/faust2* ${ROOT}/tools/faust2appls/faustremote ${ROOT}/tools/faust2appls/encoderunitypackage ${ROOT}/tools/faust2appls/usage.sh ${ROOT}/tools/faust2appls/filename2ident ${ROOT}/tools/faust2sc-1.0.0/faust2sc ) install ( - FILES ${FAUST2XXX} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + FILES ${FAUST2XXX} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_EXECUTE WORLD_READ ) install ( @@ -396,16 +390,15 @@ install ( # install sound2xxx tools file (GLOB SOUND2XXX ${ROOT}/tools/sound2faust/sound2faust ${ROOT}/tools/sound2faust/sound2file ${ROOT}/tools/sound2faust/sound2reader) install ( - FILES ${SOUND2XXX} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + FILES ${SOUND2XXX} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_EXECUTE WORLD_READ OPTIONAL ) - #################################### # install shared resources install ( - FILES ${ROOT}/documentation/man/man1/faust.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 + FILES ${ROOT}/documentation/man/man1/faust.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) @@ -427,7 +420,7 @@ install ( DIRECTORY ${ROOT}/examples DESTINATION ${CMAKE_INSTALL_PREFIX}//share/faust FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PATTERN ".DS_Store" EXCLUDE ) @@ -436,22 +429,22 @@ file (GLOB FAUSTDSPLIBS ${ROOT}/libraries/*.lib ${ROOT}/libraries/old/*.lib) file (GLOB FAUSTDPSEMB ${ROOT}/libraries/embedded/*.lib) # install various files from the architecture root folder file (GLOB FAUSTARCHS ${ARCHDIR}/*.cpp ${ARCHDIR}/*.c ${ARCHDIR}/*.cs ${ARCHDIR}/*.rs ${ARCHDIR}/*.jl - ${ARCHDIR}/*.java ${ARCHDIR}/*.h - ${ARCHDIR}/*.d ${ARCHDIR}/mathdoctexts-*.txt - ${ARCHDIR}/latexheader.tex) + ${ARCHDIR}/*.java ${ARCHDIR}/*.h + ${ARCHDIR}/*.d ${ARCHDIR}/mathdoctexts-*.txt + ${ARCHDIR}/latexheader.tex) install ( - FILES ${FAUSTDSPLIBS} ${FAUSTARCHS} ${ROOT}/tools/faust2appls/Info.plist DESTINATION ${CMAKE_INSTALL_PREFIX}/share/faust + FILES ${FAUSTDSPLIBS} ${FAUSTARCHS} ${ROOT}/tools/faust2appls/Info.plist DESTINATION ${CMAKE_INSTALL_PREFIX}/share/faust PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) install ( - FILES ${FAUSTDPSEMB} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/faust/embedded + FILES ${FAUSTDPSEMB} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/faust/embedded PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) # install folders set (ARCHSRC android api AU audiokit autodiff chaos-stratus cmajor comparator daisy esp32 iOS jax juce julia max-msp nodejs osclib sam smartKeyboard svgplot teensy unity rust vcvrack webaudio) foreach (dir ${ARCHSRC}) - set(ARCHFOLDERS ${ARCHFOLDERS} ${ARCHDIR}/${dir}) + set(ARCHFOLDERS ${ARCHFOLDERS} ${ARCHDIR}/${dir}) endforeach() set(ARCHFOLDERS ${ARCHFOLDERS} ${ARCHDIR}/httpdlib/html/js) @@ -459,7 +452,7 @@ install ( DIRECTORY ${ARCHFOLDERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/faust FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PATTERN ".DS_Store" EXCLUDE PATTERN "*.o" EXCLUDE ) @@ -467,10 +460,10 @@ install ( #################################### # install ios lib if (NOT WIN32) - install ( - FILES ${ARCHDIR}/ios-libsndfile.a DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIBSDIR} - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - ) + install ( + FILES ${ARCHDIR}/ios-libsndfile.a DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIBSDIR} + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + ) endif() #################################### @@ -479,7 +472,6 @@ if (MSVC) include (InstallRequiredSystemLibraries) endif() - #################################### # cpack section #################################### diff --git a/build/emcc/CMakeLists.txt b/build/emcc/CMakeLists.txt index 9b47a52026..ba100a5c0b 100644 --- a/build/emcc/CMakeLists.txt +++ b/build/emcc/CMakeLists.txt @@ -10,8 +10,8 @@ set ( CMAKE_CXX_COMPILER "emcc") set (CMAKE_CXX_LINK_FLAGS "") if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64") - message (WARNING "Compiling on M1") - set (CMAKE_OSX_ARCHITECTURES " ") + message (WARNING "Compiling on M1") + set (CMAKE_OSX_ARCHITECTURES " ") endif() if (UNIVERSAL) @@ -42,10 +42,10 @@ target_compile_definitions (wasmlib PRIVATE -DEMCC -DFAUST_LIB ${FAUST_DEFINITIO #target_compile_definitions (wasmlib PRIVATE -DEMCC -DFAUST_LIB -DWASM_BUILD ${FAUST_DEFINITIONS}) set_target_properties (wasmlib PROPERTIES - OUTPUT_NAME libfaust-wasm - LINK_FLAGS ${WASM_LINK_FLAGS} - COMPILE_FLAGS -O3 -# RUNTIME_OUTPUT_DIRECTORY ${LIBDIR} generation in a non default place prevents the data file to be found - SUFFIX ".js") + OUTPUT_NAME libfaust-wasm + LINK_FLAGS ${WASM_LINK_FLAGS} + COMPILE_FLAGS -O3 +# RUNTIME_OUTPUT_DIRECTORY ${LIBDIR} generation in a non default place prevents the data file to be found + SUFFIX ".js") scan_backends (wasmlib WASM) diff --git a/build/misc/msvc_static_runtime.cmake b/build/misc/msvc_static_runtime.cmake index e8c3a496b6..ed9f7d5be0 100644 --- a/build/misc/msvc_static_runtime.cmake +++ b/build/misc/msvc_static_runtime.cmake @@ -1,6 +1,5 @@ if(WIN32) message (STATUS "Using static MSVC Runtime") - 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) diff --git a/build/wasmglue/CMakeLists.txt b/build/wasmglue/CMakeLists.txt index f6dcdc37e3..2915009eca 100644 --- a/build/wasmglue/CMakeLists.txt +++ b/build/wasmglue/CMakeLists.txt @@ -7,29 +7,29 @@ project (faustemcc) option (WORKLET "Compile wasm glue library for worklet" off) set (CMAKE_OSX_DEPLOYMENT_TARGET "") -set (CMAKE_OSX_SYSROOT "") +set (CMAKE_OSX_SYSROOT "") set (CMAKE_CXX_COMPILER "emcc") set (CMAKE_CXX_LINK_FLAGS "") if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64") - message (WARNING "Compiling on M1") - set (CMAKE_OSX_ARCHITECTURES " ") + message (WARNING "Compiling on M1") + set (CMAKE_OSX_ARCHITECTURES " ") endif() if (UNIVERSAL) -message (WARNING "WASM do not support universal mode. Switch back to native mode before compiling") + message (WARNING "WASM do not support universal mode. Switch back to native mode before compiling") endif() if (WORKLET) -message(STATUS "Compile wasm glue library for worklet") -set (WASM_COMPILE_FLAGS "-O3 -DAUDIO_WORKLET") -set (WASM_LINK_FLAGS_EXTRA "-s WASM_ASYNC_COMPILATION=0 -s SINGLE_FILE=1 -s ASSERTIONS=0") -set (LIB_NAME "libfaust-worklet-glue") + message(STATUS "Compile wasm glue library for worklet") + set (WASM_COMPILE_FLAGS "-O3 -DAUDIO_WORKLET") + set (WASM_LINK_FLAGS_EXTRA "-s WASM_ASYNC_COMPILATION=0 -s SINGLE_FILE=1 -s ASSERTIONS=0") + set (LIB_NAME "libfaust-worklet-glue") else() -message(STATUS "Compile wasm glue library") -set (WASM_COMPILE_FLAGS "-O3") -set (WASM_LINK_FLAGS_EXTRA "-s ASSERTIONS=1") -set (LIB_NAME "libfaust-glue") + message(STATUS "Compile wasm glue library") + set (WASM_COMPILE_FLAGS "-O3") + set (WASM_LINK_FLAGS_EXTRA "-s ASSERTIONS=1") + set (LIB_NAME "libfaust-glue") endif() set (WGLUE wasmglue) @@ -43,10 +43,10 @@ file (GLOB HH ${SRCDIR}/generator/wasm/wasm_dsp_aux.hh ${SRCDIR}/generator/expor #################################### # include directories set (FAUST_INC ${SRCDIR} - ${SRCDIR}/errors - ${SRCDIR}/generator - ${SRCDIR}/tlib ${SRCDIR}/transform ${SRCDIR}/utils - ${SRCDIR}/../architecture /usr/local/include) +${SRCDIR}/errors +${SRCDIR}/generator +${SRCDIR}/tlib ${SRCDIR}/transform ${SRCDIR}/utils +${SRCDIR}/../architecture /usr/local/include) #################################### @@ -61,8 +61,8 @@ add_executable(${WGLUE} EXCLUDE_FROM_ALL ${SRC} ${HH}) target_include_directories (${WGLUE} PRIVATE ${SRCDIR}/generator/wasm ${FAUST_INC}) target_compile_definitions (${WGLUE} PRIVATE -DEMCC ${FAUST_DEFINITIONS}) set_target_properties (${WGLUE} PROPERTIES - OUTPUT_NAME ${LIB_NAME} - LINK_FLAGS ${WASM_LINK_FLAGS} - COMPILE_FLAGS ${WASM_COMPILE_FLAGS} - RUNTIME_OUTPUT_DIRECTORY ${LIBDIR} - SUFFIX ".js") +OUTPUT_NAME ${LIB_NAME} +LINK_FLAGS ${WASM_LINK_FLAGS} +COMPILE_FLAGS ${WASM_COMPILE_FLAGS} +RUNTIME_OUTPUT_DIRECTORY ${LIBDIR} +SUFFIX ".js") diff --git a/embedded/faustgen/CMakeLists.txt b/embedded/faustgen/CMakeLists.txt index 6e268dc02d..673e199f28 100644 --- a/embedded/faustgen/CMakeLists.txt +++ b/embedded/faustgen/CMakeLists.txt @@ -10,34 +10,34 @@ set (CMAKE_CXX_STANDARD 11) ####################################### # Max part if (NOT DEFINED MAXSDK) - message (FATAL_ERROR "MAXSDK path undefined ! Call cmake with -DMAXSDK=path/toMax/sdk") + message (FATAL_ERROR "MAXSDK path undefined ! Call cmake with -DMAXSDK=path/toMax/sdk") else() - message (STATUS "Using MAXSDK from ${MAXSDK}") + message (STATUS "Using MAXSDK from ${MAXSDK}") endif() set (MAXINCL ${MAXSDK}/max-includes ${MAXSDK}/msp-includes) if (APPLE) - set (MAXLIBS "-F${MAXSDK}/max-includes -F${MAXSDK}/msp-includes -framework MaxAudioAPI") + set (MAXLIBS "-F${MAXSDK}/max-includes -F${MAXSDK}/msp-includes -framework MaxAudioAPI") elseif (WIN32) - file (GLOB MAPI ${MAXSDK}/max-includes/x64/MaxAPI.lib) - file (GLOB MAUDIO ${MAXSDK}/msp-includes/x64/MaxAudio.lib) - set (MAXLIBS ${MAPI} ${MAUDIO}) -# set (MAXLIBS ${MAXSDK}/max-includes/x64/MaxAPI ${MAXSDK}/msp-includes/x64/MaxAudio) + file (GLOB MAPI ${MAXSDK}/max-includes/x64/MaxAPI.lib) + file (GLOB MAUDIO ${MAXSDK}/msp-includes/x64/MaxAudio.lib) + set (MAXLIBS ${MAPI} ${MAUDIO}) +# set (MAXLIBS ${MAXSDK}/max-includes/x64/MaxAPI ${MAXSDK}/msp-includes/x64/MaxAudio) endif() ####################################### # Faust part if(DEFINED FAUST_PATH_IS_ABSOLUTE AND FAUST_PATH_IS_ABSOLUTE MATCHES "1") -# We can't execute an arm64 faust executable on a GitHub x86 runner, -# so we make some strong assumptions about where the include and libs are. -cmake_path(GET FAUST PARENT_PATH FAUST_DIR) -cmake_path(GET FAUST_DIR PARENT_PATH FAUST_DIR) -set(FAUSTINC ${FAUST_DIR}/include) -set(FAUSTLIB ${FAUST_DIR}/lib) -string ( STRIP ${FAUSTINC} FAUSTINC ) -message("USING FAUSTINC ${FAUSTINC}") + # We can't execute an arm64 faust executable on a GitHub x86 runner, + # so we make some strong assumptions about where the include and libs are. + cmake_path(GET FAUST PARENT_PATH FAUST_DIR) + cmake_path(GET FAUST_DIR PARENT_PATH FAUST_DIR) + set(FAUSTINC ${FAUST_DIR}/include) + set(FAUSTLIB ${FAUST_DIR}/lib) + string ( STRIP ${FAUSTINC} FAUSTINC ) + message("USING FAUSTINC ${FAUSTINC}") else() if (NOT DEFINED FAUST) - set (FAUST faust) + set (FAUST faust) endif() message (STATUS "Using Faust as ${FAUST}") execute_process (COMMAND ${FAUST} --includedir OUTPUT_VARIABLE FINC) @@ -51,37 +51,37 @@ endif() ####################################### # libsndfile if (WIN32) - if (NOT DEFINED LIBSNDFILE) - set (LIBSNDFILE "C:/Program Files/Mega-Nerd/libsndfile") - endif() - set (SNDFILE_LIBRARIES ${LIBSNDFILE}/lib/sndfile.lib) - set (SNDFILE_INCLUDE_DIRS ${LIBSNDFILE}/include) + if (NOT DEFINED LIBSNDFILE) + set (LIBSNDFILE "C:/Program Files/Mega-Nerd/libsndfile") + endif() + set (SNDFILE_LIBRARIES ${LIBSNDFILE}/lib/sndfile.lib) + set (SNDFILE_INCLUDE_DIRS ${LIBSNDFILE}/include) else() - find_package(PkgConfig REQUIRED) - if (DEFINED USE_STATIC_SNDFILE AND "${USE_STATIC_SNDFILE}" STREQUAL "1" ) - # We expect the user to have built libsndfile as a static lib - # and for it to be accessible via `pkg-config --static libsndfile` - set(SNDFILE_IS_STATIC 1) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) - list(APPEND PKG_CONFIG_EXECUTABLE "--static") # append temporarily - pkg_check_modules(SNDFILE REQUIRED IMPORTED_TARGET sndfile) - pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac) - pkg_check_modules(VORBIS REQUIRED IMPORTED_TARGET vorbis) - pkg_check_modules(OGG REQUIRED IMPORTED_TARGET ogg) - pkg_check_modules(OPUS REQUIRED IMPORTED_TARGET opus) - pkg_check_modules(MPG123 IMPORTED_TARGET libmpg123) # libmpg123 is not REQUIRED because it requires macos 12 - list(POP_BACK PKG_CONFIG_EXECUTABLE) # undo the append above - else() - # We expect the user to have installed sndfile with - # brew install libsndfile - set(SNDFILE_IS_STATIC 1) - pkg_check_modules(SNDFILE REQUIRED IMPORTED_TARGET sndfile) - pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac) - pkg_check_modules(VORBIS REQUIRED IMPORTED_TARGET vorbis) - pkg_check_modules(OGG REQUIRED IMPORTED_TARGET ogg) - pkg_check_modules(OPUS REQUIRED IMPORTED_TARGET opus) - pkg_check_modules(MPG123 IMPORTED_TARGET libmpg123) # libmpg123 is not REQUIRED because it requires macos 12 - endif() + find_package(PkgConfig REQUIRED) + if (DEFINED USE_STATIC_SNDFILE AND "${USE_STATIC_SNDFILE}" STREQUAL "1" ) + # We expect the user to have built libsndfile as a static lib + # and for it to be accessible via `pkg-config --static libsndfile` + set(SNDFILE_IS_STATIC 1) + set(CMAKE_FIND_LIBRARY_SUFFIXES .a) + list(APPEND PKG_CONFIG_EXECUTABLE "--static") # append temporarily + pkg_check_modules(SNDFILE REQUIRED IMPORTED_TARGET sndfile) + pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac) + pkg_check_modules(VORBIS REQUIRED IMPORTED_TARGET vorbis) + pkg_check_modules(OGG REQUIRED IMPORTED_TARGET ogg) + pkg_check_modules(OPUS REQUIRED IMPORTED_TARGET opus) + pkg_check_modules(MPG123 IMPORTED_TARGET libmpg123) # libmpg123 is not REQUIRED because it requires macos 12 + list(POP_BACK PKG_CONFIG_EXECUTABLE) # undo the append above + else() + # We expect the user to have installed sndfile with + # brew install libsndfile + set(SNDFILE_IS_STATIC 1) + pkg_check_modules(SNDFILE REQUIRED IMPORTED_TARGET sndfile) + pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac) + pkg_check_modules(VORBIS REQUIRED IMPORTED_TARGET vorbis) + pkg_check_modules(OGG REQUIRED IMPORTED_TARGET ogg) + pkg_check_modules(OPUS REQUIRED IMPORTED_TARGET opus) + pkg_check_modules(MPG123 IMPORTED_TARGET libmpg123) # libmpg123 is not REQUIRED because it requires macos 12 + endif() endif() ####################################### @@ -91,21 +91,21 @@ file (GLOB DSPLIBS ${ROOT}/../../libraries/*.lib) #################################### # compiler dependent settings if (WIN32) - set (FAUSTLIBS ${FAUSTLIB}/libfaustwithllvm.lib ${FAUSTLIB}/libOSCFaust.lib) - set (WINSRC ${MAXSDK}/max-includes/common/dllmain_win.c ${MAXSDK}/max-includes/common/commonsyms.c) + set (FAUSTLIBS ${FAUSTLIB}/libfaustwithllvm.lib ${FAUSTLIB}/libOSCFaust.lib) + set (WINSRC ${MAXSDK}/max-includes/common/dllmain_win.c ${MAXSDK}/max-includes/common/commonsyms.c) else() - set (MACLIBS "-framework CoreServices -framework IOKit") - set (CMAKE_CXX_FLAGS_RELEASE "-O3") - - if(DEFINED FAUST_PATH_IS_ABSOLUTE AND FAUST_PATH_IS_ABSOLUTE MATCHES "1") - set (FAUSTLIBS ${FAUSTLIB}/libfaustwithllvm.a ${FAUSTLIB}/libOSCFaust.a) - else() - execute_process( COMMAND faust-config --system-libs OUTPUT_VARIABLE FC_OUTPUT RESULT_VARIABLE FC_RESULT) - string(REPLACE " " ";" FC_OUTPUT ${FC_OUTPUT}) - string(STRIP "${FC_OUTPUT}" FC_OUTPUT) - set (FAUSTLIBS ${FAUSTLIB}/libfaustwithllvm.a ${FC_OUTPUT} -L/opt/local/lib ${FAUSTLIB}/libOSCFaust.a) - endif() + set (MACLIBS "-framework CoreServices -framework IOKit") + set (CMAKE_CXX_FLAGS_RELEASE "-O3") + + if(DEFINED FAUST_PATH_IS_ABSOLUTE AND FAUST_PATH_IS_ABSOLUTE MATCHES "1") + set (FAUSTLIBS ${FAUSTLIB}/libfaustwithllvm.a ${FAUSTLIB}/libOSCFaust.a) + else() + execute_process( COMMAND faust-config --system-libs OUTPUT_VARIABLE FC_OUTPUT RESULT_VARIABLE FC_RESULT) + string(REPLACE " " ";" FC_OUTPUT ${FC_OUTPUT}) + string(STRIP "${FC_OUTPUT}" FC_OUTPUT) + set (FAUSTLIBS ${FAUSTLIB}/libfaustwithllvm.a ${FC_OUTPUT} -L/opt/local/lib ${FAUSTLIB}/libOSCFaust.a) + endif() endif() @@ -115,27 +115,27 @@ endif() add_library(faustgen MODULE ${ROOT}/src/faustgen~.cpp ${ROOT}/src/faustgen_factory.cpp ${WINSRC} ${DSPLIBS}) target_include_directories(faustgen PRIVATE ${ROOT}/src/ ${MAXINCL} ${FAUSTINC} ${SNDFILE_INCLUDE_DIRS}) if (DEFINED SNDFILE_IS_STATIC) -target_link_libraries (faustgen ${FAUSTLIBS} ${MAXLIBS} PkgConfig::SNDFILE PkgConfig::FLAC PkgConfig::VORBIS PkgConfig::OGG PkgConfig::OPUS PkgConfig::MPG123) + target_link_libraries (faustgen ${FAUSTLIBS} ${MAXLIBS} PkgConfig::SNDFILE PkgConfig::FLAC PkgConfig::VORBIS PkgConfig::OGG PkgConfig::OPUS PkgConfig::MPG123) else() -target_link_libraries (faustgen ${FAUSTLIBS} ${MAXLIBS} ${SNDFILE_LIBRARIES}) + target_link_libraries (faustgen ${FAUSTLIBS} ${MAXLIBS} ${SNDFILE_LIBRARIES}) endif() if (APPLE) -set_target_properties (faustgen PROPERTIES - # With Max 8.6, the MaxAPI framework is not linked anymore, so a bunch of symbols are undefined, are ignored with the -U flag and will be resolved at runtime. - LINK_FLAGS "${MACLIBS} -Wl,-U,_outlet_new,-U,_object_new_imp,-U,_atom_getlong,-U,_atom_getobj,-U,_atom_getsym,-U,_atom_gettype,-U,_atom_setfloat,-U,_atom_setsym,-U,_class_addmethod,-U,_class_new,-U,_class_register,-U,_common_symbols_gettable,-U,_dictionary_appendlong,-U,_dictionary_appendstring,-U,_dictionary_getlong,-U,_dictionary_getstring,-U,_gensym,-U,_jbox_get_color,-U,_jbox_get_nextobject,-U,_jbox_get_object,-U,_jbox_get_varname,-U,_jbox_set_varname,-U,_jmouse_getposition_global,-U,_jpatcher_get_firstobject,-U,_jpatcher_set_dirty,-U,_jpopupmenu_additem,-U,_jpopupmenu_create,-U,_jpopupmenu_destroy,-U,_jpopupmenu_popup,-U,_jrgba_set,-U,_locatefile_extended,-U,_object_alloc,-U,_object_attr_setchar,-U,_object_attr_setsym,-U,_object_classname,-U,_object_classname_compare,-U,_object_error_obtrusive,-U,_object_free,-U,_object_method_imp,-U,_object_method_typed,-U,_object_obex_lookup,-U,_open_dialog,-U,_outlet_append,-U,_outlet_bang,-U,_outlet_delete,-U,_outlet_int,-U,_outlet_list,-U,_outlet_nth,-U,_path_createsysfile,-U,_path_opensysfile,-U,_path_setdefault,-U,_path_topathname,-U,_post,-U,_proxy_getinlet,-U,_saveas_dialog,-U,_strncpy_zero,-U,_sysfile_close,-U,_sysfile_readtextfile,-U,_sysfile_setpos,-U,_sysfile_writetextfile,-U,_sysmem_copyptr,-U,_sysmem_freehandle,-U,_sysmem_handlesize,-U,_sysmem_newhandle,-U,_sysmem_newhandleclear,-U,_jbox_set_color,-U,_path_getdefault" - BUNDLE TRUE - BUNDLE_EXTENSION mxo - MACOSX_BUNDLE_INFO_PLIST ${ROOT}/Info.plist - RESOURCE "${DSPLIBS}" - OUTPUT_NAME faustgen~) + set_target_properties (faustgen PROPERTIES + # With Max 8.6, the MaxAPI framework is not linked anymore, so a bunch of symbols are undefined, are ignored with the -U flag and will be resolved at runtime. + LINK_FLAGS "${MACLIBS} -Wl,-U,_outlet_new,-U,_object_new_imp,-U,_atom_getlong,-U,_atom_getobj,-U,_atom_getsym,-U,_atom_gettype,-U,_atom_setfloat,-U,_atom_setsym,-U,_class_addmethod,-U,_class_new,-U,_class_register,-U,_common_symbols_gettable,-U,_dictionary_appendlong,-U,_dictionary_appendstring,-U,_dictionary_getlong,-U,_dictionary_getstring,-U,_gensym,-U,_jbox_get_color,-U,_jbox_get_nextobject,-U,_jbox_get_object,-U,_jbox_get_varname,-U,_jbox_set_varname,-U,_jmouse_getposition_global,-U,_jpatcher_get_firstobject,-U,_jpatcher_set_dirty,-U,_jpopupmenu_additem,-U,_jpopupmenu_create,-U,_jpopupmenu_destroy,-U,_jpopupmenu_popup,-U,_jrgba_set,-U,_locatefile_extended,-U,_object_alloc,-U,_object_attr_setchar,-U,_object_attr_setsym,-U,_object_classname,-U,_object_classname_compare,-U,_object_error_obtrusive,-U,_object_free,-U,_object_method_imp,-U,_object_method_typed,-U,_object_obex_lookup,-U,_open_dialog,-U,_outlet_append,-U,_outlet_bang,-U,_outlet_delete,-U,_outlet_int,-U,_outlet_list,-U,_outlet_nth,-U,_path_createsysfile,-U,_path_opensysfile,-U,_path_setdefault,-U,_path_topathname,-U,_post,-U,_proxy_getinlet,-U,_saveas_dialog,-U,_strncpy_zero,-U,_sysfile_close,-U,_sysfile_readtextfile,-U,_sysfile_setpos,-U,_sysfile_writetextfile,-U,_sysmem_copyptr,-U,_sysmem_freehandle,-U,_sysmem_handlesize,-U,_sysmem_newhandle,-U,_sysmem_newhandleclear,-U,_jbox_set_color,-U,_path_getdefault" + BUNDLE TRUE + BUNDLE_EXTENSION mxo + MACOSX_BUNDLE_INFO_PLIST ${ROOT}/Info.plist + RESOURCE "${DSPLIBS}" + OUTPUT_NAME faustgen~) elseif (WIN32) -set_target_properties (faustgen PROPERTIES - COMPILE_FLAGS "-DWIN_VERSION -DWIN_EXT_VERSION" - LINK_FLAGS "winmm.lib ws2_32.lib" - SUFFIX ".mxe64" - OUTPUT_NAME faustgen~) + set_target_properties (faustgen PROPERTIES + COMPILE_FLAGS "-DWIN_VERSION -DWIN_EXT_VERSION" + LINK_FLAGS "winmm.lib ws2_32.lib" + SUFFIX ".mxe64" + OUTPUT_NAME faustgen~) endif() @@ -145,11 +145,11 @@ endif() set (PACKDIR ${ROOT}/package) set (DST faustgen-${VERSION}) if (WIN32) -set (DST ${DST}-win64) + set (DST ${DST}-win64) endif() set (FG ${DST}/faustgen) install ( TARGETS faustgen - RUNTIME DESTINATION ${PACKDIR}/${FG}/externals/msp + RUNTIME DESTINATION ${PACKDIR}/${FG}/externals/msp LIBRARY DESTINATION ${PACKDIR}/${FG}/externals/msp ARCHIVE DESTINATION ${PACKDIR}/${FG}/externals/msp ) @@ -161,7 +161,7 @@ install ( DIRECTORY ${PACKCONTENT} DESTINATION ${PACKDIR}/${FG} FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PATTERN ".DS_Store" EXCLUDE )