Commit c2275c27 authored by Praetorius, Simon's avatar Praetorius, Simon

some minor changes in cmake configuration

parent 39d7363d
......@@ -72,8 +72,13 @@ macro(enable_petsc _FLAGS_ _INC_DIRS_ _LIBS_)
list(APPEND ${_FLAGS_} "-DHAVE_PARALLEL_PETSC=1" "-DPETSC_VERSION=${PETSC_VERSION}" ${PETSC_DEFINITIONS})
if (LINK_EXECUTABLE)
link_directories(${PETSC_LIBRARY_DIRS})
list(APPEND ${_LIBS_} ${PETSC_LIBRARIES})
set(PETSC_LINK_LIBRARIES "")
foreach (_PETSC_LIB ${PETSC_LIBRARIES})
find_library(_PETSC_LINK_LIB ${_PETSC_LIB} PATHS ${PETSC_LIBRARY_DIRS} NO_DEFAULT_PATH)
list(APPEND PETSC_LINK_LIBRARIES ${_PETSC_LINK_LIB})
endforeach()
message(STATUS " Found PETSc library ${PETSC_LINK_LIBRARIES}")
list(APPEND ${_LIBS_} ${PETSC_LINK_LIBRARIES})
endif (LINK_EXECUTABLE)
......
......@@ -2,7 +2,7 @@
set(MUPARSER_SOURCE_DIR ${BASE_DIR}/lib/muparser_v134/src)
set(MUPARSER_INCLUDE_DIR ${BASE_DIR}/lib/muparser_v134/include)
add_library(muparser
add_library(muparser STATIC
${MUPARSER_SOURCE_DIR}/muParser.cpp
${MUPARSER_SOURCE_DIR}/muParserBase.cpp
${MUPARSER_SOURCE_DIR}/muParserBytecode.cpp
......@@ -15,6 +15,7 @@ add_library(muparser
${MUPARSER_SOURCE_DIR}/muParserTokenReader.cpp)
include_directories(${MUPARSER_INCLUDE_DIR})
set_property(TARGET muparser PROPERTY POSITION_INDEPENDENT_CODE ON)
if (ENABLE_CXX11)
......
......@@ -2,7 +2,7 @@
set(MUPARSER_SOURCE_DIR ${BASE_DIR}/lib/muparser_v134/src)
set(MUPARSER_INCLUDE_DIR ${BASE_DIR}/lib/muparser_v134/include)
add_library(muparser
add_library(muparser STATIC
${MUPARSER_SOURCE_DIR}/muParser.cpp
${MUPARSER_SOURCE_DIR}/muParserBase.cpp
${MUPARSER_SOURCE_DIR}/muParserBytecode.cpp
......@@ -15,6 +15,7 @@ add_library(muparser
${MUPARSER_SOURCE_DIR}/muParserTokenReader.cpp)
target_include_directories(muparser PUBLIC ${MUPARSER_INCLUDE_DIR})
set_property(TARGET muparser PROPERTY POSITION_INDEPENDENT_CODE ON)
if (ENABLE_CXX11)
target_enable_cxx11(MUPARSER_ENABLE_CXX11 muparser PRIVATE)
......
macro(parse_zoltan_makefile _FILE_ _TARGET_ _SCOPE_)
# parse zoltan extra libs AND ld flags
file(STRINGS ${_FILE_} ZOLTAN_EXTRA_LIBS_LINE REGEX "ZOLTAN_EXTRA_LIBS")
file(STRINGS ${_FILE_} ZOLTAN_LDFLAGS_LINE REGEX "ZOLTAN_LDFLAGS")
get_filename_component(ZOLTAN_MAKEFILE_DIR "${ZOLTAN_MAKEFILE}" PATH CACHE)
string(STRIP "${ZOLTAN_EXTRA_LIBS_LINE}" ZOLTAN_EXTRA_LIBS_LINE)
string(STRIP "${ZOLTAN_LDFLAGS_LINE}" ZOLTAN_LDFLAGS_LINE)
if ("${ZOLTAN_EXTRA_LIBS_LINE}" MATCHES "^ZOLTAN_EXTRA_LIBS[ ]*=[ ]*([a-zA-Z0-9_/. -]+)*$")
......
......@@ -75,7 +75,13 @@ macro(target_enable_petsc _TARGET_ _SCOPE_)
target_compile_options(${_TARGET_} ${_SCOPE_} ${PETSC_DEFINITIONS})
if (LINK_EXECUTABLE)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PETSC_LIBRARIES})
set(PETSC_LINK_LIBRARIES "")
foreach (_PETSC_LIB ${PETSC_LIBRARIES})
find_library(_PETSC_LINK_LIB ${_PETSC_LIB} PATHS ${PETSC_LIBRARY_DIRS} NO_DEFAULT_PATH)
list(APPEND PETSC_LINK_LIBRARIES ${_PETSC_LINK_LIB})
endforeach()
message(STATUS " Found PETSc library ${PETSC_LINK_LIBRARIES}")
target_link_libraries(${_TARGET_} ${_SCOPE_} ${PETSC_LINK_LIBRARIES})
endif (LINK_EXECUTABLE)
......
project("example")
cmake_minimum_required(VERSION 2.8)
project("myproject")
cmake_minimum_required(VERSION 3.1)
find_package(AMDIS REQUIRED)
if(AMDIS_FOUND)
message(STATUS "AMDiS was found.")
include(${AMDIS_USE_FILE})
SET(BASIS_LIBS ${AMDIS_LIBRARIES})
endif(AMDIS_FOUND)
set(AMDIS_COMPONENT SEQUENTIAL)
set(AMDIS_VERSION 1.1)
add_executable("example" example.cc)
target_link_libraries("example" ${BASIS_LIBS})
find_package(AMDIS REQUIRED ${AMDIS_COMPONENT} VERSION>=${AMDIS_VERSION})
add_executable(mytarget src/mysource.cc)
target_include_directories(mytarget PRIVATE ${AMDIS_INCLUDE_DIRS})
target_compile_definitions(mytarget PRIVATE ${AMDIS_COMPILEFLAGS})
target_link_libraries(mytarget ${AMDIS_LIBRARIES})
......@@ -29,10 +29,25 @@ Some demo programs using the AMDiS library are implemented in the subdirectory `
```
mkdir demo/build && cd demo/build
cmake -DAMDIS_DIR:PATH=[install_dir]/share/amdis ..
cmake -DAMDIS_DIR:PATH=[install_dir]/share/amdis [-DCOMPONENT=(SEQUENTIAL|PARALLEL)] ..
cmake --build . --target all
```
The optional `COMPONENT` parameter set the variant of AMDiS to be used, i.e. sequential or parallel AMDiS. All AMDiS-dependent programs can be
configured using a `CMakeLists.txt` file similar to the following:
```
project("myproject")
cmake_minimum_required(VERSION 3.1)
find_package(AMDIS REQUIRED [SEQUENTIAL|PARALLEL] [VERSION>=1.1])
add_executable(mytarget src/mysource.cc)
target_include_directories(mytarget PRIVATE ${AMDIS_INCLUDE_DIRS})
target_compile_definitions(mytarget PRIVATE ${AMDIS_COMPILEFLAGS})
target_link_libraries(mytarget ${AMDIS_LIBRARIES})
```
## Tests
The tests are implemented in the subdirectory `test` and can be built and run by using the CMake:
......@@ -80,8 +95,10 @@ When configuring AMDiS several options can be modified. For an interactive gui,
| Option | Type | Description |
| -------------- | ---- | ----------- |
| ENABLE_UMFPACK | BOOL | Compile with support for suitesparse UMFPack library |
| ENABLE_COMPRESSION | BOOL | Allow compressed output of .vtk and .arh files. Need zlib and libbz2 to be installed on the system. |
| ENABLE_COMPRESSION | BOOL | Allow compressed output of .vtk and .arh files. Need development files of zlib and libbz2 to be installed on the system. |
| ENABLE_PARALLEL_DOMAIN | BOOL | Switch to parallel AMDiS. Needs PETSc and ParMETIS to be installed. |
| PETSC_DIR | PATH | Path to the PETSc root directory, containing the lib/ and include/ subdirectories. |
| PARMETIS_DIR | PATH | Path to the ParMETIS root directory, containing the lib/ and include/ subdirectories. |
| ENABLE_ZOLTAN | BOOL | Compile support for graph paritioning library Zoltan. |
| ZOLTAN_DIR | PATH | PAth to the Zoltan root directory, containing lib/ and include/ subdirectories. |
| ENABLE_EXTENSIONS | BOOL | Add additional features, not yet part of the standard AMDiS. Experimental! Should be used with care. |
......@@ -63,13 +63,14 @@ Optional Packages:
--with-suitesparse (see --with-umfpack)
--with-boost-dir=DIR Sets the boost root directory. [${BOOST_PREFIX}]
--download-boost Download and install boost to '${SRC_DIR}/packages/boost'.
--download-boost Download and install boost, version ${BOOST_VERSION},
to '${SRC_DIR}/packages/boost/${BOOST_VERSION}/'.
--with-petsc-dir=DIR Sets the PETSc root directory, i.e. a directory
containing the folders 'lib/', 'include/' with e.g.
'lib/libpetsc.so' [${PETSC_DIR}].
--download-petsc Download and install petsc, version ${PETSC_VERSION},
to '${SRC_DIR}/packages/petsc'.
to '${SRC_DIR}/packages/petsc/${PETSC_VERSION}/'.
--with-parmetis-dir=DIR Sets the PARMETIS root directory, i.e. a directory
containing the folders 'lib/', 'include/' with e.g.
'include/parmetis.h' [=PETSC_DIR].
......@@ -256,7 +257,7 @@ if [ "${DOWNLOAD_ZOLTAN}" -eq "1" ]; then
if [ ! -d /tmp/src/zoltan ]; then
mkdir -p /tmp/src/zoltan
curl -SL "http://www.cs.sandia.gov/~kddevin/Zoltan_Distributions/zoltan_distrib_v${ZOLTAN_VERSION}.tar.gz" \
| tar --strip-components=1 -xC /tmp/src/zoltan
| tar --strip-components=1 -xzC /tmp/src/zoltan
fi
ZOLTAN_PREFIX=${SRC_DIR}/packages/zoltan
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment