allow standard CMAKE way of setting install directory

- DAMASK_BIN in config has no effect anymore
This commit is contained in:
Martin Diehl 2019-04-25 07:08:32 +02:00
parent 53f6a4e030
commit 7104bc9934
4 changed files with 10 additions and 25 deletions

View File

@ -106,11 +106,11 @@ set (CMAKE_C_COMPILER "${PETSC_MPICC}")
# DAMASK solver defines project to build # DAMASK solver defines project to build
if (DAMASK_SOLVER STREQUAL "GRID") if (DAMASK_SOLVER STREQUAL "GRID")
project (DAMASK_grid Fortran C) project (damask-grid Fortran C)
add_definitions (-DGrid) add_definitions (-DGrid)
message ("Building Grid Solver\n") message ("Building Grid Solver\n")
elseif (DAMASK_SOLVER STREQUAL "FEM") elseif (DAMASK_SOLVER STREQUAL "FEM")
project (DAMASK_FEM Fortran C) project (damask-mesh Fortran C)
add_definitions (-DFEM) add_definitions (-DFEM)
message ("Building FEM Solver\n") message ("Building FEM Solver\n")
else () else ()
@ -156,22 +156,6 @@ if (CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
set (BUILDCMD_POST "${BUILDCMD_POST} -fsyntax-only") set (BUILDCMD_POST "${BUILDCMD_POST} -fsyntax-only")
endif () endif ()
# Parse DAMASK_BIN from CONFIG file
file (READ "CONFIG" CONFIGFILE)
string (REGEX REPLACE ";" "\\\\;" CONFIGFILE "${CONFIGFILE}")
string (REGEX REPLACE "\n" ";" CONFIGFILE "${CONFIGFILE}")
foreach (item ${CONFIGFILE})
string (REGEX MATCH ".+DAMASK_BIN.+" item ${item})
if (item)
string (REGEX REPLACE "set" "" item "${item}")
string (REGEX REPLACE "=" " " item "${item}")
string (REGEX REPLACE "\\\${DAMASK_ROOT}" "${PROJECT_SOURCE_DIR}" item "${item}")
string (REPLACE "DAMASK_BIN" ";" STRING_LIST ${item})
list (GET STRING_LIST 1 item)
string (STRIP "${item}" CMAKE_INSTALL_PREFIX)
endif ()
endforeach(item ${CONFIGFILE})
# Parse DAMASK version from VERSION file # Parse DAMASK version from VERSION file
find_program (CAT_EXECUTABLE NAMES cat) find_program (CAT_EXECUTABLE NAMES cat)
execute_process (COMMAND ${CAT_EXECUTABLE} ${PROJECT_SOURCE_DIR}/VERSION execute_process (COMMAND ${CAT_EXECUTABLE} ${PROJECT_SOURCE_DIR}/VERSION
@ -490,10 +474,10 @@ if (CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY")
exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole) exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole)
install (PROGRAMS ${nothing} DESTINATION ${black_hole}) install (PROGRAMS ${nothing} DESTINATION ${black_hole})
else () else ()
if (PROJECT_NAME STREQUAL "DAMASK_grid") if (PROJECT_NAME STREQUAL "damask-grid")
install (PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_spectral install (PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_spectral
DESTINATION ${CMAKE_INSTALL_PREFIX}) DESTINATION ${CMAKE_INSTALL_PREFIX})
elseif (PROJECT_NAME STREQUAL "DAMASK_FEM") elseif (PROJECT_NAME STREQUAL "damask-mesh")
install (PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_FEM install (PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_FEM
DESTINATION ${CMAKE_INSTALL_PREFIX}) DESTINATION ${CMAKE_INSTALL_PREFIX})
endif () endif ()

View File

@ -2,6 +2,7 @@ SHELL = /bin/sh
######################################################################################## ########################################################################################
# Makefile for the installation of DAMASK # Makefile for the installation of DAMASK
######################################################################################## ########################################################################################
DAMASK_ROOT = $(shell python -c "import os,sys; print(os.path.normpath(os.path.realpath(os.path.expanduser('$(pwd)'))))")
.PHONY: all .PHONY: all
all: grid FEM processing all: grid FEM processing
@ -20,12 +21,12 @@ FEM: build/FEM
.PHONY: build/grid .PHONY: build/grid
build/grid: build/grid:
@mkdir -p build/grid @mkdir -p build/grid
@(cd build/grid; cmake -Wno-dev -DDAMASK_SOLVER=GRID -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;) @(cd build/grid; cmake -Wno-dev -DDAMASK_SOLVER=GRID -DCMAKE_INSTALL_PREFIX=${DAMASK_ROOT}/bin -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;)
.PHONY: build/FEM .PHONY: build/FEM
build/FEM: build/FEM:
@mkdir -p build/FEM @mkdir -p build/FEM
@(cd build/FEM; cmake -Wno-dev -DDAMASK_SOLVER=FEM -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;) @(cd build/FEM; cmake -Wno-dev -DDAMASK_SOLVER=FEM -DCMAKE_INSTALL_PREFIX=${DAMASK_ROOT}/bin -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;)
.PHONY: clean .PHONY: clean
clean: clean:

@ -1 +1 @@
Subproject commit f342bc7dabddf5a9c7786d14115145ef4b0f330b Subproject commit f6171a748e51b994db27c2cc74cc0168b7aea93f

View File

@ -14,7 +14,7 @@ list(FILTER sources EXCLUDE REGEX ".*mesh_abaqus.*\\.f90")
list(FILTER sources EXCLUDE REGEX ".*commercialFEM_fileList.*\\.f90") list(FILTER sources EXCLUDE REGEX ".*commercialFEM_fileList.*\\.f90")
if (PROJECT_NAME STREQUAL "DAMASK_grid") if (PROJECT_NAME STREQUAL "damask-grid")
# probably we should have subfolders for FEM and spectral # probably we should have subfolders for FEM and spectral
list(FILTER sources EXCLUDE REGEX ".*DAMASK_FEM.*\\.f90") list(FILTER sources EXCLUDE REGEX ".*DAMASK_FEM.*\\.f90")
@ -29,7 +29,7 @@ if (PROJECT_NAME STREQUAL "DAMASK_grid")
add_library(DAMASK_spectral OBJECT ${sources}) add_library(DAMASK_spectral OBJECT ${sources})
endif() endif()
elseif (PROJECT_NAME STREQUAL "DAMASK_FEM") elseif (PROJECT_NAME STREQUAL "damask-mesh")
# probably we should have subfolders for FEM and spectral # probably we should have subfolders for FEM and spectral
list(FILTER sources EXCLUDE REGEX ".*DAMASK_grid.*\\.f90") list(FILTER sources EXCLUDE REGEX ".*DAMASK_grid.*\\.f90")