diff --git a/CMakeLists_packages.txt b/CMakeLists_packages.txt index 7b745a6d98a4f71179cc64d663cf90a67709c07c..17a1099ce1aeb4dc6cd450c271f802fdb45a137d 100644 --- a/CMakeLists_packages.txt +++ b/CMakeLists_packages.txt @@ -1,7 +1,11 @@ # vim: syntax=cmake #cmake_policy(SET CMP0074 NEW) + +set(MPI_STATIC ON) find_package(MPI REQUIRED) + +set(HDF5_STATIC ON) find_package(HDF5 REQUIRED) ############################################################################### @@ -13,6 +17,7 @@ endif() ############################################################################### # ugly manual settings for FFTW. +set(FFTW_STATIC ON) if (NOT DEFINED ENV{FFTW_BASE}) message(FATAL_ERROR "Required FFTW_BASE environment variable is not defined.") endif() diff --git a/setup.py b/setup.py index 34f63082741b0976b57517275f7d67294490fd47..23f9c266050ce9fae23470b7331260a53f1a6bf1 100644 --- a/setup.py +++ b/setup.py @@ -145,7 +145,6 @@ particle_headers = [ 'cpp/particles/particles_field_computer.hpp', 'cpp/particles/particles_generic_interp.hpp', 'cpp/particles/particles_inner_computer_empty.hpp', - #'cpp/particles/particles_inner_computer.hpp', 'cpp/particles/particles_input_hdf5.hpp', 'cpp/particles/particles_output_hdf5.hpp', 'cpp/particles/particles_output_mpiio.hpp', @@ -231,33 +230,39 @@ class CompileLibCommand(distutils.cmd.Command): eca += ['-DUSE_FFTWESTIMATE'] if self.disable_fftw_omp: eca += ['-DNO_FFTWOMP'] - for fname in src_file_list: - ifile = 'bfps/cpp/' + fname + '.cpp' - ofile = 'obj/' + fname + '.o' - if not os.path.exists(ofile): - need_to_compile_file = True - else: - need_to_compile_file = False - if not need_to_compile: - latest = libtime - dependency_list = get_file_dependency_list(fname) - for depname in dependency_list.split()[1:]: - latest = max(latest, - datetime.datetime.fromtimestamp(os.path.getctime(depname))) - need_to_compile_file = (latest > libtime) - if need_to_compile_file: - command_strings = [compiler, '-c'] - command_strings += ['bfps/cpp/' + fname + '.cpp'] - command_strings += ['-o', 'obj/' + fname + '.o'] - command_strings += eca - command_strings += ['-I' + idir for idir in include_dirs] - command_strings.append('-Ibfps/cpp/') - print(' '.join(command_strings)) - subprocess.check_call(command_strings) - command_strings = ['ar', 'rvs', 'bfps/libbfps.a'] - command_strings += ['obj/' + fname + '.o' for fname in src_file_list] - print(' '.join(command_strings)) - subprocess.check_call(command_strings) + os.makedirs('cmake_build_dir', exist_ok = True) + os.chdir('cmake_build_dir') + subprocess.check_call(['cmake', '..']) + subprocess.check_call(['make', '-j4']) + os.chdir('..') + subprocess.check_call(['cp', 'cmake_build_dir/libbfps.a', 'bfps/']) + #for fname in src_file_list: + # ifile = 'bfps/cpp/' + fname + '.cpp' + # ofile = 'obj/' + fname + '.o' + # if not os.path.exists(ofile): + # need_to_compile_file = True + # else: + # need_to_compile_file = False + # if not need_to_compile: + # latest = libtime + # dependency_list = get_file_dependency_list(fname) + # for depname in dependency_list.split()[1:]: + # latest = max(latest, + # datetime.datetime.fromtimestamp(os.path.getctime(depname))) + # need_to_compile_file = (latest > libtime) + # if need_to_compile_file: + # command_strings = [compiler, '-c'] + # command_strings += ['bfps/cpp/' + fname + '.cpp'] + # command_strings += ['-o', 'obj/' + fname + '.o'] + # command_strings += eca + # command_strings += ['-I' + idir for idir in include_dirs] + # command_strings.append('-Ibfps/cpp/') + # print(' '.join(command_strings)) + # subprocess.check_call(command_strings) + #command_strings = ['ar', 'rvs', 'bfps/libbfps.a'] + #command_strings += ['obj/' + fname + '.o' for fname in src_file_list] + #print(' '.join(command_strings)) + #subprocess.check_call(command_strings) ### save compiling information pickle.dump(