]> OCCT Git - occt.git/commitdiff
Configuration - Version information update #308
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Fri, 31 Jan 2025 13:17:38 +0000 (14:17 +0100)
committerGitHub <noreply@github.com>
Fri, 31 Jan 2025 13:17:38 +0000 (13:17 +0000)
Refactor version handling to use version.cmake and update related scripts.
Created new symbols to extract information by C function

18 files changed:
CMakeLists.txt
README.md
adm/cmake/occt_macros.cmake
adm/cmake/version.cmake [new file with mode: 0644]
adm/occaux.tcl
adm/scripts/android_build.bat
adm/scripts/build_common.bat [new file with mode: 0644]
adm/scripts/build_common.sh [new file with mode: 0644]
adm/scripts/ios_build.sh
adm/scripts/macos_build.sh
adm/scripts/mingw_build.bat
adm/scripts/wasm_build.bat
adm/templates/Standard_Version.hxx.in [new file with mode: 0644]
adm/templates/occt_toolkit.rc.in
src/Standard/FILES
src/Standard/Standard_Version.hxx [deleted file]
src/Standard/Standard_VersionInfo.cxx [new file with mode: 0644]
src/Standard/Standard_VersionInfo.hxx [new file with mode: 0644]

index 766356f3f9f79865abf983372ee0a2a10f5ac4b6..67449a37c117ba36416602372222a0e5dc735ce6 100644 (file)
@@ -975,6 +975,9 @@ message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header fi
 # collect all the headers to <binary dir>/inc folder
 COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}" "src" "${INSTALL_DIR_INCLUDE}")
 
+# Create and install Standard_Version.hxx
+CONFIGURE_AND_INSTALL_VERSION_HEADER()
+
 string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
 message (STATUS "Info: \(${CURRENT_TIME}\) End the collecting")
 
