Skip to content

Commit 14c90e2

Browse files
committed
make mkl libs static for distribution
1 parent 6f04bb0 commit 14c90e2

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

arrayfire/library.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,7 @@ def _setup():
571571
else:
572572
raise OSError(platform_name + ' not supported')
573573

574-
if AF_PATH is None:
575-
os.environ['AF_PATH'] = AF_SEARCH_PATH
576-
577-
return pre, post, AF_SEARCH_PATH, CUDA_FOUND
574+
return pre, post, AF_PATH, AF_SEARCH_PATH, CUDA_FOUND
578575

579576
class _clibrary(object):
580577

@@ -589,21 +586,31 @@ def __libname(self, name, head='af', ver_major=AF_VER_MAJOR):
589586
post = self.__post.replace(_VER_MAJOR_PLACEHOLDER, ver_major)
590587
libname = self.__pre + head + name + post
591588

592-
if os.path.isdir(self.AF_PATH + '/lib64'):
593-
path_search = self.AF_PATH + '/lib64/'
589+
if self.AF_PATH:
590+
if os.path.isdir(self.AF_PATH + '/lib64'):
591+
path_search = self.AF_PATH + '/lib64/'
592+
else:
593+
path_search = self.AF_PATH + '/lib/'
594594
else:
595-
path_search = self.AF_PATH + '/lib/'
595+
if os.path.isdir(self.AF_SEARCH_PATH + '/lib64'):
596+
path_search = self.AF_SEARCH_PATH + '/lib64/'
597+
else:
598+
path_search = self.AF_SEARCH_PATH + '/lib/'
596599

597600
if platform.architecture()[0][:2] == '64':
598601
path_site = sys.prefix + '/lib64/'
599602
else:
600603
path_site = sys.prefix + '/lib/'
601604

602605
path_local = self.AF_PYMODULE_PATH
603-
return [('', libname),
604-
(path_search, libname),
605-
(path_site, libname),
606-
(path_local,libname)]
606+
libpaths = [('', libname),
607+
(path_site, libname),
608+
(path_local,libname)]
609+
if self.AF_PATH: #prefer specified AF_PATH if exists
610+
libpaths.append((path_search, libname))
611+
else:
612+
libpaths.insert(2, (path_search, libname))
613+
return libpaths
607614

608615
def set_unsafe(self, name):
609616
lib = self.__clibs[name]
@@ -615,11 +622,12 @@ def __init__(self):
615622

616623
more_info_str = "Please look at https://github.com/arrayfire/arrayfire-python/wiki for more information."
617624

618-
pre, post, AF_PATH, CUDA_FOUND = _setup()
625+
pre, post, AF_PATH, AF_SEARCH_PATH, CUDA_FOUND = _setup()
619626

620627
self.__pre = pre
621628
self.__post = post
622629
self.AF_PATH = AF_PATH
630+
self.AF_SEARCH_PATH = AF_SEARCH_PATH
623631
self.CUDA_FOUND = CUDA_FOUND
624632

625633
# prefer locally packaged arrayfire libraries if they exist

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def filter_af_files(cmake_manifest):
6262
or name.endswith('libforge.so')
6363
or re.match('.*libforge\.so\.1\..*', name) is not None
6464
or 'examples' in name), cmake_manifest))
65-
print(cmake_manifest)
6665
return cmake_manifest
6766

6867
print('Building CMAKE with following configurable variables: ')
@@ -94,7 +93,9 @@ def filter_af_files(cmake_manifest):
9493
'-DBUILD_TESTING:BOOL=OFF',
9594
'-DAF_BUILD_FORGE:BOOL=ON',
9695
'-DAF_INSTALL_LIB_DIR:STRING=arrayfire',
96+
'-DAF_INSTALL_BIN_DIR:STRING=arrayfire',
9797
'-DFG_INSTALL_LIB_DIR:STRING=arrayfire',
98+
'-DAF_WITH_STATIC_MKL=ON',
9899
]
99100
)
100101

0 commit comments

Comments
 (0)