libpng package: build with CMake (#35105)

This commit is contained in:
John W. Parent 2023-03-16 19:44:53 -04:00 committed by GitHub
parent 97d6c741b0
commit d76845e875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,10 +3,11 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.build_systems.cmake import CMakeBuilder
from spack.package import * from spack.package import *
class Libpng(AutotoolsPackage): class Libpng(CMakePackage):
"""libpng is the official PNG reference library.""" """libpng is the official PNG reference library."""
homepage = "http://www.libpng.org/pub/png/libpng.html" homepage = "http://www.libpng.org/pub/png/libpng.html"
@ -36,19 +37,12 @@ class Libpng(AutotoolsPackage):
description="Build shared libs, static libs or both", description="Build shared libs, static libs or both",
) )
def configure_args(self):
args = [ class CMakeBuilder(CMakeBuilder):
# not honored, see def cmake_args(self):
# https://sourceforge.net/p/libpng/bugs/210/#33f1 return [
# '--with-zlib=' + self.spec['zlib'].prefix, self.define("CMAKE_CXX_FLAGS", self.spec["zlib"].headers.include_flags),
f"CPPFLAGS={self.spec['zlib'].headers.include_flags}", self.define("ZLIB_ROOT", self.spec["zlib"].prefix),
f"LDFLAGS={self.spec['zlib'].libs.search_flags}", self.define("PNG_SHARED", "shared" in self.spec.variants["libs"].value),
self.define("PNG_STATIC", "static" in self.spec.variants["libs"].value),
] ]
args += self.enable_or_disable("libs")
return args
def check(self):
# Libpng has both 'check' and 'test' targets that are aliases.
# Only need to run the tests once.
make("check")