Add i3ipc::get_version()
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
||||||
project(i3ipc++)
|
project(i3ipc++)
|
||||||
|
|
||||||
|
string(TIMESTAMP I3IPCppBUILD_DATETIME "%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
option(I3IPCpp_WITH_TESTS "Build unit tests executables" OFF)
|
option(I3IPCpp_WITH_TESTS "Build unit tests executables" OFF)
|
||||||
option(I3IPCpp_BUILD_EXAMPLES "Build example executables" OFF)
|
option(I3IPCpp_BUILD_EXAMPLES "Build example executables" OFF)
|
||||||
|
|
||||||
@@ -58,6 +60,10 @@ target_compile_options(i3ipc++
|
|||||||
PUBLIC -std=c++11 -Wall -Wextra -Wno-unused-parameter
|
PUBLIC -std=c++11 -Wall -Wextra -Wno-unused-parameter
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(i3ipc++
|
||||||
|
PRIVATE I3IPC_BUILD_DATETIME="${I3IPCppBUILD_DATETIME}"
|
||||||
|
)
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
|
if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
|
||||||
target_compile_options(i3ipc++
|
target_compile_options(i3ipc++
|
||||||
PUBLIC -g3
|
PUBLIC -g3
|
||||||
|
|||||||
@@ -342,6 +342,12 @@ private:
|
|||||||
const std::string m_socket_path;
|
const std::string m_socket_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get version of i3ipc++
|
||||||
|
* @return the version of i3ipc++
|
||||||
|
*/
|
||||||
|
const version_t& get_version();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
15
src/ipc.cpp
15
src/ipc.cpp
@@ -553,4 +553,19 @@ int32_t connection::get_main_socket_fd() { return m_main_socket; }
|
|||||||
|
|
||||||
int32_t connection::get_event_socket_fd() { return m_event_socket; }
|
int32_t connection::get_event_socket_fd() { return m_event_socket; }
|
||||||
|
|
||||||
|
|
||||||
|
const version_t& get_version() {
|
||||||
|
#define I3IPC_VERSION_MAJOR 0
|
||||||
|
#define I3IPC_VERSION_MINOR 3
|
||||||
|
#define I3IPC_VERSION_PATCH 0
|
||||||
|
static version_t version = {
|
||||||
|
.human_readable = auss_t() << I3IPC_VERSION_MAJOR << '.' << I3IPC_VERSION_MINOR << '.' << I3IPC_VERSION_PATCH << " (built on " << I3IPC_BUILD_DATETIME << ")",
|
||||||
|
.loaded_config_file_name = std::string(),
|
||||||
|
.major = I3IPC_VERSION_MAJOR,
|
||||||
|
.minor = I3IPC_VERSION_MINOR,
|
||||||
|
.patch = I3IPC_VERSION_PATCH,
|
||||||
|
};
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user