У меня есть 2 цели и 1 модуль CLibBSM (SPM) в проекте MyApp в Xcode 11.5
цели
1.MyApp (GUI App )
2. служебная ссылка на CLibBSM (инструмент командной строки)
Отдельные цели компиляции 2 очень хороши.
Но когда я копирую Utility
в MyApp в Build Phases-Copy Files
(Wrapper-subpath: Contents / Library / LaunchServices) в MyApp, в котором произошла ошибка «Ошибка компилятора Swift - нет такого модуля CLibBSM
».
Возможно ли решить эту проблему?
CLibBSM / Package .swift (SPM)
// swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "CLibBSM",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "CLibBSM",
targets: ["CLibBSM"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "CLibBSM",
dependencies: []),
.testTarget(
name: "CLibBSMTests",
dependencies: ["CLibBSM"]),
]
)
CLibBSM / Sources / CLibBSM / include / module.modulemap (SPM)
module CLibBSM [system] {
header "shim.h"
link "bsm"
export *
}
CLibBSM / Sources / CLibBSM / include / shim.h (SPM)
#ifndef __CLIBBSM_SHIM_H__
#define __CLIBBSM_SHIM_H__
#import <sys/sysctl.h>
#import <Foundation/Foundation.h>
#import <unistd.h>
#import <libproc.h>
#import <pthread.h>
#import <bsm/audit.h>
#import <sys/ioctl.h>
#import <sys/types.h>
#import <bsm/libbsm.h>
#import <bsm/audit_kevents.h>
#import <security/audit/audit_ioctl.h>
#import <sys/proc_info.h>
#endif
CLibBSM / Sources / CLibBSM / shim. c (SPM)
// empty