index 483d28ae832a39fc0ac299ff3a3a50b104595b05..13ee509951f99bf331305e352c196c2017f3bd9e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@ Consult the file [dox/build/build_occt/building_occt.md](dox/build/build_occt/bu
 
 ## Version
 
-The current version of OCCT can be found in the file [`src/Standard/Standard_Version.hxx`](src/Standard/Standard_Version.hxx).
+The current version of OCCT can be found in the file [`adm/cmake/version.cmake`](adm/cmake/version.cmake).
 
 ## Development
 
index efef453612a55d519bafba073c9ff1977b23653e..7ec52b89d2daf28620bdfc1c63b1a6443e11bc12 100644 (file)
@@ -458,6 +458,18 @@ function (COLLECT_AND_INSTALL_OCCT_HEADER_FILES THE_ROOT_TARGET_OCCT_DIR THE_OCC
   install (FILES ${OCCT_HEADER_FILES_INSTALLATION} DESTINATION "${INSTALL_DIR}/${THE_OCCT_INSTALL_DIR_PREFIX}")
 endfunction()
 
+# Macro to configure and install Standard_Version.hxx file
+macro (CONFIGURE_AND_INSTALL_VERSION_HEADER)
+  if (DEFINED BUILD_OCCT_VERSION_EXT AND "${BUILD_OCCT_VERSION_EXT}" STREQUAL "${OCC_VERSION_STRING_EXT}" AND EXISTS "${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE}/Standard_Version.hxx")
+    install(FILES "${OCCT_BINARY_DIR}/${INSTALL_DIR_INCLUDE}/Standard_Version.hxx" DESTINATION  "${INSTALL_DIR}/${INSTALL_DIR_INCLUDE}")
+  else()
+    set(BUILD_OCCT_VERSION_EXT "${OCC_VERSION_STRING_EXT}" CACHE STRING "OCCT Version string. Used only for caching, can't impact on build. For modification of version, please check adm/cmake/version.cmake" FORCE)
+    mark_as_advanced(BUILD_OCCT_VERSION_EXT)
+    string(TIMESTAMP OCCT_VERSION_DATE "%Y-%m-%d" UTC)
+    OCCT_CONFIGURE_AND_INSTALL ("adm/templates/Standard_Version.hxx.in" "${INSTALL_DIR_INCLUDE}/Standard_Version.hxx" "Standard_Version.hxx" "${INSTALL_DIR}/${INSTALL_DIR_INCLUDE}")
+  endif()
+endmacro()
+
 function(ADD_PRECOMPILED_HEADER INPUT_TARGET PRECOMPILED_HEADER THE_IS_PRIVATE)
   if (NOT BUILD_USE_PCH)
     return()
@@ -550,42 +562,69 @@ function (OCCT_MODULES_AND_TOOLKITS FILE_NAME TOOLKITS_NAME_SUFFIX MODULE_LIST)
   set (${MODULE_LIST} ${${MODULE_LIST}} PARENT_SCOPE)
 endfunction()
 
-# Returns OCC version string from file Standard_Version.hxx (if available)
-function (OCC_VERSION OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE OCC_VERSION_DEVELOPMENT OCC_VERSION_STRING_EXT)
 
-  set (OCC_VERSION_MAJOR         7)
-  set (OCC_VERSION_MINOR         0)
-  set (OCC_VERSION_MAINTENANCE   0)
-  set (OCC_VERSION_DEVELOPMENT   dev)
-  set (OCC_VERSION_COMPLETE      "7.0.0")
-  set (STANDARD_VERSION_FILE "${CMAKE_SOURCE_DIR}/src/Standard/Standard_Version.hxx")
-  if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/Standard/Standard_Version.hxx")
-    set (STANDARD_VERSION_FILE "${BUILD_PATCH}/src/Standard/Standard_Version.hxx")
-  endif()
-
-  if (EXISTS "${STANDARD_VERSION_FILE}")
-    foreach (SOUGHT_VERSION OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE)
-      file (STRINGS "${STANDARD_VERSION_FILE}" ${SOUGHT_VERSION} REGEX "^#define ${SOUGHT_VERSION} .*")
-      string (REGEX REPLACE ".*${SOUGHT_VERSION} .*([^ ]+).*" "\\1" ${SOUGHT_VERSION} "${${SOUGHT_VERSION}}" )
-    endforeach()
-    
-    foreach (SOUGHT_VERSION OCC_VERSION_DEVELOPMENT OCC_VERSION_COMPLETE)
-      file (STRINGS "${STANDARD_VERSION_FILE}" ${SOUGHT_VERSION} REGEX "^#define ${SOUGHT_VERSION} .*")
-      string (REGEX REPLACE ".*${SOUGHT_VERSION} .*\"([^ ]+)\".*" "\\1" ${SOUGHT_VERSION} "${${SOUGHT_VERSION}}" )
-    endforeach()
+# Macro to extract git hash from the source directory
+# and store it in the variable GIT_HASH
+# in case if git is not found or error occurs, GIT_HASH is set to empty string
+macro(OCCT_GET_GIT_HASH)
+  set(GIT_HASH "")
+  
+  find_package(Git QUIET)
+  if(GIT_FOUND)
+    execute_process(
+      COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
+      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+      OUTPUT_VARIABLE GIT_HASH
+      ERROR_VARIABLE GIT_ERROR 
+      OUTPUT_STRIP_TRAILING_WHITESPACE
+    )
+    if(NOT GIT_ERROR)
+      # Check if working directory is clean
+      execute_process(
+        COMMAND ${GIT_EXECUTABLE} status --porcelain
+        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+        OUTPUT_VARIABLE GIT_STATUS
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+      )
+      if(NOT "${GIT_STATUS}" STREQUAL "")
+        message(DEBUG "Git working directory is not clean. Git hash may be incorrect.")
+      endif()
+    else()
+      set(GIT_HASH "")
+    endif()
   endif()
+endmacro()
+
+# Returns OCC version string
+function (OCC_VERSION OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANCE OCC_VERSION_DEVELOPMENT OCC_VERSION_STRING_EXT)
+
+  include (version)
+  set (OCC_VERSION_COMPLETE "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
+  set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}")
+
   set (OCC_VERSION_MAJOR "${OCC_VERSION_MAJOR}" PARENT_SCOPE)
   set (OCC_VERSION_MINOR "${OCC_VERSION_MINOR}" PARENT_SCOPE)
   set (OCC_VERSION_MAINTENANCE "${OCC_VERSION_MAINTENANCE}" PARENT_SCOPE)
-  set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
+  set (OCCT_ON_DEVELOPMENT OFF)
+  if (NOT "${OCC_VERSION_DEVELOPMENT}" STREQUAL "" AND NOT "${OCC_VERSION_DEVELOPMENT}" STREQUAL "OCC_VERSION_DEVELOPMENT")
+    set (OCCT_ON_DEVELOPMENT ON)
+  endif()
+  if (${OCCT_ON_DEVELOPMENT})
+    set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
+  endif()
   
-  if (OCC_VERSION_DEVELOPMENT AND OCC_VERSION_COMPLETE)
-    set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}.${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
-  else()
-    set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}" PARENT_SCOPE)
+  set (SET_OCC_VERSION_DEVELOPMENT "")
+  if (${OCCT_ON_DEVELOPMENT})
+    OCCT_GET_GIT_HASH()
+    if (NOT "${GIT_HASH}" STREQUAL "")
+      set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}-${GIT_HASH}")
+      set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
+    endif()
+    set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}.${OCC_VERSION_DEVELOPMENT}")
+    set (OCC_VERSION_STRING_EXT "${OCC_VERSION_STRING_EXT}" PARENT_SCOPE)
+    set (SET_OCC_VERSION_DEVELOPMENT "#define OCC_VERSION_DEVELOPMENT \"${OCC_VERSION_DEVELOPMENT}\"")
   endif()
