Skip to content
Snippets Groups Projects
Commit e901be5b authored by Carl Philipp Klemm's avatar Carl Philipp Klemm
Browse files

add version information function

parent 4ff75825
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,13 @@ set(SRC_FILES
utils.c
)
set(CMAKE_PROJECT_VERSION_MAJOR 1)
set(CMAKE_PROJECT_VERSION_MINOR 1)
set(CMAKE_PROJECT_VERSION_PATCH 4)
add_compile_definitions(VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR})
add_compile_definitions(VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR})
add_compile_definitions(VERSION_PATCH=${CMAKE_PROJECT_VERSION_PATCH})
set(API_HEADERS_DIR relaxisloader/)
set(API_HEADERS_C
......@@ -28,10 +35,12 @@ if(WIN32)
${PROJECT_SOURCE_DIR}/strptime/strptime.c
)
set(SQL_LIBRARIES sqlite3.a)
else()
endif(WIN32)
add_library(${PROJECT_NAME} SHARED ${SRC_FILES} ${API_HEADERS_C})
set(LIBTYPE SHARED)
add_library(${PROJECT_NAME} ${LIBTYPE} ${SRC_FILES} ${API_HEADERS_C})
target_link_libraries(${PROJECT_NAME} ${SQL_LIBRARIES})
target_include_directories(${PROJECT_NAME} PUBLIC ./${API_HEADERS_DIR} ${SQL_INCLUDE_DIRS})
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-Wall -O2 -march=native -g" LINK_FLAGS "-flto -pthread")
......
......
......@@ -33,11 +33,12 @@ struct rlxfile
sqlite3 *db;
};
/**
* @brief Frees a project struct
*
* @param proj project struct to be freed, or NULL
*/
const struct rlx_version_fixed rlx_get_version(void)
{
static struct rlx_version_fixed version = {VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH};
return version;
}
void rlx_project_free(struct rlx_project* proj)
{
if(!proj)
......
......
......@@ -40,6 +40,22 @@ enum {
RLX_ERR_FMT = -104,
};
struct rlx_version_fixed {
int major;
int minor;
int patch;
};
/**
* @brief Gets the version of librelaxisloader
*
* This function must always be used for every singular rlx_project struct to avoid memory leaks.
* It is safe to pass NULL to this function.
*
* @return a rlx_version_fixed struct with the version, owned by librelaxisloader do not free.
*/
const struct rlx_version_fixed rlx_get_version(void);
struct rlxfile;
/**
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment