Fixed compilation with MSVC.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import requests
|
||||
from SCons.Script import *
|
||||
@@ -20,11 +21,15 @@ def versions(env: Environment, update: bool = False):
|
||||
continue
|
||||
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2])))
|
||||
with open(versions_file, 'w') as f:
|
||||
json.dump(versions, f)
|
||||
json.dump(result, f)
|
||||
return result
|
||||
else:
|
||||
with open(versions_file, 'r') as f:
|
||||
return [tuple(v) for v in json.load(f)]
|
||||
try:
|
||||
with open(versions_file, 'r') as f:
|
||||
return [tuple(v) for v in json.load(f)]
|
||||
except:
|
||||
print('boost_versions.json is empty or broken, redownloading.')
|
||||
return versions(env, update=True)
|
||||
|
||||
def dependencies(env: Environment, version) -> 'dict':
|
||||
return {}
|
||||
@@ -50,7 +55,12 @@ def cook(env: Environment, version) -> dict:
|
||||
libs.append(fname)
|
||||
else:
|
||||
for lib in set(env['BOOST_LIBS']):
|
||||
libs.append(env.FindLib(f'boost_{lib}', paths=build_result['LIBPATH']))
|
||||
if os.name == 'posix':
|
||||
libs.append(env.FindLib(f'boost_{lib}', paths=build_result['LIBPATH']))
|
||||
elif os.name == 'nt':
|
||||
libs.append(env.FindLib(f'libboost_{lib}-*', paths=build_result['LIBPATH'], use_glob=True))
|
||||
else:
|
||||
raise Exception('Boost not supported on this platform.')
|
||||
return {
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': libs
|
||||
|
||||
@@ -1,14 +1,25 @@
|
||||
|
||||
import os
|
||||
import re
|
||||
from SCons.Script import *
|
||||
|
||||
def _build_lib_name(env: Environment) -> str:
|
||||
if os.name == 'posix':
|
||||
return {
|
||||
'debug': 'png16d'
|
||||
}.get(env['BUILD_TYPE'], 'png16')
|
||||
elif os.name == 'nt':
|
||||
return {
|
||||
'debug': 'libpng16_staticd'
|
||||
}.get(env['BUILD_TYPE'], 'libpng16_static')
|
||||
else:
|
||||
raise Exception('libpng is not supported yet on this OS')
|
||||
|
||||
def _git_cook(env: Environment, repo: dict) -> dict:
|
||||
lib_zlib = env.Cook('zlib')
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.CMakeProject(checkout_root, dependencies = [lib_zlib])
|
||||
lib_name = {
|
||||
'debug': 'png16d'
|
||||
}.get(env['BUILD_TYPE'], 'png16')
|
||||
lib_name = _build_lib_name(env)
|
||||
return {
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])]
|
||||
|
||||
@@ -11,7 +11,11 @@ def dependencies(env: Environment, version) -> 'dict':
|
||||
def cook(env: Environment, version) -> dict:
|
||||
repo = env.GitBranch(repo_name = 'mikktspace', remote_url = 'https://github.com/mmikk/MikkTSpace.git', git_ref = 'master')
|
||||
checkout_root = repo['checkout_root']
|
||||
ccflags = env['CCFLAGS'].copy()
|
||||
if env['COMPILER_FAMILY'] == 'cl':
|
||||
ccflags.append('/wd4456')
|
||||
lib_mikktspace = env.StaticLibrary(
|
||||
CCFLAGS = ccflags,
|
||||
CPPPATH = [checkout_root],
|
||||
target = env['LIB_DIR'] + '/mikktspace',
|
||||
source = [os.path.join(repo['checkout_root'], 'mikktspace.c')]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
import os
|
||||
import re
|
||||
from SCons.Script import *
|
||||
|
||||
@@ -6,6 +7,18 @@ _REPO_NAME = 'zlib'
|
||||
_REPO_URL = 'https://github.com/madler/zlib.git'
|
||||
_TAG_PATTERN = re.compile(r'^v([0-9]+)\.([0-9]+)(?:\.([0-9]+))?$')
|
||||
|
||||
def _build_lib_name(env: Environment) -> str:
|
||||
if os.name == 'posix':
|
||||
return {
|
||||
'debug': 'zd'
|
||||
}.get(env['BUILD_TYPE'], 'z')
|
||||
elif os.name == 'nt':
|
||||
return {
|
||||
'debug': 'zlibstaticd'
|
||||
}.get(env['BUILD_TYPE'], 'zlibstatic')
|
||||
else:
|
||||
raise Exception('libpng is not supported yet on this OS')
|
||||
|
||||
def versions(env: Environment, update: bool = False):
|
||||
tags = env.GitTags(repo_name = _REPO_NAME, remote_url = _REPO_URL, force_fetch=update)
|
||||
result = []
|
||||
@@ -25,7 +38,14 @@ def cook(env: Environment, version) -> dict:
|
||||
repo = env.GitBranch(repo_name = _REPO_NAME, remote_url = _REPO_URL, git_ref = git_ref)
|
||||
checkout_root = repo['checkout_root']
|
||||
build_result = env.CMakeProject(project_root=checkout_root)
|
||||
include_dir = os.path.join(build_result['install_dir'], 'include')
|
||||
lib_name = _build_lib_name(env)
|
||||
lib_file = env.FindLib(lib_name, paths=build_result['LIBPATH'])
|
||||
return {
|
||||
'CPPPATH': [os.path.join(build_result['install_dir'], 'include')],
|
||||
'LIBS': [env.FindLib('z', paths=build_result['LIBPATH'])]
|
||||
'CPPPATH': [include_dir],
|
||||
'LIBS': [lib_file],
|
||||
'CMAKE_VARS': {
|
||||
'ZLIB_LIBRARY': lib_file,
|
||||
'ZLIB_INCLUDE_DIR': include_dir
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user