config.py :  » Development » PyObjC » trunk » pyobjc » PyOpenGL-2.0.2.01 » setup » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Development » PyObjC 
PyObjC » trunk » pyobjc » PyOpenGL 2.0.2.01 » setup » config.py
import distutils.command.config
from distutils.errors import *
from distutils.sysconfig import customize_compiler
from distutils.ccompiler import CompileError
from util import *


glu_body = '''
#ifdef _WIN32
#include <windows.h>
#endif
#ifdef __APPLE_CC__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#ifdef GLU_VERSION_1_2
GLUnurbs *x;
GLUtesselator *y;
GLUquadric *z;
#endif
'''

texture_object_body = '''
#ifdef _WIN32
#include <windows.h>
#endif
#ifdef __APPLE_CC__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#ifndef GL_EXT_texture_object
void glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences)
{
}
#endif
'''

class config(distutils.command.config.config):

  def run(self):
    self.output_dir = "" # Try by Jack
    self._check_compiler()
    customize_compiler(self.compiler)

    if not self.try_compile(glu_body):
      self.distribution.define_macros.append(('BAD_GLU_HEADER', None))

    if not self.try_compile(texture_object_body):
      self.distribution.define_macros.append(('GL_EXT_texture_object', 1))


  def try_compile (self, body, headers=None, include_dirs=None, lang="c"):
    """Try to compile a source file built from 'body' and 'headers'.
    Return true on success, false otherwise.
    """
    
    try:
      self._compile(body, headers, include_dirs, lang)
      ok = 1
    except CompileError:
      ok = 0
    
    return ok
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.