Commit 50e3b1e6 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

cmake: build packages with version information from Git tags

parent 3336af16
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR ${PROJECT_AUTHOR})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Dynamic Phasor simulation library in C++")
set(CPACK_PACKAGE_VERSION_MAJOR ${DPsim_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${DPsim_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${DPsim_PATH_VERSION})
set(CPACK_PACKAGE_VERSION ${DPSIM_SHORT_VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${DPSIM_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${DPSIM_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${DPSIM_PATH_VERSION})
set(CPACK_RPM_PACKAGE_RELEASE ${DPSIM_RELEASE})
set(CPACK_RPM_PACKAGE_RELEASE "1")
set(CPACK_RPM_PACKAGE_RELEASE ${DPSIM_RELEASE})
set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
set(CPACK_RPM_PACKAGE_LICENSE "GPLv3")
set(CPACK_RPM_PACKAGE_URL "http://www.fein-aachen.org/projects/dpsim/")
set(CPACK_RPM_PACKAGE_REQUIRES "libcimpp")
set(CPACK_RPM_PACKAGE_REQUIRES "libcimpp libvillas python3-libs")
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
# As close as possible to Fedoras naming
set(CPACK_RPM_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}.${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}.${CPACK_RPM_PACKAGE_ARCHITECTURE}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.md")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
......
......@@ -7,22 +7,33 @@ set(CMAKE_CXX_STANDARD 11)
set(PROJECT_AUTHOR "Institute for Automation of Complex Power Systems, RWTH Aachen Univerity")
set(PROJECT_COPYRIGHT "2017, Institute for Automation of Complex Power Systems, RWTH Aachen Univerity")
set(DPSIM_MAJOR_VERSION 0)
set(DPSIM_MINOR_VERSION 1)
set(DPSIM_PATCH_VERSION 0)
set(DPSIM_VERSION ${DPSIM_MAJOR_VERSION}.${DPSIM_MINOR_VERSION}.${DPSIM_PATCH_VERSION})
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
include(GetGitRevisionDescription)
git_describe(DPSIM_VERSION --tags --dirty=-dirty)
git_rev_parse(GIT_BRANCH --abbrev-ref HEAD)
get_git_head_revision(GIT_REFSPEC GIT_HASH)
string(SUBSTRING ${GIT_HASH} 0 7 GIT_HASH_SHORT)
string(TIMESTAMP YMD "%Y%m%d")
set(DPSIM_RELEASE ${YMD}git${GIT_HASH_SHORT})
# {arse the version information into pieces.
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" DPSIM_MAJOR_VERSION "${DPSIM_VERSION}")
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" DPSIM_MINOR_VERSION "${DPSIM_VERSION}")
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" DPSIM_PATCH_VERSION "${DPSIM_VERSION}")
set(DPSIM_SHORT_VERSION "${DPSIM_MAJOR_VERSION}.${DPSIM_MINOR_VERSION}.${DPSIM_PATCH_VERSION}")
set(Python_ADDITIONAL_VERSIONS 3.5 3.6 3.7)
find_package(PythonInterp 3.5)
find_package(PythonLibs 3.5)
set(CIM_DIR 16v29a)
find_package(CIMpp)
find_package(Eigen3 3.0 REQUIRED)
find_package(CIMpp)
find_package(VILLASnode)
find_package(PythonInterp 3.5)
find_package(PythonLibs 3.5)
if(PythonInterp_FOUND AND PythonLibs_FOUND)
set(Python_FOUND ON)
......
......@@ -19,6 +19,7 @@ RUN dnf -y install \
git \
gcc-c++ \
redhat-rpm-config \
rpmdevtools \
make cmake \
doxygen \
graphviz \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment