Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
7c001d47
Commit
7c001d47
authored
May 26, 2011
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX #494] - cleaned up and unified automatic version definition.
parent
359200e0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
24 deletions
+54
-24
.hgignore
.hgignore
+1
-0
VERSION
VERSION
+1
-0
src/CMakeLists.txt
src/CMakeLists.txt
+7
-0
src/qt4gui/CMakeLists.txt
src/qt4gui/CMakeLists.txt
+1
-22
src/qt4gui/OpenWalnut.cpp
src/qt4gui/OpenWalnut.cpp
+0
-2
tools/cmake/BuildUtils.cmake
tools/cmake/BuildUtils.cmake
+44
-0
No files found.
.hgignore
View file @
7c001d47
...
@@ -23,6 +23,7 @@ syntax: regexp
...
@@ -23,6 +23,7 @@ syntax: regexp
# files generated by "make tags"
# files generated by "make tags"
^src/tags
^src/tags
^src/cscope.out
^src/cscope.out
^src/ncscope.out
# files geneterated by build system
# files geneterated by build system
^src/qt4gui/version.h
^src/qt4gui/version.h
...
...
VERSION
0 → 100644
View file @
7c001d47
CHECKOUT
src/CMakeLists.txt
View file @
7c001d47
...
@@ -159,6 +159,13 @@ IF( NOT CMAKE_HOST_SYSTEM MATCHES "Windows" )
...
@@ -159,6 +159,13 @@ IF( NOT CMAKE_HOST_SYSTEM MATCHES "Windows" )
OPTION
(
OW_LINK_SHADERS
"If turned on, shaders do not get copied. They get linked. This is a nice option for developers."
OFF
)
OPTION
(
OW_LINK_SHADERS
"If turned on, shaders do not get copied. They get linked. This is a nice option for developers."
OFF
)
ENDIF
()
ENDIF
()
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# The walnut executable should print the revision/tag
# ---------------------------------------------------------------------------------------------------------------------------------------------------
GET_VERSION_STRING
(
OW_VERSION
"Unknown Tarball Version"
)
ADD_DEFINITIONS
(
-DW_VERSION=
"
${
OW_VERSION
}
"
)
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
#
# REQUIRED third party libs
# REQUIRED third party libs
...
...
src/qt4gui/CMakeLists.txt
View file @
7c001d47
...
@@ -45,27 +45,6 @@ SET( QT_LIBS ${QT_QTCORE_LIBRARY}
...
@@ -45,27 +45,6 @@ SET( QT_LIBS ${QT_QTCORE_LIBRARY}
${
QT_QTOPENGL_LIBRARY
}
${
QT_QTOPENGL_LIBRARY
}
${
QT_QTWEBKIT_LIBRARY
}
)
${
QT_QTWEBKIT_LIBRARY
}
)
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# The walnut executable should print the revision/tag
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# We use mercurial to get current version information. This is stored in version.h, included by OpenWalnut.cpp
IF
(
NOT CMAKE_GENERATOR MATCHES
"Visual Studio"
)
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_SOURCE_DIR
}
/version.h
MAIN_DEPENDENCY
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../.hg/dirstate
COMMAND hg parents --template '\
#define W_VERSION \"{node|short} {rev} {branches} {tags}\" //' > ${CMAKE_CURRENT_SOURCE_DIR}/version.h
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
COMMENT
"Creating version.h"
)
ELSE
()
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_SOURCE_DIR
}
/version.h
MAIN_DEPENDENCY
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../.hg/dirstate
COMMAND hg parents --template
"
\"
#define W_VERSION
\"\"
{node|short} {rev} {branches} {tags}
\"\"\"
"
>
${
CMAKE_CURRENT_SOURCE_DIR
}
/version.h
WORKING_DIRECTORY
${
PROJECT_SOURCE_DIR
}
COMMENT
"Creating version.h"
)
ENDIF
()
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Add sources as target
# Add sources as target
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------------------------------------------------------------------------
...
@@ -80,7 +59,7 @@ QT4_AUTOMOC( ${TARGET_CPP_FILES} )
...
@@ -80,7 +59,7 @@ QT4_AUTOMOC( ${TARGET_CPP_FILES} )
INCLUDE_DIRECTORIES
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
INCLUDE_DIRECTORIES
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
# Setup the target
# Setup the target
ADD_EXECUTABLE
(
${
BinName
}
${
TARGET_CPP_FILES
}
${
TARGET_H_FILES
}
"version.h"
)
ADD_EXECUTABLE
(
${
BinName
}
${
TARGET_CPP_FILES
}
${
TARGET_H_FILES
}
)
TARGET_LINK_LIBRARIES
(
${
BinName
}
${
OWCoreName
}
${
QT_LIBS
}
${
Boost_LIBRARIES
}
)
TARGET_LINK_LIBRARIES
(
${
BinName
}
${
OWCoreName
}
${
QT_LIBS
}
${
Boost_LIBRARIES
}
)
# Do not forget the install targets
# Do not forget the install targets
...
...
src/qt4gui/OpenWalnut.cpp
View file @
7c001d47
...
@@ -29,8 +29,6 @@
...
@@ -29,8 +29,6 @@
#include "qt4/WQt4Gui.h"
#include "qt4/WQt4Gui.h"
#include "version.h" // this header gets created by our build system.
/**
/**
* \mainpage OpenWalnut Inline Documentation
* \mainpage OpenWalnut Inline Documentation
* \par
* \par
...
...
tools/cmake/BuildUtils.cmake
View file @
7c001d47
...
@@ -249,3 +249,47 @@ FUNCTION( SETUP_RESOURCES )
...
@@ -249,3 +249,47 @@ FUNCTION( SETUP_RESOURCES )
)
)
ENDFUNCTION
(
SETUP_RESOURCES
)
ENDFUNCTION
(
SETUP_RESOURCES
)
# This function tries to find a proper version string. It therefore uses the file src/../VERSION and mercurial. If the file exists and is not
# empty, the contents of it get combined with the mercurial results if mercurial is installed. If not, only the file content will be used. If
# both methods fail, a default string is used.
# _version the returned version string
# _default a default string you specify if all version check methods fail
FUNCTION
(
GET_VERSION_STRING _version _default
)
# Undef the OW_VERSION variable
UNSET
(
OW_VERSION_HG
)
UNSET
(
OW_VERSION_FILE
)
# Grab version file.
SET
(
OW_VERSION_FILENAME
${
PROJECT_SOURCE_DIR
}
/../VERSION
)
IF
(
EXISTS
${
OW_VERSION_FILENAME
}
)
# Read the version file
FILE
(
READ
${
OW_VERSION_FILENAME
}
OW_VERSION_FILE
)
# this wil contain an line-break. Remove it.
STRING
(
REGEX REPLACE
"
\n
"
""
OW_VERSION_FILE
"
${
OW_VERSION_FILE
}
"
)
# this is ugly because, if the version file is empty, the OW_VERSION_FILE content is "". Unfortunately, this is not UNDEFINED as it would be
# by SET( VAR "" ) ... so set it manually
IF
(
OW_VERSION_FILE STREQUAL
""
)
UNSET
(
OW_VERSION_FILE
)
ENDIF
()
ENDIF
()
# Use hg to query version information.
# -> the nice thing is: if hg is not available, no compilation errors anymore
execute_process
(
COMMAND hg parents --template
"{rev}:{node|short} {branches} {tags}"
OUTPUT_VARIABLE OW_VERSION_HG RESULT_VARIABLE hgParentsRetVar
)
IF
(
NOT
${
hgParentsRetVar
}
STREQUAL 0
)
UNSET
(
OW_VERSION_HG
)
ENDIF
()
# Use the version strings and set them as #define
IF
(
DEFINED OW_VERSION_HG AND DEFINED OW_VERSION_FILE
)
SET
(
${
_version
}
"
${
OW_VERSION_FILE
}
-
${
OW_VERSION_HG
}
"
PARENT_SCOPE
)
ELSEIF
(
DEFINED OW_VERSION_FILE
)
SET
(
${
_version
}
"
${
OW_VERSION_FILE
}
"
PARENT_SCOPE
)
ELSEIF
(
DEFINED OW_VERSION_HG
)
SET
(
${
_version
}
"
${
OW_VERSION_HG
}
"
PARENT_SCOPE
)
ELSE
()
SET
(
${
_version
}
${
_default
}
PARENT_SCOPE
)
ENDIF
()
ENDFUNCTION
(
GET_VERSION_STRING
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment