Skip to content

Commit 960569d

Browse files
committed
iscpython makefile
1 parent 4b40d3b commit 960569d

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

c/Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
CC := gcc
2+
RM := rm
3+
CD := cd
4+
MAKE := make
5+
6+
CFLAGS += -Wall -Wextra -fpic -O2 -fno-strict-aliasing -Wno-unused-parameter
7+
8+
9+
SYS := $(shell gcc -dumpmachine)
10+
11+
ifeq ($(SYS), x86_64-w64-mingw32)
12+
BUILDSYS := $(SYS)
13+
else
14+
BUILDSYS := $(shell bash $(LIBFFI_PATH)/config.guess)
15+
endif
16+
17+
ifneq (, $(findstring linux, $(SYS)))
18+
SUFFIX := so
19+
LDFLAGS := -shared
20+
LIBS += -ldl
21+
else ifneq (, $(findstring mingw, $(SYS)))
22+
SUFFIX := dll
23+
LDFLAGS := -shared
24+
else
25+
$(error Unsupported build platform)
26+
endif
27+
28+
29+
30+
31+
ifndef GLOBALS_HOME
32+
$(error Couldn't find GLOBALS_HOME)
33+
endif
34+
35+
ifndef PYTHONHOME
36+
$(error Couldn't find PYTHONHOME)
37+
endif
38+
39+
PYTHONVER := $(shell ${PYTHONHOME}python -c "import sys; print(sys.version_info[0],sys.version_info[1],sep='')")
40+
LIBS = -lpython${PYTHONVER}
41+
42+
LDFLAGS += -L${PYTHONHOME}/Libs
43+
44+
INCLUDES += -I${GLOBALS_HOME}/dev/cpp/include
45+
INCLUDES += -I${PYTHONHOME}/include
46+
CFLAGS += $(INCLUDES)
47+
48+
.PHONY: all clean
49+
50+
all: iscpython.$(SUFFIX)
51+
52+
iscpython.o: iscpython.c
53+
54+
iscpython.$(SUFFIX): iscpython.o
55+
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
56+
57+
clean:
58+
$(RM) *.$(SUFFIX) *.o
File renamed without changes.

isc/py/Callout.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// Main callout wrapper.
22
/// To use:
3-
/// 1. Call: write ##class(isc.py.Callout).Setup() once per systems start
3+
/// 1. Call: do ##class(isc.py.Callout).Setup() once per systems start
44
/// 2. Call: do ##class(isc.py.Callout).Initialize() once per process
55
/// 3. Call main method (can be called many times, context persists): write ##class(isc.py.Callout).SimpleString(code, data)
66
/// 4. Call: do ##class(isc.py.Callout).Finalize() to free Python context
@@ -22,7 +22,7 @@ Parameter SimpleStringFull As Integer = 5;
2222

2323
Parameter SimpleString As Integer = 6;
2424

25-
Parameter DLL As COSEXPRESSION = "$g(^isc.py.Callout, $g(^%SYS(""bindir"")) _ ""libhelloworld.dll"")";
25+
Parameter DLL As COSEXPRESSION = "$g(^isc.py.Callout, $g(^%SYS(""bindir"")) _ ""iscpython.dll"")";
2626

2727
/// Should be executed once per system start. Idempotent.
2828
/// Add to ZSTART or production start.

0 commit comments

Comments
 (0)