mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 09:05:10 +00:00
Windows build fixes when symlink is not available.
This commit is contained in:
parent
0016d214c3
commit
0405c3a41a
@ -10,7 +10,7 @@ install:
|
|||||||
environment:
|
environment:
|
||||||
CLICOLOR_FORCE: 1
|
CLICOLOR_FORCE: 1
|
||||||
matrix:
|
matrix:
|
||||||
- MSYSTEM: MINGW64
|
# - MSYSTEM: MINGW64
|
||||||
- MSYSTEM: MSVC
|
- MSYSTEM: MSVC
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
@ -18,7 +18,7 @@ build_script:
|
|||||||
If ($Env:MSYSTEM -Eq "MSVC") {
|
If ($Env:MSYSTEM -Eq "MSVC") {
|
||||||
$dir = "cquery-${env:appveyor_build_version}-win64"
|
$dir = "cquery-${env:appveyor_build_version}-win64"
|
||||||
cd C:\projects\cquery
|
cd C:\projects\cquery
|
||||||
python waf configure --msvc_version="msvc 15.0"
|
python waf configure
|
||||||
python waf build
|
python waf build
|
||||||
mkdir "${dir}\build\release\bin" -ea 0
|
mkdir "${dir}\build\release\bin" -ea 0
|
||||||
mkdir "${dir}\build\release\lib\LLVM-5.0.1-win64\lib\clang\5.0.1\"
|
mkdir "${dir}\build\release\lib\LLVM-5.0.1-win64\lib\clang\5.0.1\"
|
||||||
|
31
wscript
31
wscript
@ -52,7 +52,7 @@ if sys.platform == 'win32':
|
|||||||
flags = int(target_is_directory) | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
|
flags = int(target_is_directory) | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
|
||||||
|
|
||||||
# Use unicode version (W suffix) of Windows symbolic link function and convert strings to
|
# Use unicode version (W suffix) of Windows symbolic link function and convert strings to
|
||||||
# unicode if Python 2 is used (strings are unicode by default in Python 3).
|
# unicode if Python 2 is used (strings are unicode by default in Python 3).
|
||||||
if sys.version_info < (3, 0):
|
if sys.version_info < (3, 0):
|
||||||
ret = kdll.CreateSymbolicLinkW(unicode(link_name), unicode(source), flags)
|
ret = kdll.CreateSymbolicLinkW(unicode(link_name), unicode(source), flags)
|
||||||
else:
|
else:
|
||||||
@ -133,6 +133,18 @@ def download_and_extract(destdir, url, ext):
|
|||||||
else:
|
else:
|
||||||
print('Found extracted at {0}'.format(destdir))
|
print('Found extracted at {0}'.format(destdir))
|
||||||
|
|
||||||
|
def copy_or_symlink(src, dst):
|
||||||
|
print('copy_or_symlink src={0}, dst={1}'.format(src, dst))
|
||||||
|
try:
|
||||||
|
os.makedirs(os.path.dirname(dst))
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.symlink(src, dst)
|
||||||
|
except (OSError, NotImplementedError):
|
||||||
|
shutil.copy(src, dst)
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
ctx.resetenv(ctx.options.variant)
|
ctx.resetenv(ctx.options.variant)
|
||||||
|
|
||||||
@ -300,19 +312,12 @@ def configure(ctx):
|
|||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin':
|
||||||
ctx.env.rpath = ['@loader_path/../lib/' + clang_tarball_name + '/lib']
|
ctx.env.rpath = ['@loader_path/../lib/' + clang_tarball_name + '/lib']
|
||||||
elif sys.platform == 'win32':
|
elif sys.platform == 'win32':
|
||||||
|
# Poor Windows users' RPATH - copy libclang.lib and libclang.dll to the build directory.
|
||||||
ctx.env.rpath = [] # Unsupported
|
ctx.env.rpath = [] # Unsupported
|
||||||
name = os.path.basename(os.path.dirname(ctx.env['LIBPATH_clang'][0]))
|
clang_dir = os.path.dirname(ctx.env['LIBPATH_clang'][0])
|
||||||
# Poor Windows users' RPATH
|
dest_dir = os.path.join(ctx.path.get_bld().abspath(), ctx.options.variant, 'bin')
|
||||||
out_clang_dll = os.path.join(ctx.path.get_bld().abspath(), 'bin', 'libclang.dll')
|
# copy_or_symlink(os.path.join(clang_dir, 'lib', 'libclang.lib'), os.path.join(dest_dir, 'libclang.lib'))
|
||||||
try:
|
copy_or_symlink(os.path.join(clang_dir, 'bin', 'libclang.dll'), os.path.join(dest_dir, 'libclang.dll'))
|
||||||
os.makedirs(os.path.dirname(out_clang_dll))
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
dst = os.path.join(ctx.path.get_bld().abspath(), 'lib', name, 'bin', 'libclang.dll')
|
|
||||||
os.symlink(dst, out_clang_dll)
|
|
||||||
except (OSError, NotImplementedError):
|
|
||||||
shutil.copy(out_clang_dll, dst)
|
|
||||||
else:
|
else:
|
||||||
ctx.env.rpath = ctx.env['LIBPATH_clang']
|
ctx.env.rpath = ctx.env['LIBPATH_clang']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user