build: Use the standard BUILD_SHARED_LIBS variable (#1292)
Use the standard BUILD_SHARED_LIBS variable instead of the custom LIBPACKAGER_SHARED variable
This commit is contained in:
parent
168e74c4c9
commit
562473c57e
|
@ -123,9 +123,9 @@ jobs:
|
||||||
mkdir -p build/
|
mkdir -p build/
|
||||||
|
|
||||||
if [[ "${{ matrix.lib_type }}" == "shared" ]]; then
|
if [[ "${{ matrix.lib_type }}" == "shared" ]]; then
|
||||||
LIBPACKAGER_SHARED="ON"
|
BUILD_SHARED_LIBS="ON"
|
||||||
else
|
else
|
||||||
LIBPACKAGER_SHARED="OFF"
|
BUILD_SHARED_LIBS="OFF"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If set, override the default generator for the platform.
|
# If set, override the default generator for the platform.
|
||||||
|
@ -142,7 +142,7 @@ jobs:
|
||||||
|
|
||||||
cmake \
|
cmake \
|
||||||
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \
|
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \
|
||||||
-DLIBPACKAGER_SHARED="$LIBPACKAGER_SHARED" \
|
-DBUILD_SHARED_LIBS="$BUILD_SHARED_LIBS" \
|
||||||
-S . \
|
-S . \
|
||||||
-B build/
|
-B build/
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ project(shaka-packager VERSION "")
|
||||||
|
|
||||||
# The only build option for Shaka Packager is whether to build a shared
|
# The only build option for Shaka Packager is whether to build a shared
|
||||||
# libpackager library. By default, don't.
|
# libpackager library. By default, don't.
|
||||||
option(LIBPACKAGER_SHARED "Build libpackager as a shared library" OFF)
|
option(BUILD_SHARED_LIBS "Build libpackager as a shared library" OFF)
|
||||||
|
|
||||||
# Enable CMake's test infrastructure.
|
# Enable CMake's test infrastructure.
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
|
@ -94,7 +94,7 @@ You can change other build settings with `-D` flags to CMake, for example
|
||||||
you can build a shared `libpackager` instead of static by adding
|
you can build a shared `libpackager` instead of static by adding
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
-DLIBPACKAGER_SHARED="ON"
|
-DBUILD_SHARED_LIBS="ON"
|
||||||
```
|
```
|
||||||
|
|
||||||
After configuring CMake you can run the build with
|
After configuring CMake you can run the build with
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# If we're building a shared library, make sure it works. We only do this for
|
# If we're building a shared library, make sure it works. We only do this for
|
||||||
# a shared library because the static library won't wrap the third-party
|
# a shared library because the static library won't wrap the third-party
|
||||||
# dependencies like absl.
|
# dependencies like absl.
|
||||||
if(LIBPACKAGER_SHARED)
|
if(BUILD_SHARED_LIBS)
|
||||||
# Install the library and headers to a temporary location.
|
# Install the library and headers to a temporary location.
|
||||||
set(TEST_INSTALL_DIR ${CMAKE_BINARY_DIR}/test-install)
|
set(TEST_INSTALL_DIR ${CMAKE_BINARY_DIR}/test-install)
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
# Include a module to define standard install directories.
|
# Include a module to define standard install directories.
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# Build static libs by default, or shared if LIBPACKAGER_SHARED is defined.
|
# Build static libs by default, or shared if BUILD_SHARED_LIBS is on.
|
||||||
if(LIBPACKAGER_SHARED)
|
if(BUILD_SHARED_LIBS)
|
||||||
add_definitions(-DSHARED_LIBRARY_BUILD)
|
add_definitions(-DSHARED_LIBRARY_BUILD)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
endif()
|
endif()
|
||||||
|
@ -88,7 +88,7 @@ set(libpackager_sources
|
||||||
../include/packager/packager.h
|
../include/packager/packager.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBPACKAGER_SHARED)
|
if(BUILD_SHARED_LIBS)
|
||||||
add_library(libpackager SHARED ${libpackager_sources})
|
add_library(libpackager SHARED ${libpackager_sources})
|
||||||
target_compile_definitions(libpackager PUBLIC SHAKA_IMPLEMENTATION)
|
target_compile_definitions(libpackager PUBLIC SHAKA_IMPLEMENTATION)
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -29,7 +29,7 @@ target_link_libraries(file
|
||||||
status
|
status
|
||||||
version)
|
version)
|
||||||
|
|
||||||
if(LIBPACKAGER_SHARED)
|
if(BUILD_SHARED_LIBS)
|
||||||
target_compile_definitions(file PUBLIC SHAKA_IMPLEMENTATION)
|
target_compile_definitions(file PUBLIC SHAKA_IMPLEMENTATION)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ target_link_libraries(status
|
||||||
absl::log
|
absl::log
|
||||||
absl::str_format)
|
absl::str_format)
|
||||||
|
|
||||||
if(LIBPACKAGER_SHARED)
|
if(BUILD_SHARED_LIBS)
|
||||||
target_compile_definitions(status PUBLIC SHAKA_IMPLEMENTATION)
|
target_compile_definitions(status PUBLIC SHAKA_IMPLEMENTATION)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue