Permalink
Browse files

CMake installation scripts

Adding CMake installation scripts for library and examples.
find_package(inmost) was not tested.
  • Loading branch information...
kirill-terekhov committed Jan 12, 2015
1 parent 3cbe1ef commit 3ba8f44af1b56170a0c7bf4f2774bb8ed43f733b
@@ -37,7 +37,10 @@ set(HEADER inmost.h
solver_bcgsl.hpp
solver_prototypes.hpp)
set(INMOST_MAJOR_VERSION 0)
set(INMOST_MINOR_VERSION 1)
set(INMOST_PATCH_VERSION 0)
set(INMOST_VERSION "${INMOST_MAJOR_VERSION}.${INMOST_MINOR_VERSION}.${INMOST_PATCH_VERSION}")
add_library(inmost STATIC ${SOURCE} ${HEADER})
@@ -121,7 +124,7 @@ if(USE_PARTITIONER_ZOLTAN)
set(USE_PARTITIONER_ZOLTAN OFF)
message("ZOLTAN NOT FOUND")
else()
include_directories(${ZOLTAN_INCLUDE_DIR})
#include_directories(${ZOLTAN_INCLUDE_DIR})
include_directories(${ZOLTAN_INCLUDE_DIRS})
set(USE_PARTITIONER_ZOLTAN ON)
message("ZOLTAN FOUND")
@@ -225,3 +228,46 @@ if(COMPILE_TESTS)
add_subdirectory(tests)
endif(COMPILE_TESTS)
set(INMOST_INSTALL_HEADERS inmost.h
inmost_options_cmake.h
inmost_common.h
inmost_mesh.h
inmost_solver.h
inmost_partitioner.h
inmost_autodiff.h
container.hpp)
include(CPack)
export(TARGETS inmost FILE inmost-targets.cmake)
export(PACKAGE inmost)
set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
configure_file(inmost-config.cmake.in "${PROJECT_BINARY_DIR}/inmost-config.cmake" @ONLY)
set(CONF_INCLUDE_DIRS "\${INMOST_DIR}/include")
configure_file(inmost-config.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/inmost-config.cmake" @ONLY)
configure_file(inmost-config-version.cmake.in "${PROJECT_BINARY_DIR}/inmost-config-version.cmake" @ONLY)
set_property(TARGET inmost PROPERTY PUBLIC_HEADER
"${PROJECT_BINARY_DIR}/inmost_options.h"
"${PROJECT_SOURCE_DIR}/inmost.h"
"${PROJECT_SOURCE_DIR}/inmost_common.h"
"${PROJECT_SOURCE_DIR}/inmost_mesh.h"
"${PROJECT_SOURCE_DIR}/inmost_solver.h"
"${PROJECT_SOURCE_DIR}/inmost_partitioner.h"
"${PROJECT_SOURCE_DIR}/inmost_autodiff.h"
"${PROJECT_SOURCE_DIR}/container.hpp")
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/inmost-config.cmake"
"${PROJECT_BINARY_DIR}/inmost-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(TARGETS inmost EXPORT inmost-targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include)
install(EXPORT inmost-targets DESTINATION "lib/CMake")
@@ -25,3 +25,4 @@ else(OPENGL_FOUND)
message("OpenGL not found")
endif(OPENGL_FOUND)
install(TARGETS DrawGrid EXPORT inmost-targets RUNTIME DESTINATION bin)
@@ -41,3 +41,4 @@ else(OPENGL_FOUND)
endif(OPENGL_FOUND)
install(TARGETS DrawMatrix EXPORT inmost-targets RUNTIME DESTINATION bin)
@@ -43,4 +43,4 @@ if(USE_MPI)
endif()
endif(USE_MPI)
install(TARGETS FVDiscr EXPORT inmost-targets RUNTIME DESTINATION bin)
@@ -12,3 +12,6 @@ if(USE_MPI)
set_target_properties(GridGen PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS GridGen EXPORT inmost-targets RUNTIME DESTINATION bin)
@@ -30,3 +30,5 @@ if(USE_SOLVER)
target_link_libraries(MatSolve ${Trilinos_LIBRARIES} ${Trilinos_TPL_LIBRARIES})
endif()
endif()
install(TARGETS MatSolve EXPORT inmost-targets RUNTIME DESTINATION bin)
@@ -25,3 +25,6 @@ if(OPENGL_FOUND)
else(OPENGL_FOUND)
message("OpenGL not found, not building OldDrawGrid")
endif(OPENGL_FOUND)
install(TARGETS OldDrawGrid EXPORT inmost-targets RUNTIME DESTINATION bin)
@@ -38,3 +38,6 @@ if(USE_MPI)
set_target_properties(Solver PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS Solver EXPORT inmost-targets RUNTIME DESTINATION bin)
@@ -0,0 +1,11 @@
set(PACKAGE_VERSION "@INMOST_VERSION@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
@@ -0,0 +1,58 @@
# - Config file for the INMOST package
# It defines the following variables
# INMOST_INCLUDE_DIRS - include directories for INMOST and dependencies
# INMOST_LIBRARY_DIRS - library directories for INMOST and dependencies
# INMOST_LIBRARIES - libraries to link against
# INMOST_COMPILE_FLAGS - flags to set to compiler (generally inherited from MPI)
# Compute paths
get_filename_component(INMOST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(INMOST_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
if(NOT TARGET inmost AND NOT INMOST_BINARY_DIR)
include("${INMOST_DIR}/inmost-targets.cmake")
endif()
set(INMOST_LIBRARY_DIRS "${INMOST_DIR}/lib")
set(INMOST_LIBRARIES inmost)
set(USE_MPI,@USE_MPI@)
set(USE_PARTITIONER_ZOLTAN,@USE_PARTITIONER_ZOLTAN@)
set(USE_PARTITIONER_PARMETIS,@USE_PARTITIONER_PARMETIS@)
set(USE_SOLVER_TRILINOS,@USE_SOLVER_TRILINOS@)
set(USE_SOLVER_PETSC,@USE_SOLVER_PETSC@)
if( USE_MPI )
list(APPEND INMOST_INCLUDE_DIRS "@MPI_INCLUDE_PATH@")
list(APPEND INMOST_COMPILE_FLAGS "@MPI_COMPILE_FLAGS@")
endif( USE_MPI )
if( USE_PARTITIONER_ZOLTAN )
list(APPEND INMOST_LIBRARIES "@ZOLTAN_LIBRARIES@")
list(APPEND INMOST_INCLUDE_DIRS "@ZOLTAN_INCLUDE_DIRS@")
endif( USE_PARTITIONER_ZOLTAN )
if( USE_PARTITIONER_PARMETIS )
list(APPEND INMOST_LIBRARIES "@PARMETIS_LIBRARIES@")
list(APPEND INMOST_INCLUDE_DIRS "@PARMETIS_INCLUDE_DIR@")
list(APPEND INMOST_INCLUDE_DIRS "@METIS_INCLUDE_DIR@")
endif( USE_PARTITIONER_PARMETIS )
if( USE_SOLVER_TRILINOS )
list(APPEND INMOST_LIBRARIES "@Trilinos_LIBRARIES@")
list(APPEND INMOST_LIBRARIES "@Trilinos_TPL_LIBRARIES@")
list(APPEND INMOST_LIBRARY_DIRS "@Trilinos_LIBRARY_DIRS@")
list(APPEND INMOST_LIBRARY_DIRS "@Trilinos_TPL_LIBRARY_DIRS@")
list(APPEND INMOST_INCLUDE_DIRS "@Trilinos_INCLUDE_DIRS@")
list(APPEND INMOST_INCLUDE_DIRS "@Trilinos_TPL_INCLUDE_DIRS@")
endif( USE_SOLVER_TRILINOS )
if( USE_SOLVER_PETSC )
list(APPEND INMOST_LIBRARIES "@PETSC_LIBRARIES@")
list(APPEND INMOST_LIBRARY_DIRS "@PETSC_LIBRARY_DIRS@")
list(APPEND INMOST_INCLUDE_DIRS "@PETSC_INCLUDES@")
endif( USE_SOLVER_PETSC )
@@ -146,28 +146,16 @@ namespace INMOST
if( prec != NULL ) prec->ReplaceRHS(RHS);
info->GetLocalRegion(info->GetRank(),vlocbeg,vlocend);
info->GetVectorRegion(vbeg,vend);
{
Solver::Vector::iterator itr0 = r[0].Begin();
Solver::Vector::iterator itrhs = RHS.Begin(), endrhs = RHS.End();
while(itrhs != endrhs ) *itr0++ = *itrhs++;
}
//std::copy(RHS.Begin(),RHS.End(),r[0].Begin());
std::copy(RHS.Begin(),RHS.End(),r[0].Begin());
{
Alink->MatVec(-1,SOL,1,r[0]); //global multiplication, r probably needs an update
if( is_parallel ) info->Update(r[0]); // r is good
}
{
Solver::Vector::iterator itr00 = r0.Begin();
Solver::Vector::iterator itr0 = r[0].Begin(), endr0 = r[0].End();
while( itr0 != endr0 ) *itr00++ = *itr0++;
}
//std::copy(r[0].Begin(),r[0].End(),r0.Begin());
//for(Solver::Vector::iterator it = u[0].Begin(); it != u[0].End(); ++it) *it = 0.0;
std::copy(r[0].Begin(),r[0].End(),r0.Begin());
std::fill(u[0].Begin(),u[0].End(),0);
{
resid = 0;
for(INMOST_DATA_ENUM_TYPE k = vlocbeg; k != vlocend; k++)
resid += r[0][k]*r[0][k];
for(INMOST_DATA_ENUM_TYPE k = vlocbeg; k != vlocend; k++) resid += r[0][k]*r[0][k];
if( is_parallel ) info->Integrate(&resid,1);
}
last_resid = resid = resid0 = sqrt(resid);
@@ -487,22 +475,12 @@ namespace INMOST
if (prec != NULL)prec->ReplaceRHS(RHS);
info->GetLocalRegion(info->GetRank(),vlocbeg,vlocend);
info->GetVectorRegion(vbeg,vend);
{
Solver::Vector::iterator itr = r.Begin();
Solver::Vector::iterator itrhs = RHS.Begin(), endrhs = RHS.End();
while(itrhs != endrhs ) *itr++ = *itrhs++;
}
//std::copy(RHS.Begin(),RHS.End(),r.Begin());
std::copy(RHS.Begin(),RHS.End(),r.Begin());
{
Alink->MatVec(-1,SOL,1,r); //global multiplication, r probably needs an update
info->Update(r); // r is good
}
{
Solver::Vector::iterator itr00 = r0.Begin();
Solver::Vector::iterator itr = r.Begin(), endr = r.End();
while( itr != endr ) *itr00++ = *itr++;
}
//std::copy(r.Begin(),r.End(),r0.Begin());
std::copy(r.Begin(),r.End(),r0.Begin());
std::fill(v.Begin(),v.End(),0.0);
std::fill(p.Begin(),p.End(),0.0);
{

0 comments on commit 3ba8f44

Please sign in to comment.