Skip to content

Commit 96e3388

Browse files
committed
Fix architecture-specific header paths for x86_64 builds
- Add preprocessor directives to detect ARM64 vs x86_64 architecture - Use /opt/homebrew for ARM64 (Apple Silicon) - Use /usr/local for x86_64 (Intel/Rosetta) - Fixes build failures when compiling for x86_64 architecture This allows the same codebase to build for both architectures.
1 parent a1758e9 commit 96e3388

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

TablePro/Core/Database/CLibPQ/CLibPQ.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99
#ifndef CLibPQ_h
1010
#define CLibPQ_h
1111

12-
// Use absolute path to avoid Xcode Build Settings dependency
13-
// This path is for Apple Silicon Macs with Homebrew
14-
#include "/opt/homebrew/opt/libpq/include/libpq-fe.h"
12+
// Use architecture-specific paths for Homebrew installations
13+
// ARM64: /opt/homebrew (Apple Silicon)
14+
// x86_64: /usr/local (Intel or Rosetta)
15+
#if defined(__arm64__) || defined(__aarch64__)
16+
#include "/opt/homebrew/opt/libpq/include/libpq-fe.h"
17+
#else
18+
#include "/usr/local/opt/libpq/include/libpq-fe.h"
19+
#endif
1520

1621
#endif /* CLibPQ_h */

TablePro/Core/Database/CMariaDB/CMariaDB.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99
#ifndef CMariaDB_h
1010
#define CMariaDB_h
1111

12-
// Use absolute path to avoid Xcode Build Settings dependency
13-
// This path is for Apple Silicon Macs with Homebrew
14-
#include "/opt/homebrew/opt/mariadb-connector-c/include/mariadb/mysql.h"
12+
// Use architecture-specific paths for Homebrew installations
13+
// ARM64: /opt/homebrew (Apple Silicon)
14+
// x86_64: /usr/local (Intel or Rosetta)
15+
#if defined(__arm64__) || defined(__aarch64__)
16+
#include "/opt/homebrew/opt/mariadb-connector-c/include/mariadb/mysql.h"
17+
#else
18+
#include "/usr/local/opt/mariadb-connector-c/include/mariadb/mysql.h"
19+
#endif
1520

1621
#endif /* CMariaDB_h */

0 commit comments

Comments
 (0)