Browse Source

Define ARCH_* macros in arch.hpp instead of on the command line.

tags/v2.5.2
Andrew Belt 6 months ago
parent
commit
7c0941777f
10 changed files with 35 additions and 8 deletions
  1. +0
    -5
      compile.mk
  2. +20
    -0
      include/arch.hpp
  3. +2
    -0
      include/common.hpp
  4. +1
    -0
      include/simd/Vector.hpp
  5. +0
    -1
      include/simd/functions.hpp
  6. +2
    -0
      src/asset.cpp
  7. +3
    -1
      src/plugin.cpp
  8. +2
    -0
      src/string.cpp
  9. +3
    -1
      src/system.cpp
  10. +2
    -0
      src/window/Window.cpp

+ 0
- 5
compile.mk View File

@@ -28,20 +28,16 @@ endif


# Architecture-independent flags # Architecture-independent flags
ifdef ARCH_X64 ifdef ARCH_X64
FLAGS += -DARCH_X64
FLAGS += -march=nehalem FLAGS += -march=nehalem
endif endif
ifdef ARCH_ARM64 ifdef ARCH_ARM64
FLAGS += -DARCH_ARM64
FLAGS += -march=armv8-a+fp+simd FLAGS += -march=armv8-a+fp+simd
endif endif


ifdef ARCH_LIN ifdef ARCH_LIN
FLAGS += -DARCH_LIN
CXXFLAGS += -Wsuggest-override CXXFLAGS += -Wsuggest-override
endif endif
ifdef ARCH_MAC ifdef ARCH_MAC
FLAGS += -DARCH_MAC
CXXFLAGS += -stdlib=libc++ CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++ LDFLAGS += -stdlib=libc++
MAC_SDK_FLAGS := -mmacosx-version-min=10.9 MAC_SDK_FLAGS := -mmacosx-version-min=10.9
@@ -49,7 +45,6 @@ ifdef ARCH_MAC
LDFLAGS += $(MAC_SDK_FLAGS) LDFLAGS += $(MAC_SDK_FLAGS)
endif endif
ifdef ARCH_WIN ifdef ARCH_WIN
FLAGS += -DARCH_WIN
FLAGS += -D_USE_MATH_DEFINES FLAGS += -D_USE_MATH_DEFINES
FLAGS += -municode FLAGS += -municode
CXXFLAGS += -Wsuggest-override CXXFLAGS += -Wsuggest-override


+ 20
- 0
include/arch.hpp View File

@@ -0,0 +1,20 @@
#pragma once

// Check CPU
#if defined __x86_64__
#define ARCH_X64 1
#endif
#if defined __aarch64__
#define ARCH_ARM64 1
#endif

// Check OS
#if defined _WIN32
#define ARCH_WIN 1
#endif
#if defined __APPLE__
#define ARCH_MAC 1
#endif
#if defined __linux__
#define ARCH_LIN 1
#endif

+ 2
- 0
include/common.hpp View File

@@ -15,6 +15,8 @@
#include <string> #include <string>
#include <stdexcept> #include <stdexcept>


#include <arch.hpp>



/** Attribute for deprecated functions and symbols. /** Attribute for deprecated functions and symbols.
E.g. E.g.


+ 1
- 0
include/simd/Vector.hpp View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include <cstring> #include <cstring>
#include "common.hpp" #include "common.hpp"
#include <common.hpp>




namespace rack { namespace rack {


+ 0
- 1
include/simd/functions.hpp View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <simd/Vector.hpp> #include <simd/Vector.hpp>
#include <simd/sse_mathfun_extension.h> #include <simd/sse_mathfun_extension.h>
#include <common.hpp>
#include <math.hpp> #include <math.hpp>






+ 2
- 0
src/asset.cpp View File

@@ -1,3 +1,5 @@
#include <arch.hpp>

#if defined ARCH_MAC #if defined ARCH_MAC
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>


+ 3
- 1
src/plugin.cpp View File

@@ -1,3 +1,5 @@
#include <arch.hpp>

#include <thread> #include <thread>
#include <map> #include <map>
#include <stdexcept> #include <stdexcept>
@@ -99,7 +101,7 @@ static InitCallback loadPluginCallback(Plugin* plugin) {
libraryExt = "so"; libraryExt = "so";
#elif defined ARCH_WIN #elif defined ARCH_WIN
libraryExt = "dll"; libraryExt = "dll";
#elif ARCH_MAC
#elif defined ARCH_MAC
libraryExt = "dylib"; libraryExt = "dylib";
#endif #endif




+ 2
- 0
src/string.cpp View File

@@ -1,3 +1,5 @@
#include <arch.hpp>

#include <ctime> #include <ctime>
#include <cctype> // for tolower and toupper #include <cctype> // for tolower and toupper
#include <algorithm> // for transform and equal #include <algorithm> // for transform and equal


+ 3
- 1
src/system.cpp View File

@@ -1,3 +1,5 @@
#include <arch.hpp>

#include <thread> #include <thread>
#include <regex> #include <regex>
#include <chrono> #include <chrono>
@@ -701,7 +703,7 @@ std::string getStackTrace() {
// If regex fails, just use the raw line // If regex fails, just use the raw line
s += line; s += line;
} }
#elif ARCH_MAC
#elif defined ARCH_MAC
// Parse line, e.g. // Parse line, e.g.
// 1 Rack 0x0000000002ddc3eb _mangled_symbol + 27 // 1 Rack 0x0000000002ddc3eb _mangled_symbol + 27
std::regex r(R"((\d+)\s+(.+?)\s+(.+?) (.*?) \+ (.+?))"); std::regex r(R"((\d+)\s+(.+?)\s+(.+?) (.*?) \+ (.+?))");


+ 2
- 0
src/window/Window.cpp View File

@@ -1,3 +1,5 @@
#include <arch.hpp>

#include <map> #include <map>
#include <queue> #include <queue>
#include <thread> #include <thread>


Loading…
Cancel
Save