-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CMake-based builds and prerequisites to README (#123)
* Add CMake-based builds to README * Small addendum * Update README.md Co-authored-by: Hendrik Ranocha <[email protected]> * Allow macOS builds with CMake * Add prerequisites * Fix formatting --------- Co-authored-by: Hendrik Ranocha <[email protected]> Co-authored-by: Andrew Winters <[email protected]>
- Loading branch information
1 parent
f49ddf8
commit 49f2ceb
Showing
4 changed files
with
94 additions
and
38 deletions.
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
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 |
---|---|---|
@@ -1,28 +1,26 @@ | ||
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2) | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
SET(FFLAGS "-cpp -O" CACHE STRING "Fortran compiler flags") | ||
set(FFLAGS "-cpp -O" CACHE STRING "Fortran compiler flags") | ||
|
||
MESSAGE("--------------- cmake START -------------------") | ||
MESSAGE("-- FC: ${FC}") | ||
MESSAGE("-- FFLAGS: ${FFLAGS}") | ||
MESSAGE("-- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") | ||
MESSAGE("------------------------------------------------") | ||
message("--------------- cmake START -------------------") | ||
message("-- FC: ${FC}") | ||
message("-- FFLAGS: ${FFLAGS}") | ||
message("-- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") | ||
message("------------------------------------------------") | ||
|
||
SET(CMAKE_Fortran_COMPILER_INIT ${FC}) | ||
SET(CMAKE_Fortran_FLAGS "${FFLAGS} ${CMAKE_Fortran_FLAGS}") | ||
set(CMAKE_Fortran_COMPILER_INIT ${FC}) | ||
set(CMAKE_Fortran_FLAGS "${FFLAGS} ${CMAKE_Fortran_FLAGS}") | ||
|
||
FIND_PACKAGE(FTObjectLibrary REQUIRED) | ||
find_package(FTObjectLibrary REQUIRED) | ||
|
||
INCLUDE_DIRECTORIES("${FTOBJECTLIBRARY_INCLUDE_DIRS}") | ||
include_directories("${FTOBJECTLIBRARY_INCLUDE_DIRS}") | ||
|
||
PROJECT(HOHQMesh Fortran) | ||
SET(VERSION 1.0.2-pre) | ||
SET(CMAKE_VERBOSE_MAKEFILE ON) | ||
project(HOHQMesh Fortran) | ||
|
||
IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) | ||
MESSAGE(FATAL_ERROR "Fortran compiler does not support F90") | ||
ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) | ||
if(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) | ||
message(FATAL_ERROR "Fortran compiler does not support F90") | ||
endif(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) | ||
|
||
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/Source) | ||
add_subdirectory(${CMAKE_SOURCE_DIR}/Source) | ||
|
||
message("-- HOHQMESH ------------- cmake 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
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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
PROJECT(HOHQMesh) | ||
set(HOHQMESH "HOHQMesh") | ||
set(HOHQMESH_LIB "hohqmesh") | ||
|
||
SET(HOHQMESH "HOHQMesh") | ||
SET(HOHQMESH_LIB "hohqmesh") | ||
file(GLOB_RECURSE HOHQMESH_SRC ${CMAKE_CURRENT_SOURCE_DIR} "*.f90") | ||
|
||
FILE(GLOB_RECURSE HOHQMESH_SRC ${CMAKE_CURRENT_SOURCE_DIR} "*.f90") | ||
|
||
SET(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/include) | ||
|
||
ADD_LIBRARY(${HOHQMESH_LIB} STATIC | ||
${HOHQMESH_SRC}) | ||
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/include) | ||
|
||
ADD_EXECUTABLE(${HOHQMESH} ${HOHQMESH_SRC}) | ||
TARGET_LINK_LIBRARIES(${HOHQMESH} "${FTOBJECTLIBRARY_LIBRARY}") | ||
add_executable(${HOHQMESH} ${HOHQMESH_SRC}) | ||
target_link_libraries(${HOHQMESH} "${FTOBJECTLIBRARY_LIBRARY}") | ||
|
||
# Install libhohqmesh.a | ||
INSTALL(TARGETS ${HOHQMESH_LIB} | ||
ARCHIVE DESTINATION lib | ||
LIBRARY DESTINATION lib) | ||
install(TARGETS ${HOHQMESH}) | ||
|
||
# Note: Separate library build disabled in https://github.com/trixi-framework/HOHQMesh/pull/123 | ||
# since it caused issues on macOS | ||
# | ||
# add_library(${HOHQMESH_LIB} STATIC | ||
# ${HOHQMESH_SRC}) | ||
# | ||
# Install libhohqmesh.a | ||
# INSTALL(TARGETS ${HOHQMESH_LIB} | ||
# ARCHIVE DESTINATION lib | ||
# LIBRARY DESTINATION lib) | ||
# | ||
# Add .mod files to include/ directory | ||
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/include DESTINATION .) | ||
|
||
# Install HOHQMesh binary under bin/ | ||
INSTALL(TARGETS ${HOHQMESH} DESTINATION bin) | ||
# install(DIRECTORY ${CMAKE_BINARY_DIR}/include DESTINATION .) |