Skip to content

Commit

Permalink
Add additional version information, including in jar manifest
Browse files Browse the repository at this point in the history
Signed-off-by: Petre Eftime <[email protected]>
  • Loading branch information
Petre Eftime committed May 4, 2016
1 parent 249b457 commit f329830
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${VE
string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+).*" "\\1" VERSION_COMMIT "${VERSION}")
string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+\\-(.*)" "\\1" VERSION_SHA1 "${VERSION}")
set (VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
set (VERSION_API "${VERSION_MAJOR}.${VERSION_MINOR}")

if ("${VERSION_COMMIT}" MATCHES "^v.*")
set (VERSION_COMMIT "")
Expand Down Expand Up @@ -76,6 +77,7 @@ include_directories (${SYSTEM_USR_DIR})
option (BUILDJAVA "Build Java API." OFF)

IF(BUILDJAVA)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/java/manifest.txt.in ${CMAKE_CURRENT_BINARY_DIR}/java/manifest.txt)
add_subdirectory (java)
add_subdirectory (examples/java)
ENDIF(BUILDJAVA)
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/version.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

const char* gVERSION = "@VERSION@";
const char* gVERSION_SHORT = "@VERSION_SHORT@";
const char* gVERSION_API = "@VERSION_API@";
1 change: 1 addition & 0 deletions include/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

extern const char* gVERSION;
extern const char* gVERSION_SHORT;
extern const char* gVERSION_API;
6 changes: 4 additions & 2 deletions java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ if(NOT Java_JAVAH_EXECUTABLE)
message(FATAL_ERROR "Cannot locate javah executable.")
endif(NOT Java_JAVAH_EXECUTABLE)

set(CMAKE_JNI_TARGET TRUE)
file(GLOB JAVA_SOURCES "*.java")
add_jar(tinybjar ${JAVA_SOURCES}
MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/manifest.txt
VERSION ${VERSION}
OUTPUT_NAME tinyb
)

Expand All @@ -41,7 +44,6 @@ add_custom_command (TARGET tinybjar
)

set(JNI_HEADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/tinybjar.dir/jni")

install (FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyb.jar DESTINATION ${CMAKE_INSTALL_LIBDIR}/java)
install_jar (tinybjar DESTINATION ${CMAKE_INSTALL_LIBDIR}/java)

add_subdirectory (jni)
9 changes: 9 additions & 0 deletions java/manifest.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Manifest-version: 1.0

Name: tinyb/
Specification-Title: "TinyB"
Specification-Version: "@VERSION_API@"
Specification-Vendor: "Intel Corp."
Package-Title: "tinyb"
Package-Version: "@VERSION_SHORT@"
Package-Vendor: "Intel Corp."

0 comments on commit f329830

Please sign in to comment.