diff --git a/cmake-local/Version.cmake b/cmake-local/Version.cmake index b0c2cf1c2..e76bcba2b 100644 --- a/cmake-local/Version.cmake +++ b/cmake-local/Version.cmake @@ -2,10 +2,11 @@ set(CPACK_PACKAGE_NAME "osvr-core") set(CPACK_PACKAGE_VENDOR "Sensics, Inc.") set(CPACK_PACKAGE_CONTACT "") -set(CPACK_PACKAGE_VERSION_MAJOR 0) -set(CPACK_PACKAGE_VERSION_MINOR 2) -set(OSVR_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION ${OSVR_VERSION}) +set(OSVR_CORE_VERSION_1 0) +set(OSVR_CORE_VERSION_2 2) +set(OSVR_CORE_VERSION_3 0) +set(OSVR_CORE_VERSION_4 0) +set(OSVR_CORE_VERSION_STRING ${OSVR_CORE_VERSION_1}.${OSVR_CORE_VERSION_2}) include(GetGitRevisionDescription) git_describe(GIT_REVISION_DESCRIPTION --tags --match v*) @@ -13,22 +14,69 @@ if(GIT_REVISION_DESCRIPTION) string(REPLACE "v" "" GIT_REVISION_DESCRIPTION "${GIT_REVISION_DESCRIPTION}") - set(CPACK_PACKAGE_VERSION "${GIT_REVISION_DESCRIPTION}") - message(STATUS "Git reports version ${CPACK_PACKAGE_VERSION}") + set(OSVR_CORE_VERSION_STRING "${GIT_REVISION_DESCRIPTION}") + message(STATUS "Git reports version ${OSVR_CORE_VERSION_STRING}") + string(REGEX REPLACE ".*-g" "" OSVR_CORE_VERSION_COMMIT "${GIT_REVISION_DESCRIPTION}") + string(REGEX REPLACE "-g.*" "" DESCRIBE_COMPONENTS "${GIT_REVISION_DESCRIPTION}") + string(REGEX MATCHALL "[0-9]+" DESCRIBE_COMPONENTS "${DESCRIBE_COMPONENTS}") + + list(LENGTH DESCRIBE_COMPONENTS NUM_COMPONENTS) + + if(NUM_COMPONENTS GREATER 0) + list(GET DESCRIBE_COMPONENTS 0 VERCOMPONENT) + if(NOT ${VERCOMPONENT} EQUAL ${OSVR_CORE_VERSION_1}) + message("WARNING: need to update OSVR_CORE_VERSION_1 in Version.cmake - doesn't match tag!") + set(OSVR_CORE_VERSION_1 ${VERCOMPONENT}) + endif() + endif() + if(NUM_COMPONENTS GREATER 1) + list(GET DESCRIBE_COMPONENTS 1 VERCOMPONENT) + if(NOT ${VERCOMPONENT} EQUAL ${OSVR_CORE_VERSION_2}) + message("WARNING: need to update OSVR_CORE_VERSION_2 in Version.cmake - doesn't match tag!") + set(OSVR_CORE_VERSION_2 ${VERCOMPONENT}) + endif() + endif() + if(NUM_COMPONENTS GREATER 2) + list(GET DESCRIBE_COMPONENTS 2 OSVR_CORE_VERSION_3) + endif() + + if(NUM_COMPONENTS GREATER 3) + message(FATAL_ERROR "Need to update Version.cmake - currently assumes we get 2 version components from the tag and the third from the commit number, while we got more than that!") + endif() else() - message(STATUS "Could not get revision information from Git! Calling this just version ${CPACK_PACKAGE_VERSION}!") + message(STATUS "Could not get revision information from Git! Calling this just version ${OSVR_CORE_VERSION_STRING}!") endif() +if(NOT "$ENV{BUILD_TAG}" STREQUAL "") + set(OSVR_CORE_BUILD_TAG "$ENV{BUILD_TAG}") + message(STATUS "Detected CI build tag ${OSVR_CORE_BUILD_TAG}") +endif() + +if(OSVR_CORE_BUILD_TAG AND OSVR_OFFICIAL) + message(STATUS "Detected an official build environment!") + set(OSVR_CORE_OFFICIAL_BUILD TRUE) +endif() + +set(OSVR_VERSION ${OSVR_CORE_VERSION_1}.${OSVR_CORE_VERSION_2}) +set(CPACK_PACKAGE_VERSION_MAJOR ${OSVR_CORE_VERSION_1}) +set(CPACK_PACKAGE_VERSION_MINOR ${OSVR_CORE_VERSION_2}) +set(CPACK_PACKAGE_VERSION_PATCH ${OSVR_CORE_VERSION_3}) +set(CPACK_PACKAGE_VERSION ${OSVR_CORE_VERSION_STRING}) + if(WIN32) set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_CXX_COMPILER_ID}") if(MSVC) include(GetMSVCVersion) get_msvc_major_minor_version(_vs_major _vs_minor) set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}${_vs_major}${_vs_minor}") + set(OSVR_INTERNAL_API_VARIANT "Visual Studio ${_vs_major}.${_vs_minor}") endif() + if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8) set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-64bit") + set(OSVR_BIT_VARIANT "64-bit") else() set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-32bit") + set(OSVR_BIT_VARIANT "32-bit") endif() endif() diff --git a/inc/osvr/Client/GetRuntimeVersion.h b/inc/osvr/Client/GetRuntimeVersion.h new file mode 100644 index 000000000..68bc116f9 --- /dev/null +++ b/inc/osvr/Client/GetRuntimeVersion.h @@ -0,0 +1,77 @@ +/** @file + @brief Header for accessing runtime version information. + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_h_GUID_487199D9_CA87_4E85_52A2_D1BDBC119163 +#define INCLUDED_GetRuntimeVersion_h_GUID_487199D9_CA87_4E85_52A2_D1BDBC119163 + +// Internal Includes +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace client { + /// @brief Returns the value of the version component (zero-indexed) + /// specified, in the inclusive range [0,3]. + /// @return version component value, or 0 if component out of range. + OSVR_CLIENT_EXPORT util::NumericVersionComponent + getVersionComponent(uint8_t componentIndex); + + /// @brief Gets all numeric components of the runtime version in a tuple. + OSVR_CLIENT_EXPORT util::RuntimeNumericVersion getRuntimeNumericVersion(); + + /// @brief Gets the Git commit hash corresponding to this library build. + /// @returns an empty string if the commit hash could not be detected. + OSVR_CLIENT_EXPORT const char *getCommit(); + + /// @brief Gets the full descriptive version string, typically including the + /// numerical version components and the commit hash. + OSVR_CLIENT_EXPORT const char *getVersionString(); + + /// @brief If this was built by the CI, return the "Build Tag" the CI + /// associated with the build job. (Unrelated to git tags.) + /// @returns empty string if we don't have a CI build tag recorded. + OSVR_CLIENT_EXPORT const char *getCIBuildTag(); + + /// @brief Does this build identify itself as a dev build, rather than a + /// CI-build "production" build? This is not necessarily 100% accurate - for + /// informational purposes only. + OSVR_CLIENT_EXPORT bool isKnownDevBuild(); + + /// @brief Gets the name of this library/module, or an empty string if the + /// build system did not incorporate this information into the build. + OSVR_CLIENT_EXPORT const char *getModuleName(); +} // namespace client +} // namespace osvr + +#endif // INCLUDED_GetRuntimeVersion_h_GUID_487199D9_CA87_4E85_52A2_D1BDBC119163 diff --git a/inc/osvr/Common/GetRuntimeVersion.h b/inc/osvr/Common/GetRuntimeVersion.h new file mode 100644 index 000000000..4785a2ad3 --- /dev/null +++ b/inc/osvr/Common/GetRuntimeVersion.h @@ -0,0 +1,77 @@ +/** @file + @brief Header for accessing runtime version information. + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_h_GUID_5BF26574_26A9_4DB1_27B9_B5B8E69F2AE1 +#define INCLUDED_GetRuntimeVersion_h_GUID_5BF26574_26A9_4DB1_27B9_B5B8E69F2AE1 + +// Internal Includes +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace common { + /// @brief Returns the value of the version component (zero-indexed) + /// specified, in the inclusive range [0,3]. + /// @return version component value, or 0 if component out of range. + OSVR_COMMON_EXPORT util::NumericVersionComponent + getVersionComponent(uint8_t componentIndex); + + /// @brief Gets all numeric components of the runtime version in a tuple. + OSVR_COMMON_EXPORT util::RuntimeNumericVersion getRuntimeNumericVersion(); + + /// @brief Gets the Git commit hash corresponding to this library build. + /// @returns an empty string if the commit hash could not be detected. + OSVR_COMMON_EXPORT const char *getCommit(); + + /// @brief Gets the full descriptive version string, typically including the + /// numerical version components and the commit hash. + OSVR_COMMON_EXPORT const char *getVersionString(); + + /// @brief If this was built by the CI, return the "Build Tag" the CI + /// associated with the build job. (Unrelated to git tags.) + /// @returns empty string if we don't have a CI build tag recorded. + OSVR_COMMON_EXPORT const char *getCIBuildTag(); + + /// @brief Does this build identify itself as a dev build, rather than a + /// CI-build "production" build? This is not necessarily 100% accurate - for + /// informational purposes only. + OSVR_COMMON_EXPORT bool isKnownDevBuild(); + + /// @brief Gets the name of this library/module, or an empty string if the + /// build system did not incorporate this information into the build. + OSVR_COMMON_EXPORT const char *getModuleName(); +} // namespace common +} // namespace osvr + +#endif // INCLUDED_GetRuntimeVersion_h_GUID_5BF26574_26A9_4DB1_27B9_B5B8E69F2AE1 diff --git a/inc/osvr/Connection/GetRuntimeVersion.h b/inc/osvr/Connection/GetRuntimeVersion.h new file mode 100644 index 000000000..f7b123e4e --- /dev/null +++ b/inc/osvr/Connection/GetRuntimeVersion.h @@ -0,0 +1,77 @@ +/** @file + @brief Header for accessing runtime version information. + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_h_GUID_6FCB818C_A087_4CB8_E0C4_29B472CCE703 +#define INCLUDED_GetRuntimeVersion_h_GUID_6FCB818C_A087_4CB8_E0C4_29B472CCE703 + +// Internal Includes +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace connection { + /// @brief Returns the value of the version component (zero-indexed) + /// specified, in the inclusive range [0,3]. + /// @return version component value, or 0 if component out of range. + OSVR_CONNECTION_EXPORT util::NumericVersionComponent + getVersionComponent(uint8_t componentIndex); + + /// @brief Gets all numeric components of the runtime version in a tuple. + OSVR_CONNECTION_EXPORT util::RuntimeNumericVersion getRuntimeNumericVersion(); + + /// @brief Gets the Git commit hash corresponding to this library build. + /// @returns an empty string if the commit hash could not be detected. + OSVR_CONNECTION_EXPORT const char *getCommit(); + + /// @brief Gets the full descriptive version string, typically including the + /// numerical version components and the commit hash. + OSVR_CONNECTION_EXPORT const char *getVersionString(); + + /// @brief If this was built by the CI, return the "Build Tag" the CI + /// associated with the build job. (Unrelated to git tags.) + /// @returns empty string if we don't have a CI build tag recorded. + OSVR_CONNECTION_EXPORT const char *getCIBuildTag(); + + /// @brief Does this build identify itself as a dev build, rather than a + /// CI-build "production" build? This is not necessarily 100% accurate - for + /// informational purposes only. + OSVR_CONNECTION_EXPORT bool isKnownDevBuild(); + + /// @brief Gets the name of this library/module, or an empty string if the + /// build system did not incorporate this information into the build. + OSVR_CONNECTION_EXPORT const char *getModuleName(); +} // namespace connection +} // namespace osvr + +#endif // INCLUDED_GetRuntimeVersion_h_GUID_6FCB818C_A087_4CB8_E0C4_29B472CCE703 diff --git a/inc/osvr/PluginHost/GetRuntimeVersion.h b/inc/osvr/PluginHost/GetRuntimeVersion.h new file mode 100644 index 000000000..af52e783d --- /dev/null +++ b/inc/osvr/PluginHost/GetRuntimeVersion.h @@ -0,0 +1,77 @@ +/** @file + @brief Header for accessing runtime version information. + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_h_GUID_4A6A0FF9_4A87_4F9E_1192_82AEA1E1DF58 +#define INCLUDED_GetRuntimeVersion_h_GUID_4A6A0FF9_4A87_4F9E_1192_82AEA1E1DF58 + +// Internal Includes +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace pluginhost { + /// @brief Returns the value of the version component (zero-indexed) + /// specified, in the inclusive range [0,3]. + /// @return version component value, or 0 if component out of range. + OSVR_PLUGINHOST_EXPORT util::NumericVersionComponent + getVersionComponent(uint8_t componentIndex); + + /// @brief Gets all numeric components of the runtime version in a tuple. + OSVR_PLUGINHOST_EXPORT util::RuntimeNumericVersion getRuntimeNumericVersion(); + + /// @brief Gets the Git commit hash corresponding to this library build. + /// @returns an empty string if the commit hash could not be detected. + OSVR_PLUGINHOST_EXPORT const char *getCommit(); + + /// @brief Gets the full descriptive version string, typically including the + /// numerical version components and the commit hash. + OSVR_PLUGINHOST_EXPORT const char *getVersionString(); + + /// @brief If this was built by the CI, return the "Build Tag" the CI + /// associated with the build job. (Unrelated to git tags.) + /// @returns empty string if we don't have a CI build tag recorded. + OSVR_PLUGINHOST_EXPORT const char *getCIBuildTag(); + + /// @brief Does this build identify itself as a dev build, rather than a + /// CI-build "production" build? This is not necessarily 100% accurate - for + /// informational purposes only. + OSVR_PLUGINHOST_EXPORT bool isKnownDevBuild(); + + /// @brief Gets the name of this library/module, or an empty string if the + /// build system did not incorporate this information into the build. + OSVR_PLUGINHOST_EXPORT const char *getModuleName(); +} // namespace pluginhost +} // namespace osvr + +#endif // INCLUDED_GetRuntimeVersion_h_GUID_4A6A0FF9_4A87_4F9E_1192_82AEA1E1DF58 diff --git a/inc/osvr/Private/GetRuntimeVersion_InnerImpl.h b/inc/osvr/Private/GetRuntimeVersion_InnerImpl.h new file mode 100644 index 000000000..30eb2e2f1 --- /dev/null +++ b/inc/osvr/Private/GetRuntimeVersion_InnerImpl.h @@ -0,0 +1,78 @@ +/** @file + @brief Header for inclusion inside the namespace of an OSVR library to + implement runtime version reporting. + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_InnerImpl_h_GUID_3D1094A4_EC41_4F94_5774_8A4DA3E61F1C +#define INCLUDED_GetRuntimeVersion_InnerImpl_h_GUID_3D1094A4_EC41_4F94_5774_8A4DA3E61F1C + +util::NumericVersionComponent getVersionComponent(uint8_t componentIndex) { + switch (componentIndex) { + case 0: + return OSVR_CORE_VERSION_1; + case 1: + return OSVR_CORE_VERSION_2; + case 2: + return OSVR_CORE_VERSION_3; + case 3: + return OSVR_CORE_VERSION_4; + default: + return 0; + } +} + +util::RuntimeNumericVersion getRuntimeNumericVersion() { + return util::RuntimeNumericVersion{OSVR_CORE_VERSION_1, OSVR_CORE_VERSION_2, + OSVR_CORE_VERSION_3, + OSVR_CORE_VERSION_4}; +} +static const char COMMIT[] = OSVR_CORE_VERSION_COMMIT; +const char *getCommit() { return COMMIT; } + +static const char VERSTRING[] = OSVR_CORE_VERSION_STRING; +const char *getVersionString() { return VERSTRING; } + +#ifdef OSVR_CORE_BUILD_TAG +static const char BUILD_TAG[] = OSVR_CORE_BUILD_TAG; +#else +static const char BUILD_TAG[] = ""; +#endif +const char *getCIBuildTag() { return BUILD_TAG; } + +bool isKnownDevBuild() { +#ifdef OSVR_CORE_OFFICIAL_BUILD + return false; +#else + return true; +#endif +} + +#ifdef OSVR_MODULE_NAME +static const char MODULENAME[] = OSVR_MODULE_NAME; +#else +static const char MODULENAME[] = ""; +#endif + +const char *getModuleName() { return MODULENAME; } + +#endif // INCLUDED_GetRuntimeVersion_InnerImpl_h_GUID_3D1094A4_EC41_4F94_5774_8A4DA3E61F1C diff --git a/inc/osvr/Server/GetRuntimeVersion.h b/inc/osvr/Server/GetRuntimeVersion.h new file mode 100644 index 000000000..cbe750886 --- /dev/null +++ b/inc/osvr/Server/GetRuntimeVersion.h @@ -0,0 +1,77 @@ +/** @file + @brief Header for accessing runtime version information. + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_h_GUID_8513C123_CF38_4F9F_586F_1A1FDA5463BA +#define INCLUDED_GetRuntimeVersion_h_GUID_8513C123_CF38_4F9F_586F_1A1FDA5463BA + +// Internal Includes +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace server { + /// @brief Returns the value of the version component (zero-indexed) + /// specified, in the inclusive range [0,3]. + /// @return version component value, or 0 if component out of range. + OSVR_SERVER_EXPORT util::NumericVersionComponent + getVersionComponent(uint8_t componentIndex); + + /// @brief Gets all numeric components of the runtime version in a tuple. + OSVR_SERVER_EXPORT util::RuntimeNumericVersion getRuntimeNumericVersion(); + + /// @brief Gets the Git commit hash corresponding to this library build. + /// @returns an empty string if the commit hash could not be detected. + OSVR_SERVER_EXPORT const char *getCommit(); + + /// @brief Gets the full descriptive version string, typically including the + /// numerical version components and the commit hash. + OSVR_SERVER_EXPORT const char *getVersionString(); + + /// @brief If this was built by the CI, return the "Build Tag" the CI + /// associated with the build job. (Unrelated to git tags.) + /// @returns empty string if we don't have a CI build tag recorded. + OSVR_SERVER_EXPORT const char *getCIBuildTag(); + + /// @brief Does this build identify itself as a dev build, rather than a + /// CI-build "production" build? This is not necessarily 100% accurate - for + /// informational purposes only. + OSVR_SERVER_EXPORT bool isKnownDevBuild(); + + /// @brief Gets the name of this library/module, or an empty string if the + /// build system did not incorporate this information into the build. + OSVR_SERVER_EXPORT const char *getModuleName(); +} // namespace server +} // namespace osvr + +#endif // INCLUDED_GetRuntimeVersion_h_GUID_8513C123_CF38_4F9F_586F_1A1FDA5463BA diff --git a/inc/osvr/USBSerial/GetRuntimeVersion.h b/inc/osvr/USBSerial/GetRuntimeVersion.h new file mode 100644 index 000000000..4f08f141a --- /dev/null +++ b/inc/osvr/USBSerial/GetRuntimeVersion.h @@ -0,0 +1,77 @@ +/** @file + @brief Header for accessing runtime version information. + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_h_GUID_4458E735_A9DC_4F94_AE78_433B41E5147F +#define INCLUDED_GetRuntimeVersion_h_GUID_4458E735_A9DC_4F94_AE78_433B41E5147F + +// Internal Includes +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace usbserial { + /// @brief Returns the value of the version component (zero-indexed) + /// specified, in the inclusive range [0,3]. + /// @return version component value, or 0 if component out of range. + OSVR_USBSERIAL_EXPORT util::NumericVersionComponent + getVersionComponent(uint8_t componentIndex); + + /// @brief Gets all numeric components of the runtime version in a tuple. + OSVR_USBSERIAL_EXPORT util::RuntimeNumericVersion getRuntimeNumericVersion(); + + /// @brief Gets the Git commit hash corresponding to this library build. + /// @returns an empty string if the commit hash could not be detected. + OSVR_USBSERIAL_EXPORT const char *getCommit(); + + /// @brief Gets the full descriptive version string, typically including the + /// numerical version components and the commit hash. + OSVR_USBSERIAL_EXPORT const char *getVersionString(); + + /// @brief If this was built by the CI, return the "Build Tag" the CI + /// associated with the build job. (Unrelated to git tags.) + /// @returns empty string if we don't have a CI build tag recorded. + OSVR_USBSERIAL_EXPORT const char *getCIBuildTag(); + + /// @brief Does this build identify itself as a dev build, rather than a + /// CI-build "production" build? This is not necessarily 100% accurate - for + /// informational purposes only. + OSVR_USBSERIAL_EXPORT bool isKnownDevBuild(); + + /// @brief Gets the name of this library/module, or an empty string if the + /// build system did not incorporate this information into the build. + OSVR_USBSERIAL_EXPORT const char *getModuleName(); +} // namespace usbserial +} // namespace osvr + +#endif // INCLUDED_GetRuntimeVersion_h_GUID_4458E735_A9DC_4F94_AE78_433B41E5147F diff --git a/inc/osvr/Util/GetRuntimeVersion.h b/inc/osvr/Util/GetRuntimeVersion.h new file mode 100644 index 000000000..d7539bc5d --- /dev/null +++ b/inc/osvr/Util/GetRuntimeVersion.h @@ -0,0 +1,77 @@ +/** @file + @brief Header for accessing runtime version information. + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_h_GUID_FF76C4D7_2239_4DA3_0216_19D9473788E8 +#define INCLUDED_GetRuntimeVersion_h_GUID_FF76C4D7_2239_4DA3_0216_19D9473788E8 + +// Internal Includes +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace util { + /// @brief Returns the value of the version component (zero-indexed) + /// specified, in the inclusive range [0,3]. + /// @return version component value, or 0 if component out of range. + OSVR_UTIL_EXPORT util::NumericVersionComponent + getVersionComponent(uint8_t componentIndex); + + /// @brief Gets all numeric components of the runtime version in a tuple. + OSVR_UTIL_EXPORT util::RuntimeNumericVersion getRuntimeNumericVersion(); + + /// @brief Gets the Git commit hash corresponding to this library build. + /// @returns an empty string if the commit hash could not be detected. + OSVR_UTIL_EXPORT const char *getCommit(); + + /// @brief Gets the full descriptive version string, typically including the + /// numerical version components and the commit hash. + OSVR_UTIL_EXPORT const char *getVersionString(); + + /// @brief If this was built by the CI, return the "Build Tag" the CI + /// associated with the build job. (Unrelated to git tags.) + /// @returns empty string if we don't have a CI build tag recorded. + OSVR_UTIL_EXPORT const char *getCIBuildTag(); + + /// @brief Does this build identify itself as a dev build, rather than a + /// CI-build "production" build? This is not necessarily 100% accurate - for + /// informational purposes only. + OSVR_UTIL_EXPORT bool isKnownDevBuild(); + + /// @brief Gets the name of this library/module, or an empty string if the + /// build system did not incorporate this information into the build. + OSVR_UTIL_EXPORT const char *getModuleName(); +} // namespace util +} // namespace osvr + +#endif // INCLUDED_GetRuntimeVersion_h_GUID_FF76C4D7_2239_4DA3_0216_19D9473788E8 diff --git a/inc/osvr/Util/RuntimeNumericVersion.h b/inc/osvr/Util/RuntimeNumericVersion.h new file mode 100644 index 000000000..d551d16b9 --- /dev/null +++ b/inc/osvr/Util/RuntimeNumericVersion.h @@ -0,0 +1,47 @@ +/** @file + @brief Header + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_RuntimeNumericVersion_h_GUID_2B8A8F86_5430_4CBD_36E1_987F3EC0AF66 +#define INCLUDED_RuntimeNumericVersion_h_GUID_2B8A8F86_5430_4CBD_36E1_987F3EC0AF66 + +// Internal Includes +// - none + +// Library/third-party includes +// - none + +// Standard includes +#include +#include + +namespace osvr { +namespace util { + typedef uint16_t NumericVersionComponent; + typedef std::tuple RuntimeNumericVersion; +} // namespace util +} // namespace osvr + +#endif // INCLUDED_RuntimeNumericVersion_h_GUID_2B8A8F86_5430_4CBD_36E1_987F3EC0AF66 diff --git a/inc/osvr/VRPNServer/GetRuntimeVersion.h b/inc/osvr/VRPNServer/GetRuntimeVersion.h new file mode 100644 index 000000000..4f7112c30 --- /dev/null +++ b/inc/osvr/VRPNServer/GetRuntimeVersion.h @@ -0,0 +1,77 @@ +/** @file + @brief Header for accessing runtime version information. + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_h_GUID_D58CA30A_7011_4BA6_509B_CF2A61DDF191 +#define INCLUDED_GetRuntimeVersion_h_GUID_D58CA30A_7011_4BA6_509B_CF2A61DDF191 + +// Internal Includes +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace vrpnserver { + /// @brief Returns the value of the version component (zero-indexed) + /// specified, in the inclusive range [0,3]. + /// @return version component value, or 0 if component out of range. + OSVR_VRPNSERVER_EXPORT util::NumericVersionComponent + getVersionComponent(uint8_t componentIndex); + + /// @brief Gets all numeric components of the runtime version in a tuple. + OSVR_VRPNSERVER_EXPORT util::RuntimeNumericVersion getRuntimeNumericVersion(); + + /// @brief Gets the Git commit hash corresponding to this library build. + /// @returns an empty string if the commit hash could not be detected. + OSVR_VRPNSERVER_EXPORT const char *getCommit(); + + /// @brief Gets the full descriptive version string, typically including the + /// numerical version components and the commit hash. + OSVR_VRPNSERVER_EXPORT const char *getVersionString(); + + /// @brief If this was built by the CI, return the "Build Tag" the CI + /// associated with the build job. (Unrelated to git tags.) + /// @returns empty string if we don't have a CI build tag recorded. + OSVR_VRPNSERVER_EXPORT const char *getCIBuildTag(); + + /// @brief Does this build identify itself as a dev build, rather than a + /// CI-build "production" build? This is not necessarily 100% accurate - for + /// informational purposes only. + OSVR_VRPNSERVER_EXPORT bool isKnownDevBuild(); + + /// @brief Gets the name of this library/module, or an empty string if the + /// build system did not incorporate this information into the build. + OSVR_VRPNSERVER_EXPORT const char *getModuleName(); +} // namespace vrpnserver +} // namespace osvr + +#endif // INCLUDED_GetRuntimeVersion_h_GUID_D58CA30A_7011_4BA6_509B_CF2A61DDF191 diff --git a/src/osvr/Client/CMakeLists.txt b/src/osvr/Client/CMakeLists.txt index e66860dd3..215577029 100644 --- a/src/osvr/Client/CMakeLists.txt +++ b/src/osvr/Client/CMakeLists.txt @@ -1,7 +1,8 @@ osvr_setup_lib_vars(Client) set(API - "${HEADER_LOCATION}/CreateContext.h") + "${HEADER_LOCATION}/CreateContext.h" + "${HEADER_LOCATION}/GetRuntimeVersion.h") set(SOURCE AnalogRemoteFactory.cpp @@ -9,6 +10,7 @@ set(SOURCE ButtonRemoteFactory.cpp ButtonRemoteFactory.h CreateContext.cpp + GetRuntimeVersion.cpp HandlerContainer.h ImagingRemoteFactory.cpp ImagingRemoteFactory.h @@ -26,7 +28,6 @@ set(SOURCE VRPNConnectionCollection.cpp VRPNConnectionCollection.h) - osvr_add_library() set_target_properties(${LIBNAME_FULL} PROPERTIES diff --git a/src/osvr/Client/CreateContext.cpp b/src/osvr/Client/CreateContext.cpp index 161b097e2..7aff4e7cc 100644 --- a/src/osvr/Client/CreateContext.cpp +++ b/src/osvr/Client/CreateContext.cpp @@ -26,6 +26,7 @@ #include #include "PureClientContext.h" #include +#include // Library/third-party includes // - none @@ -38,6 +39,8 @@ namespace client { common::ClientContext *createContext(const char appId[], const char host[]) { + OSVR_DEV_VERBOSE("Creating client context - OSVR " + << getModuleName() << " " << getVersionString()); common::ClientContext *ret = nullptr; if (!appId || std::strlen(appId) == 0) { OSVR_DEV_VERBOSE("Could not create client context - null or empty " diff --git a/src/osvr/Client/GetRuntimeVersion.cpp b/src/osvr/Client/GetRuntimeVersion.cpp new file mode 100644 index 000000000..e550a2a71 --- /dev/null +++ b/src/osvr/Client/GetRuntimeVersion.cpp @@ -0,0 +1,44 @@ +/** @file + @brief Implementation + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Internal Includes +#include +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace client { +#include +} // namespace client +} // namespace osvr diff --git a/src/osvr/Common/CMakeLists.txt b/src/osvr/Common/CMakeLists.txt index 65f8d162e..2c089da9e 100644 --- a/src/osvr/Common/CMakeLists.txt +++ b/src/osvr/Common/CMakeLists.txt @@ -38,6 +38,7 @@ set(API "${HEADER_LOCATION}/DeviceComponentPtr.h" "${HEADER_LOCATION}/Endianness.h" "${HEADER_LOCATION}/GetEnvironmentVariable.h" + "${HEADER_LOCATION}/GetRuntimeVersion.h" "${HEADER_LOCATION}/ImagingComponent.h" "${HEADER_LOCATION}/IntegerByteSwap.h" "${HEADER_LOCATION}/InterfaceCallbacks.h" @@ -101,6 +102,7 @@ set(SOURCE DeviceWrapper.h GetEnvironmentVariable.cpp GetJSONStringFromTree.h + GetRuntimeVersion.cpp ImagingComponent.cpp IPCRingBuffer.cpp IPCRingBufferResults.h diff --git a/src/osvr/Common/GetRuntimeVersion.cpp b/src/osvr/Common/GetRuntimeVersion.cpp new file mode 100644 index 000000000..ba36f6c8a --- /dev/null +++ b/src/osvr/Common/GetRuntimeVersion.cpp @@ -0,0 +1,44 @@ +/** @file + @brief Implementation + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Internal Includes +#include +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace common { +#include +} // namespace common +} // namespace osvr diff --git a/src/osvr/Connection/CMakeLists.txt b/src/osvr/Connection/CMakeLists.txt index e9e60d14a..a9f07197f 100755 --- a/src/osvr/Connection/CMakeLists.txt +++ b/src/osvr/Connection/CMakeLists.txt @@ -11,6 +11,7 @@ set(API "${HEADER_LOCATION}/DeviceInitObject.h" "${HEADER_LOCATION}/DeviceToken.h" "${HEADER_LOCATION}/DeviceTokenPtr.h" + "${HEADER_LOCATION}/GetRuntimeVersion.h" "${HEADER_LOCATION}/ImagingServerInterface.h" "${HEADER_LOCATION}/MessageType.h" "${HEADER_LOCATION}/MessageTypePtr.h" @@ -32,6 +33,7 @@ set(SOURCE GenerateVrpnDynamicServer.cpp GenerateVrpnDynamicServer.h GenericConnectionDevice.h + GetRuntimeVersion.cpp ImagingServerInterface.cpp MessageType.cpp SyncDeviceToken.cpp diff --git a/src/osvr/Connection/GetRuntimeVersion.cpp b/src/osvr/Connection/GetRuntimeVersion.cpp new file mode 100644 index 000000000..97226f1a9 --- /dev/null +++ b/src/osvr/Connection/GetRuntimeVersion.cpp @@ -0,0 +1,44 @@ +/** @file + @brief Implementation + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Internal Includes +#include +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace connection { +#include +} // namespace connection +} // namespace osvr diff --git a/src/osvr/GenerateGetRuntimeVersion.cmake b/src/osvr/GenerateGetRuntimeVersion.cmake new file mode 100644 index 000000000..3bb892695 --- /dev/null +++ b/src/osvr/GenerateGetRuntimeVersion.cmake @@ -0,0 +1,29 @@ +# Manually-run script for generating the GetRuntimeVersion headers/implementations. +# Manually generated simply because they're identical except for module name. + +set(INPUT_H "${CMAKE_CURRENT_LIST_DIR}/GetRuntimeVersion.h.in") +set(INPUT_CPP "${CMAKE_CURRENT_LIST_DIR}/GetRuntimeVersion.cpp.in") +foreach(guidmod + 487199D9_CA87_4E85_52A2_D1BDBC119163:Client + 5BF26574_26A9_4DB1_27B9_B5B8E69F2AE1:Common + 6FCB818C_A087_4CB8_E0C4_29B472CCE703:Connection + 4A6A0FF9_4A87_4F9E_1192_82AEA1E1DF58:PluginHost + 8513C123_CF38_4F9F_586F_1A1FDA5463BA:Server + 4458E735_A9DC_4F94_AE78_433B41E5147F:USBSerial + FF76C4D7_2239_4DA3_0216_19D9473788E8:Util + D58CA30A_7011_4BA6_509B_CF2A61DDF191:VRPNServer) + + string(SUBSTRING "${guidmod}" 0 36 GUID) + string(SUBSTRING "${guidmod}" 37 -1 Modname) + message(STATUS "Module: '${Modname}'") + string(TOUPPER "${Modname}" MODNAME) + string(TOLOWER "${Modname}" modname) + configure_file("${INPUT_H}" + "${CMAKE_CURRENT_LIST_DIR}/../../inc/osvr/${Modname}/GetRuntimeVersion.h" + @ONLY + NEWLINE_STYLE LF) + configure_file("${INPUT_CPP}" + "${CMAKE_CURRENT_LIST_DIR}/${Modname}/GetRuntimeVersion.cpp" + @ONLY + NEWLINE_STYLE LF) +endforeach() diff --git a/src/osvr/GetRuntimeVersion.cpp.in b/src/osvr/GetRuntimeVersion.cpp.in new file mode 100644 index 000000000..1aab69164 --- /dev/null +++ b/src/osvr/GetRuntimeVersion.cpp.in @@ -0,0 +1,44 @@ +/** @file + @brief Implementation + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Internal Includes +#include +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace @modname@ { +#include +} // namespace @modname@ +} // namespace osvr diff --git a/src/osvr/GetRuntimeVersion.h.in b/src/osvr/GetRuntimeVersion.h.in new file mode 100644 index 000000000..1ab9ade5e --- /dev/null +++ b/src/osvr/GetRuntimeVersion.h.in @@ -0,0 +1,77 @@ +/** @file + @brief Header for accessing runtime version information. + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_GetRuntimeVersion_h_GUID_@GUID@ +#define INCLUDED_GetRuntimeVersion_h_GUID_@GUID@ + +// Internal Includes +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace @modname@ { + /// @brief Returns the value of the version component (zero-indexed) + /// specified, in the inclusive range [0,3]. + /// @return version component value, or 0 if component out of range. + OSVR_@MODNAME@_EXPORT util::NumericVersionComponent + getVersionComponent(uint8_t componentIndex); + + /// @brief Gets all numeric components of the runtime version in a tuple. + OSVR_@MODNAME@_EXPORT util::RuntimeNumericVersion getRuntimeNumericVersion(); + + /// @brief Gets the Git commit hash corresponding to this library build. + /// @returns an empty string if the commit hash could not be detected. + OSVR_@MODNAME@_EXPORT const char *getCommit(); + + /// @brief Gets the full descriptive version string, typically including the + /// numerical version components and the commit hash. + OSVR_@MODNAME@_EXPORT const char *getVersionString(); + + /// @brief If this was built by the CI, return the "Build Tag" the CI + /// associated with the build job. (Unrelated to git tags.) + /// @returns empty string if we don't have a CI build tag recorded. + OSVR_@MODNAME@_EXPORT const char *getCIBuildTag(); + + /// @brief Does this build identify itself as a dev build, rather than a + /// CI-build "production" build? This is not necessarily 100% accurate - for + /// informational purposes only. + OSVR_@MODNAME@_EXPORT bool isKnownDevBuild(); + + /// @brief Gets the name of this library/module, or an empty string if the + /// build system did not incorporate this information into the build. + OSVR_@MODNAME@_EXPORT const char *getModuleName(); +} // namespace @modname@ +} // namespace osvr + +#endif // INCLUDED_GetRuntimeVersion_h_GUID_@GUID@ diff --git a/src/osvr/Macros.cmake b/src/osvr/Macros.cmake index 109e31f03..9375b780a 100644 --- a/src/osvr/Macros.cmake +++ b/src/osvr/Macros.cmake @@ -37,6 +37,9 @@ macro(osvr_add_library) target_compile_definitions(${LIBNAME_FULL} PUBLIC ${EXPORT_BASENAME}_STATIC_DEFINE) endif() + # Module name + target_compile_definitions(${LIBNAME_FULL} PRIVATE OSVR_MODULE_NAME="${LIBNAME}") + target_include_directories(${LIBNAME_FULL} PUBLIC $ diff --git a/src/osvr/PluginHost/CMakeLists.txt b/src/osvr/PluginHost/CMakeLists.txt index afe2311d5..8fe9cfaba 100644 --- a/src/osvr/PluginHost/CMakeLists.txt +++ b/src/osvr/PluginHost/CMakeLists.txt @@ -1,6 +1,7 @@ osvr_setup_lib_vars(PluginHost) set(API + "${HEADER_LOCATION}/GetRuntimeVersion.h" "${HEADER_LOCATION}/PluginSpecificRegistrationContext_fwd.h" "${HEADER_LOCATION}/PluginSpecificRegistrationContext.h" "${HEADER_LOCATION}/PluginRegPtr.h" @@ -11,6 +12,7 @@ set(API set(SOURCE BinaryLocation.cpp BinaryLocation.h + GetRuntimeVersion.cpp PluginSpecificRegistrationContext.cpp PluginSpecificRegistrationContextImpl.cpp PluginSpecificRegistrationContextImpl.h diff --git a/src/osvr/PluginHost/GetRuntimeVersion.cpp b/src/osvr/PluginHost/GetRuntimeVersion.cpp new file mode 100644 index 000000000..5d24ebddc --- /dev/null +++ b/src/osvr/PluginHost/GetRuntimeVersion.cpp @@ -0,0 +1,44 @@ +/** @file + @brief Implementation + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Internal Includes +#include +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace pluginhost { +#include +} // namespace pluginhost +} // namespace osvr diff --git a/src/osvr/Server/CMakeLists.txt b/src/osvr/Server/CMakeLists.txt index bfb4b97b7..66c395e16 100644 --- a/src/osvr/Server/CMakeLists.txt +++ b/src/osvr/Server/CMakeLists.txt @@ -3,6 +3,7 @@ osvr_setup_lib_vars(Server) set(API "${HEADER_LOCATION}/ConfigureServer.h" "${HEADER_LOCATION}/ConfigureServerFromFile.h" + "${HEADER_LOCATION}/GetRuntimeVersion.h" "${HEADER_LOCATION}/Server.h" "${HEADER_LOCATION}/ServerPtr.h" "${HEADER_LOCATION}/RegisterShutdownHandler.h" @@ -11,6 +12,7 @@ set(API set(SOURCE ConfigureServer.cpp + GetRuntimeVersion.cpp JSONResolvePossibleRef.h JSONResolvePossibleRef.cpp Server.cpp diff --git a/src/osvr/Server/GetRuntimeVersion.cpp b/src/osvr/Server/GetRuntimeVersion.cpp new file mode 100644 index 000000000..0dffd5247 --- /dev/null +++ b/src/osvr/Server/GetRuntimeVersion.cpp @@ -0,0 +1,44 @@ +/** @file + @brief Implementation + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Internal Includes +#include +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace server { +#include +} // namespace server +} // namespace osvr diff --git a/src/osvr/USBSerial/CMakeLists.txt b/src/osvr/USBSerial/CMakeLists.txt index 2a84db157..c013faa81 100644 --- a/src/osvr/USBSerial/CMakeLists.txt +++ b/src/osvr/USBSerial/CMakeLists.txt @@ -1,9 +1,11 @@ osvr_setup_lib_vars(USBSerial) set(API + "${HEADER_LOCATION}/GetRuntimeVersion.h" "${HEADER_LOCATION}/USBSerialDevice.h" "${HEADER_LOCATION}/USBSerialEnum.h") set(SOURCE + GetRuntimeVersion.cpp USBSerialDevInfo.h USBSerialDevInfo.cpp USBSerialDevInfo_Linux.h diff --git a/src/osvr/USBSerial/GetRuntimeVersion.cpp b/src/osvr/USBSerial/GetRuntimeVersion.cpp new file mode 100644 index 000000000..72463b3e8 --- /dev/null +++ b/src/osvr/USBSerial/GetRuntimeVersion.cpp @@ -0,0 +1,44 @@ +/** @file + @brief Implementation + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Internal Includes +#include +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace usbserial { +#include +} // namespace usbserial +} // namespace osvr diff --git a/src/osvr/Util/CMakeLists.txt b/src/osvr/Util/CMakeLists.txt index 2cbe41b3b..1eac2b1af 100644 --- a/src/osvr/Util/CMakeLists.txt +++ b/src/osvr/Util/CMakeLists.txt @@ -6,6 +6,41 @@ if(BUILD_DEV_VERBOSE) endif() configure_file(Verbosity.h.in "${CMAKE_CURRENT_BINARY_DIR}/Verbosity.h") +### +# Version header +### +configure_file(Version.h.in "${CMAKE_CURRENT_BINARY_DIR}/Version.h") + +### +# Version resource helper +### +set(OSVR_RC_COMMONCOMMENTS_STR "") +if(OSVR_BIT_VARIANT) + set(OSVR_RC_COMMONCOMMENTS_STR "${OSVR_BIT_VARIANT}") +endif() +# TODO make this actually update automatically +set(OSVR_RC_CURRENTYEAR_STR 2015) + +if(WIN32) + if(MSVC) + set(OSVR_RC_COMPILER_STR "MSVC ${MSVC_VERSION}") + elseif("${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}" MATCHES "/gcc/") + foreach(linkdir ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}) + if("${linkdir}" MATCHES "gcc/([^/]+/[.0-9]+)") + set(OSVR_RC_COMPILER_STR "GCC ${CMAKE_MATCH_1}") + break() + endif() + endforeach() + else() + set(OSVR_RC_COMPILER_STR "${CMAKE_CXX_COMPILER_ID}") + endif() +endif() +set(OSVR_RC_PRIVATEBUILDINFO "") +if(NOT OSVR_RC_RELEASEBUILD) + # TODO make this string descriptive + set(OSVR_RC_PRIVATEBUILDINFO "TODO") +endif() +configure_file(VersionResourceHelper.h.in "${CMAKE_CURRENT_BINARY_DIR}/VersionResourceHelper.h") ### # Platform Config Header @@ -42,6 +77,7 @@ set(API "${HEADER_LOCATION}/Flag.h" "${HEADER_LOCATION}/GenericCaller.h" "${HEADER_LOCATION}/GenericDeleter.h" + "${HEADER_LOCATION}/GetRuntimeVersion.h" "${HEADER_LOCATION}/GuardInterface.h" "${HEADER_LOCATION}/GuardInterfaceDummy.h" "${HEADER_LOCATION}/ImagingReportTypesC.h" @@ -77,15 +113,25 @@ set(API "${HEADER_LOCATION}/ValueOrRange.h" "${HEADER_LOCATION}/Vec3C.h" "${HEADER_LOCATION}/WindowsVariantC.h" - "${CMAKE_CURRENT_BINARY_DIR}/PlatformConfig.h") + "${CMAKE_CURRENT_BINARY_DIR}/PlatformConfig.h" + "${CMAKE_CURRENT_BINARY_DIR}/VersionResourceHelper.h" + "${CMAKE_CURRENT_BINARY_DIR}/Version.h") + +if(WIN32 AND FALSE) + list(APPEND API + "${HEADER_LOCATION}/SharedVersion.rc") +endif() set(SOURCE AnyMap.cpp Deletable.cpp + GetRuntimeVersion.cpp GuardInterface.cpp TimeValueC.cpp MessageKeys.cpp PlatformConfig.h.in + VersionResourceHelper.h.in + Version.h.in Verbosity.h.in ClientCallbackTypesC.h.in ClientCallbackTypesCSnippet.h.in diff --git a/src/osvr/Util/GetRuntimeVersion.cpp b/src/osvr/Util/GetRuntimeVersion.cpp new file mode 100644 index 000000000..0c8d35ed3 --- /dev/null +++ b/src/osvr/Util/GetRuntimeVersion.cpp @@ -0,0 +1,44 @@ +/** @file + @brief Implementation + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Internal Includes +#include +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace util { +#include +} // namespace util +} // namespace osvr diff --git a/src/osvr/Util/Version.h.in b/src/osvr/Util/Version.h.in new file mode 100644 index 000000000..316538fda --- /dev/null +++ b/src/osvr/Util/Version.h.in @@ -0,0 +1,63 @@ +/** @file + @brief Generated header containing version information on this build. + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef INCLUDED_Version_h_GUID_21A16B7B_8942_41A9_0C2A_EF19730DDE7F +#define INCLUDED_Version_h_GUID_21A16B7B_8942_41A9_0C2A_EF19730DDE7F + +/* clang-format off */ +/** @brief Component 1 of the version ("major") */ +#define OSVR_CORE_VERSION_1 @OSVR_CORE_VERSION_1@ + +/** @brief Component 2 of the version ("minor") */ +#define OSVR_CORE_VERSION_2 @OSVR_CORE_VERSION_2@ + +/** @brief Component 3 of the version ("micro" or "patch") - currently + generated by `git describe` +*/ +#define OSVR_CORE_VERSION_3 @OSVR_CORE_VERSION_3@ + +/** @brief Component 4 of the version ("tweak") - typically 0, although + "official builds" may place a build number here. +*/ +#define OSVR_CORE_VERSION_4 @OSVR_CORE_VERSION_4@ +/* clang-format on */ + +/** @brief The abbreviated commit hash corresponding to this build. */ +#cmakedefine OSVR_CORE_VERSION_COMMIT "@OSVR_CORE_VERSION_COMMIT@" + +#ifndef OSVR_CORE_VERSION_COMMIT +#define OSVR_CORE_VERSION_COMMIT "" +#endif + +/** @brief The version described as a string literal */ +#cmakedefine OSVR_CORE_VERSION_STRING "@OSVR_CORE_VERSION_STRING@" + +/** @brief Defined if this is a self-proclaimed "official build" - just + convenience, not actual assurance (just a build switch) */ +#cmakedefine OSVR_CORE_OFFICIAL_BUILD 1 + +/** @brief Primarily in official builds, a build ID/tag from the build system */ +#cmakedefine OSVR_CORE_BUILD_TAG "@OSVR_CORE_BUILD_TAG@" + +#endif // INCLUDED_Version_h_GUID_21A16B7B_8942_41A9_0C2A_EF19730DDE7F diff --git a/src/osvr/VRPNServer/CMakeLists.txt b/src/osvr/VRPNServer/CMakeLists.txt index 41996dbda..7511ddbd6 100644 --- a/src/osvr/VRPNServer/CMakeLists.txt +++ b/src/osvr/VRPNServer/CMakeLists.txt @@ -1,10 +1,12 @@ osvr_setup_lib_vars(VRPNServer) set(API + "${HEADER_LOCATION}/GetRuntimeVersion.h" "${HEADER_LOCATION}/GetVRPNConnection.h" "${HEADER_LOCATION}/VRPNDeviceRegistration.h") set(SOURCE + GetRuntimeVersion.cpp GetVRPNConnection.cpp VRPNDeviceRegistration.cpp) diff --git a/src/osvr/VRPNServer/GetRuntimeVersion.cpp b/src/osvr/VRPNServer/GetRuntimeVersion.cpp new file mode 100644 index 000000000..57e729fec --- /dev/null +++ b/src/osvr/VRPNServer/GetRuntimeVersion.cpp @@ -0,0 +1,44 @@ +/** @file + @brief Implementation + + Generated by running: + + `cmake -P src/osvr/GenerateGetRuntimeVersion.cmake` + + @date 2015 + + @author + Sensics, Inc. + +*/ + +// Copyright 2015 Sensics, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Internal Includes +#include +#include +#include + +// Library/third-party includes +// - none + +// Standard includes +// - none + +namespace osvr { +namespace vrpnserver { +#include +} // namespace vrpnserver +} // namespace osvr diff --git a/tests/header_dependencies/CMakeLists.txt b/tests/header_dependencies/CMakeLists.txt index 6d1c00f86..1c04d077c 100644 --- a/tests/header_dependencies/CMakeLists.txt +++ b/tests/header_dependencies/CMakeLists.txt @@ -2,7 +2,10 @@ # Ensure all headers include all dependencies # -set(IGNORED_HEADERS osvr/Util/MSStdIntC.h) +set(IGNORED_HEADERS + osvr/Util/MSStdIntC.h + osvr/Private/GetRuntimeVersion_InnerImpl.h) + if(NOT BUILD_USBSERIALENUM) list(APPEND IGNORED_HEADERS osvr/USBSerial/USBSerialDevice.h