scripts/cmake

Branch


Log

Author Commit Date CI Message
Cosmin Truta 0cc6436e 2025-05-29T22:55:00 build: Repair and reduce the CMake build dependency graph A funny thing happened while refactoring the function argument parsing in the `PNGGenConfig` module: the processing of dependencies inside the CMake function `generate_copy` got fixed, thanks to an inadvertent typo correction! Going down the rabbit hole, we uncovered two issues: 1. A typo in `scripts/cmake/PNGGenConfig.cmake` caused a dependency declaration to disappear, disrupting the graph. Fortunately, this disruption was being mitigated by an additional set of (redundant) symbolic target declarations that kept the CMake build going. 2. The exact string matching inside `scripts/cmake/gensrc.cmake.in` imposed an artificial limitation, disallowing the use of absolute file paths. The typo correction in (1), and the use of regex matching instead of exact string matching in (2), allowed us to use absolute file paths in the main CMake file, consistently, thus allowing CMake to recognize them as uniquely-identifiable nodes in the dependency graph. There should be no further need to have extra symbolic targets for proper node identification. In the end, we shaved off the redundant symbolic target declarations, retaining only `png_genfiles` and `png_genprebuilt`.
Joost Nieuwenhuijse dc71f481 2025-02-26T22:17:08 build: Fix apple-non-apple cross building When cross compiling for an apple platform on a non-apple platform (or the reverse), `if(APPLE)` in line 32 should refer to the target platform. Without importing the `APPLE` variable, it refers to the host platform. Reviewed-by: John Bowler <jbowler@acm.org> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 23bdc7a6 2025-04-28T20:44:53 build: Add the CMake build option `PNG_LIBCONF_HEADER` Running the pnglibconf scripts (script/*.awk) is not always possible. An AWK interpreter is not always guaranteed to be available; and even if it is, there are limitations when making cross-platform libpng builds, especially when the differences between the host platform and the target platform are significant. For example: * Building for the Windows (MinGW) target on a Unix development host; * Building for the iOS target on a macOS development host; * Building for the Android target on any development host. In such scenarios, a preconfigured (i.e. prebuilt) pnglibconf.h file, either taken from the libpng source tree or provided by the user who wants to make a custom libpng build, becomes a necessity. In this commit we introduce the build option `PNG_LIBCONF_HEADER` in order to address this specific use case. We also specify a version range (3.14...4.0) for the minimum required CMake program, to future-proof the CMake build for just a little bit longer. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 2a845ff8 2025-01-06T17:09:10 build: Move portions from the main CMake file to separate modules In preparation for the upcoming changes in the build system, any parts of the CMake file that are unlikely to be affected should be moved out of the way. This should facilitate an easier resync between the branch 'libpng16' and its successor(s). Specifically: * Move the functions `generate_chk`, `generate_out`, `generate_source` and `generate_copy` to scripts/cmake/PNGGenConfig.cmake. * Move the function `png_add_test` to scripts/cmake/PNGTest.cmake. * Leave the function `create_symlink` in place, but add a TODO note. As we raised the minimum required CMake version to 3.14, we should now be able to use CMake's built-in function instead.
Cosmin Truta a7a8faee 2024-10-11T23:24:46 [libpng16] style: Add a cmake-format config file and satisfy cmake-lint Introduce CMake file linting, based on the cmakelang project by Josh Bialkowski (@cheshirekow). Fix various style issues in the CMake files: * Add the missing copyright header to PNGConfig.cmake. * Resolve a "missing docstring" warning raised by cmake-lint. * Rewrite all docstrings in the style of CMake's own documentation. * Fix whitespace inconsistencies. References: * https://pypi.org/project/cmakelang * https://github.com/cheshirekow/cmake_format This is a cherry-pick of commit c317fe31114d92d05d44bf98c9b559edf4656b9c from branch 'libpng18'.
Cosmin Truta 9ee82380 2024-10-06T21:22:09 [libpng16] test: Tidy up the logging of test program arguments in CTest This is a cherry-pick of commit 2e416c623d293659a102936870c4b36c00e1b347 from branch 'libpng18'.
Green Sky 8cc22a8c 2024-04-17T12:32:45 cmake: Fix an error in the declaration of target include directories Properly declare target include directories for generated includes. Previously the non targeted `include_directories()` was used, which had issue when using the `png_static` target in a submodule. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 843dbb75 2024-09-10T22:41:03 Revert "cmake: Fix an error in the declaration of target include directories" This reverts commit 1d1cc9ae18f677201bf7e47928c30562df967756. The verification has failed. (Oopsie!)
Green Sky 1d1cc9ae 2024-04-17T12:32:45 cmake: Fix an error in the declaration of target include directories Properly declare target include directories for generated includes. Previously the non targeted `include_directories()` was used, which had issue when using the `png_static` target in a submodule. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Benjamin Buch 0e204b73 2024-03-01T13:14:17 build: Add a CMake config file compatible with the FindPNG module Co-authored-by: Cosmin Truta <ctruta@gmail.com> Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Eric Riff 43d6ad3e 2024-09-04T19:29:14 cmake: Honor CMAKE_SYSROOT if set Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 3b9a73ed 2024-02-22T16:47:51 doc: Review the libpng history and update scripts/cmake/AUTHORS.md
Benjamin Buch 7b888092 2024-02-21T19:06:33 build: Mark the installed libpng headers as system headers in CMake Modern compilers can disable the warnings that originate from system headers. This change allows them to do so with the libpng headers. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Dan Rosser e7ba9c0d 2024-02-19T14:23:53 build: Fix a CMake build regression introduced in version 1.6.41 This fixes commit 4edbb4da81626a7342a22824d7a8f60a3ea71bd0. During the move of CMake scripts to the scripts/cmake/ subdirectory, some of the workflows have been broken. Signed-off-by: Cosmin Truta <ctruta@gmail.com>
Cosmin Truta 4edbb4da 2024-01-22T17:24:59 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.