fix(cmake): generate versioned shared libraries (#5865)

Signed-off-by: Marek Vasut <marex@denx.de>
Co-authored-by: Marek Vasut <marex@denx.de>
This commit is contained in:
Marex 2024-04-20 20:33:09 +02:00 committed by GitHub
parent ffb3e3788c
commit 2c469279f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 47 additions and 6 deletions

View File

@ -1,3 +1,10 @@
set(LVGL_VERSION_MAJOR "9")
set(LVGL_VERSION_MINOR "1")
set(LVGL_VERSION_PATCH "1")
set(LVGL_VERSION_INFO "dev")
set(LVGL_VERSION ${LVGL_VERSION_MAJOR}.${LVGL_VERSION_MINOR}.${LVGL_VERSION_PATCH})
set(LVGL_SOVERSION ${LVGL_VERSION_MAJOR})
# Option to define LV_LVGL_H_INCLUDE_SIMPLE, default: ON
option(LV_LVGL_H_INCLUDE_SIMPLE
"Use #include \"lvgl.h\" instead of #include \"../../lvgl.h\"" ON)
@ -47,7 +54,7 @@ if(LV_CONF_SKIP)
endif()
# Include root and optional parent path of LV_CONF_PATH
target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${LV_CONF_DIR})
target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${LV_CONF_DIR} ${CMAKE_CURRENT_BINARY_DIR})
if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL)
@ -120,6 +127,7 @@ endif()
configure_file("${LVGL_ROOT_DIR}/lvgl.pc.in" lvgl.pc @ONLY)
configure_file("${LVGL_ROOT_DIR}/lv_version.h.in" lv_version.h @ONLY)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/lvgl.pc"
@ -129,6 +137,8 @@ install(
set_target_properties(
lvgl
PROPERTIES OUTPUT_NAME lvgl
VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
@ -147,6 +157,8 @@ if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL)
set_target_properties(
lvgl_thorvg
PROPERTIES OUTPUT_NAME lvgl_thorvg
VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
@ -165,6 +177,8 @@ if(NOT LV_CONF_BUILD_DISABLE_DEMOS)
set_target_properties(
lvgl_demos
PROPERTIES OUTPUT_NAME lvgl_demos
VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
@ -183,6 +197,8 @@ if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
set_target_properties(
lvgl_examples
PROPERTIES OUTPUT_NAME lvgl_examples
VERSION ${LVGL_VERSION}
SOVERSION ${LVGL_SOVERSION}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"

14
lv_version.h Normal file
View File

@ -0,0 +1,14 @@
/**
* @file version.h
* The current version of LVGL
*/
#ifndef LVGL_VERSION_H
#define LVGL_VERSION_H
#define LVGL_VERSION_MAJOR 9
#define LVGL_VERSION_MINOR 1
#define LVGL_VERSION_PATCH 1
#define LVGL_VERSION_INFO "dev"
#endif /*LVGL_VERSION_H*/

14
lv_version.h.in Normal file
View File

@ -0,0 +1,14 @@
/**
* @file version.h
* The current version of LVGL
*/
#ifndef LVGL_VERSION_H
#define LVGL_VERSION_H
#define LVGL_VERSION_MAJOR @LVGL_VERSION_MAJOR@
#define LVGL_VERSION_MINOR @LVGL_VERSION_MINOR@
#define LVGL_VERSION_PATCH @LVGL_VERSION_PATCH@
#define LVGL_VERSION_INFO "@LVGL_VERSION_INFO@"
#endif /*LVGL_VERSION_H*/

5
lvgl.h
View File

@ -13,10 +13,7 @@ extern "C" {
/***************************
* CURRENT VERSION OF LVGL
***************************/
#define LVGL_VERSION_MAJOR 9
#define LVGL_VERSION_MINOR 1
#define LVGL_VERSION_PATCH 1
#define LVGL_VERSION_INFO "dev"
#include "lv_version.h"
/*********************
* INCLUDES

View File

@ -5,6 +5,6 @@ libdir=${prefix}/lib
Name: lvgl
Description: Light and Versatile Graphics Library
URL: https://lvgl.io/
Version: 9.1.0
Version: @LVGL_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -llvgl