Skip to content

Commit

Permalink
Refactored CMake-code.
Browse files Browse the repository at this point in the history
  • Loading branch information
bilke committed May 28, 2019
1 parent 00ad8f2 commit 9f71cae
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 63 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
###################

cmake_minimum_required(VERSION 3.10)

set(PDAF_FLAGS "-fPIC")
project(OGS-PDAF Fortran)

add_definitions(${PDAF_FLAGS})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(BUILD_SHARED_LIBS ON)

add_subdirectory(pdaf_base/src)
add_subdirectory(pdaf_user)
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# PDAF-OGS module

## Build

```bash
mkdir build; cd build
FC=mpif90 cmake ../[path-to-sources]
make
```

Find the shared library `pdaf` in `build/pdaf_user/`.
12 changes: 0 additions & 12 deletions pdaf_base/CMakeLists.txt

This file was deleted.

6 changes: 3 additions & 3 deletions pdaf_base/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
file(GLOB PDAF_BASE_SOURCES *.F90)

include_directories(dummympi)

add_library(PDAF_base ${PDAF_BASE_SOURCES})
add_library(PDAF_base STATIC ${PDAF_BASE_SOURCES})
target_include_directories(PDAF_base PRIVATE dummympi)
target_compile_options(PDAF_base PRIVATE "-fdefault-real-8")
12 changes: 6 additions & 6 deletions pdaf_user/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.10)

file(GLOB PDAF_USER_SOURCES *.F90)

include_directories(dummympi)
add_library(pdaf ${PDAF_USER_SOURCES})
target_include_directories(pdaf PRIVATE dummympi)
target_link_libraries(pdaf PRIVATE PDAF_base)

add_library(PDAF_user SHARED ${PDAF_USER_SOURCES})
set_target_properties(PDAF_user PROPERTIES PREFIX "")
set_target_properties(PDAF_user PROPERTIES OUTPUT_NAME "pdaf")
if(APPLE AND BUILD_SHARED_LIBS)
target_link_libraries(pdaf PUBLIC "-framework Accelerate")
endif()
39 changes: 0 additions & 39 deletions pdaf_user/cmake_install.cmake

This file was deleted.

0 comments on commit 9f71cae

Please sign in to comment.