Fixed compilation option for CosmoTool. Show a message to indicate which variant is used to build the python modules

This commit is contained in:
Guilhem Lavaux 2015-02-10 13:43:05 +01:00
parent beb651c79a
commit 68bdc4fb31
3 changed files with 30 additions and 23 deletions

View File

@ -22,11 +22,13 @@ option(INTERNAL_HDF5 "Build internal version of HDF5" OFF)
option(INTERNAL_NETCDF "Build internal version of NETCDF" OFF) option(INTERNAL_NETCDF "Build internal version of NETCDF" OFF)
option(INTERNAL_BOOST "Build internal version of BOOST" OFF) option(INTERNAL_BOOST "Build internal version of BOOST" OFF)
IF(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) IF(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
SET(CosmoTool_local CosmoTool_static) SET(CosmoTool_local CosmoTool_static)
ELSE(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) ELSE(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
SET(CosmoTool_local CosmoTool) SET(CosmoTool_local CosmoTool)
ENDIF(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) ENDIF(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
MESSAGE(STATUS "Using the target ${CosmoTool_local} to build python module")
include(${CMAKE_SOURCE_DIR}/external/external_build.cmake) include(${CMAKE_SOURCE_DIR}/external/external_build.cmake)

View File

@ -154,6 +154,8 @@ def get_grid_values(xx,data, ranges):
def get_mean_density(fdir, smin, step): def get_mean_density(fdir, smin, step):
""" estimate ensemble mean """ estimate ensemble mean
""" """
import progressbar as pb
print('-'*60) print('-'*60)
print('Get 3D ensemble mean density field') print('Get 3D ensemble mean density field')
print('-'*60) print('-'*60)
@ -208,6 +210,8 @@ def get_mean_density(fdir, smin, step):
def get_mean_density_fdir(fdir,init,steps): def get_mean_density_fdir(fdir,init,steps):
""" estimate ensemble mean """ estimate ensemble mean
""" """
import progressbar as pb
print('-'*60) print('-'*60)
print('Get 3D ensemble mean density field') print('Get 3D ensemble mean density field')
print('-'*60) print('-'*60)
@ -227,7 +231,7 @@ def get_mean_density_fdir(fdir,init,steps):
norm0=0. norm0=0.
norm1=0. norm1=0.
for fn in fname0: for fn in pb.ProgressBar(len(fname0))(fname0):
auxborg=read_borg_vol(fn) auxborg=read_borg_vol(fn)
auxdata0 = auxborg.density auxdata0 = auxborg.density
MEAN0+=auxdata0 MEAN0+=auxdata0
@ -236,7 +240,7 @@ def get_mean_density_fdir(fdir,init,steps):
del auxdata0 del auxdata0
del auxborg del auxborg
for fn in fname1: for fn in pb.ProgressBar(len(fname1))(fname1):
auxborg1=read_borg_vol(fn) auxborg1=read_borg_vol(fn)
auxdata1 = auxborg1.density auxdata1 = auxborg1.density
MEAN1+=auxdata1 MEAN1+=auxdata1

View File

@ -1,4 +1,3 @@
add_definitions(-fPIC)
SET(CosmoTool_SRCS SET(CosmoTool_SRCS
fortran.cpp fortran.cpp
@ -75,9 +74,11 @@ if (BUILD_SHARED_LIBS)
target_link_libraries(CosmoTool ${CosmoTool_LIBS}) target_link_libraries(CosmoTool ${CosmoTool_LIBS})
if (BUILD_STATIC_LIBS) if (BUILD_STATIC_LIBS)
add_library(CosmoTool_static STATIC ${CosmoTool_SRCS}) add_library(CosmoTool_static STATIC ${CosmoTool_SRCS})
set_target_properties(CosmoTool_static PROPERTIES COMPILE_FLAGS "${CMAKE_C_COMPILE_OPTIONS_PIC}")
endif(BUILD_STATIC_LIBS) endif(BUILD_STATIC_LIBS)
else (BUILD_SHARED_LIBS) else (BUILD_SHARED_LIBS)
add_library(CosmoTool STATIC ${CosmoTool_SRCS}) add_library(CosmoTool STATIC ${CosmoTool_SRCS})
set_target_properties(CosmoTool PROPERTIES COMPILE_FLAGS "${CMAKE_C_COMPILE_OPTIONS_PIC}")
endif (BUILD_SHARED_LIBS) endif (BUILD_SHARED_LIBS)
install(TARGETS CosmoTool install(TARGETS CosmoTool