Compatibility adjustment.
parent
14e28827ee
commit
50a16dfde6
|
@ -0,0 +1,20 @@
|
||||||
|
slvs.py
|
||||||
|
python_solvespace/*.cpp
|
||||||
|
*.o*
|
||||||
|
*.def
|
||||||
|
*.lib
|
||||||
|
*.so
|
||||||
|
*.pyd
|
||||||
|
*.a
|
||||||
|
*.cxx
|
||||||
|
|
||||||
|
*__pycache__*
|
||||||
|
*obj*
|
||||||
|
|
||||||
|
*.eric6project*
|
||||||
|
*.e4p
|
||||||
|
*.e4q
|
||||||
|
*.e6t
|
||||||
|
*.ui
|
||||||
|
|
||||||
|
.DS_Store
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -10,7 +10,9 @@ __email__ = "pyslvs@gmail.com"
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import codecs
|
import codecs
|
||||||
|
from textwrap import dedent
|
||||||
from setuptools import setup, Extension, find_packages
|
from setuptools import setup, Extension, find_packages
|
||||||
|
from setuptools.command.build_ext import build_ext
|
||||||
from platform import system
|
from platform import system
|
||||||
from distutils import sysconfig
|
from distutils import sysconfig
|
||||||
|
|
||||||
|
@ -22,6 +24,11 @@ ver = sysconfig.get_config_var('VERSION')
|
||||||
lib = sysconfig.get_config_var('BINDIR')
|
lib = sysconfig.get_config_var('BINDIR')
|
||||||
|
|
||||||
|
|
||||||
|
def write(doc, *parts):
|
||||||
|
with codecs.open(os.path.join(here, *parts), 'w') as f:
|
||||||
|
f.write(doc)
|
||||||
|
|
||||||
|
|
||||||
def read(*parts):
|
def read(*parts):
|
||||||
with codecs.open(os.path.join(here, *parts), 'r') as f:
|
with codecs.open(os.path.join(here, *parts), 'r') as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
@ -77,10 +84,24 @@ if system() == 'Windows':
|
||||||
macros.append(('WIN32', None))
|
macros.append(('WIN32', None))
|
||||||
|
|
||||||
# Platform sources
|
# Platform sources
|
||||||
sources.append(platform_path + 'w32util.cpp')
|
sources.append(platform_path + 'utilwin.cpp')
|
||||||
sources.append(platform_path + 'platform.cpp')
|
sources.append(platform_path + 'platform.cpp')
|
||||||
else:
|
else:
|
||||||
sources.append(platform_path + 'unixutil.cpp')
|
sources.append(platform_path + 'utilunix.cpp')
|
||||||
|
|
||||||
|
|
||||||
|
class Build(build_ext):
|
||||||
|
def run(self):
|
||||||
|
# Generate "config.h", actually not used.
|
||||||
|
config_h = src_path + "config.h"
|
||||||
|
write(dedent(f"""\
|
||||||
|
#ifndef SOLVESPACE_CONFIG_H
|
||||||
|
#define SOLVESPACE_CONFIG_H
|
||||||
|
#endif
|
||||||
|
"""), config_h)
|
||||||
|
super(Build, self).run()
|
||||||
|
os.remove(config_h)
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="python_solvespace",
|
name="python_solvespace",
|
||||||
|
@ -92,13 +113,14 @@ setup(
|
||||||
url="https://github.com/solvespace/solvespace",
|
url="https://github.com/solvespace/solvespace",
|
||||||
packages=find_packages(exclude=('tests',)),
|
packages=find_packages(exclude=('tests',)),
|
||||||
ext_modules=[Extension(
|
ext_modules=[Extension(
|
||||||
"slvs",
|
"python_solvespace.slvs",
|
||||||
sources,
|
sources,
|
||||||
language="c++",
|
language="c++",
|
||||||
include_dirs=[include_path, src_path, platform_path],
|
include_dirs=[include_path, src_path, platform_path],
|
||||||
define_macros=macros,
|
define_macros=macros,
|
||||||
extra_compile_args=compile_args
|
extra_compile_args=compile_args
|
||||||
)],
|
)],
|
||||||
|
cmdclass={'build_ext': Build},
|
||||||
python_requires=">=3.6",
|
python_requires=">=3.6",
|
||||||
setup_requires=[
|
setup_requires=[
|
||||||
'setuptools',
|
'setuptools',
|
||||||
|
|
|
@ -458,7 +458,7 @@ bool WriteFile(const Platform::Path &filename, const std::string &data) {
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
|
||||||
const void *LoadResource(const std::string &name, size_t *size) {
|
const void *LoadResource(const std::string &name, size_t *size) {
|
||||||
HRSRC hres = FindResourceW(NULL, Widen(name).c_str(), RT_RCDATA);
|
HRSRC hres = FindResourceW(NULL, Widen(name).c_str(), (LPWSTR)RT_RCDATA);
|
||||||
ssassert(hres != NULL, "Cannot find resource");
|
ssassert(hres != NULL, "Cannot find resource");
|
||||||
HGLOBAL res = ::LoadResource(NULL, hres);
|
HGLOBAL res = ::LoadResource(NULL, hres);
|
||||||
ssassert(res != NULL, "Cannot load resource");
|
ssassert(res != NULL, "Cannot load resource");
|
||||||
|
|
Loading…
Reference in New Issue