+  set (OCC_VERSION_STRING_EXT "${OCC_VERSION_STRING_EXT}" PARENT_SCOPE)
 endfunction()
 
 macro (CHECK_PATH_FOR_CONSISTENCY THE_ROOT_PATH_NAME THE_BEING_CHECKED_PATH_NAME THE_VAR_TYPE THE_MESSAGE_OF_BEING_CHECKED_PATH)
diff --git a/adm/cmake/version.cmake b/adm/cmake/version.cmake
new file mode 100644 (file)
index 0000000..72e3d04
--- /dev/null
@@ -0,0 +1,22 @@
+#======================================================================
+#
+# Purpose:   Defines macros identifying current version of Open CASCADE
+#
+#  OCC_VERSION_MAJOR       : (integer) number identifying major version
+#  OCC_VERSION_MINOR       : (integer) number identifying minor version
+#  OCC_VERSION_MAINTENANCE : (integer) number identifying maintenance version
+#  OCC_VERSION_DEVELOPMENT : (string)  if defined, indicates development or modified version
+#                              in case of release, remove the value
+#
+#  Sample values of OCC_VERSION_DEVELOPMENT:
+#  - "dev" for development version between releases
+#  - "beta..." or "rc..." for beta releases or release candidates
+#  - "project..." for version containing project-specific fixes
+#
+#  For development version git commit hash can be added to the version string
+#======================================================================
+
+set (OCC_VERSION_MAJOR 7 )
+set (OCC_VERSION_MINOR 8 )
+set (OCC_VERSION_MAINTENANCE 2 )
+set (OCC_VERSION_DEVELOPMENT "dev" )
index cd7fcb45c4d235787bfb22e8836657763d1b16de..a2c87bc5d12b87a9e08a991bb13de96505fbbd66 100644 (file)
@@ -142,17 +142,20 @@ proc OCCDoc_GetRelPath {thePathFrom thePathTo} {
   return $thePathTo
 }
 
