New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes in FindPetsc and related modules from Flow123d #3
Open
jbrezmorf
wants to merge
9
commits into
jedbrown:master
Choose a base branch
from
jbrezmorf:master
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4c4719a
Initial commit
jbrezmorf 0d48a58
Merge https://github.com/jedbrown/cmake-modules
jbrezmorf c73e62a
Merge modules from Flow123d with those from Jed.
jbrezmorf 42927d1
Make minimize changes compared to Jed's version.
jbrezmorf 8c891c6
Rebase to Jed's branch.
jbrezmorf c70e6d0
New merge of changes from Flow123d.
jbrezmorf 039ebb3
Merge branch 'master' of https://github.com/jbrezmorf/cmake-modules
jbrezmorf 2e1e099
Merge remote-tracking branch 'jedbrown-origin/master'
jbrezmorf 127f5c7
Merge changes from Flow123d project.
jbrezmorf File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
CMakeCache.txt | ||
CMakeFiles | ||
Makefile | ||
cmake_install.cmake | ||
install_manifest.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#InstallPetsc.cmake | ||
# | ||
# Created on: Jul 20, 2012 | ||
# Author: jb | ||
# | ||
# accepted variables: | ||
# EXTERNAL_PETSC_DIR - target directory used for instalation | ||
# INSTALL_PETSC_URL - url with petsc tarball | ||
# PETSC_MPI_DIR - pass MPI to PETSC configure | ||
# PETSC_LAPACK_DIR - pass Lapack to PETSC configure | ||
# INSTALL_PETSC_ONLY - install only petsc (possibly MPI and BLAS/LAPACK) | ||
# INSTALL_PETSC_OPTIONS - add content of this variable to the PETSC configure command | ||
# (default) - install also, metis, parmetis | ||
|
||
|
||
|
||
if (NOT EXTERNAL_PETSC_DIR) | ||
set(EXTERNAL_PETSC_DIR "${EXTERNAL_PROJECT_DIR}/petsc_build") | ||
endif() | ||
|
||
########################################################################## | ||
# Download PETSC | ||
# A temporary CMakeLists.txt | ||
|
||
# set configure line for PETSC | ||
set(PETSC_CONF_LINE "--COPTFLAGS ${CMAKE_C_FLAGS} --CXXOPTFLAGS ${CMAKE_CXX_FLAGS} --with-clanguage=C --with-debugging=0") | ||
if (CMAKE_Fortran_COMPILER) | ||
set(PETSC_CONF_LINE "${PETSC_CONF_LINE} --FOPTFLAGS ${CMAKE_Fortran_FLAGS}") | ||
endif() | ||
|
||
if (PETSC_MPI_DIR) | ||
set(PETSC_CONF_LINE "${PETSC_CONF_LINE} --with-mpi-dir=${PETSC_MPI_DIR}") | ||
else() | ||
set(PETSC_CONF_LINE "${PETSC_CONF_LINE} --download-mpich=yes") | ||
endif() | ||
|
||
if (PETSC_LAPACK_DIR) | ||
set(PETSC_CONF_LINE "${PETSC_CONF_LINE} --with-lapack-dir=${PETSC_LAPACK_DIR}") | ||
else() | ||
if(CMAKE_Fortran_COMPILER) | ||
set(PETSC_CONF_LINE "${PETSC_CONF_LINE} --download-f-blas-lapack=yes") | ||
else() | ||
set(PETSC_CONF_LINE "${PETSC_CONF_LINE} --download-c-blas-lapack=yes") | ||
endif() | ||
endif() | ||
|
||
if(INSTALL_PETSC_ONLY) | ||
else() | ||
set(PETSC_CONF_LINE "${PETSC_CONF_LINE} --download-metis=yes --download-parmetis=yes") | ||
endif() | ||
|
||
set(PETSC_CONF_LINE "${PETSC_CONF_LINE} ${INSTALL_PETSC_OPTIONS}") | ||
|
||
set (cmakelists_fname "${EXTERNAL_PETSC_DIR}/CMakeLists.txt") | ||
file (WRITE "${cmakelists_fname}" | ||
" | ||
## This file was autogenerated by InstallPETSC.cmake | ||
cmake_minimum_required(VERSION 2.8) | ||
include(ExternalProject) | ||
ExternalProject_Add(PETSC | ||
DOWNLOAD_DIR ${EXTERNAL_PETSC_DIR} | ||
URL ${INSTALL_PETSC_URL} | ||
SOURCE_DIR ${EXTERNAL_PETSC_DIR}/src | ||
BINARY_DIR ${EXTERNAL_PETSC_DIR}/src | ||
CONFIGURE_COMMAND ${EXTERNAL_PETSC_DIR}/src/configure ${PETSC_CONF_LINE} | ||
BUILD_COMMAND make all | ||
INSTALL_COMMAND \"\" | ||
) | ||
") | ||
|
||
message(STATUS "=== Installing PETSC ===") | ||
# run cmake | ||
set(PETSC_DIR "${EXTERNAL_PETSC_DIR}/src") | ||
set(PETSC_ARCH "cmake") | ||
set(ENV{PETSC_DIR} "${PETSC_DIR}") | ||
set(ENV{PETSC_ARCH} "${PETSC_ARCH}") | ||
execute_process(COMMAND ${CMAKE_COMMAND} ${EXTERNAL_PETSC_DIR} | ||
WORKING_DIRECTORY ${EXTERNAL_PETSC_DIR}) | ||
|
||
find_program (MAKE_EXECUTABLE NAMES make gmake) | ||
# run make | ||
execute_process(COMMAND ${MAKE_EXECUTABLE} PETSC | ||
WORKING_DIRECTORY ${EXTERNAL_PETSC_DIR}) | ||
|
||
|
||
#file (REMOVE ${cmakelists_fname}) | ||
|
||
message(STATUS "== PETSC build done") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cmake_modules | ||
============= | ||
|
||
CMake modules to detect and/or install specific libraries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a precedent anywhere else for distributing InstallXXX.cmake files? If not, then I think this script is probably better distributed with your project where you can easily customize it, rather than in cmake-modules where I maintain it if it doesn't match the needs of some user.