|
|
@ -7,21 +7,37 @@ except ImportError:
|
|
|
|
from setuptools import setup, find_packages
|
|
|
|
from setuptools import setup, find_packages
|
|
|
|
from distutils.core import Extension
|
|
|
|
from distutils.core import Extension
|
|
|
|
from os import path
|
|
|
|
from os import path
|
|
|
|
|
|
|
|
import platform
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if platform.system() == 'Windows':
|
|
|
|
|
|
|
|
# dfhack.lib location can differ, search for it
|
|
|
|
|
|
|
|
for libdir in ["..", path.join("..",".."), path.join("..", "..", "output"), path.join("..", "..", "output", "Release")]:
|
|
|
|
|
|
|
|
if path.isfile(path.join(libdir, "dfhack.lib")):
|
|
|
|
|
|
|
|
lib_dirs = libdir
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raise Exception("dfhack.lib is not found")
|
|
|
|
|
|
|
|
osspec = dict(library_dirs=lib_dirs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elif platform.system() == 'Linux':
|
|
|
|
|
|
|
|
osspec = dict(extra_compile_args=["-DLINUX_BUILD", "-w"],
|
|
|
|
|
|
|
|
library_dirs=[path.join("..","..","output")])
|
|
|
|
|
|
|
|
|
|
|
|
e = Extension("pydfhack._pydfhack",
|
|
|
|
e = Extension("pydfhack._pydfhack",
|
|
|
|
sources=["DF_API.cpp", "DF_Buildings.cpp", "DF_Constructions.cpp", "DF_CreatureManager.cpp", "DF_GUI.cpp", "DF_Maps.cpp", "DF_Material.cpp", "DF_Position.cpp", "DF_Translate.cpp", "DF_Vegetation.cpp", "pydfhack.cpp"],
|
|
|
|
sources=["DF_API.cpp", "DF_Buildings.cpp", "DF_Constructions.cpp", "DF_CreatureManager.cpp",\
|
|
|
|
include_dirs=["../", path.join("..", "include"), path.join("..","depends","md5"), path.join("..","depends","tinyxml")],
|
|
|
|
"DF_GUI.cpp", "DF_Maps.cpp", "DF_Material.cpp", "DF_Position.cpp", "DF_Translate.cpp",\
|
|
|
|
library_dirs=[path.join("..","..","output")],
|
|
|
|
"DF_Vegetation.cpp", "pydfhack.cpp"],
|
|
|
|
extra_compile_args=["-DLINUX_BUILD", "-w"],
|
|
|
|
include_dirs=["../", path.join("..", "include"), path.join("..","depends","md5"), path.join("..","depends","tinyxml")],
|
|
|
|
libraries=["dfhack"],
|
|
|
|
libraries=["dfhack"],
|
|
|
|
export_symbols=["init_pydfhack", "ReadRaw", "WriteRaw"])
|
|
|
|
export_symbols=["init_pydfhack", "ReadRaw", "WriteRaw"],
|
|
|
|
|
|
|
|
**osspec)
|
|
|
|
|
|
|
|
|
|
|
|
for file in ["Memory.xml", path.join("..","..","output","Memory.xml")]:
|
|
|
|
for file in ["Memory.xml", path.join("..","..","output","Memory.xml")]:
|
|
|
|
if path.isfile(file):
|
|
|
|
if path.isfile(file):
|
|
|
|
datafile = file
|
|
|
|
datafile = file
|
|
|
|
break
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise Exception("Memory.xml not found.")
|
|
|
|
raise Exception("Memory.xml is not found.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setup(
|
|
|
|
setup(
|
|
|
|