Fix builds and tests to pass on Linux.

Builds on both 32-bit and 64-bit executables and all tests (except gm.dls stuff obviously, which was excluded) pass on 64-bit Linux. Cannot test the 32-bit executables, as WSL does not support running 32-bit.
This commit is contained in:
Veikko 2020-05-26 21:27:53 +03:00 committed by Veikko Sariola
parent b64723323f
commit 5e05057240
4 changed files with 87 additions and 62 deletions

View File

@ -84,14 +84,17 @@ New features since fork
- **Supports 32 and 64 bit builds**. The 64-bit version is done with minimal
changes to get it work, mainly for the future prospect of running the MIDI
instrument in 64-bit mode. All the tests are passing so it seems to work.
- **Supports both Windows and Linux**. Currently, all the tests are compiling
on Windows and Linux, both 32-bit and 64-bit, and the tests are passing on
64-bit Linux, tested on WSL. 32-bit executables don't run on WSL, so those
remain to be tested.
Future goals
------------
- **Cross-platform support for win / mac / linux**. The build is already based
on CMake and compiles on Windows. Cross-platform NASM/YASM macros have been
drafted and remain to be tested. Once the project is more mature, I will
try compiling on other platforms.
- **Support for mac**. This should be rather easy, as all the macros are
designed for cross-platform support, but as I don't have a mac, I cannot
test this.
- **Find a more general solution for skipping opcodes / early outs**. It's
probably a new opcode "skip" that skips from the opcode to the next out in
case the signal entering skip and the signal leaving out are both close to

View File

@ -27,11 +27,18 @@
%define MANGLE_DATA(d) d
%endif
%ifidn __OUTPUT_FORMAT__,elf32
%ifidn __OUTPUT_FORMAT__,elf
; on linux, function f with n parameters is mangled as "f"
%define MANGLE_FUNC(f,n) f
; On linux, data label d is mangled as "d"
%define MANGLE_DATA(d) d
%assign BITS 32
%endif
%ifidn __OUTPUT_FORMAT__,elf64
%define MANGLE_FUNC(f,n) f
%define MANGLE_DATA(d) d
%assign BITS 64
%endif
%ifidn __OUTPUT_FORMAT__,macho32

View File

@ -91,8 +91,10 @@ regression_test(test_oscillat_trisaw ENVELOPE)
regression_test(test_oscillat_pulse ENVELOPE VCO_PULSE)
regression_test(test_oscillat_gate ENVELOPE)
regression_test(test_oscillat_stereo ENVELOPE)
regression_test(test_oscillat_sample ENVELOPE)
regression_test(test_oscillat_sample_stereo ENVELOPE)
if(WIN32) # The samples are currently only GMDLs based, and thus require Windows.
regression_test(test_oscillat_sample ENVELOPE)
regression_test(test_oscillat_sample_stereo ENVELOPE)
endif()
regression_test(test_oscillat_unison ENVELOPE)
regression_test(test_oscillat_unison_stereo ENVELOPE)
regression_test(test_oscillat_lfo "ENVELOPE;VCO_SINE;VCO_PULSE;FOP_MULP2")

View File

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdbool.h>
#if defined (_WIN32)
#include <windows.h>
@ -12,7 +13,19 @@
#include <math.h>
extern void __stdcall su_render();
#include <stdint.h>
#if UINTPTR_MAX == 0xffffffff // are we 32-bit?
#if defined(__clang__) || defined(__GNUC__)
#define CALLCONV __attribute__ ((stdcall))
#elif defined(_WIN32)
#define CALLCONV __stdcall // on 32-bit platforms, we just use stdcall, as all know it
#endif
#else // 64-bit
#define CALLCONV // the asm will use honor honor correct x64 ABI on all 64-bit platforms
#endif
extern void CALLCONV su_render(void *);
extern int su_max_samples;
int main(int argc, char* argv[]) {
@ -25,7 +38,7 @@ int main(int argc, char* argv[]) {
char actual_output_folder[] = "actual_output/";
long fsize;
long bufsize;
boolean small_difference;
bool small_difference;
double diff;
#ifndef SU_USE_16BIT_OUTPUT
float* buf = NULL;
@ -84,7 +97,7 @@ int main(int argc, char* argv[]) {
fread((void*)filebuf, su_max_samples * 2, sizeof(*filebuf), f);
small_difference = FALSE;
small_difference = false;
for (n = 0; n < su_max_samples * 2; n++) {
diff = (double)(buf[n]) - (double)(filebuf[n]);
@ -97,7 +110,7 @@ int main(int argc, char* argv[]) {
goto fail;
}
else if (diff > 0.0f) {
small_difference = TRUE;
small_difference = true;
}
}