xlnt/configure

44 lines
977 B
Plaintext
Raw Normal View History

2015-11-03 03:22:13 +08:00
#!/usr/bin/env python3
import os
import subprocess
import sys
def which(program):
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
os.chdir(os.path.dirname(os.path.abspath(__file__)))
if not os.path.isdir('./build'):
os.mkdir('./build')
generator = 'Unix Makefiles'
2015-11-03 05:45:05 +08:00
if len(sys.argv) > 1:
generator = sys.argv[1]
elif sys.platform == 'darwin':
2015-11-03 03:22:13 +08:00
generator = 'Unix Makefiles'
elif sys.platform == 'win32':
2015-11-03 06:25:10 +08:00
generator = 'Visual Studio 14 2015 Win64'
2015-11-03 03:22:13 +08:00
cmake = 'cmake'
if which('cmake3'):
cmake = 'cmake3'
subprocess.call([cmake, '-G', generator, '../cmake'], cwd='./build')