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.
This commit is contained in:
Cosmin Truta 2024-01-22 17:24:59 +02:00
parent 9a774b9156
commit 4edbb4da81
7 changed files with 132 additions and 66 deletions

View File

@ -1,37 +1,19 @@
# CMakeLists.txt
# Copyright (c) 2018-2023 Cosmin Truta # CMakeLists.txt - CMake lists for libpng
# Copyright (c) 2007,2009-2018 Glenn Randers-Pehrson #
# Written by Christian Ehrlicher, 2007 # Copyright (c) 2018-2024 Cosmin Truta.
# Revised by Roger Lowman, 2009-2010 # Copyright (c) 2007-2018 Glenn Randers-Pehrson.
# Revised by Clifford Yapp, 2011-2012,2017 # Originally written by Christian Ehrlicher, 2007.
# Revised by Claudio Bley, 2013 #
# Revised by Roger Leigh, 2016 # Use, modification and distribution are subject to
# Revised by Andreas Franek, 2016 # the same licensing terms and conditions as libpng.
# Revised by Sam Serrels, 2017 # Please see the copyright notice in png.h or visit
# Revised by Vadim Barkov, 2017 # http://libpng.org/pub/png/src/libpng-LICENSE.txt
# Revised by Vicky Pfau, 2018 #
# Revised by Cameron Cawley, 2018,2021 # For copyright and licensing purposes, please see
# Revised by Kyle Bentley, 2018 # the accompanying file scripts/cmake/AUTHORS.md
# Revised by David Callu, 2020 #
# Revised by Steve Robinson, 2020 # SPDX-License-Identifier: libpng-2.0
# Revised by Simon Hausmann, 2020
# Revised by Alex Gaynor, 2020
# Revised by Owen Rudge, 2020
# Revised by Gleb Mazovetskiy, 2021
# Revised by Christopher Sean Morrison, 2022
# Revised by B. Scott Michel, 2022
# Revised by Jeremy Maitin-Shepard, 2022
# Revised by Martin Storsjo, 2022
# Revised by Jon Creighton, 2023
# Revised by Gunther Nikl, 2023
# Revised by Tyler Kropp, 2023
# Revised by Timothy Lyanguzov, 2023
# Revised by Clinton Ingram, 2023
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
cmake_minimum_required(VERSION 3.6) cmake_minimum_required(VERSION 3.6)
@ -370,7 +352,7 @@ else()
COMMAND "${CMAKE_COMMAND}" COMMAND "${CMAKE_COMMAND}"
"-DINPUT=${_GC_INPUT}" "-DINPUT=${_GC_INPUT}"
"-DOUTPUT=${_GC_OUTPUT}" "-DOUTPUT=${_GC_OUTPUT}"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake" -P "${CMAKE_CURRENT_BINARY_DIR}/genchk.cmake"
DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS} DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endfunction() endfunction()
@ -393,7 +375,7 @@ else()
COMMAND "${CMAKE_COMMAND}" COMMAND "${CMAKE_COMMAND}"
"-DINPUT=${_GO_INPUT}" "-DINPUT=${_GO_INPUT}"
"-DOUTPUT=${_GO_OUTPUT}" "-DOUTPUT=${_GO_OUTPUT}"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake" -P "${CMAKE_CURRENT_BINARY_DIR}/genout.cmake"
DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS} DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endfunction() endfunction()
@ -412,7 +394,7 @@ else()
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}" add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
COMMAND "${CMAKE_COMMAND}" COMMAND "${CMAKE_COMMAND}"
"-DOUTPUT=${_GSO_OUTPUT}" "-DOUTPUT=${_GSO_OUTPUT}"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" -P "${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake"
DEPENDS ${_GSO_DEPENDS} DEPENDS ${_GSO_DEPENDS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endfunction() endfunction()
@ -542,7 +524,7 @@ else()
add_custom_target(png_genprebuilt add_custom_target(png_genprebuilt
COMMAND "${CMAKE_COMMAND}" COMMAND "${CMAKE_COMMAND}"
"-DOUTPUT=scripts/pnglibconf.h.prebuilt" "-DOUTPUT=scripts/pnglibconf.h.prebuilt"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake" -P "${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
# A single target handles generation of all generated files. # A single target handles generation of all generated files.
@ -750,7 +732,7 @@ if(PNG_TESTS AND PNG_SHARED)
set(TEST_OPTIONS "${_PAT_OPTIONS}") set(TEST_OPTIONS "${_PAT_OPTIONS}")
set(TEST_FILES "${_PAT_FILES}") set(TEST_FILES "${_PAT_FILES}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in" configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/test.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake"
@ONLY) @ONLY)
add_test(NAME "${_PAT_NAME}" add_test(NAME "${_PAT_NAME}"
@ -984,14 +966,14 @@ function(create_symlink DEST_FILE)
endfunction() endfunction()
# Create source generation scripts. # Create source generation scripts.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/genchk.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake ${CMAKE_CURRENT_BINARY_DIR}/genchk.cmake
@ONLY) @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/genout.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake ${CMAKE_CURRENT_BINARY_DIR}/genout.cmake
@ONLY) @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/gensrc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake ${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake
@ONLY) @ONLY)
# libpng is a library so default to 'lib' # libpng is a library so default to 'lib'

35
scripts/cmake/AUTHORS.md Normal file
View File

@ -0,0 +1,35 @@
CMake Files, Lists and Scripts for the PNG Reference Library
============================================================
Author List
-----------
* Alex Gaynor
* Andreas Franek
* B. Scott Michel
* Cameron Cawley
* Christian Ehrlicher
* Christopher Sean Morrison
* Claudio Bley
* Clifford Yapp
* Clinton Ingram
* Cosmin Truta
* David Callu
* Gleb Mazovetskiy
* Glenn Randers-Pehrson
* Gunther Nikl
* Jeremy Maitin-Shepard
* John Bowler
* Jon Creighton
* Kyle Bentley
* Martin Storsjö
* Owen Rudge
* Roger Leigh
* Roger Lowman
* Sam Serrels
* Simon Hausmann
* Steve Robinson
* Timothy Lyanguzov
* Tyler Kropp
* Vadim Barkov
* Vicky Pfau

35
scripts/cmake/README.md Normal file
View File

@ -0,0 +1,35 @@
CMake Files, Lists and Scripts for the PNG Reference Library
============================================================
Copyright Notice
----------------
* Copyright (c) 2018-2024 Cosmin Truta.
* Copyright (c) 2007-2018 Glenn Randers-Pehrson.
* Originally written by Christian Ehrlicher, 2007.
Use, modification and distribution of the CMake
files in the libpng 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
File List
---------
CMakeLists.txt ==> The main CMake lists file
scripts/cmake/AUTHORS.md ==> The Authors file
scripts/cmake/README.md ==> This file
scripts/cmake/genchk.cmake.in ==> Template for genchk.cmake
scripts/cmake/genout.cmake.in ==> Template for genout.cmake
scripts/cmake/gensrc.cmake.in ==> Template for gensrc.cmake
scripts/cmake/test.cmake.in ==> Template for test.cmake
Acknowledgements
----------------
See the accompanying file `scripts/cmake/AUTHORS.md`
for the list of Contributing Authors.
If you are a Contributing Author, please make sure
that you are being acknowledged.

View File

@ -1,13 +1,16 @@
# genchk.cmake.in # genchk.cmake.in
# Generate .chk from .out with awk (generic), based upon the automake logic. # Generate .chk from .out with awk (generic), based upon the automake logic.
# Copyright (c) 2022-2023 Cosmin Truta # Copyright (c) 2022-2024 Cosmin Truta
# Copyright (c) 2016 Glenn Randers-Pehrson # Copyright (c) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016 # Written by Roger Leigh, 2016
#
# This code is released under the libpng license. # Use, modification and distribution are subject to
# For conditions of distribution and use, see the disclaimer # the same licensing terms and conditions as libpng.
# and license in png.h # 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 # Variables substituted from CMakeLists.txt
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@") set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")

View File

@ -1,13 +1,16 @@
# genout.cmake.in # genout.cmake.in
# Generate .out from .c with awk (generic), based upon the automake logic. # Generate .out from .c with awk (generic), based upon the automake logic.
# Copyright (c) 2022-2023 Cosmin Truta # Copyright (c) 2022-2024 Cosmin Truta
# Copyright (c) 2016 Glenn Randers-Pehrson # Copyright (c) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016 # Written by Roger Leigh, 2016
#
# This code is released under the libpng license. # Use, modification and distribution are subject to
# For conditions of distribution and use, see the disclaimer # the same licensing terms and conditions as libpng.
# and license in png.h # 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 # Variables substituted from CMakeLists.txt
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@") set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")

View File

@ -1,13 +1,16 @@
# gensrc.cmake.in # gensrc.cmake.in
# Generate source files with awk, based upon the automake logic. # Generate source files with awk, based upon the automake logic.
# Copyright (c) 2022-2023 Cosmin Truta # Copyright (c) 2022-2024 Cosmin Truta
# Copyright (c) 2016 Glenn Randers-Pehrson # Copyright (c) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016 # Written by Roger Leigh, 2016
#
# This code is released under the libpng license. # Use, modification and distribution are subject to
# For conditions of distribution and use, see the disclaimer # the same licensing terms and conditions as libpng.
# and license in png.h # 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 # Variables substituted from CMakeLists.txt
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@") set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
@ -135,5 +138,7 @@ elseif(OUTPUT STREQUAL "scripts/pnglibconf.h.prebuilt")
message(FATAL_ERROR "Stopping build") message(FATAL_ERROR "Stopping build")
else() else()
message(FATAL_ERROR "Unsupported output: ${OUTPUT}") message(FATAL_ERROR "Unsupported output: ${OUTPUT}")
endif() endif()

View File

@ -1,11 +1,15 @@
# test.cmake.in # test.cmake.in
# Copyright (C) 2016 Glenn Randers-Pehrson # Copyright (c) 2024 Cosmin Truta
# Copyright (c) 2016 Glenn Randers-Pehrson
# Written by Roger Leigh, 2016 # Written by Roger Leigh, 2016
#
# This code is released under the libpng license. # Use, modification and distribution are subject to
# For conditions of distribution and use, see the disclaimer # the same licensing terms and conditions as libpng.
# and license in png.h # 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
set(TEST_OPTIONS "@TEST_OPTIONS@") set(TEST_OPTIONS "@TEST_OPTIONS@")
set(TEST_FILES "@TEST_FILES@") set(TEST_FILES "@TEST_FILES@")
@ -22,8 +26,7 @@ if(WIN32)
set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}") set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}")
endif() endif()
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}) message("Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES})
execute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES} execute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}
RESULT_VARIABLE TEST_STATUS) RESULT_VARIABLE TEST_STATUS)
if(TEST_STATUS) if(TEST_STATUS)