Working on win-scons #355
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@@ -151,6 +151,9 @@
|
||||
run: '${{ github.workspace }}\.github\workflows\scripts\win\install-deps.bat x64',
|
||||
working-directory: proj/vs2017
|
||||
},
|
||||
{
|
||||
run: "dir C:/vcpkg/packages/boost-system_x64-windows/lib"
|
||||
},
|
||||
{
|
||||
name: build and unit test,
|
||||
run: '.\.github\workflows\scripts\win\scons-build.bat'
|
||||
|
||||
@@ -5,4 +5,4 @@ for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Micros
|
||||
call "%%i" x86_amd64
|
||||
)
|
||||
|
||||
scons
|
||||
scons bits=64
|
||||
|
||||
40
SConstruct
40
SConstruct
@@ -158,12 +158,19 @@ if platform == "darwin":
|
||||
break
|
||||
elif platform == "win32":
|
||||
if 'msvc' in env['TOOLS']:
|
||||
vcpkg_prefix = (os.environ['HOME'] if 'HOME' in os.environ else 'C:') + f'/vcpkg/installed/x{env["bits"]}-windows'
|
||||
vcpkg_prefix = (os.environ['HOME'] if 'HOME' in os.environ else 'C:') + '/vcpkg/'
|
||||
vcpkg_installed = vcpkg_prefix + 'installed/x{env["bits"]}-windows'
|
||||
vcpkg_other_packages = Glob(vcpkg_prefix + f'packages/**x{env["bits"]}-windows')
|
||||
vcpkg_other_includes = [d.get_abspath() + '\\include' for d in vcpkg_other_packages]
|
||||
vcpkg_other_libs = [d.get_abspath() + '\\lib' for d in vcpkg_other_packages]
|
||||
project_includes = ['src/' + dir for dir in filter(lambda dir: os.path.isdir('src/' + dir), os.listdir('src'))]
|
||||
include_paths=[vcpkg_installed + '/include'] + vcpkg_other_includes + project_includes
|
||||
env.Append(
|
||||
LINKFLAGS=['/SUBSYSTEM:WINDOWS','/ENTRY:mainCRTStartup','/MACHINE:X86'],
|
||||
LINKFLAGS=['/SUBSYSTEM:WINDOWS','/ENTRY:mainCRTStartup',f'/MACHINE:X{env["bits"]}'],
|
||||
CXXFLAGS=['/EHsc','/MD','/FIglobal.hpp'],
|
||||
INCLUDEPATH=vcpkg_prefix + '/include',
|
||||
LIBPATH=vcpkg_prefix + '/lib',
|
||||
CPPPATH=include_paths,
|
||||
INCLUDEPATH=include_paths,
|
||||
LIBPATH=[vcpkg_installed + '/lib'] + vcpkg_other_libs,
|
||||
LIBS=Split("""
|
||||
kernel32
|
||||
user32
|
||||
@@ -250,16 +257,17 @@ if not env.GetOption('clean'):
|
||||
print('zlib must be installed!')
|
||||
Exit(1)
|
||||
|
||||
def check_lib(lib, disp, suffixes=[], versions=[]):
|
||||
if platform == "win32" and lib.startswith("boost"):
|
||||
lib = "lib" + lib
|
||||
def check_lib(lib, disp, suffixes=[], versions=[], msvc_versions=[]):
|
||||
if "mingw" in env["TOOLS"] and lib.startswith("sfml"):
|
||||
lib = "lib" + lib
|
||||
possible_names = [lib]
|
||||
if platform == "win32":
|
||||
if 'msvc' in env['TOOLS']:
|
||||
vc_suffix = '-vc' + env['MSVC_VERSION'].replace('.','')
|
||||
possible_names.append(lib + vc_suffix)
|
||||
msvc_versions.append(env['MSVC_VERSION'].replace('.',''))
|
||||
msvc_versions = list(set(msvc_versions))
|
||||
for version in msvc_versions:
|
||||
vc_suffix = '-vc' + version
|
||||
possible_names.append(lib + vc_suffix)
|
||||
n = len(possible_names)
|
||||
for i in range(n):
|
||||
for suff in suffixes:
|
||||
@@ -282,7 +290,9 @@ if not env.GetOption('clean'):
|
||||
print(" If you're sure it's installed, try passing INCLUDEPATH=...")
|
||||
Exit(1)
|
||||
|
||||
boost_versions = ['-1_54', '-1_55', '-1_56', '-1_57', '-1_58'] # This is a bit of a hack. :(
|
||||
boost_versions = ['-1_84'] # This is a bit of a hack. :(
|
||||
msvc_versions = ['140', '141', '142', '143'] # This is a new bit of a hack. :(
|
||||
suffixes = ['-mt', '-mt-x64', '-mt-x32']
|
||||
bundled_libs = []
|
||||
|
||||
|
||||
@@ -292,8 +302,8 @@ if not env.GetOption('clean'):
|
||||
check_header('boost/any.hpp', 'Boost.Any')
|
||||
check_header('boost/math_fwd.hpp', 'Boost.Math')
|
||||
check_header('boost/spirit/include/classic.hpp', 'Boost.Spirit.Classic')
|
||||
check_lib('boost_system', 'Boost.System', ['-mt'], boost_versions)
|
||||
check_lib('boost_filesystem', 'Boost.Filesystem', ['-mt'], boost_versions)
|
||||
check_lib('boost_system', 'Boost.System', suffixes, boost_versions, msvc_versions)
|
||||
check_lib('boost_filesystem', 'Boost.Filesystem', suffixes, boost_versions, msvc_versions)
|
||||
check_lib('sfml-system', 'SFML-system')
|
||||
check_lib('sfml-window', 'SFML-window')
|
||||
check_lib('sfml-audio', 'SFML-audio')
|
||||
@@ -396,12 +406,12 @@ elif platform == "win32":
|
||||
break
|
||||
# Extra: Microsoft redistributable libraries installer
|
||||
if 'msvc' in env["TOOLS"]:
|
||||
if path.exists("dep/VCRedistInstall.exe"):
|
||||
env.Install("build/Blades of Exile/", "dep/VCRedistInstall.exe")
|
||||
if path.exists("deps/VCRedistInstall.exe"):
|
||||
env.Install("build/Blades of Exile/", "deps/VCRedistInstall.exe")
|
||||
else:
|
||||
print("WARNING: Cannot find installer for the MSVC redistributable libraries for your version of Visual Studio.")
|
||||
print("Please download it from Microsoft's website and place it at:")
|
||||
print(" dep/VCRedistInstall.exe")
|
||||
print(" deps/VCRedistInstall.exe")
|
||||
# Create it so its lack doesn't cause makensis to break
|
||||
# (Because the installer is an optional component.)
|
||||
open("build/Blades of Exile/VCRedistInstall.exe", 'w').close()
|
||||
|
||||
BIN
deps/VCRedistInstall.exe
vendored
Normal file
BIN
deps/VCRedistInstall.exe
vendored
Normal file
Binary file not shown.
@@ -4,7 +4,7 @@ import os.path as path
|
||||
Import("env platform")
|
||||
|
||||
if str(platform) != "win32":
|
||||
print "Error: Building for", str(platform), "but trying to create a Windows installer package"
|
||||
print(f"Error: Building for {platform}, but trying to create a Windows installer package")
|
||||
|
||||
env.Depends("data.nsi", ["gen-data.py", "#build/Blades of Exile/data"])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user