-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.py
68 lines (53 loc) · 1.89 KB
/
install.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This program is a part of EASIFEM library.
# See. www.easifem.com
# Copyright (c) 2020-2021, All right reserved, Vikas Sharma, Ph.D.
#
import os
# import sys
import platform
def installRequest(LIB):
while True:
choice = input(f"Do you want to Install {LIB} 'yes' or 'no' [Y/n]: ")
if choice == " ":
choice = "no"
else:
choice = choice.lower()
if choice in ["Y", "y", "ye", "yes"]:
return True
else:
return False
def getOption(key, opt):
while True:
separator = ", "
return (
input(
f"select option for {key}, possible options are : {separator.join(opt)} : "
)
+ " "
)
print("Detecting OS type...")
_os = platform.system()
if _os == "Windows":
print("ERROR: INSTALLATION on windows is work in progress")
exit
# print("Please use Windows Subsystem Linux(WSL) ")
# print("Installation DONE!!")
else:
cmake_def = ' -G "Ninja" -D CMAKE_BUILD_TYPE:STRING=Release'
cmake_def += " -D BUILD_SHARED_LIBS:BOOL=ON "
default_build_dir = "${HOME}/temp/easifem-extpkgs/Sparsekit/build"
opt = getOption("Build directory: ", [f"{default_build_dir}", "build/dir/path"])
if opt == " ":
build_dir = default_build_dir
print(f"Sparsekit will be build at {build_dir}")
print("Enter the place where you want to install Sparsekit")
opt = getOption("CMAKE_INSTALL_PREFIX: ", ["[${EASIFEM_EXTPKGS}], ${PREFIX}"])
if opt == " ":
opt = "${EASIFEM_EXTPKGS}"
cmake_def += " -D CMAKE_INSTALL_PREFIX=" + opt
print(f"Sparsekit will be installed at {opt}")
print("Sparsekit is configured with : ", cmake_def)
os.makedirs(build_dir, exist_ok=True)
os.system(f"cmake -S ./ -B {build_dir} {cmake_def}")
os.system(f"cmake --build {build_dir} --target install")
print("Installation DONE!!")