1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-12-16 16:35:45 +00:00

CMake: create shared libraries with correct SO name

Fix #174
This commit is contained in:
Xorg 2022-10-22 21:16:44 +02:00
parent e073118328
commit 7cabadd903
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A
3 changed files with 18 additions and 7 deletions

View file

@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.13)
set(VERSION "0.6.0")
set(SOVERSION 16)
set(LIBCPUID_CURRENT 16)
set(LIBCPUID_AGE 0)
set(LIBCPUID_REVISION 0)
project(
cpuid
LANGUAGES C CXX ASM_MASM

View file

@ -16,13 +16,22 @@ if ! [[ "$SO_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
exit 1
fi
IFS='.' read -a so_version_array <<< "$SO_VERSION"
LIBCPUID_CURRENT="${so_version_array[0]}"
LIBCPUID_AGE="${so_version_array[1]}"
LIBCPUID_REVISION="${so_version_array[2]}"
echo "$DATE: bumping libcpuid version from $OLD_VERSION to $NEW_VERSION"
echo "LIBCPUID_CURRENT=$LIBCPUID_CURRENT LIBCPUID_AGE=$LIBCPUID_AGE LIBCPUID_REVISION=$LIBCPUID_REVISION"
echo -e "\nVersion $NEW_VERSION ($DATE):" >> "$GIT_DIR/ChangeLog"
sed -i "s|\[$OLD_VERSION\]|\[$NEW_VERSION\]|" "$GIT_DIR/configure.ac"
sed -i "s|LIBCPUID_CURRENT=.*|dnl $(echo $SO_VERSION | tr . :) Version $NEW_VERSION:\nLIBCPUID_CURRENT=$(echo $SO_VERSION | cut -d. -f1)|" "$GIT_DIR/configure.ac"
sed -i "s|LIBCPUID_AGE=.*|LIBCPUID_AGE=$(echo $SO_VERSION | cut -d. -f2)|" "$GIT_DIR/configure.ac"
sed -i "s|LIBCPUID_REVISION=.*|LIBCPUID_REVISION=$(echo $SO_VERSION | cut -d. -f3)|" "$GIT_DIR/configure.ac"
sed -i "s|LIBCPUID_CURRENT=.*|dnl $(echo $SO_VERSION | tr . :) Version $NEW_VERSION:\nLIBCPUID_CURRENT=$LIBCPUID_CURRENT|" "$GIT_DIR/configure.ac"
sed -i "s|LIBCPUID_AGE=.*|LIBCPUID_AGE=$LIBCPUID_AGE|" "$GIT_DIR/configure.ac"
sed -i "s|LIBCPUID_REVISION=.*|LIBCPUID_REVISION=$LIBCPUID_REVISION|" "$GIT_DIR/configure.ac"
sed -i "s|VERSION \"$OLD_VERSION\"|VERSION \"$NEW_VERSION\"|" "$GIT_DIR/CMakeLists.txt"
sed -i "s|set(SOVERSION .*)|set(SOVERSION $(echo $SO_VERSION | cut -d. -f1))|" "$GIT_DIR/CMakeLists.txt"
sed -i "s|set(LIBCPUID_CURRENT .*)|set(LIBCPUID_CURRENT $LIBCPUID_CURRENT)|" "$GIT_DIR/CMakeLists.txt"
sed -i "s|set(LIBCPUID_AGE .*)|set(LIBCPUID_AGE $LIBCPUID_AGE)|" "$GIT_DIR/CMakeLists.txt"
sed -i "s|set(LIBCPUID_REVISION .*)|set(LIBCPUID_REVISION $LIBCPUID_REVISION)|" "$GIT_DIR/CMakeLists.txt"
sed -i "s|$OLD_VERSION|$NEW_VERSION|g" "$GIT_DIR/libcpuid/"{Makefile.x64,Makefile.x86,libcpuid.dsp,libcpuid_vc10.vcxproj,libcpuid_vc71.vcproj}
sed -i "s|\\\version $OLD_VERSION|\\\version $NEW_VERSION|" "$GIT_DIR/libcpuid/libcpuid.h"

View file

@ -23,8 +23,8 @@ set_property(TARGET cpuid PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON)
target_include_directories(cpuid SYSTEM PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_compile_definitions(cpuid PRIVATE VERSION="${PROJECT_VERSION}")
set_target_properties(cpuid PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(cpuid PROPERTIES SOVERSION ${SOVERSION})
set_target_properties(cpuid PROPERTIES VERSION "${LIBCPUID_CURRENT}.${LIBCPUID_AGE}.${LIBCPUID_REVISION}")
set_target_properties(cpuid PROPERTIES SOVERSION "${LIBCPUID_CURRENT}")
set_target_properties(cpuid PROPERTIES PUBLIC_HEADER "libcpuid.h;libcpuid_types.h;libcpuid_constants.h")
# Documentation