Skip to content
Snippets Groups Projects
Commit 6dd28874 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

[broken] trying to compile executable

parent 01fd875a
Branches
Tags
1 merge request!23WIP: Feature/use cmake
Pipeline #45075 failed
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
project(BFPS C CXX) project(BFPS)
execute_process(COMMAND python ${PROJECT_SOURCE_DIR}/get_version.py OUTPUT_VARIABLE BFPS_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
project(BFPS
VERSION ${BFPS_VERSION}
LANGUAGES C CXX)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/morse ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/morse ${CMAKE_MODULE_PATH})
......
...@@ -38,9 +38,6 @@ here = os.path.normcase(__file__) ...@@ -38,9 +38,6 @@ here = os.path.normcase(__file__)
header_dir = os.path.join(os.path.join(dist_loc, 'bfps'), 'cpp') header_dir = os.path.join(os.path.join(dist_loc, 'bfps'), 'cpp')
lib_dir = os.path.join(dist_loc, 'bfps') lib_dir = os.path.join(dist_loc, 'bfps')
install_info = pickle.load(
open(os.path.join(os.path.dirname(here), 'install_info.pickle'), 'rb'))
homefolder = os.path.expanduser('~') homefolder = os.path.expanduser('~')
bfpsfolder = os.path.join(homefolder, '.config/', 'bfps') bfpsfolder = os.path.join(homefolder, '.config/', 'bfps')
sys.path.append(bfpsfolder) sys.path.append(bfpsfolder)
......
...@@ -28,7 +28,6 @@ import os ...@@ -28,7 +28,6 @@ import os
import sys import sys
import numpy as np import numpy as np
import h5py import h5py
from bfps import install_info
from bfps import __version__ from bfps import __version__
class _base(object): class _base(object):
...@@ -175,8 +174,7 @@ class _base(object): ...@@ -175,8 +174,7 @@ class _base(object):
ofile['parameters/' + k] = self.parameters[k] ofile['parameters/' + k] = self.parameters[k]
ofile['iteration'] = int(iter0) ofile['iteration'] = int(iter0)
ofile['bfps_info/solver_class'] = type(self).__name__ ofile['bfps_info/solver_class'] = type(self).__name__
for k in install_info.keys(): ofile['bfps_info/VERSION'] = __version__
ofile['bfps_info/' + k] = str(install_info[k])
ofile.close() ofile.close()
return None return None
def rewrite_par( def rewrite_par(
......
...@@ -198,36 +198,11 @@ class _code(_base): ...@@ -198,36 +198,11 @@ class _code(_base):
self, self,
no_debug = False): no_debug = False):
# compile code # compile code
if not os.path.isfile(os.path.join(bfps.header_dir, 'base.hpp')): os.makedirs('bfps_build', exist_ok = True)
raise IOError('header not there:\n' + os.chdir('bfps_build')
'{0}\n'.format(os.path.join(bfps.header_dir, 'base.hpp')) +
'{0}\n'.format(bfps.dist_loc))
libraries = ['bfps']
libraries += bfps.install_info['libraries']
command_strings = [bfps.install_info['compiler']]
command_strings += [self.name + '.cpp', '-o', self.name]
command_strings += bfps.install_info['extra_compile_args']
if no_debug:
command_strings += ['-DNDEBUG']
command_strings += ['-I' + idir for idir in bfps.install_info['include_dirs']]
command_strings.append('-I' + bfps.header_dir)
command_strings += ['-L' + ldir for ldir in bfps.install_info['library_dirs']]
command_strings += ['-Wl,-rpath=' + ldir for ldir in bfps.install_info['library_dirs']]
command_strings.append('-L' + bfps.lib_dir)
command_strings.append('-Wl,-rpath=' + bfps.lib_dir)
for libname in libraries:
if libname[0] not in ['-', '/']:
command_strings += ['-l' + libname]
else:
command_strings += [libname]
command_strings += ['-fopenmp']
self.write_src() self.write_src()
print('compiling code with command\n' + ' '.join(command_strings)) print('compiling code with command\n' + ' '.join(command_strings))
return subprocess.check_call(command_strings)
def set_host_info( def set_host_info(
self, self,
host_info = {}): host_info = {}):
......
...@@ -56,33 +56,8 @@ from machine_settings import compiler, include_dirs, library_dirs, extra_compile ...@@ -56,33 +56,8 @@ from machine_settings import compiler, include_dirs, library_dirs, extra_compile
### package versioning ### package versioning
# get current time import get_version
now = datetime.datetime.now() VERSION = get_version.main()
# obtain version
try:
git_branch = subprocess.check_output(['git',
'rev-parse',
'--abbrev-ref',
'HEAD']).strip().split()[-1].decode()
git_revision = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
git_date = datetime.datetime.fromtimestamp(int(subprocess.check_output(['git', 'log', '-1', '--format=%ct']).strip()))
except:
git_revision = ''
git_branch = ''
git_date = now
if git_branch == '':
# there's no git available or something
VERSION = '{0:0>4}{1:0>2}{2:0>2}.{3:0>2}{4:0>2}{5:0>2}'.format(
git_date.year, git_date.month, git_date.day,
git_date.hour, git_date.minute, git_date.second)
else:
if (('develop' in git_branch) or
('feature' in git_branch) or
('bugfix' in git_branch)):
VERSION = subprocess.check_output(
['git', 'describe', '--tags', '--dirty']).strip().decode().replace('-g', '+g').replace('-dirty', '.dirty').replace('-', '.post')
else:
VERSION = subprocess.check_output(['git', 'describe', '--tags']).strip().decode().split('-')[0]
print('This is bfps version ' + VERSION) print('This is bfps version ' + VERSION)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment