Skip to content

Commit b60c6eb

Browse files
committed
Support for Swift Package Manager
1 parent 1c4b0f2 commit b60c6eb

File tree

7 files changed

+37
-10
lines changed

7 files changed

+37
-10
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ msbuild/nuget.exe
88
msbuild/Win32
99
msbuild/x64
1010
msbuild/packages
11+
12+
.build

CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ add_library(mcpp STATIC
1818
"eval.c"
1919
"expand.c"
2020
"internal.H"
21-
"main.c"
21+
"mcpp_main.c"
2222
"mbchar.c"
2323
"support.c"
2424
"system.c"
@@ -32,9 +32,9 @@ target_sources(mcpp PUBLIC
3232

3333
if(UNIX)
3434
include(GNUInstallDirs)
35-
36-
set_property(TARGET mcpp PROPERTY PUBLIC_HEADER
37-
"mcpp_lib.h"
35+
36+
set_property(TARGET mcpp PROPERTY PUBLIC_HEADER
37+
"mcpp_lib.h"
3838
"mcpp_out.h"
3939
)
4040

@@ -56,7 +56,7 @@ if(UNIX)
5656
elseif(WIN32)
5757
# define character set - not set, per shipped project files
5858
add_definitions(-D_SBCS)
59-
59+
6060
target_compile_definitions(mcpp PRIVATE
6161
"_WIN32_WINNT=0x600"
6262
"WIN32_LEAN_AND_MEAN"

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ifeq ($(UNAME),AIX)
4848
CC ?= xlc_r
4949
endif
5050

51-
OBJS = directive.o eval.o expand.o main.o mbchar.o support.o system.o
51+
OBJS = directive.o eval.o expand.o mcpp_main.o mbchar.o support.o system.o
5252

5353
$(LIBDIR)/libmcpp.a: $(OBJS)
5454
-mkdir -p $(LIBDIR)

Package.swift

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// swift-tools-version: 5.10
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "mcpp",
7+
defaultLocalization: "en",
8+
platforms: [
9+
.macOS(.v14),
10+
.iOS(.v12),
11+
],
12+
products: [
13+
.library(name: "mcpp", targets: ["mcpp"])
14+
],
15+
targets: [
16+
.target(
17+
name: "mcpp",
18+
path: "./",
19+
publicHeadersPath: ".",
20+
cSettings: [
21+
.unsafeFlags(["-Wno-implicit-function-declaration", "-Wno-deprecated-non-prototype"])
22+
]
23+
)
24+
]
25+
)

internal.H

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
#define OP_LPA 2 /* ( */
9595
/* The following are unary. */
9696
#define FIRST_UNOP OP_PLU /* First unary operator */
97-
#define OP_PLU 3 /* + */
97+
#define OP_PLU 3 /* + */
9898
#define OP_NEG 4 /* - */
9999
#define OP_COM 5 /* ~ */
100100
#define OP_NOT 6 /* ! */
@@ -320,7 +320,7 @@ extern struct std_limits_ {
320320
int inc_nest; /* Least maximum of include nest*/
321321
long n_macro; /* Least maximum of num of macro*/
322322
long line_num; /* Maximum source line number */
323-
} std_limits;
323+
} std_limits;
324324
/* The boolean flags specified by the execution options. */
325325
extern struct option_flags_ {
326326
int c; /* -C option (keep comments) */
@@ -370,7 +370,7 @@ extern FILEINFO * sh_file;
370370
extern int sh_line;
371371
/* Temporary buffer for directive line and macro expansion */
372372

373-
/* main.c */
373+
/* mcpp_main.c */
374374
extern void un_predefine( int clearall);
375375
/* Undefine predefined macros */
376376

main.c renamed to mcpp_main.c

File renamed without changes.

msbuild/mcpp.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<ClCompile Include="..\directive.c" />
104104
<ClCompile Include="..\eval.c" />
105105
<ClCompile Include="..\expand.c" />
106-
<ClCompile Include="..\main.c" />
106+
<ClCompile Include="..\mcpp_main.c" />
107107
<ClCompile Include="..\mbchar.c" />
108108
<ClCompile Include="..\support.c" />
109109
<ClCompile Include="..\system.c" />

0 commit comments

Comments
 (0)