-# Returns OCCT version string from file Standard_Version.hxx (if available)
+# Returns OCCT version string from version.cmake (if available)
 proc OCCDoc_DetectCasVersion {} {
-  set occt_ver 6.7.0
+  set occt_ver "7.8.0"
   set occt_ver_add ""
-  set filename "[OCCDoc_GetSourceDir]/Standard/Standard_Version.hxx"
+  set filename "[OCCDoc_GetSourceDir]/../adm/cmake/version.cmake"
   if { [file exists $filename] } {
     set fh [open $filename "r"]
     set fh_loaded [read $fh]
     close $fh
-    regexp {[^/]\s*#\s*define\s+OCC_VERSION_COMPLETE\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver
-    regexp {[^/]\s*#\s*define\s+OCC_VERSION_DEVELOPMENT\s+\"([^\s]*)\"} $fh_loaded dummy occt_ver_add
+    regexp {set\s+OCC_VERSION_MAJOR\s+([0-9]+)} $fh_loaded dummy major
+    regexp {set\s+OCC_VERSION_MINOR\s+([0-9]+)} $fh_loaded dummy minor 
+    regexp {set\s+OCC_VERSION_MAINTENANCE\s+([0-9]+)} $fh_loaded dummy maint
+    regexp {set\s+OCC_VERSION_DEVELOPMENT\s+\"([^\"]+)\"} $fh_loaded dummy occt_ver_add
+    set occt_ver "$major.$minor.$maint"
     if { "$occt_ver_add" != "" } { set occt_ver ${occt_ver}.$occt_ver_add }
   }
   return $occt_ver
index 247d23cde7633e1e7041d564cdf501423ee7b8c9..2fd7a9aef84d7eace9c7e4826a2de07123c6d99a 100644 (file)
@@ -67,8 +67,9 @@ if ["%toCMake%"] == ["1"] (
 set "anOcctVerSuffix="
 set "anOcctVersion=0.0.0"
 set "aGitBranch="
-for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOPMENT" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVerSuffix=%%i" )
-for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_COMPLETE" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVersion=%%i" )
+rem Get OCCT version
+call "%~dp0build_common.bat"
+set "aGitBranch="
 for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
 
 for %%s in (%anNdkAbiList%) do (
diff --git a/adm/scripts/build_common.bat b/adm/scripts/build_common.bat
new file mode 100644 (file)
index 0000000..7228b6c
--- /dev/null
@@ -0,0 +1,8 @@
+@echo OFF
+
+rem Extract version info from version.cmake
+for /f tokens^=2^ delims^=^" %%i in ('findstr OCC_VERSION_DEVELOPMENT "%~dp0\..\cmake\version.cmake"') do ( set "anOcctVerSuffix=%%i" )
+for /f tokens^=3 %%i in ('findstr OCC_VERSION_MAJOR "%~dp0\..\cmake\version.cmake"') do ( set "OCC_VERSION_MAJOR=%%i" )
+for /f tokens^=3 %%i in ('findstr OCC_VERSION_MINOR "%~dp0\..\cmake\version.cmake"') do ( set "OCC_VERSION_MINOR=%%i" )
+for /f tokens^=3 %%i in ('findstr OCC_VERSION_MAINTENANCE "%~dp0\..\cmake\version.cmake"') do ( set "OCC_VERSION_MAINTENANCE=%%i" )
+set "anOcctVersion=%OCC_VERSION_MAJOR%.%OCC_VERSION_MINOR%.%OCC_VERSION_MAINTENANCE%"
diff --git a/adm/scripts/build_common.sh b/adm/scripts/build_common.sh
new file mode 100644 (file)
index 0000000..ade4428
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# Extract version info from version.cmake
+anOcctVerSuffix=`grep -e "OCC_VERSION_DEVELOPMENT" "$aScriptDir/../cmake/version.cmake" | grep -o '".*"' | tr -d '"'`
+OCC_VERSION_MAJOR=`grep -e "OCC_VERSION_MAJOR" "$aScriptDir/../cmake/version.cmake" | awk '{print $3}'`
+OCC_VERSION_MINOR=`grep -e "OCC_VERSION_MINOR" "$aScriptDir/../cmake/version.cmake" | awk '{print $3}'`
+OCC_VERSION_MAINTENANCE=`grep -e "OCC_VERSION_MAINTENANCE" "$aScriptDir/../cmake/version.cmake" | awk '{print $3}'`
+anOcctVersion="$OCC_VERSION_MAJOR.$OCC_VERSION_MINOR.$OCC_VERSION_MAINTENANCE"
index b9ada581b53a5eb42233d414054fd49c028743b1..dd87bd950f2f0d80f5d5082b49b3947f0e62e2fb 100755 (executable)
@@ -49,8 +49,7 @@ if [[ -f "${aScriptDir}/ios_custom.sh" ]]; then
   source "${aScriptDir}/ios_custom.sh"
 fi
 
-anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
-anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
+source "${aScriptDir}/build_common.sh"
 aGitBranch=`git symbolic-ref --short HEAD`
 
 YEAR=$(date +"%Y")
index 4cdaa8bddcf714459c08b70570e01ec6cb1e1e51..66efea83f4d8e590355ef8ad9c769a48e4124c44 100755 (executable)
@@ -51,8 +51,7 @@ if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then
   source "${aScriptDir}/macos_custom.sh"
 fi
 
-anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
-anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
+source "${aScriptDir}/build_common.sh"
 aGitBranch=`git symbolic-ref --short HEAD`
 
 YEAR=$(date +"%Y")
index 27e33625fae6501805f4487fd4087601f42bb625..1b981beda87f2d8fa5c59323f508b328e9f859cc 100644 (file)
@@ -53,9 +53,8 @@ if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
 
 set "anOcctVerSuffix="
 set "anOcctVersion=0.0.0"
+call "%~dp0build_common.bat"
 set "aGitBranch="
-for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOPMENT" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVerSuffix=%%i" )
-for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_COMPLETE" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVersion=%%i" )
 for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
 
 set "aBuildType=Release"
index 7495b8079bb6b2c2cc2b1b71dfb67ce22eff7f01..3011aad167e3f52d4a8860c88b8a5e185748d2cf 100644 (file)
@@ -55,8 +55,8 @@ if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
 set "anOcctVerSuffix="
 set "anOcctVersion=0.0.0"
 set "aGitBranch="
-for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOPMENT" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVerSuffix=%%i" )
-for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_COMPLETE" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVersion=%%i" )
+call "%~dp0build_common.bat"
+set "aGitBranch="
 for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" )
 
 set "aBuildType=Release"
