1 #===============================================================================
2 # Copyright 2019 Intel Corporation
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #===============================================================================
17 # Control generating version file
18 #===============================================================================
20 if(version_cmake_included)
23 set(version_cmake_included true)
25 string(REPLACE "." ";" VERSION_LIST ${PROJECT_VERSION})
26 list(GET VERSION_LIST 0 MKLDNN_VERSION_MAJOR)
27 list(GET VERSION_LIST 1 MKLDNN_VERSION_MINOR)
28 list(GET VERSION_LIST 2 MKLDNN_VERSION_PATCH)
32 execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%H
33 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
34 RESULT_VARIABLE RESULT
35 OUTPUT_VARIABLE MKLDNN_VERSION_HASH
36 OUTPUT_STRIP_TRAILING_WHITESPACE)
39 if(NOT GIT_FOUND OR RESULT)
40 set(MKLDNN_VERSION_HASH "N/A")
44 "${PROJECT_SOURCE_DIR}/include/mkldnn_version.h.in"
45 "${PROJECT_BINARY_DIR}/include/mkldnn_version.h"