diff --git a/CMakeLists.txt b/CMakeLists.txt index 766356f3f9..67449a37c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -975,6 +975,9 @@ message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT header fi # collect all the headers to /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") diff --git a/README.md b/README.md index 483d28ae83..13ee509951 100644 --- 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 diff --git a/adm/cmake/occt_macros.cmake b/adm/cmake/occt_macros.cmake index efef453612..7ec52b89d2 100644 --- a/adm/cmake/occt_macros.cmake +++ b/adm/cmake/occt_macros.cmake @@ -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) + +# 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) - 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() + include (version) + set (OCC_VERSION_COMPLETE "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}") + set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}") - 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() - endif() - 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) - - 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 (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() + + 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 index 0000000000..72e3d0464b --- /dev/null +++ b/adm/cmake/version.cmake @@ -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" ) diff --git a/adm/occaux.tcl b/adm/occaux.tcl index cd7fcb45c4..a2c87bc5d1 100644 --- a/adm/occaux.tcl +++ b/adm/occaux.tcl @@ -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 diff --git a/adm/scripts/android_build.bat b/adm/scripts/android_build.bat index 247d23cde7..2fd7a9aef8 100644 --- a/adm/scripts/android_build.bat +++ b/adm/scripts/android_build.bat @@ -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 index 0000000000..7228b6cfb4 --- /dev/null +++ b/adm/scripts/build_common.bat @@ -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 index 0000000000..ade4428660 --- /dev/null +++ b/adm/scripts/build_common.sh @@ -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" diff --git a/adm/scripts/ios_build.sh b/adm/scripts/ios_build.sh index b9ada581b5..dd87bd950f 100755 --- a/adm/scripts/ios_build.sh +++ b/adm/scripts/ios_build.sh @@ -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") diff --git a/adm/scripts/macos_build.sh b/adm/scripts/macos_build.sh index 4cdaa8bddc..66efea83f4 100755 --- a/adm/scripts/macos_build.sh +++ b/adm/scripts/macos_build.sh @@ -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") diff --git a/adm/scripts/mingw_build.bat b/adm/scripts/mingw_build.bat index 27e33625fa..1b981beda8 100644 --- a/adm/scripts/mingw_build.bat +++ b/adm/scripts/mingw_build.bat @@ -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" diff --git a/adm/scripts/wasm_build.bat b/adm/scripts/wasm_build.bat index 7495b8079b..3011aad167 100644 --- a/adm/scripts/wasm_build.bat +++ b/adm/scripts/wasm_build.bat @@ -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/src/Standard/Standard_Version.hxx b/adm/templates/Standard_Version.hxx.in similarity index 84% rename from src/Standard/Standard_Version.hxx rename to adm/templates/Standard_Version.hxx.in index e58b9370a8..5285c10233 100644 --- a/src/Standard/Standard_Version.hxx +++ b/adm/templates/Standard_Version.hxx.in @@ -1,6 +1,5 @@ -// Created on: 2002-07-09 -// Created by: Andrey BETENEV -// Copyright (c) 2002-2014 OPEN CASCADE SAS +// Created on: @OCCT_VERSION_DATE@ +// Copyright (c) 2002-2025 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // @@ -37,21 +36,21 @@ major, minor, and patch number #define _Standard_Version_HeaderFile // Primary definitions -#define OCC_VERSION_MAJOR 7 -#define OCC_VERSION_MINOR 8 -#define OCC_VERSION_MAINTENANCE 2 +#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 -#define OCC_VERSION_DEVELOPMENT "dev" +@SET_OCC_VERSION_DEVELOPMENT@ // 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" +#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 diff --git a/adm/templates/occt_toolkit.rc.in b/adm/templates/occt_toolkit.rc.in index 5614d5df5e..d4874782de 100644 --- a/adm/templates/occt_toolkit.rc.in +++ b/adm/templates/occt_toolkit.rc.in @@ -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" diff --git a/src/Standard/FILES b/src/Standard/FILES index 2b56a0c5eb..c5d5af44cb 100755 --- a/src/Standard/FILES +++ b/src/Standard/FILES @@ -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_VersionInfo.cxx b/src/Standard/Standard_VersionInfo.cxx new file mode 100644 index 0000000000..cd88e38e95 --- /dev/null +++ b/src/Standard/Standard_VersionInfo.cxx @@ -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 + +#include + +//================================================================================================= + +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 index 0000000000..69c0d16120 --- /dev/null +++ b/src/Standard/Standard_VersionInfo.hxx @@ -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 + +#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 */