Skip to content

Commit

Permalink
Add soname/soversion in Unix libs
Browse files Browse the repository at this point in the history
https://en.wikipedia.org/wiki/Soname
https://cmake.org/cmake/help/latest/prop_tgt/SOVERSION.html

- The SONAME/SOVERSION "rename" the libarary to `libavistnth.so.X.X.X` and add symlink to `libavisynth.so.X` and `libavisynth.so`.

~~~
└───╼  ls libavisynth.so*
lrwxrwxrwx 1 sl1pkn07 users       16 mar 19 02:00 libavisynth.so -> libavisynth.so.3
lrwxrwxrwx 1 sl1pkn07 users       20 mar 19 02:00 libavisynth.so.3 -> libavisynth.so.3.5.0
-rwxr-xr-x 1 sl1pkn07 users 10916424 mar 19 02:00 libavisynth.so.3.5.0
└───╼  objdump -p libavisynth.so.3.5.0 | grep SONAME
  SONAME               libavisynth.so.3
└───╼  readelf -d libavisynth.so.3.5.0 | grep SONAME
 0x000000000000000e (SONAME)             Nombre-so de la biblioteca: [libavisynth.so.3]
~~~

- Add `PROJECT_VERSION` in the `project()` function with moving some code from `avs_core\CMakeLists.txt` to main `CMakeLists`.

- Add little tweak in all CMakeFiles.
  • Loading branch information
sl1pkn07 committed Mar 27, 2020
1 parent d438bd5 commit 47231a2
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 19 deletions.
17 changes: 15 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@
# "Visual Studio 16 2019" + LLVM 8.0 (clang) optional platform generator Win32 and x64
CMAKE_MINIMUM_REQUIRED( VERSION 3.8.2 )

# Get PROJECT_VERSION property from 'avs_core/core/version.h.in'
file(READ "avs_core/core/version.h.in" versioning)
string(REGEX MATCH "AVS_MAJOR_VER ([0-9]*)" _ ${versioning})
set(version_major ${CMAKE_MATCH_1})
string(REGEX MATCH "AVS_MINOR_VER ([0-9]*)" _ ${versioning})
set(version_minor ${CMAKE_MATCH_1})
string(REGEX MATCH "AVS_BUGFIX_VER ([0-9]*)" _ ${versioning})
set(version_bugfix ${CMAKE_MATCH_1})
# Get AVISYNTH_INTERFACE_VERSION from avs_core/include/avisynth.h
file(READ "avs_core/include/avisynth.h" versioning)
string(REGEX MATCH "AVISYNTH_INTERFACE_VERSION = ([0-9]*)" _ ${versioning})
set(AVISYNTH_INTERFACE_VERSION ${CMAKE_MATCH_1})

option(HEADERS_ONLY "Install only the Headers" ${INSTALL_ONLY_HEADER})
if(${INSTALL_ONLY_HEADER})
set(INSTALL_ONLY_HEADER OFF)
Expand All @@ -18,7 +31,7 @@ include(GNUInstallDirs)

if(NOT HEADERS_ONLY)

project("AviSynth+")
project("AviSynth+" VERSION ${version_major}.${version_minor}.${version_bugfix} LANGUAGES CXX)

# Avoid uselessly linking to unused libraries
set(CMAKE_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
Expand Down Expand Up @@ -195,7 +208,7 @@ if(NOT HEADERS_ONLY)

else()

project(AviSynth-Headers NONE)
project(AviSynth-Headers VERSION ${version_major}.${version_minor}.${version_bugfix} LANGUAGES)
message(STATUS "Install Only Headers: ON")

add_library(${PROJECT_NAME} INTERFACE)
Expand Down
11 changes: 2 additions & 9 deletions avs_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ else()
endif()

# Create library
project("AvsCore")
project("AvsCore" VERSION "${PROJECT_VERSION}" LANGUAGES CXX)
Include("Files.cmake")
add_library("AvsCore" SHARED ${AvsCore_Sources})
set_target_properties("AvsCore" PROPERTIES "OUTPUT_NAME" "${CoreName}")
set_target_properties("AvsCore" PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${AVISYNTH_INTERFACE_VERSION})
if (MINGW)
set_target_properties("AvsCore" PROPERTIES PREFIX "")
set_target_properties("AvsCore" PROPERTIES IMPORT_PREFIX "")
Expand Down Expand Up @@ -138,14 +139,6 @@ ADD_CUSTOM_TARGET(
ADD_DEPENDENCIES("AvsCore" VersionGen)

# Generate pkg-config file
file(READ "core/version.h.in" versioning)
string(REGEX MATCH "AVS_MAJOR_VER ([0-9]*)" _ ${versioning})
set(version_major ${CMAKE_MATCH_1})
string(REGEX MATCH "AVS_MINOR_VER ([0-9]*)" _ ${versioning})
set(version_minor ${CMAKE_MATCH_1})
string(REGEX MATCH "AVS_BUGFIX_VER ([0-9]*)" _ ${versioning})
set(version_bugfix ${CMAKE_MATCH_1})
set(AVS_VERSION "${version_major}.${version_minor}.${version_bugfix}")
get_target_property(LIB_NAME AvsCore OUTPUT_NAME)
set(LIBS "-l${LIB_NAME}")
CONFIGURE_FILE("avisynth.pc.in" "avisynth.pc" @ONLY)
Expand Down
2 changes: 1 addition & 1 deletion avs_core/avisynth.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ includedir=${exec_prefix}/@CMAKE_INSTALL_INCLUDEDIR@/avisynth

Name: AviSynth+
Description: A powerful nonlinear scripting language for video.
Version: @AVS_VERSION@
Version: @PROJECT_VERSION@

Libs: -L${libdir} @LIBS@
Cflags: -I${includedir}
2 changes: 1 addition & 1 deletion plugins/ConvertStacked/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (NOT WIN32)
endif()

# Create library
project(${ProjectName})
project(${ProjectName} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
list (APPEND SourceFiles
"ConvertStacked.cpp"
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/DirectShowSource/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set(DSHOWSRC_BASECLASSES_PATH "${DEFAULT_BASECLASSES_PATH}" CACHE STRING "Fold
set(DSHOWSRC_BASECLASSES_LIB "${DEFAULT_BASECLASSES_LIB}" CACHE FILEPATH "File path to the DirectShow example baseclasses precompiled static library ('strmbase.lib').")

# Create library
project(${ProjectName})
project(${ProjectName} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
list (APPEND SourceFiles
"directshow_source.cpp"
"directshow_source.h"
Expand Down
2 changes: 1 addition & 1 deletion plugins/ImageSeq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (NOT WIN32)
endif()

# Create library
project(${ProjectName})
project(${ProjectName} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
list (APPEND SourceFiles
"ImageSeq.cpp"
"ImageSeq.h"
Expand Down
2 changes: 1 addition & 1 deletion plugins/Shibatch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (NOT WIN32)
endif()

# Create library
project(${ProjectName})
project(${ProjectName} VERSION ${PROJECT_VERSION} LANGUAGES C)
list (APPEND SourceFiles
"dbesi0.c"
"fft.h"
Expand Down
2 changes: 1 addition & 1 deletion plugins/TimeStretch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (NOT WIN32)
endif()

# Create library
project(${ProjectName})
project(${ProjectName} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
list (APPEND SourceFiles
"TimeStretch.cpp"
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/VDubFilter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(PluginName "VDubFilter")
set(ProjectName "Plugin${PluginName}")

# Create library
project(${ProjectName})
project(${ProjectName} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
list (APPEND SourceFiles
"VDubFilter.cpp"
"GetCPUFlags.cpp"
Expand Down
2 changes: 1 addition & 1 deletion plugins/VFAPIFilter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(DSHOWSRC_BASECLASSES_LIB CACHE FILEPATH "File path to the DirectShow example
set(DSHOWSRC_DX_INCLUDE_PATH "C:/Program Files/Microsoft DirectX SDK (August 2009)/Include" CACHE STRING "Include folder path to the DirectX headers.")

# Create library
project(${ProjectName})
project(${ProjectName} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
list (APPEND SourceFiles
"VFAPIFilter.cpp"
)
Expand Down

0 comments on commit 47231a2

Please sign in to comment.