File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.14)
22
3- project (libscratchcpp LANGUAGES C CXX)
3+ project (libscratchcpp VERSION 0.9.0 LANGUAGES C CXX)
44
55set (CMAKE_INCLUDE_CURRENT_DIR ON )
66set (CMAKE_CXX_STANDARD 17)
@@ -92,6 +92,10 @@ if (LIBSCRATCHCPP_NETWORK_SUPPORT)
9292endif ()
9393
9494target_compile_definitions (scratchcpp PRIVATE LIBSCRATCHCPP_LIBRARY)
95+ target_compile_definitions (scratchcpp PRIVATE LIBSCRATCHCPP_VERSION="${PROJECT_VERSION} " )
96+ target_compile_definitions (scratchcpp PRIVATE LIBSCRATCHCPP_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} )
97+ target_compile_definitions (scratchcpp PRIVATE LIBSCRATCHCPP_VERSION_MINOR=${PROJECT_VERSION_MINOR} )
98+ target_compile_definitions (scratchcpp PRIVATE LIBSCRATCHCPP_VERSION_PATCH=${PROJECT_VERSION_PATCH} )
9599
96100if (LIBSCRATCHCPP_BUILD_UNIT_TESTS)
97101 enable_testing ()
Original file line number Diff line number Diff line change @@ -40,6 +40,11 @@ class LIBSCRATCHCPP_EXPORT ScratchConfiguration
4040 static void removeGraphicsEffect (const std::string &name);
4141 static IGraphicsEffect *getGraphicsEffect (const std::string &name);
4242
43+ static const std::string &version ();
44+ static int majorVersion ();
45+ static int minorVersion ();
46+ static int patchVersion ();
47+
4348 private:
4449 static const std::vector<std::shared_ptr<IExtension>> getExtensions ();
4550
Original file line number Diff line number Diff line change @@ -49,6 +49,31 @@ IGraphicsEffect *ScratchConfiguration::getGraphicsEffect(const std::string &name
4949 return it->second .get ();
5050}
5151
52+ /* ! Returns the version string of the library. */
53+ const std::string &ScratchConfiguration::version ()
54+ {
55+ static const std::string ret = LIBSCRATCHCPP_VERSION;
56+ return ret;
57+ }
58+
59+ /* ! Returns the major version of the library. */
60+ int ScratchConfiguration::majorVersion ()
61+ {
62+ return LIBSCRATCHCPP_VERSION_MAJOR;
63+ }
64+
65+ /* ! Returns the minor version of the library. */
66+ int ScratchConfiguration::minorVersion ()
67+ {
68+ return LIBSCRATCHCPP_VERSION_MINOR;
69+ }
70+
71+ /* ! Returns the patch version of the library. */
72+ int ScratchConfiguration::patchVersion ()
73+ {
74+ return LIBSCRATCHCPP_VERSION_PATCH;
75+ }
76+
5277const std::vector<std::shared_ptr<IExtension>> ScratchConfiguration::getExtensions ()
5378{
5479 return impl->extensions ;
You can’t perform that action at this time.
0 commit comments