mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
pngminus: Update CMake file; rename test scripts; add .gitignore
Raise the minimum required CMake version to 3.5. Add the configuration option `PNGMINUS_USE_SYSTEM_PNG` for compiling and linking with the system libpng library instead of the internal one. Remove the old configuration option `PNGMINUS_USE_STATIC_LIBRARIES`. When using the internal libpng (via `PNGMINUS_USE_SYSTEM_PNG=OFF`), simply enforce static linking and produce single-file executables. Rename the scripts "png2pnm.sh" (etc.) to "test_png2pnm.sh" (etc.), to make it obvious that they are test drivers, not program launchers. Add a .gitignore file for project-specific build and test artifacts.
This commit is contained in:
parent
6abf8c1e91
commit
c993ae4c67
11
contrib/pngminus/.gitignore
vendored
Normal file
11
contrib/pngminus/.gitignore
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Compiled executables
|
||||||
|
png2pnm
|
||||||
|
png2pnm.exe
|
||||||
|
png2pnm-static*
|
||||||
|
pnm2png
|
||||||
|
pnm2png.exe
|
||||||
|
pnm2png-static*
|
||||||
|
|
||||||
|
# Test artifacts
|
||||||
|
*.png
|
||||||
|
*.p[abgnp]m
|
@ -1,24 +1,41 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
# Copyright (c) 2018-2024 Cosmin Truta
|
||||||
cmake_policy(VERSION 3.1)
|
#
|
||||||
|
# This software is released under the MIT license. For conditions of
|
||||||
|
# distribution and use, see the LICENSE file part of this package.
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
project(PNGMINUS C)
|
project(PNGMINUS C)
|
||||||
|
|
||||||
option(PNGMINUS_USE_STATIC_LIBRARIES "Use the static library builds" ON)
|
option(PNGMINUS_USE_SYSTEM_PNG
|
||||||
|
"Use the libpng build found in the system" OFF)
|
||||||
|
|
||||||
# libpng
|
|
||||||
add_subdirectory(../.. libpng)
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/libpng)
|
|
||||||
if(PNGMINUS_USE_STATIC_LIBRARIES)
|
|
||||||
set(PNGMINUS_PNG_LIBRARY png_static)
|
|
||||||
else()
|
|
||||||
set(PNGMINUS_PNG_LIBRARY png)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# png2pnm
|
|
||||||
add_executable(png2pnm png2pnm.c)
|
add_executable(png2pnm png2pnm.c)
|
||||||
target_link_libraries(png2pnm ${PNGMINUS_PNG_LIBRARY})
|
|
||||||
|
|
||||||
# pnm2png
|
|
||||||
add_executable(pnm2png pnm2png.c)
|
add_executable(pnm2png pnm2png.c)
|
||||||
target_link_libraries(pnm2png ${PNGMINUS_PNG_LIBRARY})
|
|
||||||
|
if(PNGMINUS_USE_SYSTEM_PNG)
|
||||||
|
# Use the system libpng.
|
||||||
|
find_package(PNG REQUIRED)
|
||||||
|
target_link_libraries(png2pnm PRIVATE PNG::PNG)
|
||||||
|
target_link_libraries(pnm2png PRIVATE PNG::PNG)
|
||||||
|
else()
|
||||||
|
# Build and use the internal libpng.
|
||||||
|
# Configure libpng for static linking, to produce single-file executables.
|
||||||
|
set(PNG_STATIC ON
|
||||||
|
CACHE STRING "Build the internal libpng as a static library" FORCE)
|
||||||
|
set(PNG_SHARED OFF
|
||||||
|
CACHE STRING "Build the internal libpng as a shared library" FORCE)
|
||||||
|
set(PNG_FRAMEWORK OFF
|
||||||
|
CACHE STRING "Build the internal libpng as a framework bundle" FORCE)
|
||||||
|
add_subdirectory(../.. libpng)
|
||||||
|
target_include_directories(png2pnm PRIVATE
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../..>"
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/libpng>"
|
||||||
|
)
|
||||||
|
target_include_directories(pnm2png PRIVATE
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../..>"
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/libpng>"
|
||||||
|
)
|
||||||
|
target_link_libraries(png2pnm PRIVATE png_static)
|
||||||
|
target_link_libraries(pnm2png PRIVATE png_static)
|
||||||
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user