diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cfe47248..78d63117e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,11 +106,11 @@ set (CMAKE_C_COMPILER "${PETSC_MPICC}") # DAMASK solver defines project to build if (DAMASK_SOLVER STREQUAL "GRID") - project (DAMASK_grid Fortran C) + project (damask-grid Fortran C) add_definitions (-DGrid) message ("Building Grid Solver\n") elseif (DAMASK_SOLVER STREQUAL "FEM") - project (DAMASK_FEM Fortran C) + project (damask-mesh Fortran C) add_definitions (-DFEM) message ("Building FEM Solver\n") else () @@ -156,22 +156,6 @@ if (CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY") set (BUILDCMD_POST "${BUILDCMD_POST} -fsyntax-only") 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 find_program (CAT_EXECUTABLE NAMES cat) execute_process (COMMAND ${CAT_EXECUTABLE} ${PROJECT_SOURCE_DIR}/VERSION @@ -483,18 +467,3 @@ message ("Fortran Linker Command:\n${CMAKE_Fortran_LINK_EXECUTABLE}\n") # location of code add_subdirectory (src) - -# INSTALL BUILT BINARIES -if (CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY") - exec_program (mktemp OUTPUT_VARIABLE nothing) - exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole) - install (PROGRAMS ${nothing} DESTINATION ${black_hole}) -else () - if (PROJECT_NAME STREQUAL "DAMASK_grid") - install (PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_spectral - DESTINATION ${CMAKE_INSTALL_PREFIX}) - elseif (PROJECT_NAME STREQUAL "DAMASK_FEM") - install (PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_FEM - DESTINATION ${CMAKE_INSTALL_PREFIX}) - endif () -endif () diff --git a/CONFIG b/CONFIG index 31a9c34c8..6d5226c89 100644 --- a/CONFIG +++ b/CONFIG @@ -1,8 +1,6 @@ # "set"-syntax needed only for tcsh (but works with bash and zsh) # DAMASK_ROOT will be expanded -set DAMASK_BIN = ${DAMASK_ROOT}/bin - set DAMASK_NUM_THREADS = 4 set MSC_ROOT = /opt/msc diff --git a/Makefile b/Makefile index 53ae30c1c..161d4c3ce 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ SHELL = /bin/sh ######################################################################################## # 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 all: grid FEM processing @@ -20,12 +21,12 @@ FEM: build/FEM .PHONY: build/grid 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} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;) .PHONY: build/FEM 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} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILDCMD_POST=${BUILDCMD_POST} -DBUILDCMD_PRE=${BUILDCMD_PRE} -DOPTIMIZATION=${OPTIMIZATION} -DOPENMP=${OPENMP} ../../;) .PHONY: clean clean: diff --git a/PRIVATE b/PRIVATE index f342bc7da..f6171a748 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit f342bc7dabddf5a9c7786d14115145ef4b0f330b +Subproject commit f6171a748e51b994db27c2cc74cc0168b7aea93f diff --git a/env/DAMASK.csh b/env/DAMASK.csh index 1819dd305..d223d885a 100644 --- a/env/DAMASK.csh +++ b/env/DAMASK.csh @@ -13,9 +13,7 @@ set BRANCH = `git branch 2>/dev/null| grep -E '^\* ')` cd - >/dev/null # if DAMASK_BIN is present -if ( $?DAMASK_BIN) then - set path = ($DAMASK_BIN $path) -endif +set path = ($DAMASK_ROOT/bin $path) set SOLVER=`which DAMASK_spectral` set PROCESSING=`which postResults` diff --git a/env/DAMASK.sh b/env/DAMASK.sh index fa2c8db25..1b4bea86a 100644 --- a/env/DAMASK.sh +++ b/env/DAMASK.sh @@ -33,8 +33,7 @@ unset -f set # add BRANCH if DAMASK_ROOT is a git repository cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null -# add DAMASK_BIN if present -[ "x$DAMASK_BIN" != "x" ] && PATH=$DAMASK_BIN:$PATH +PATH=${DAMASK_ROOT}/bin:$PATH SOLVER=$(type -p DAMASK_spectral || true 2>/dev/null) [ "x$SOLVER" == "x" ] && SOLVER=$(blink 'Not found!') diff --git a/env/DAMASK.zsh b/env/DAMASK.zsh index 61b9c89f9..5449007f9 100644 --- a/env/DAMASK.zsh +++ b/env/DAMASK.zsh @@ -25,7 +25,7 @@ unset -f set cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null # add DAMASK_BIN if present -[[ "x$DAMASK_BIN" != "x" ]] && PATH=$DAMASK_BIN:$PATH +PATH=${DAMASK_ROOT}/bin:$PATH SOLVER=$(which DAMASK_spectral || true 2>/dev/null) [[ "x$SOLVER" == "x" ]] && SOLVER=$(blink 'Not found!') diff --git a/installation/symlink_Processing.py b/installation/symlink_Processing.py index 60f8d3639..90497c0eb 100755 --- a/installation/symlink_Processing.py +++ b/installation/symlink_Processing.py @@ -7,7 +7,7 @@ import damask damaskEnv = damask.Environment() baseDir = damaskEnv.relPath('processing/') -binDir = damaskEnv.options['DAMASK_BIN'] +binDir = damaskEnv.relPath('bin/') if not os.path.isdir(binDir): os.mkdir(binDir) diff --git a/python/.gitignore b/python/.gitignore new file mode 100644 index 000000000..1521c8b76 --- /dev/null +++ b/python/.gitignore @@ -0,0 +1 @@ +dist diff --git a/python/damask/LICENSE b/python/damask/LICENSE new file mode 120000 index 000000000..30cff7403 --- /dev/null +++ b/python/damask/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/python/damask/VERSION b/python/damask/VERSION new file mode 120000 index 000000000..558194c5a --- /dev/null +++ b/python/damask/VERSION @@ -0,0 +1 @@ +../../VERSION \ No newline at end of file diff --git a/python/damask/__init__.py b/python/damask/__init__.py index d7ed4a9f9..a57d450d8 100644 --- a/python/damask/__init__.py +++ b/python/damask/__init__.py @@ -3,8 +3,8 @@ """Main aggregator""" import os -with open(os.path.join(os.path.dirname(__file__),'../../VERSION')) as f: - version = f.readline()[:-1] +with open(os.path.join(os.path.dirname(__file__),'VERSION')) as f: + version = f.readline()[1:-1] name = 'damask' diff --git a/python/damask/environment.py b/python/damask/environment.py index 0b77c94d2..21eb24694 100644 --- a/python/damask/environment.py +++ b/python/damask/environment.py @@ -1,6 +1,6 @@ # -*- coding: UTF-8 no BOM -*- -import os,subprocess,shlex,re +import os,re class Environment(): __slots__ = [ \ diff --git a/python/setup.py b/python/setup.py new file mode 100644 index 000000000..823365d34 --- /dev/null +++ b/python/setup.py @@ -0,0 +1,18 @@ +import setuptools + +setuptools.setup( + name="damask", + version="0.0.1", + author="The DAMASK team", + author_email="damask@mpie.de", + description="Python library for DAMASK", + long_description='test', + long_description_content_type="text/markdown", + url="https://github.com/pypa/sampleproject", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: GLPv3", + "Operating System :: OS Independent", + ], +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 274069226..736db112a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,7 +14,7 @@ list(FILTER sources EXCLUDE REGEX ".*mesh_abaqus.*\\.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 list(FILTER sources EXCLUDE REGEX ".*DAMASK_FEM.*\\.f90") @@ -25,11 +25,15 @@ if (PROJECT_NAME STREQUAL "DAMASK_grid") if(NOT CMAKE_BUILD_TYPE STREQUAL "SYNTAXONLY") add_executable(DAMASK_spectral ${sources}) + install (TARGETS DAMASK_spectral RUNTIME DESTINATION bin) else() add_library(DAMASK_spectral OBJECT ${sources}) + exec_program (mktemp OUTPUT_VARIABLE nothing) + exec_program (mktemp ARGS -d OUTPUT_VARIABLE black_hole) + install (PROGRAMS ${nothing} DESTINATION ${black_hole}) endif() -elseif (PROJECT_NAME STREQUAL "DAMASK_FEM") +elseif (PROJECT_NAME STREQUAL "damask-mesh") # probably we should have subfolders for FEM and spectral list(FILTER sources EXCLUDE REGEX ".*DAMASK_grid.*\\.f90") @@ -42,5 +46,6 @@ elseif (PROJECT_NAME STREQUAL "DAMASK_FEM") list(FILTER sources EXCLUDE REGEX ".*mesh_grid.*\\.f90") add_executable(DAMASK_FEM ${sources}) + install (TARGETS DAMASK_FEM RUNTIME DESTINATION bin) endif()