xlnt/configure
2015-11-02 16:45:05 -05:00

44 lines
971 B
Python
Executable File

#!/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'
if len(sys.argv) > 1:
generator = sys.argv[1]
elif sys.platform == 'darwin':
generator = 'Unix Makefiles'
elif sys.platform == 'win32':
generator = 'Visual Studio 14 2015'
cmake = 'cmake'
if which('cmake3'):
cmake = 'cmake3'
subprocess.call([cmake, '-G', generator, '../cmake'], cwd='./build')