Cleanup of Apple OpenGL shim packages (#44269)
- Remove duplicated code - Use BundlePackage as a base class
This commit is contained in:
		 Massimiliano Culpo
					Massimiliano Culpo
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							a3aca0242a
						
					
				
				
					commit
					5a99142b41
				
			| @@ -2,34 +2,14 @@ | ||||
| # Spack Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| 
 | ||||
| from spack.package import * | ||||
| 
 | ||||
| 
 | ||||
| class AppleGl(Package): | ||||
|     """Shim package for the core OpenGL library from Apple""" | ||||
| 
 | ||||
| class AppleGlBase(BundlePackage): | ||||
|     homepage = "https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_intro/opengl_intro.html" | ||||
| 
 | ||||
|     maintainers("aphecetche") | ||||
| 
 | ||||
|     has_code = False | ||||
| 
 | ||||
|     version("4.1.0") | ||||
| 
 | ||||
|     provides("gl@4.1") | ||||
| 
 | ||||
|     # Only supported on 'platform=darwin' and compiler=apple-clang | ||||
|     conflicts("platform=linux") | ||||
|     conflicts("platform=cray") | ||||
|     conflicts("platform=windows") | ||||
|     conflicts("%gcc") | ||||
|     conflicts("%clang") | ||||
|     conflicts("%msvc") | ||||
| 
 | ||||
|     phases = [] | ||||
| 
 | ||||
|     def setup_dependent_build_environment(self, env, dependent_spec): | ||||
|         # we try to setup a build environment with enough hints | ||||
|         # for the build system to pick up on the Apple framework version | ||||
| @@ -50,3 +30,16 @@ def headers(self): | ||||
|     @property | ||||
|     def libs(self): | ||||
|         return LibraryList(join_path(self.prefix, "System/Library/Frameworks/OpenGL.framework")) | ||||
| 
 | ||||
| 
 | ||||
| class AppleGl(AppleGlBase): | ||||
|     """Shim package for the core OpenGL library from Apple""" | ||||
| 
 | ||||
|     version("4.1.0") | ||||
| 
 | ||||
|     provides("gl@4.1") | ||||
| 
 | ||||
|     requires( | ||||
|         "%apple-clang platform=darwin", | ||||
|         msg="Apple-GL is only available on Darwin, when using Apple Clang", | ||||
|     ) | ||||
|   | ||||
| @@ -2,49 +2,18 @@ | ||||
| # Spack Project Developers. See the top-level COPYRIGHT file for details. | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| 
 | ||||
| from spack.package import * | ||||
| from spack.pkg.builtin.apple_gl import AppleGlBase | ||||
| 
 | ||||
| 
 | ||||
| class AppleGlu(Package): | ||||
| class AppleGlu(AppleGlBase): | ||||
|     """Shim package for Apple implementation of OpenGL Utility Libray (GLU)""" | ||||
| 
 | ||||
|     homepage = "https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_intro/opengl_intro.html" | ||||
| 
 | ||||
|     maintainers("aphecetche") | ||||
| 
 | ||||
|     has_code = False | ||||
| 
 | ||||
|     version("1.3.0") | ||||
| 
 | ||||
|     provides("glu@1.3") | ||||
| 
 | ||||
|     # Only supported on 'platform=darwin' and compiler=apple-clang | ||||
|     conflicts("platform=linux") | ||||
|     conflicts("platform=cray") | ||||
|     conflicts("%gcc") | ||||
|     conflicts("%clang") | ||||
| 
 | ||||
|     phases = [] | ||||
| 
 | ||||
|     def setup_dependent_build_environment(self, env, dependent_spec): | ||||
|         # we try to setup a build environment with enough hints | ||||
|         # for the build system to pick up on the Apple framework version | ||||
|         # of OpenGL. | ||||
|         # - for a cmake build we actually needs nothing at all as | ||||
|         # find_package(OpenGL) will do the right thing | ||||
|         # - for the rest of the build systems we'll assume that | ||||
|         # setting the C_INCLUDE_PATH will be enough for the compilation phase | ||||
|         # and *** for the link phase. | ||||
|         env.prepend_path("C_INCLUDE_PATH", self.prefix[:-4]) | ||||
| 
 | ||||
|     @property | ||||
|     def headers(self): | ||||
|         return HeaderList( | ||||
|             join_path(self.prefix, "System/Library/Frameworks/OpenGL.framework/Headers") | ||||
|     requires( | ||||
|         "%apple-clang platform=darwin", | ||||
|         msg="Apple-GLU is only available on Darwin, when using Apple Clang", | ||||
|     ) | ||||
| 
 | ||||
|     @property | ||||
|     def libs(self): | ||||
|         return LibraryList(join_path(self.prefix, "System/Library/Frameworks/OpenGL.framework")) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user