diff --git a/adm/templates/Standard_Version.hxx.in b/adm/templates/Standard_Version.hxx.in
new file mode 100644 (file)
index 0000000..5285c10
--- /dev/null
@@ -0,0 +1,65 @@
+// Created on: @OCCT_VERSION_DATE@
+// Copyright (c) 2002-2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+/*======================================================================
+//
+// Purpose:   Defines macros identifying current version of Open CASCADE
+//
+//            OCC_VERSION_MAJOR       : (integer) number identifying major version
+//            OCC_VERSION_MINOR       : (integer) number identifying minor version
+//            OCC_VERSION_MAINTENANCE : (integer) number identifying maintenance version
+//            OCC_VERSION_DEVELOPMENT : (string)  if defined, indicates development or modified
+version
+//            OCC_VERSION             : (real)    complete number (major.minor)
+//            OCC_VERSION_STRING      : (string)  short version number ("major.minor")
+//            OCC_VERSION_COMPLETE    : (string)  complete version number
+("major.minor.maintenance")
+//            OCC_VERSION_STRING_EXT  : (string)  extended version
+("major.minor.maintenance.development")
+//            OCC_VERSION_HEX         : (hex)     complete number as hex, two positions per each of
+major, minor, and patch number
+//
+//======================================================================*/
+
+#ifndef _Standard_Version_HeaderFile
+#define _Standard_Version_HeaderFile
+
+// Primary definitions
+#define OCC_VERSION_MAJOR @OCC_VERSION_MAJOR@
+#define OCC_VERSION_MINOR @OCC_VERSION_MINOR@
+#define OCC_VERSION_MAINTENANCE @OCC_VERSION_MAINTENANCE@
+
+//! This macro must be commented in official release, and set to non-empty
+//! string in other situations, to identify specifics of the version, e.g.:
+//! - "dev" for development version between releases
+//! - "beta..." or "rc..." for beta releases or release candidates
+//! - "project..." for version containing project-specific fixes
+@SET_OCC_VERSION_DEVELOPMENT@
+
+// Derived (manually): version as real and string (major.minor)
+#define OCC_VERSION @OCC_VERSION_MAJOR@.@OCC_VERSION_MINOR@
+#define OCC_VERSION_STRING "@OCC_VERSION_MAJOR@.@OCC_VERSION_MINOR@"
+#define OCC_VERSION_COMPLETE "@OCC_VERSION_MAJOR@.@OCC_VERSION_MINOR@.@OCC_VERSION_MAINTENANCE@"
+
+//! Derived: extended version as string ("major.minor.maintenance.dev")
+#ifdef OCC_VERSION_DEVELOPMENT
+  #define OCC_VERSION_STRING_EXT OCC_VERSION_COMPLETE "." OCC_VERSION_DEVELOPMENT
+#else
+  #define OCC_VERSION_STRING_EXT OCC_VERSION_COMPLETE
+#endif
+
+// Derived: complete version as hex (0x0'major'0'minor'0'maintenance')
+#define OCC_VERSION_HEX (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE)
+
+#endif /* _Standard_Version_HeaderFile */
index 5614d5df5e3ef08baaa470b8d80a28b3f130f0b5..d4874782deb3a4fc5ecb8aaba638b36912590824 100644 (file)
@@ -20,7 +20,7 @@ BEGIN
       VALUE "LegalCopyright",  "\251 OPEN CASCADE SAS\000"
       VALUE "ProductName",     "Open CASCADE Technology\000"
       VALUE "ProductVersion",  OCC_VERSION_STRING_EXT "\000"
