mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-28 03:10:24 -04:00
feat(asm&CI): Add support for macho-formats to header.inc and run tests also on MacOS.
Mac was giving errors about position dependent code, so had to add linker flag -Wl,-no_pie to ld & cgo.
This commit is contained in:
parent
bca34febcb
commit
335d2af05b
12
.github/workflows/tests.yml
vendored
12
.github/workflows/tests.yml
vendored
@ -22,18 +22,26 @@ jobs:
|
||||
cmakeflags: -GNinja
|
||||
maker: ninja
|
||||
gotests: yes
|
||||
cgo_ldflags:
|
||||
- os: windows-latest
|
||||
cmakeflags: -GNinja
|
||||
maker: ninja
|
||||
asmnasm: C:\Users\runneradmin\nasm\nasm
|
||||
gotests: yes
|
||||
cgo_ldflags:
|
||||
- os: macos-latest
|
||||
cmakeflags: -GNinja
|
||||
maker: ninja
|
||||
asmnasm: /Users/runner/nasm/nasm
|
||||
gotests: yes
|
||||
cgo_ldflags: -Wl,-no_pie # ld on mac is complaining about position dependent code
|
||||
# TODO: win32 builds didn't quite work out, complains gcc broken
|
||||
steps:
|
||||
- uses: lukka/get-cmake@v3.18.3
|
||||
- uses: actions/setup-go@v2
|
||||
if: ${{ matrix.config.gotests == 'yes' }}
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ilammy/setup-nasm@v1.1.0
|
||||
- uses: ilammy/setup-nasm@v1.2.0
|
||||
- name: Run ctest
|
||||
env:
|
||||
ASM_NASM: ${{ matrix.config.asmnasm }}
|
||||
@ -45,6 +53,8 @@ jobs:
|
||||
ctest --output-on-failure
|
||||
- name: Run go test
|
||||
if: ${{ matrix.config.gotests == 'yes' }}
|
||||
env:
|
||||
CGO_LDFLAGS: ${{ matrix.config.cgo_ldflags }}
|
||||
run: |
|
||||
cd go4k
|
||||
go test . ./bridge
|
||||
|
@ -24,6 +24,10 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||
include(CTest)
|
||||
endif()
|
||||
|
||||
IF(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie")
|
||||
endif()
|
||||
|
||||
enable_language(ASM_NASM)
|
||||
|
||||
# The normal NASM compile object does not include <DEFINES>
|
||||
|
19
README.md
19
README.md
@ -2,7 +2,7 @@
|
||||

|
||||
|
||||
A cross-platform modular software synthesizer for small intros, forked from
|
||||
[4klang](https://github.com/hzdgopher/4klang).
|
||||
[4klang](https://github.com/hzdgopher/4klang). Supports win32/win64/linux/mac.
|
||||
|
||||
Summary
|
||||
-------
|
||||
@ -21,8 +21,10 @@ Building
|
||||
|
||||
Requires [CMake](https://cmake.org), [nasm](https://www.nasm.us/) or
|
||||
[yasm](https://yasm.tortall.net), and your favorite c-compiler & build tool.
|
||||
Results have been obtained using Visual Studio 2019, gcc&make on linux, and
|
||||
MinGW&mingw32-make.
|
||||
Results have been obtained using Visual Studio 2019, gcc&make on linux,
|
||||
MinGW&mingw32-make, and ninja&AppleClang.
|
||||
|
||||
Additionally, building the tracker requires [go](https://golang.org/).
|
||||
|
||||
### Example: building and running CTests using MinGW32
|
||||
|
||||
@ -136,11 +138,9 @@ New features since fork
|
||||
and right channels. See [this example](tests/test_oscillat_unison.asm).
|
||||
- **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.
|
||||
instrument in 64-bit mode. All tests are passing so it seems to work.
|
||||
- **Supports Windows, Linux and MacOS**. On all three 64-bit platforms,
|
||||
all tests are passing. Additionally, all tests are passing on windows 32.
|
||||
- **Compiling as a library**. The API is very rudimentary, a single function
|
||||
render, and between calls, the user is responsible for manipulating
|
||||
the synth state in a similar way as the actual player does (e.g. triggering/
|
||||
@ -151,9 +151,6 @@ New features since fork
|
||||
Future goals
|
||||
------------
|
||||
|
||||
- **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
|
||||
|
@ -10,46 +10,40 @@
|
||||
%endmacro
|
||||
|
||||
%ifidn __OUTPUT_FORMAT__,win32
|
||||
; on win32, function f with n parameters is mangled as "_f@n"
|
||||
%define MANGLE_FUNC(f,n) _ %+ f %+ @ %+ n
|
||||
%define WIN_OR_MAC
|
||||
%define WINDOWS
|
||||
%assign BITS 32
|
||||
; On windows and mac, data label d is mangled as "_d"
|
||||
%define MANGLE_FUNC(f,n) _ %+ f %+ @ %+ n
|
||||
%define MANGLE_DATA(d) _ %+ d
|
||||
%endif
|
||||
|
||||
%ifidn __OUTPUT_FORMAT__,win64
|
||||
; on win32, function f with n parameters is mangled as "_f@n"
|
||||
%define MANGLE_FUNC(f,n) f
|
||||
%define WIN_OR_MAC
|
||||
%define WINDOWS
|
||||
%assign BITS 64
|
||||
; On windows and mac, data label d is mangled as "_d"
|
||||
%define MANGLE_FUNC(f,n) f
|
||||
%define MANGLE_DATA(d) d
|
||||
%endif
|
||||
|
||||
%ifidn __OUTPUT_FORMAT__,macho32
|
||||
%define MACOS
|
||||
%assign BITS 32
|
||||
%endif
|
||||
|
||||
%ifidn __OUTPUT_FORMAT__,macho64
|
||||
%define MACOS
|
||||
%assign BITS 64
|
||||
%endif
|
||||
|
||||
%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
|
||||
%define LINUX
|
||||
%assign BITS 32
|
||||
%endif
|
||||
|
||||
%ifidn __OUTPUT_FORMAT__,elf64
|
||||
%define MANGLE_FUNC(f,n) f
|
||||
%define MANGLE_DATA(d) d
|
||||
%define LINUX
|
||||
%assign BITS 64
|
||||
%endif
|
||||
|
||||
%ifidn __OUTPUT_FORMAT__,macho32
|
||||
; on mac, function f with x parameters is mangled as "_f"
|
||||
%define MANGLE_FUNC(f,n) _f
|
||||
%define WIN_OR_MAC
|
||||
; On windows and mac, data label d is mangled as "_d"
|
||||
%define MANGLE_DATA(d) _ %+ d
|
||||
%endif
|
||||
|
||||
%ifdef WIN_OR_MAC
|
||||
%ifdef WINDOWS
|
||||
; Windows has crinkler so one may put everything in custom sections to aid crinkler.
|
||||
; Maybe mac users need it too
|
||||
%ifndef DISABLE_SECTIONS
|
||||
@ -61,8 +55,17 @@
|
||||
%define SECT_DATA(n) section .data align=1
|
||||
%define SECT_TEXT(n) section .code align=1
|
||||
%endif
|
||||
%else
|
||||
; Linux
|
||||
%elifdef MACOS
|
||||
%define MANGLE_FUNC(f,n) _ %+ f
|
||||
%define MANGLE_DATA(d) _ %+ d
|
||||
; macho does not seem to support named sections, so DISABLE_SECTIONS
|
||||
; is "always on" / ignored
|
||||
%define SECT_BSS(n) section .bss align=1
|
||||
%define SECT_DATA(n) section .data align=1
|
||||
%define SECT_TEXT(n) section .text align=1
|
||||
%else ; Linux, or hopefully something similar
|
||||
%define MANGLE_FUNC(f,n) f
|
||||
%define MANGLE_DATA(d) d
|
||||
%ifndef DISABLE_SECTIONS
|
||||
%define SECT_BSS(n) section .bss. %+ n nobits alloc noexec write align=1
|
||||
%define SECT_DATA(n) section .data. %+ n progbits alloc noexec write align=1
|
||||
|
Loading…
Reference in New Issue
Block a user