Added branch management functions into cmake
This commit is contained in:
parent
e1372edcf3
commit
e3235e8fda
|
@ -1,12 +1,16 @@
|
|||
cmake_minimum_required(VERSION 2.8.12)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/sc-components/cmake)
|
||||
|
||||
include(cmake/GitFunctions.cmake)
|
||||
get_branch_from_git()
|
||||
|
||||
### set the directory names of the submodules
|
||||
set(GIT_SUBMODULES sc-components)
|
||||
set(GIT_SUBMODULE_DIR_sc-components .)
|
||||
### set each submodules's commit or tag that is to be checked out
|
||||
### (leave empty if you want master)
|
||||
#set(GIT_SUBMODULE_VERSION_sc-components 3af6b9836589b082c19d9131c5d0b7afa8ddd7cd)
|
||||
set(GIT_SUBMODULE_BRANCH_sc-components "develop")
|
||||
set(GIT_SUBMODULE_BRANCH_sc-components ${GIT_BRANCH})
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(cmake/Submodules.cmake)
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
SET(_SYSTEMC_HINTS
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\SystemC\\2.2;SystemcHome]/include"
|
||||
${SYSTEMC_PREFIX}/include
|
||||
${SYSTEMC_PREFIX}/lib
|
||||
${SYSTEMC_PREFIX}/lib-linux
|
||||
${SYSTEMC_PREFIX}/lib-linux64
|
||||
${SYSTEMC_PREFIX}/lib-macos
|
||||
$ENV{SYSTEMC_PREFIX}/include
|
||||
$ENV{SYSTEMC_PREFIX}/lib
|
||||
$ENV{SYSTEMC_PREFIX}/lib-linux
|
||||
$ENV{SYSTEMC_PREFIX}/lib-linux64
|
||||
$ENV{SYSTEMC_PREFIX}/lib-macos
|
||||
$ENV{SYSTEMC_HOME}/include
|
||||
$ENV{SYSTEMC_HOME}/lib
|
||||
$ENV{SYSTEMC_HOME}/lib-linux
|
||||
$ENV{SYSTEMC_HOME}/lib-linux64
|
||||
$ENV{SYSTEMC_HOME}/lib-macos
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib-linux
|
||||
${CMAKE_INSTALL_PREFIX}/lib-linux64
|
||||
${CMAKE_INSTALL_PREFIX}/lib-macos
|
||||
)
|
||||
SET(_SYSTEMC_PATHS
|
||||
/usr/include/systemc
|
||||
/usr/lib
|
||||
/usr/lib-linux
|
||||
/usr/lib-linux64
|
||||
/usr/lib-macos
|
||||
/usr/local/include/sysc
|
||||
/usr/local/lib
|
||||
/usr/local/lib-linux
|
||||
/usr/local/lib-linux64
|
||||
/usr/local/lib-macos
|
||||
)
|
||||
FIND_FILE(_SYSTEMC_HEADER_FILE
|
||||
NAMES systemc
|
||||
HINTS ${_SYSTEMC_HINTS}
|
||||
PATHS ${_SYSTEMC_PATHS}
|
||||
PATH_SUFFIXES sysc/kernel
|
||||
)
|
||||
|
||||
FIND_FILE(_SCV_HEADER_FILE
|
||||
NAMES scv.h
|
||||
HINTS ${_SYSTEMC_HINTS}
|
||||
PATHS ${_SYSTEMC_PATHS}
|
||||
PATH_SUFFIXES sysc/kernel
|
||||
)
|
||||
|
||||
if(NOT _SYSTEMC_HEADER_FILE STREQUAL _SYSTEMC_HEADER_FILE-NOTFOUND)
|
||||
set(SystemC_FOUND TRUE)
|
||||
endif(NOT _SYSTEMC_HEADER_FILE STREQUAL _SYSTEMC_HEADER_FILE-NOTFOUND)
|
||||
|
||||
if(NOT _SCV_HEADER_FILE STREQUAL _SCV_HEADER_FILE-NOTFOUND)
|
||||
set(SCV_FOUND TRUE)
|
||||
endif(NOT _SCV_HEADER_FILE STREQUAL _SCV_HEADER_FILE-NOTFOUND)
|
||||
|
||||
FIND_PATH(SystemC_INCLUDE_DIRS
|
||||
NAMES systemc.h
|
||||
HINTS ${_SYSTEMC_HINTS}
|
||||
PATHS ${_SYSTEMC_PATHS}
|
||||
)
|
||||
|
||||
FIND_PATH(SystemC_LIBRARY_DIRS
|
||||
NAMES libsystemc.a
|
||||
HINTS ${_SYSTEMC_HINTS}
|
||||
PATHS ${_SYSTEMC_PATHS}
|
||||
)
|
||||
|
||||
FIND_PATH(SCV_INCLUDE_DIRS
|
||||
NAMES scv.h
|
||||
HINTS ${_SYSTEMC_HINTS}
|
||||
PATHS ${_SYSTEMC_PATHS}
|
||||
)
|
||||
|
||||
FIND_PATH(SCV_LIBRARY_DIRS
|
||||
NAMES libscv.a
|
||||
HINTS ${_SYSTEMC_HINTS}
|
||||
PATHS ${_SYSTEMC_PATHS}
|
||||
)
|
||||
|
||||
if(SystemC_FOUND)
|
||||
set(SystemC_LIBRARIES systemc)
|
||||
message(STATUS "SystemC header files are taken from ${SystemC_INCLUDE_DIRS}")
|
||||
message(STATUS "SystemC library is taken from ${SystemC_LIBRARY_DIRS}")
|
||||
if(SCV_FOUND)
|
||||
set(SCV_LIBRARIES scv)
|
||||
message(STATUS "SCV header files are taken from ${SCV_INCLUDE_DIRS}")
|
||||
message(STATUS "SCV library is taken from ${SCV_LIBRARY_DIRS}")
|
||||
endif(SCV_FOUND)
|
||||
endif(SystemC_FOUND)
|
|
@ -0,0 +1,22 @@
|
|||
if(__git_functions)
|
||||
return()
|
||||
endif()
|
||||
set(__git_functions YES)
|
||||
|
||||
function( get_branch_from_git )
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE git_branch
|
||||
ERROR_VARIABLE git_error
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if( NOT git_result EQUAL 0 )
|
||||
message( FATAL_ERROR "Failed to execute Git: ${git_error}" )
|
||||
endif()
|
||||
|
||||
set( GIT_BRANCH ${git_branch} PARENT_SCOPE )
|
||||
endfunction( get_branch_from_git )
|
||||
|
Loading…
Reference in New Issue