From a97d152c8495ccf4272c733b63747a78b0371afa Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Tue, 29 Oct 2024 22:39:57 -0500 Subject: build: use lib name in version macros Use the library name in version define macros. This should prevent collisions when using the engine alongside other libraries, as the VERSION keyword is likely very common. In addition, create three new macros for the major, minor and patch numbers separately. This allows the engine to use only the part it needs, when it needs it. Signed-off-by: Danny Holman --- CMakeLists.txt | 5 ++++- core/init.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4ad9c0..91f8a98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,10 @@ endif() list(APPEND LINK_LIBS ${GLFW_LIBRARIES}) -add_compile_definitions(VERSION="${PROJECT_VERSION}") +add_compile_definitions(RUNE_VER="${PROJECT_VERSION}") +add_compile_definitions(RUNE_VER_MAJOR="${PROJECT_VERSION_MAJOR}") +add_compile_definitions(RUNE_VER_MINOR="${PROJECT_VERSION_MINOR}") +add_compile_definitions(RUNE_VER_PATCH="${PROJECT_VERSION_PATCH}") add_compile_definitions(RAPI_EXPORT) add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES}) diff --git a/core/init.c b/core/init.c index 96fee70..1a600ef 100644 --- a/core/init.c +++ b/core/init.c @@ -6,7 +6,8 @@ int rune_init(int argc, char* argv[]) { enable_log_color(); - log_output(LOG_INFO, "Started Rune Engine version %s", VERSION); + log_output(LOG_INFO, "Started Rune Engine version %s", RUNE_VER); + _parse_args(argc, argv); rune_init_thread_api(); return 0; } -- cgit v1.2.3