From 26016a22267d14e287de381f6cd05731e6e12334 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 7 Sep 2022 16:41:13 -0400 Subject: [PATCH 1/2] Add ARCH_X64 macro when compiling on x64. --- arch.mk | 5 +---- compile.mk | 4 ++++ include/common.hpp | 1 + src/common.cpp | 3 +++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch.mk b/arch.mk index b2676f27..1d62c9f3 100644 --- a/arch.mk +++ b/arch.mk @@ -1,11 +1,8 @@ MACHINE = $(shell $(CC) -dumpmachine) ifneq (,$(findstring x86_64-,$(MACHINE))) - ARCH_x64 := 1 + ARCH_X64 := 1 ARCH_NAME := x64 -else ifneq (,$(findstring i686-,$(MACHINE))) - ARCH_x86 := 1 - ARCH_NAME := x86 else $(error Could not determine CPU architecture of $(MACHINE). Try hacking around in arch.mk) endif diff --git a/compile.mk b/compile.mk index 9580533c..58f0d89f 100644 --- a/compile.mk +++ b/compile.mk @@ -21,6 +21,10 @@ FLAGS += -Wall -Wextra -Wno-unused-parameter CXXFLAGS += -std=c++11 # Architecture-independent flags +ifdef ARCH_X64 + FLAGS += -DARCH_X64 +endif + ifdef ARCH_LIN FLAGS += -DARCH_LIN CXXFLAGS += -Wsuggest-override diff --git a/include/common.hpp b/include/common.hpp index 6fcc867f..4d5f3c10 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -259,6 +259,7 @@ extern const std::string APP_EDITION_NAME; extern const std::string APP_VERSION_MAJOR; extern const std::string APP_VERSION; extern const std::string APP_OS; +extern const std::string APP_ARCH; extern const std::string API_URL; diff --git a/src/common.cpp b/src/common.cpp index 7fad3b15..ef020738 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -27,6 +27,9 @@ const std::string APP_VERSION = TOSTRING(_APP_VERSION); #elif defined ARCH_LIN const std::string APP_OS = "lin"; #endif +#if defined ARCH_X64 + const std::string APP_ARCH = "x64"; +#endif const std::string API_URL = "https://api.vcvrack.com"; From 639c2c6374d63da725d718ac0953622139c7d302 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 7 Sep 2022 18:48:17 -0400 Subject: [PATCH 2/2] Build libRack target to root dir instead of build/ dir. --- .gitignore | 4 ++++ Makefile | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0d08f5e9..f519e208 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ .DS_Store +*.so +*.dylib +*.dll +*.a /Rack /dep diff --git a/Makefile b/Makefile index 501d06ed..4428a1e4 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ LDFLAGS += -shared ifdef ARCH_LIN SED := sed -i - TARGET := build/libRack.so + TARGET := libRack.so SOURCES += dep/osdialog/osdialog_zenity.c @@ -40,7 +40,7 @@ endif ifdef ARCH_MAC SED := sed -i '' - TARGET := build/libRack.dylib + TARGET := libRack.dylib SOURCES += dep/osdialog/osdialog_mac.m LDFLAGS += -lpthread -ldl @@ -51,7 +51,7 @@ endif ifdef ARCH_WIN SED := sed -i - TARGET := build/libRack.dll + TARGET := libRack.dll SOURCES += dep/osdialog/osdialog_win.c LDFLAGS += -municode @@ -245,7 +245,7 @@ ifdef ARCH_MAC $(STRIP) -S dist/"$(DIST_SDK_DIR)"/libRack.dylib endif ifdef ARCH_WIN - cp build/libRack.dll.a dist/"$(DIST_SDK_DIR)"/ + cp libRack.dll.a dist/"$(DIST_SDK_DIR)"/ endif cd dist && zip -q -9 -r "$(DIST_SDK)" "$(DIST_SDK_DIR)"