Makefile creates .so (internall a .dll on windows?)

This commit is contained in:
surkeh 2018-04-21 15:44:09 -07:00
parent d888298afd
commit 3f76eddbce
3 changed files with 28 additions and 13 deletions

3
.gitignore vendored
View File

@ -1,9 +1,10 @@
# Files from compilation and tests
*.o
*.so
*.gch
*.exe
*.stackdump
*.log
devil1test
demo-extractpld
demo-extracttexture
demo-extractmesh

View File

@ -1,21 +1,30 @@
CC=gcc
CFLAGS=-I"include" -Wall -fPIC #-g
LDFLAGS=-shared
TARGET=lib3ddevil1.so
PEX=demo-extractpld
TEX=demo-extracttexture
MEX=demo-extractmesh
OBJ=devil1pld.o devil1tex.o devil1geo.o
CC=gcc
CFLAGS= -I"include" -Wall
all: $(TARGET) demos
all: pld texture mesh
$(TARGET): $(OBJ)
$(LINK.cc) $(LDFLAGS) $^ -o $@
pld: devil1pld.o devil1tex.o devil1geo.o
demos: pld texture mesh
pld: $(OBJ)
$(CC) $^ demo/extractpld.c $(CFLAGS) -o $(PEX)
texture: devil1pld.o devil1tex.o devil1geo.o
texture: $(OBJ)
$(CC) $^ demo/extracttexture.c $(CFLAGS) -o $(TEX)
mesh: devil1pld.o devil1tex.o devil1geo.o
mesh: $(OBJ)
$(CC) $^ demo/extractmesh.c $(CFLAGS) -o $(MEX)
devil1pld.o: src/devil1pld.c
$(CC) -c $^ $(CFLAGS)
@ -26,4 +35,4 @@ devil1geo.o: src/devil1geo.c
$(CC) -c $^ $(CFLAGS)
clean:
rm *.o $(EX) $(PEX) $(TEX) $(MEX)
rm *.o $(TARGET) $(PEX) $(TEX) $(MEX)

9
bindings/py3devil1.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/python3
import ctypes
class PldHeader(ctypes.Structure):
@ -14,8 +15,12 @@ class Devil1FN_PLD(ctypes.Structure):
]
def main():
libc = cdll.LoadLibrary('./libdevil1pld.so')
if (lib):
sharedlib='./lib3ddevil1.so'
libc = cdll.LoadLibrary(sharedlib)
if (not lib):
print("Couldn't load %s" % sharedlib)
return 1
print("OK")
with open("pl01.pld", "rb") as f:
data = f.read()