Skip to content

Commit

Permalink
build: Move scripts/*.cmake.in to scripts/cmake/; add cmake/AUTHORS.md
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ctruta committed Jan 22, 2024
1 parent 9a774b9 commit 4edbb4d
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 67 deletions.
72 changes: 27 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
# CMakeLists.txt

# Copyright (c) 2018-2023 Cosmin Truta
# Copyright (c) 2007,2009-2018 Glenn Randers-Pehrson
# Written by Christian Ehrlicher, 2007
# Revised by Roger Lowman, 2009-2010
# Revised by Clifford Yapp, 2011-2012,2017
# Revised by Claudio Bley, 2013
# Revised by Roger Leigh, 2016
# Revised by Andreas Franek, 2016
# Revised by Sam Serrels, 2017
# Revised by Vadim Barkov, 2017
# Revised by Vicky Pfau, 2018
# Revised by Cameron Cawley, 2018,2021
# Revised by Kyle Bentley, 2018
# Revised by David Callu, 2020
# Revised by Steve Robinson, 2020
# 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

# CMakeLists.txt - CMake lists for libpng
#
# Copyright (c) 2018-2024 Cosmin Truta.
# Copyright (c) 2007-2018 Glenn Randers-Pehrson.
# Originally written by Christian Ehrlicher, 2007.
#
# 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
#
# For copyright and licensing purposes, please see
# the accompanying file scripts/cmake/AUTHORS.md
#
# SPDX-License-Identifier: libpng-2.0

cmake_minimum_required(VERSION 3.6)

Expand Down Expand Up @@ -370,7 +352,7 @@ else()
COMMAND "${CMAKE_COMMAND}"
"-DINPUT=${_GC_INPUT}"
"-DOUTPUT=${_GC_OUTPUT}"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake"
-P "${CMAKE_CURRENT_BINARY_DIR}/genchk.cmake"
DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endfunction()
Expand All @@ -393,7 +375,7 @@ else()
COMMAND "${CMAKE_COMMAND}"
"-DINPUT=${_GO_INPUT}"
"-DOUTPUT=${_GO_OUTPUT}"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake"
-P "${CMAKE_CURRENT_BINARY_DIR}/genout.cmake"
DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endfunction()
Expand All @@ -412,7 +394,7 @@ else()
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
COMMAND "${CMAKE_COMMAND}"
"-DOUTPUT=${_GSO_OUTPUT}"
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
-P "${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake"
DEPENDS ${_GSO_DEPENDS}
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endfunction()
Expand Down Expand Up @@ -542,7 +524,7 @@ else()
add_custom_target(png_genprebuilt
COMMAND "${CMAKE_COMMAND}"
"-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}")

# A single target handles generation of all generated files.
Expand Down Expand Up @@ -750,7 +732,7 @@ if(PNG_TESTS AND PNG_SHARED)
set(TEST_OPTIONS "${_PAT_OPTIONS}")
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"
@ONLY)
add_test(NAME "${_PAT_NAME}"
Expand Down Expand Up @@ -984,14 +966,14 @@ function(create_symlink DEST_FILE)
endfunction()

# Create source generation scripts.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/genchk.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/genchk.cmake
@ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/genout.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/genout.cmake
@ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/gensrc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/gensrc.cmake
@ONLY)

# libpng is a library so default to 'lib'
Expand Down
35 changes: 35 additions & 0 deletions scripts/cmake/AUTHORS.md
Original file line number Diff line number Diff line change
@@ -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 changes: 35 additions & 0 deletions scripts/cmake/README.md
Original file line number Diff line number Diff line change
@@ -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.
13 changes: 8 additions & 5 deletions scripts/genchk.cmake.in → scripts/cmake/genchk.cmake.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# genchk.cmake.in
# 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
# Written by Roger Leigh, 2016

# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# 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@")
Expand Down
13 changes: 8 additions & 5 deletions scripts/genout.cmake.in → scripts/cmake/genout.cmake.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# genout.cmake.in
# 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
# Written by Roger Leigh, 2016

# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# 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@")
Expand Down
15 changes: 10 additions & 5 deletions scripts/gensrc.cmake.in → scripts/cmake/gensrc.cmake.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# gensrc.cmake.in
# 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
# Written by Roger Leigh, 2016

# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# 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@")
Expand Down Expand Up @@ -135,5 +138,7 @@ elseif(OUTPUT STREQUAL "scripts/pnglibconf.h.prebuilt")
message(FATAL_ERROR "Stopping build")

else()

message(FATAL_ERROR "Unsupported output: ${OUTPUT}")

endif()
17 changes: 10 additions & 7 deletions scripts/test.cmake.in → scripts/cmake/test.cmake.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# 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

# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# 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

set(TEST_OPTIONS "@TEST_OPTIONS@")
set(TEST_FILES "@TEST_FILES@")
Expand All @@ -22,8 +26,7 @@ if(WIN32)
set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}")
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}
RESULT_VARIABLE TEST_STATUS)
if(TEST_STATUS)
Expand Down

0 comments on commit 4edbb4d

Please sign in to comment.