mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
merge accidental branch
This commit is contained in:
commit
5670217760
|
@ -1,6 +1,6 @@
|
||||||
language: cpp
|
language: cpp
|
||||||
script:
|
script:
|
||||||
- mkdir build && cd build && cmake -G "Unix Makefiles" -D SHARED=0 -D AUTORUN_TESTS=1 -D BUILD_TESTS=1 ../cmake && make
|
- ./configure SHARED=0 BUILD_TESTS=1 AUTORUN_TESTS=1 "Unix Makefiles" && make -C build
|
||||||
compiler:
|
compiler:
|
||||||
- clang
|
- clang
|
||||||
- gcc
|
- gcc
|
||||||
|
|
14
clean
14
clean
|
@ -1,11 +1,3 @@
|
||||||
#!/usr/bin/env python3
|
# -*- mode: sh -*-
|
||||||
|
cd ${0%/*}
|
||||||
import os
|
./configure clean
|
||||||
import shutil
|
|
||||||
|
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
|
|
||||||
dirs = ['./bin', './lib', './build']
|
|
||||||
|
|
||||||
for dir in dirs:
|
|
||||||
if os.path.isdir(dir): shutil.rmtree(dir)
|
|
||||||
|
|
|
@ -4,4 +4,4 @@ for /f %%i in ('where python') DO (set PYTHON=%%i) & goto :done1
|
||||||
:done1
|
:done1
|
||||||
@where python3 > nul 2>&1 && for /f %%i in ('@where python3') DO (@set PYTHON=%%i) & goto :done2
|
@where python3 > nul 2>&1 && for /f %%i in ('@where python3') DO (@set PYTHON=%%i) & goto :done2
|
||||||
:done2
|
:done2
|
||||||
!PYTHON! clean
|
!PYTHON! configure %*
|
95
configure
vendored
95
configure
vendored
|
@ -1,14 +1,24 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# -*- mode: python -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def which(program):
|
def clean():
|
||||||
def is_exe(fpath):
|
import shutil
|
||||||
|
|
||||||
|
dirs = ['./bin', './lib', './build']
|
||||||
|
|
||||||
|
for dir in dirs:
|
||||||
|
if os.path.isdir(dir): shutil.rmtree(dir)
|
||||||
|
|
||||||
|
def is_exe(fpath):
|
||||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||||
|
|
||||||
|
def which(program):
|
||||||
fpath, fname = os.path.split(program)
|
fpath, fname = os.path.split(program)
|
||||||
|
|
||||||
if fpath:
|
if fpath:
|
||||||
if is_exe(program):
|
if is_exe(program):
|
||||||
return program
|
return program
|
||||||
|
@ -16,28 +26,81 @@ def which(program):
|
||||||
for path in os.environ["PATH"].split(os.pathsep):
|
for path in os.environ["PATH"].split(os.pathsep):
|
||||||
path = path.strip('"')
|
path = path.strip('"')
|
||||||
exe_file = os.path.join(path, program)
|
exe_file = os.path.join(path, program)
|
||||||
|
|
||||||
if is_exe(exe_file):
|
if is_exe(exe_file):
|
||||||
return exe_file
|
return exe_file
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
def default_generator(platform):
|
||||||
|
|
||||||
if not os.path.isdir('./build'):
|
|
||||||
os.mkdir('./build')
|
|
||||||
|
|
||||||
generator = 'Unix Makefiles'
|
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
generator = sys.argv[1]
|
|
||||||
elif sys.platform == 'darwin':
|
|
||||||
generator = 'Unix Makefiles'
|
generator = 'Unix Makefiles'
|
||||||
elif sys.platform == 'win32':
|
|
||||||
|
if sys.platform == 'darwin':
|
||||||
|
generator = 'Xcode'
|
||||||
|
elif sys.platform == 'win32':
|
||||||
generator = 'Visual Studio 14 2015 Win64'
|
generator = 'Visual Studio 14 2015 Win64'
|
||||||
|
|
||||||
cmake = 'cmake'
|
return generator
|
||||||
|
|
||||||
if which('cmake3'):
|
def find_cmake():
|
||||||
|
cmake = None
|
||||||
|
|
||||||
|
if which('cmake3'):
|
||||||
cmake = 'cmake3'
|
cmake = 'cmake3'
|
||||||
|
elif which('cmake'):
|
||||||
|
cmake = 'cmake'
|
||||||
|
|
||||||
subprocess.call([cmake, '-G', generator, '../cmake'], cwd='./build')
|
if cmake == None:
|
||||||
|
raise Exception("cmake not found")
|
||||||
|
|
||||||
|
return cmake
|
||||||
|
|
||||||
|
def parse_args(args):
|
||||||
|
options = {}
|
||||||
|
generator = default_generator(sys.platform)
|
||||||
|
|
||||||
|
if len(args) == 0:
|
||||||
|
return options, generator
|
||||||
|
|
||||||
|
while len(args) > 1:
|
||||||
|
option = args.pop(0)
|
||||||
|
|
||||||
|
if '=' not in option:
|
||||||
|
raise Exception('bad option: {}'.format(option))
|
||||||
|
|
||||||
|
options[option.split('=')[0]] = option.split('=')[1]
|
||||||
|
|
||||||
|
generator = args[0]
|
||||||
|
|
||||||
|
return options, generator
|
||||||
|
|
||||||
|
def main():
|
||||||
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
if len(sys.argv) == 2 and sys.argv[1] == 'clean':
|
||||||
|
clean()
|
||||||
|
return
|
||||||
|
|
||||||
|
build_dir = './build'
|
||||||
|
|
||||||
|
if not os.path.isdir(build_dir):
|
||||||
|
os.mkdir(build_dir)
|
||||||
|
|
||||||
|
cmake = find_cmake()
|
||||||
|
options, generator = parse_args(sys.argv[1:])
|
||||||
|
command = [cmake]
|
||||||
|
|
||||||
|
if generator != None:
|
||||||
|
command.extend(['-G', generator])
|
||||||
|
|
||||||
|
if options != None:
|
||||||
|
for option in options:
|
||||||
|
command.extend(['-D', '{}={}'.format(option, options[option])])
|
||||||
|
|
||||||
|
cmake_scripts_dir = '../cmake' # relative to build_dir
|
||||||
|
command.append(cmake_scripts_dir)
|
||||||
|
|
||||||
|
subprocess.call(command, cwd=build_dir)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user