Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ if (WIN32)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()

if(LINUX)
#add_compile_definitions(-msse -mfpmath=sse)
endif()

# settings used across all formats
include_directories(src)

Expand Down Expand Up @@ -165,7 +169,27 @@ elseif(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}\\${CMAKE_BUILD_TYPE}\\${PROJECT_NAME}_plugin.dll" "%LOCALAPPDATA%\\Programs\\Common\\CLAP\\${PROJECT_NAME}.clap"
)
endif() # MSVC
endif()
elseif(LINUX)
add_library(${PROJECT_NAME}_plugin MODULE
example/example.c
src/cplug_clap.c
src/cplug_vst3.c
)
set_target_properties(${PROJECT_NAME}_plugin PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}_plugin
)
add_custom_command(TARGET ${PROJECT_NAME}_plugin POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.vst3"

COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.clap" "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.vst3"

COMMAND ${CMAKE_COMMAND} -E echo "Installing ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.clap to ~/.clap/"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.clap" "~/.clap/${PROJECT_NAME}.clap"

COMMAND ${CMAKE_COMMAND} -E echo "Installing ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.vst3 to ~/.vst3"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.vst3" "~/.vst3/${PROJECT_NAME}.vst3"
)
endif() #LINUX


# ███████╗████████╗ █████╗ ███╗ ██╗██████╗ █████╗ ██╗ ██████╗ ███╗ ██╗███████╗
Expand Down
11 changes: 11 additions & 0 deletions example/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
unsigned int newMXCSR = oldMXCSR |= 0x8040; /* set DAZ and FZ bits */ \
_mm_setcsr(newMXCSR); /* write the new MXCSR setting to the MXCSR */
#define RESTORE_DENORMALS _mm_setcsr(oldMXCSR);
#elif defined(__linux__)
#ifdef __x86_64__
#include <xmmintrin.h>
#include <pmmintrin.h>
#define DISABLE_DENORMALS \
uint32_t oldMXCSR, newMXCSR; \
__builtin_ia32_fxsave(&oldMXCSR); \
newMXCSR = oldMXCSR |= 0x8040; \
__builtin_ia32_fxrstor(&newMXCSR);
#define RESTORE_DENORMALS __builtin_ia32_fxrstor(&oldMXCSR);
#endif
#else
#include <fenv.h>
#if defined(__x86_64__)
Expand Down
5 changes: 5 additions & 0 deletions src/cplug_clap.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#include <stdio.h>
#include <string.h>

// fixes something that's probably an issue with glibc-shipped headers
#ifndef static_assert
#define static_assert(cond, arg) _Static_assert(cond, arg)
#endif

typedef struct CLAPPlugin
{
clap_plugin_t clapPlugin;
Expand Down
6 changes: 5 additions & 1 deletion src/cplug_vst3.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include <vst3_c_api.h>
#include <wchar.h>

#ifndef static_assert
#define static_assert(cond, arg) _Static_assert(cond, arg)
#endif

#define tuid_match(a, b) memcmp(a, b, sizeof(Steinberg_TUID)) == 0
#define CPLUG_ARRLEN(a) (sizeof(a) / sizeof(a[0]))

Expand Down Expand Up @@ -2652,4 +2656,4 @@ bool VST3_EXIT(void)
cplug_log("Bundle exit");
cplug_libraryUnload();
return true;
}
}
14 changes: 14 additions & 0 deletions src/test_compile.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This fixes an issue caused by possibly glibc-shipped headers
#include <stdint.h>
#ifndef char16_t
typedef int16_t char16_t;
#endif

#include "example/config.h"
#include "src/cplug_clap.c"
#include "src/cplug_vst3.c"

#ifdef _WIN32
#include "src/cplug_standalone_win.c"
#include "example/example.c"
#endif