Skip to content
Snippets Groups Projects
Commit 2e27c004 authored by Dave Moxey's avatar Dave Moxey
Browse files

Move git revision from CMake definition to cpp.in file to avoid rebuilding on commit/update

parent 25c40588
No related branches found
No related tags found
No related merge requests found
///////////////////////////////////////////////////////////////////////////////
//
// File NektarUnivConsts.hpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Scientific Computing and Imaging Institute,
// University of Utah (USA) and Department of Aeronautics, Imperial
// College London (UK).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Universal constants in the Nektar Library
//
///////////////////////////////////////////////////////////////////////////////
#ifndef GITREVISION_H
#define GITREVISION_H
#include <LibUtilities/BasicConst/GitRevision.h>
#include <string>
const std::string kGitSha1 = "@GIT_SHA1@";
const std::string kGitBranch = "@GIT_REFSPEC@";
#endif
///////////////////////////////////////////////////////////////////////////////
//
// File NektarUnivConsts.hpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Scientific Computing and Imaging Institute,
// University of Utah (USA) and Department of Aeronautics, Imperial
// College London (UK).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Universal constants in the Nektar Library
//
///////////////////////////////////////////////////////////////////////////////
#ifndef GITREVISION_H
#define GITREVISION_H
#include <string>
extern const std::string kGitSha1;
extern const std::string kGitBranch;
#endif
SET(BasicConstHeaders
./BasicConst/NektarUnivConsts.hpp
./BasicConst/NektarUnivTypeDefs.hpp
./BasicConst/NektarUnivConsts.hpp
./BasicConst/NektarUnivTypeDefs.hpp
./BasicConst/GitRevision.h
)
SET(BasicUtilsHeaders
......@@ -42,7 +43,6 @@ SET(BasicUtilsSources
./BasicUtils/XmlUtil.cpp
)
SET(CommunicationHeaders
./Communication/Comm.h
./Communication/CommSerial.h
......@@ -264,7 +264,7 @@ SET(ExpressionTemplates
)
SET(BaseHeaders
LibUtilitiesDeclspec.h
LibUtilitiesDeclspec.h
)
SOURCE_GROUP("Basic Const" FILES ${BasicConstHeaders})
......@@ -278,7 +278,6 @@ SOURCE_GROUP("Linear Algebra Sources" FILES ${LinearAlgebraSources})
SOURCE_GROUP("Memory Headers" FILES ${MemoryHeaders})
SOURCE_GROUP("Memory Sources" FILES ${MemorySources})
SOURCE_GROUP("Polylib Headers" FILES ${PolyLibHeaders})
SOURCE_GROUP("Polylib Sources" FILES ${PolylibSources})
......@@ -315,26 +314,28 @@ SET(LibUtilityHeaders
${BaseHeaders}
)
SET(GitRevisionFile "${CMAKE_CURRENT_BINARY_DIR}/GitRevision.cpp")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/BasicConst/GitRevision.cpp.in
${GitRevisionFile})
SET(LibUtilitySources
${BasicUtilsSources}
${FoundationSources}
${PolylibSources}
${CommunicationSources}
${LinearAlgebraSources}
${InterpreterSources}
${KernelSources}
${LinearAlgebraSources}
${InterpreterSources}
${KernelSources}
${TimeIntegrationSources}
${FFTSources}
${FFTSources}
${MemorySources}
${GitRevisionFile}
)
# Define the git branch and SHA1 hash if we are in a git repository
# Only apply to FieldIO.cpp to minimise rebuilding on git commit/update.
IF (NOT ${GIT_REFSPEC} STREQUAL "GITDIR-NOTFOUND")
SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/BasicUtils/FieldIO.cpp
APPEND PROPERTY COMPILE_DEFINITIONS
GIT_SHA1=\"${GIT_SHA1}\" GIT_BRANCH=\"${GIT_REFSPEC}\")
ENDIF ()
#IF (NOT ${GIT_REFSPEC} STREQUAL "GITDIR-NOTFOUND")
#ENDIF ()
ADD_DEFINITIONS(-DLIB_UTILITIES_EXPORTS)
ADD_NEKTAR_LIBRARY(LibUtilities lib ${NEKTAR_LIBRARY_TYPE} ${LibUtilitySources} ${LibUtilityHeaders})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment