Skip to content

Commit

Permalink
Work on cmake and qmake install
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Aug 3, 2024
1 parent da9d035 commit b2a5369
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
19 changes: 11 additions & 8 deletions minivideo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ set(minivideo_PUBLIC_HEADERS
src/minivideo_mediafile.h src/minivideo_mediastream.h src/minivideo_metadata_vendors.h
src/minivideo_settings.h src/minivideo_typedef.h # internals?
src/minivideo_codecs_private_struct.h
src/decoder/h264/h264_parameterset_struct.h
src/decoder/h265/h265_parameterset_struct.h
src/decoder/h266/h266_parameterset_struct.h
#src/decoder/h264/h264_parameterset_struct.h
#src/decoder/h265/h265_parameterset_struct.h
#src/decoder/h266/h266_parameterset_struct.h
)

# Build
Expand Down Expand Up @@ -316,7 +316,7 @@ if (BUILD_STATIC_LIBS)
endif (BUILD_STATIC_LIBS)


# Deployment
# Deployment (optional step, requires root credentials, relative to CMAKE_INSTALL_PREFIX)
################################################################################

# pkg-config integration
Expand All @@ -326,16 +326,19 @@ set(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Installation prefix
set(BIN_INSTALL_DIR ${EXEC_INSTALL_PREFIX}/bin CACHE PATH "Installation prefix for user executables" FORCE)
set(LIB_INSTALL_DIR ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH "Installation prefix for object code libraries" FORCE)
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/minivideo CACHE PATH "Installation prefix for header files" FORCE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libminivideo.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libminivideo.pc)
configure_file(libminivideo.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libminivideo.pc)

# Install the shared library and its header into the system (optional step, requires root credentials)
# Relative to $<INSTALL_PREFIX>
# Install pkgconfig file
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libminivideo.pc DESTINATION lib/pkgconfig/)

# Install the library into the system
if (BUILD_SHARED_LIBS)
install(TARGETS minivideo_shared DESTINATION lib/)
endif (BUILD_SHARED_LIBS)
if (BUILD_STATIC_LIBS)
install(TARGETS minivideo_static DESTINATION lib/)
endif (BUILD_STATIC_LIBS)

# Install headers
install(FILES ${minivideo_PUBLIC_HEADERS} DESTINATION include/minivideo/)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libminivideo.pc DESTINATION lib/pkgconfig/)
install(DIRECTORY src/decoder/ DESTINATION include/minivideo/decoder/ FILES_MATCHING PATTERN "*_parameterset.h")
26 changes: 22 additions & 4 deletions minivideo/minivideo.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ CONFIG += c++14 shared_and_static

# minivideo files --------------------------------------------------------------

INCLUDEPATH += $${PWD}/src/

SOURCES = $$files(src/*.cpp, true)
HEADERS = $$files(src/*.h, true)

Expand All @@ -24,6 +26,10 @@ DESTDIR = bin/$${QT_ARCH}/

# build settings ---------------------------------------------------------------

VER_MAJ = 0
VER_MIN = 15
VER_PAT = 0

# build settings and version are usually set by the CMake build system.
# we force MINIVIDEO_SETTINGS_H to make sure we don't use the CMake settings file.
DEFINES += MINIVIDEO_SETTINGS_H
Expand Down Expand Up @@ -92,10 +98,22 @@ win32 {

unix {
isEmpty(PREFIX) { PREFIX = /usr/local }
library.files += $${OUT_PWD}/$${DESTDIR}/libminivideo.so
library.files += $${OUT_PWD}/$${DESTDIR}/libminivideo.so.*

library.files += $${DESTDIR}/libminivideo.so
library.path = $${PREFIX}/lib/
headers.files += $${OUT_PWD}/src/minivideo*.h
library_links.extra+= ln -sf libminivideo.so $${PREFIX}/lib/libminivideo.so.$${VER_MAJ};
library_links.extra+= ln -sf libminivideo.so $${PREFIX}/lib/libminivideo.so.$${VER_MAJ}.$${VER_MIN};
library_links.extra+= ln -sf libminivideo.so $${PREFIX}/lib/libminivideo.so.$${VER_MAJ}.$${VER_MIN}.$${VER_PAT};
library_links.path = $${PREFIX}/lib/

headers.files += $${PWD}/src/minivideo*.h
headers.path = $${PREFIX}/include/minivideo/
INSTALLS += library headers
headers_h264.files += $${PWD}/src/decoder/h264/h264_parameterset_struct.h
headers_h264.path = $${PREFIX}/include/minivideo/decoder/h264/
headers_h265.files += $${PWD}/src/decoder/h265/h265_parameterset_struct.h
headers_h265.path = $${PREFIX}/include/minivideo/decoder/h265/
headers_h266.files += $${PWD}/src/decoder/h266/h266_parameterset_struct.h
headers_h266.path = $${PREFIX}/include/minivideo/decoder/h266/

INSTALLS += library library_links headers headers_h264 headers_h265 headers_h266
}

0 comments on commit b2a5369

Please sign in to comment.