Skip to content
0
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
  • Recent
  • Tags
  • Popular
  • SAMSON Connect
  • Get SAMSON
Collapse
SAMSON Forum
  1. Home
  2. Develop
  3. Apps
  4. SB_ELEMENT_VERSION_HASH Warnings

SB_ELEMENT_VERSION_HASH Warnings

Scheduled Pinned Locked Moved Apps
3 Posts 2 Posters 3.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E
    E
    Elisa
    wrote on last edited by
    #1

    Dear all,

    When compiling my element for Samson 0.8.5 I get several warnings like:

    WARNING: IT IS A GOOD PRACTICE TO DEFINE SB_ELEMENT_VERSION_HASH
    

    I looked through the documentation, but I haven't found any example. Could you please provide one? And also what's the role of SB_ELEMENT_VERSION_HASH?

    Best regards,

    Elisa

    1 Reply Last reply
    0
    • J
      J
      jocelyn 2
      wrote on last edited by jocelyn 2
      #2

      Dear Elisa,

      We added that to be abble to follow element version used by SAMSON.

      To solve that, you can either generate a new element and get the code from the root CMakeList
      or add that into your root CMakeList

      # VERSION_HASH information : New since SAMSON 0.8.0
      #
      # The maximum size of this variable is 63 Bytes ie char[63].
      # We can embed into elements file one string to identify it. Usualy we put the git commit hash or the svn revision number inside.
      # The information is relevant only if the working copy is up to date and if everything is commited
      # If you upload your element on samson-connect, you will see this information next to your element inside My SAMSON->My Factory->Edit Element.
      
      # you can choose either git either svn either nothing
      SET ( USE_GIT 1 )
      SET ( USE_SVN 0 )
      
      IF( ${USE_GIT} )
      	# if USE_GIT=1 the next command will get the current commit hash and will store 
      	# it inside VERSION_HASH variable.
      	MESSAGE( "Getting current git commit hash and storing it inside VERSION_HASH variable." )
      	EXECUTE_PROCESS(
      	  COMMAND git log -1 --format=%H
      	  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/SAMSON-Element
      	  OUTPUT_VARIABLE VERSION_HASH
      	  OUTPUT_STRIP_TRAILING_WHITESPACE
      	 )
      ELSE (${USE_GIT})
      	IF (${USE_SVN})
      		# if USE_SVN=1 and USE_GIT=0 the next command will get the current commit revision
      		# of your working copy and will store it inside VERSION_HASH variable.
      		MESSAGE( "Getting current svn revision and storing it inside VERSION_HASH variable." )
      		find_package(Subversion)
      		IF(SUBVERSION_FOUND)
      		  Subversion_WC_INFO(${CMAKE_SOURCE_DIR} REPO)
      		  SET ( VERSION_HASH ${REPO_WC_REVISION} )
      		ENDIF()
      	ELSE (${USE_SVN})
      		# if USE_SVN=0 and USE_GIT=0 we set the variable VERSION_HASH equal to 
      		# "undefined hash" or what you desire.
      		SET(VERSION_HASH "undefined")
      	ENDIF(${USE_SVN})
      ENDIF(${USE_GIT})
      
      # we create ElementVersionHash.cmake file in CMAKE_SOURCE_DIR folder containing the corresponding VERSION_HASH
      # This file just creates add definition of SB_ELEMENT_VERSION_HASH accessible throught the code.
      FILE ( WRITE ElementVersionHash.cmake "ADD_DEFINITIONS\(-DSB_ELEMENT_VERSION_HASH=\"${VERSION_HASH}\"\)\n" )
      
      MESSAGE( "CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}")
      MESSAGE( "CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}")
      
      
      INCLUDE ( ElementVersionHash )
      
      # End off VERSION_HASH information
      
      
      INCLUDE ( SDKConfiguration )
      

      Hope it will help.

      Jocelyn

      1 Reply Last reply
      2
      • E
        E
        Elisa
        wrote on last edited by
        #3

        It does! Thanks a lot.

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Login or register to search.
        • First post
          Last post