Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,22 @@ let package = Package(
dependencies: ["CFreeTDS"],
path: "Sources/SQLClientSwift",
swiftSettings: [
// Enable strict concurrency checking (Swift 5.9+)
.enableExperimentalFeature("StrictConcurrency=complete"),
// Pass both Homebrew prefix locations to the C compiler so
// angle bracket includes in CFreeTDS.h resolve on both
// Intel (/usr/local) and Apple Silicon (/opt/homebrew) Macs.
// The compiler silently ignores paths that don't exist,
// so providing both is safe.
.unsafeFlags([
"-Xcc", "-I/opt/homebrew/opt/freetds/include", // Apple Silicon
"-Xcc", "-I/usr/local/opt/freetds/include", // Intel
], .when(platforms: [.macOS])),
],
linkerSettings: [
.unsafeFlags(["-L/opt/homebrew/opt/freetds/lib"], .when(platforms: [.macOS])),
.unsafeFlags([
"-L/opt/homebrew/opt/freetds/lib", // Apple Silicon
"-L/usr/local/opt/freetds/lib", // Intel
], .when(platforms: [.macOS])),
.linkedLibrary("sybdb"),
.linkedLibrary("iconv", .when(platforms: [.macOS]))
]
Expand Down
15 changes: 11 additions & 4 deletions Sources/CFreeTDS/include/CFreeTDS.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#ifndef CFREETDS_H
#define CFREETDS_H

#pragma once

#ifdef __APPLE__
#include "/opt/homebrew/opt/freetds/include/sybdb.h"
#include "/opt/homebrew/opt/freetds/include/sybfront.h"
#ifdef __x86_64__
#include "/usr/local/opt/freetds/include/sybdb.h"
#include "/usr/local/opt/freetds/include/sybfront.h"
#else
#include "/opt/homebrew/opt/freetds/include/sybdb.h"
#include "/opt/homebrew/opt/freetds/include/sybfront.h"
#endif
#else
#include <sybdb.h>
#include <sybfront.h>
#include <sybdb.h>
#include <sybfront.h>
#endif

#endif /* CFREETDS_H */