Build system supports both MacOS and Linux now
This commit is contained in:
parent
b93a236e37
commit
0d7f4b1eb5
8
Makefile
8
Makefile
@ -5,13 +5,13 @@ Obj := $(subst musique/,,$(Sources:%.cc=%.o))
|
|||||||
|
|
||||||
all: bin/musique
|
all: bin/musique
|
||||||
|
|
||||||
|
include scripts/$(os).mk
|
||||||
include scripts/debug.mk
|
include scripts/debug.mk
|
||||||
include scripts/release.mk
|
include scripts/release.mk
|
||||||
include scripts/test.mk
|
include scripts/test.mk
|
||||||
include scripts/windows.mk
|
|
||||||
|
|
||||||
# http://www.music.mcgill.ca/~gary/rtmidi/#compiling
|
# http://www.music.mcgill.ca/~gary/rtmidi/#compiling
|
||||||
bin/rtmidi.o: lib/rtmidi/RtMidi.cpp lib/rtmidi/RtMidi.h
|
bin/$(os)/rtmidi.o: lib/rtmidi/RtMidi.cpp lib/rtmidi/RtMidi.h
|
||||||
@echo "CXX $@"
|
@echo "CXX $@"
|
||||||
@$(CXX) $< -c -O2 -o $@ $(CPPFLAGS) -std=c++20
|
@$(CXX) $< -c -O2 -o $@ $(CPPFLAGS) -std=c++20
|
||||||
|
|
||||||
@ -32,5 +32,5 @@ install: bin/musique
|
|||||||
|
|
||||||
.PHONY: clean doc doc-open all test unit-tests release install
|
.PHONY: clean doc doc-open all test unit-tests release install
|
||||||
|
|
||||||
$(shell mkdir -p $(subst musique/,bin/,$(shell find musique/* -type d)))
|
$(shell mkdir -p $(subst musique/,bin/$(os)/,$(shell find musique/* -type d)))
|
||||||
$(shell mkdir -p $(subst musique/,bin/debug/,$(shell find musique/* -type d)))
|
$(shell mkdir -p $(subst musique/,bin/$(os)/debug/,$(shell find musique/* -type d)))
|
||||||
|
12
config.mk
12
config.mk
@ -8,15 +8,9 @@ LDLIBS= -lpthread
|
|||||||
RELEASE_FLAGS=-O2
|
RELEASE_FLAGS=-O2
|
||||||
DEBUG_FLAGS=-O0 -ggdb -fsanitize=undefined -DDebug
|
DEBUG_FLAGS=-O0 -ggdb -fsanitize=undefined -DDebug
|
||||||
|
|
||||||
ifeq ($(os),windows)
|
ifeq ($(shell uname),Darwin)
|
||||||
CC=i686-w64-mingw32-gcc
|
os=macos
|
||||||
CXX=i686-w64-mingw32-g++
|
|
||||||
CPPFLAGS:=$(CPPFLAGS) -D__WINDOWS_MM__
|
|
||||||
LDLIBS:=-lwinmm $(LDLIBS)
|
|
||||||
else
|
else
|
||||||
CC=gcc
|
os=linux
|
||||||
CXX=g++
|
|
||||||
CPPFLAGS:=$(CPPFLAGS) -D __MACOSX_CORE__
|
|
||||||
LDLIBS:=-framework CoreMIDI -framework CoreAudio -framework CoreFoundation $(LDLIBS)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -9,13 +9,14 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <compare>
|
#include <compare>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
Value::Value() = default;
|
Value::Value() = default;
|
||||||
|
|
||||||
std::strong_ordering operator<=>(std::string const& lhs, std::string const& rhs)
|
std::strong_ordering operator<=>(std::string const& lhs, std::string const& rhs)
|
||||||
{
|
{
|
||||||
if (auto cmp = lhs.size() <=> rhs.size(); cmp == 0) {
|
if (auto cmp = lhs.size() <=> rhs.size(); cmp == 0) {
|
||||||
if (auto cmp = strncmp(lhs.c_str(), rhs.c_str(), lhs.size()); cmp == 0) {
|
if (auto cmp = std::strncmp(lhs.c_str(), rhs.c_str(), lhs.size()); cmp == 0) {
|
||||||
return std::strong_ordering::equal;
|
return std::strong_ordering::equal;
|
||||||
} else if (cmp < 0) {
|
} else if (cmp < 0) {
|
||||||
return std::strong_ordering::less;
|
return std::strong_ordering::less;
|
||||||
|
5
scripts/linux.mk
Normal file
5
scripts/linux.mk
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CC=gcc
|
||||||
|
CXX=g++
|
||||||
|
CPPFLAGS:=$(CPPFLAGS) -D __LINUX_ALSA__
|
||||||
|
LDLIBS:=-lasound $(LDLIBS) -static-libgcc -static-libstdc++
|
||||||
|
Bestline=bin/$(os)/bestline.o
|
7
scripts/macos.mk
Normal file
7
scripts/macos.mk
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
CC=clang
|
||||||
|
CXX=clang++
|
||||||
|
CPPFLAGS:=$(CPPFLAGS) -D __MACOSX_CORE__
|
||||||
|
LDLIBS:=-framework CoreMIDI -framework CoreAudio -framework CoreFoundation $(LDLIBS)
|
||||||
|
Release_Obj=$(addprefix bin/,$(Obj))
|
||||||
|
Bestline=bin/$(os)/bestline.o
|
||||||
|
|
@ -1,15 +1,13 @@
|
|||||||
ifneq ($(os),windows)
|
Release_Obj=$(addprefix bin/$(os)/,$(Obj))
|
||||||
Release_Obj=$(addprefix bin/,$(Obj))
|
|
||||||
|
|
||||||
bin/bestline.o: lib/bestline/bestline.c lib/bestline/bestline.h
|
bin/$(os)/bestline.o: lib/bestline/bestline.c lib/bestline/bestline.h
|
||||||
@echo "CC $@"
|
@echo "CC $@"
|
||||||
@$(CC) $< -c -O3 -o $@
|
@$(CC) $< -c -O3 -o $@
|
||||||
|
|
||||||
bin/%.o: musique/%.cc
|
bin/$(os)/%.o: musique/%.cc
|
||||||
@echo "CXX $@"
|
@echo "CXX $@"
|
||||||
@$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $< -c
|
@$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $< -c
|
||||||
|
|
||||||
bin/musique: $(Release_Obj) bin/main.o bin/rtmidi.o bin/bestline.o
|
bin/musique: $(Release_Obj) bin/$(os)/main.o bin/$(os)/rtmidi.o $(Bestline)
|
||||||
@echo "CXX $@"
|
@echo "CXX $@"
|
||||||
@$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $(Release_Obj) bin/rtmidi.o bin/bestline.o $(LDFLAGS) $(LDLIBS)
|
@$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $(Release_Obj) bin/$(os)/rtmidi.o $(Bestline) $(LDFLAGS) $(LDLIBS)
|
||||||
endif
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
ifeq ($(os),windows)
|
CC=i686-w64-mingw32-gcc
|
||||||
Release_Obj=$(addprefix bin/,$(Obj))
|
CXX=i686-w64-mingw32-g++
|
||||||
|
CPPFLAGS:=$(CPPFLAGS) -D__WINDOWS_MM__
|
||||||
|
LDLIBS:=-lwinmm $(LDLIBS) -static-libgcc -static-libstdc++
|
||||||
|
|
||||||
bin/%.o: musique/%.cc
|
|
||||||
@echo "CXX $@"
|
|
||||||
@$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $< -c
|
|
||||||
|
|
||||||
bin/musique: $(Release_Obj) bin/main.o bin/rtmidi.o
|
|
||||||
@echo "CXX $@"
|
|
||||||
@$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $(Release_Obj) bin/rtmidi.o $(LDFLAGS) $(LDLIBS)
|
|
||||||
endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user