Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.14)

project(libscratchcpp LANGUAGES C CXX)
project(libscratchcpp VERSION 0.9.0 LANGUAGES C CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -92,6 +92,10 @@ if (LIBSCRATCHCPP_NETWORK_SUPPORT)
endif()

target_compile_definitions(scratchcpp PRIVATE LIBSCRATCHCPP_LIBRARY)
target_compile_definitions(scratchcpp PRIVATE LIBSCRATCHCPP_VERSION="${PROJECT_VERSION}")
target_compile_definitions(scratchcpp PRIVATE LIBSCRATCHCPP_VERSION_MAJOR=${PROJECT_VERSION_MAJOR})
target_compile_definitions(scratchcpp PRIVATE LIBSCRATCHCPP_VERSION_MINOR=${PROJECT_VERSION_MINOR})
target_compile_definitions(scratchcpp PRIVATE LIBSCRATCHCPP_VERSION_PATCH=${PROJECT_VERSION_PATCH})

if (LIBSCRATCHCPP_BUILD_UNIT_TESTS)
enable_testing()
Expand Down
5 changes: 5 additions & 0 deletions include/scratchcpp/scratchconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class LIBSCRATCHCPP_EXPORT ScratchConfiguration
static void removeGraphicsEffect(const std::string &name);
static IGraphicsEffect *getGraphicsEffect(const std::string &name);

static const std::string &version();
static int majorVersion();
static int minorVersion();
static int patchVersion();

private:
static const std::vector<std::shared_ptr<IExtension>> getExtensions();

Expand Down
25 changes: 25 additions & 0 deletions src/scratchconfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,31 @@ IGraphicsEffect *ScratchConfiguration::getGraphicsEffect(const std::string &name
return it->second.get();
}

/*! Returns the version string of the library. */
const std::string &ScratchConfiguration::version()
{
static const std::string ret = LIBSCRATCHCPP_VERSION;
return ret;
}

/*! Returns the major version of the library. */
int ScratchConfiguration::majorVersion()
{
return LIBSCRATCHCPP_VERSION_MAJOR;
}

/*! Returns the minor version of the library. */
int ScratchConfiguration::minorVersion()
{
return LIBSCRATCHCPP_VERSION_MINOR;
}

/*! Returns the patch version of the library. */
int ScratchConfiguration::patchVersion()
{
return LIBSCRATCHCPP_VERSION_PATCH;
}

const std::vector<std::shared_ptr<IExtension>> ScratchConfiguration::getExtensions()
{
return impl->extensions;
Expand Down