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
ifdef ARCH_X64
FLAGS += -DARCH_X64
FLAGS += -march=nehalem
endif
ifdef ARCH_ARM64
FLAGS += -DARCH_ARM64
FLAGS += -march=armv8-a+fp+simd
endif

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

#include <arch.hpp>


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


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

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


namespace rack {


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

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




+ 2
- 0
src/asset.cpp View File

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

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


+ 3
- 1
src/plugin.cpp View File

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

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



+ 2
- 0
src/string.cpp View File

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

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


+ 3
- 1
src/system.cpp View File

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

#include <thread>
#include <regex>
#include <chrono>
@@ -701,7 +703,7 @@ std::string getStackTrace() {
// If regex fails, just use the raw line
s += line;
}
#elif ARCH_MAC
#elif defined ARCH_MAC
// Parse line, e.g.
// 1 Rack 0x0000000002ddc3eb _mangled_symbol + 27
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 <queue>
#include <thread>


Loading…
Cancel
Save