1
0
mirror of https://github.com/glennrp/libpng.git synced 2025-08-07 13:22:57 +03:00
Files
libpng/scripts/cmake/genchk.cmake.in
Cosmin Truta 4edbb4da81 build: Move scripts/*.cmake.in to scripts/cmake/; add cmake/AUTHORS.md
From the libpng licensing point of view, the build projects, the build
scripts, the test scripts, the CI verification scripts, et cetera, have
not traditionally been part of libpng proper, although some of these,
including the CMake-based build, have been released under the libpng
license.

Considering how the CMake build grew as a result of many contributions
from many contributing authors over a long time, one may argue that it
almost became an individual piece of software in its own right.

Moving on, everything CMake-related shall be placed in the subdirectory
scripts/cmake/ (except, of course, the main CMakeLists.txt). Moreover,
contributing authors shall be acknowledged in scripts/cmake/AUTHORS.md.

Please see scripts/cmake/README.md for more information.
2024-01-22 17:24:59 +02:00

43 lines
1.6 KiB
CMake

# genchk.cmake.in
# Generate .chk from .out with awk (generic), based upon the automake logic.
# Copyright (c) 2022-2024 Cosmin Truta
# Copyright (c) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016
#
# Use, modification and distribution are subject to
# the same licensing terms and conditions as libpng.
# Please see the copyright notice in png.h or visit
# http://libpng.org/pub/png/src/libpng-LICENSE.txt
#
# SPDX-License-Identifier: libpng-2.0
# Variables substituted from CMakeLists.txt
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(BINDIR "@CMAKE_CURRENT_BINARY_DIR@")
set(AWK "@AWK@")
get_filename_component(INPUTEXT "${INPUT}" EXT)
get_filename_component(OUTPUTEXT "${OUTPUT}" EXT)
get_filename_component(INPUTBASE "${INPUT}" NAME_WE)
get_filename_component(OUTPUTBASE "${OUTPUT}" NAME_WE)
get_filename_component(INPUTDIR "${INPUT}" PATH)
get_filename_component(OUTPUTDIR "${OUTPUT}" PATH)
if(INPUTEXT STREQUAL ".out" AND OUTPUTEXT STREQUAL ".chk")
# Generate .chk from .out with awk (generic)
file(REMOVE "${OUTPUT}" "${OUTPUTDIR}/${OUTPUTBASE}.new")
execute_process(COMMAND "${AWK}" -f "${BINDIR}/scripts/checksym.awk"
"${SRCDIR}/scripts/${INPUTBASE}.def"
"of=${OUTPUTDIR}/${OUTPUTBASE}.new"
"${INPUT}"
RESULT_VARIABLE AWK_FAIL)
if(AWK_FAIL)
message(FATAL_ERROR "Failed to generate ${OUTPUTDIR}/${OUTPUTBASE}.new")
endif()
file(RENAME "${OUTPUTDIR}/${OUTPUTBASE}.new" "${OUTPUT}")
else()
message(FATAL_ERROR "Unsupported conversion: ${INPUTEXT} to ${OUTPUTEXT}")
endif()