-      VALUE "OfficialSite",    "www.opencascade.com\000"
+      VALUE "OfficialSite",    "www.occt3d.com\000"
     END
   END
   BLOCK "VarFileInfo"
index 2b56a0c5eb4f96baaed55986eb3044740489dd80..c5d5af44cbf7de2ea05136d74528f9cf5f36830f 100755 (executable)
@@ -93,6 +93,7 @@ Standard_TypeDef.hxx
 Standard_TypeMismatch.hxx
 Standard_Underflow.hxx
 Standard_UUID.hxx
-Standard_Version.hxx
+Standard_VersionInfo.cxx
+Standard_VersionInfo.hxx
 Standard_WarningsDisable.hxx
 Standard_WarningsRestore.hxx
diff --git a/src/Standard/Standard_Version.hxx b/src/Standard/Standard_Version.hxx
deleted file mode 100644 (file)
index e58b937..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// Created on: 2002-07-09
-// Created by: Andrey BETENEV
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-/*======================================================================
-//
-// Purpose:   Defines macros identifying current version of Open CASCADE
-//
-//            OCC_VERSION_MAJOR       : (integer) number identifying major version
-//            OCC_VERSION_MINOR       : (integer) number identifying minor version
-//            OCC_VERSION_MAINTENANCE : (integer) number identifying maintenance version
-//            OCC_VERSION_DEVELOPMENT : (string)  if defined, indicates development or modified
-version
-//            OCC_VERSION             : (real)    complete number (major.minor)
-//            OCC_VERSION_STRING      : (string)  short version number ("major.minor")
-//            OCC_VERSION_COMPLETE    : (string)  complete version number
-("major.minor.maintenance")
-//            OCC_VERSION_STRING_EXT  : (string)  extended version
-("major.minor.maintenance.development")
-//            OCC_VERSION_HEX         : (hex)     complete number as hex, two positions per each of
-major, minor, and patch number
-//
-//======================================================================*/
-
-#ifndef _Standard_Version_HeaderFile
-#define _Standard_Version_HeaderFile
-
-// Primary definitions
-#define OCC_VERSION_MAJOR 7
-#define OCC_VERSION_MINOR 8
-#define OCC_VERSION_MAINTENANCE 2
-
-//! This macro must be commented in official release, and set to non-empty
-//! string in other situations, to identify specifics of the version, e.g.:
-//! - "dev" for development version between releases
-//! - "beta..." or "rc..." for beta releases or release candidates
-//! - "project..." for version containing project-specific fixes
-#define OCC_VERSION_DEVELOPMENT "dev"
-
-// Derived (manually): version as real and string (major.minor)
-#define OCC_VERSION 7.8
-#define OCC_VERSION_STRING "7.8"
-#define OCC_VERSION_COMPLETE "7.8.2"
-
-//! Derived: extended version as string ("major.minor.maintenance.dev")
-#ifdef OCC_VERSION_DEVELOPMENT
-  #define OCC_VERSION_STRING_EXT OCC_VERSION_COMPLETE "." OCC_VERSION_DEVELOPMENT
-#else
-  #define OCC_VERSION_STRING_EXT OCC_VERSION_COMPLETE
-#endif
-
-// Derived: complete version as hex (0x0'major'0'minor'0'maintenance')
-#define OCC_VERSION_HEX (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE)
-
-#endif /* _Standard_Version_HeaderFile */
diff --git a/src/Standard/Standard_VersionInfo.cxx b/src/Standard/Standard_VersionInfo.cxx
new file mode 100644 (file)
index 0000000..cd88e38
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Standard_VersionInfo.hxx>
+
+#include <Standard_Version.hxx>
+
+//=================================================================================================
+
+const char* OCCT_DevelopmentVersion()
+{
+#ifdef OCC_VERSION_DEVELOPMENT
+  return OCC_VERSION_DEVELOPMENT;
+#else
+  return "";
+#endif
+}
+
+//=================================================================================================
+
+double OCCT_Version_Double()
+{
+  return OCC_VERSION;
+}
+
+//=================================================================================================
+
+const char* OCCT_Version_String()
+{
+  return OCC_VERSION_STRING;
+}
+
+//=================================================================================================
+
+const char* OCCT_Version_String_Complete()
+{
+  return OCC_VERSION_COMPLETE;
+}
+
+//=================================================================================================
+
+const char* OCCT_Version_String_Extended()
+{
+  return OCC_VERSION_STRING_EXT;
+}
diff --git a/src/Standard/Standard_VersionInfo.hxx b/src/Standard/Standard_VersionInfo.hxx
new file mode 100644 (file)
index 0000000..69c0d16
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (c) 2025 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Standard_VersionInfo_HeaderFile
+#define _Standard_VersionInfo_HeaderFile
+
+#include <Standard_Macro.hxx>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+  //! Returns development version of Open CASCADE Technology.
+  //! "" - in case of official release,
+  //! "dev" - in case of development version between releases,
+  //! "beta..." or "rc..." - in case of beta releases or release candidates,
+  //! "project..." - in case of version containing project-specific fixes.
+  Standard_EXPORT const char* OCCT_DevelopmentVersion();
+
+  //! Returns version of Open CASCADE Technology as a double "major.minor"
+  Standard_EXPORT double OCCT_Version_Double();
+
+  //! Returns version of Open CASCADE Technology as a string "major.minor"
+  Standard_EXPORT const char* OCCT_Version_String();
+
+  //! Returns complete version of Open CASCADE Technology as a string "major.minor.maintenance"
+  Standard_EXPORT const char* OCCT_Version_String_Complete();
+
+  //! Returns extended version of Open CASCADE Technology as a string
+  //! "major.minor.maintenance.devext". In case if no development version is defined, returns the
+  //! same as OCCT_Version_String_Complete().
+  Standard_EXPORT const char* OCCT_Version_String_Extended();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _Standard_VersionInfo_HeaderFile */