Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Force download works again.

  • Loading branch information...
commit 0fcb00a71a68a5922d36bd35ea5c8696789ee539 1 parent 76afd2f
@ginkgo authored
View
14 examples/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.8)
-project(minimal)
+project(example)
find_package(PythonInterp REQUIRED)
find_package(OpenGL REQUIRED)
@@ -18,10 +18,10 @@ add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/generated/flextGL.h" "${PROJECT
${PROJECT_SOURCE_DIR}/../templates/glfw/flextGL.c.template)
-add_executable(minimal minimal.cpp mesh.cpp utility.cpp generated/flextGL.c)
-target_link_libraries(minimal ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} ${GLEW_LIBRARIES})
+add_executable(example example.cpp mesh.cpp utility.cpp generated/flextGL.c)
+target_link_libraries(example ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} ${GLEW_LIBRARIES})
-add_custom_command(TARGET minimal COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${PROJECT_SOURCE_DIR}/minimal.frag" $<TARGET_FILE_DIR:minimal>)
-add_custom_command(TARGET minimal COMMAND ${CMAKE_COMMAND} -E copy_if_different
- "${PROJECT_SOURCE_DIR}/minimal.vert" $<TARGET_FILE_DIR:minimal>)
+add_custom_command(TARGET example COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${PROJECT_SOURCE_DIR}/example.frag" $<TARGET_FILE_DIR:example>)
+add_custom_command(TARGET example COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${PROJECT_SOURCE_DIR}/example.vert" $<TARGET_FILE_DIR:example>)
View
0  examples/minimal.cpp → examples/example.cpp
File renamed without changes
View
0  examples/minimal.frag → examples/example.frag
File renamed without changes
View
0  examples/minimal.vert → examples/example.vert
File renamed without changes
View
50 flext.py
@@ -1,3 +1,4 @@
+import time, os
import urllib.request
import os.path
from glob import glob
@@ -22,6 +23,10 @@
tm_file = '%s/gl.tm' % spec_dir
+def file_age(filename):
+ return time.time() - os.path.getmtime(filename) / 3600.0;
+
+
def parse_args():
parser = OptionParser(usage='Usage: %prog [options] filename')
parser.add_option('-d', '--download',
@@ -48,6 +53,31 @@ def parse_args():
return options, args[0]
+def download_spec(always_download = False):
+
+ if not os.path.exists(spec_dir):
+ os.makedirs(spec_dir)
+
+ if (24 * 3 < max([file_age(tm_file),
+ file_age(spec_file),
+ file_age(enumext_file)])):
+ always_download = True
+
+ if ( not always_download and
+ os.path.exists(spec_file) and
+ os.path.exists(tm_file) and
+ os.path.exists(enumext_file) ):
+ return
+
+
+ print ('Downloading gl.tm')
+ urllib.request.urlretrieve('http://www.opengl.org/registry/api/gl.tm', tm_file)
+ print ('Downloading gl.spec')
+ urllib.request.urlretrieve('http://www.opengl.org/registry/api/gl.spec', spec_file)
+ print ('Downloading enumext.spec')
+ urllib.request.urlretrieve('http://www.opengl.org/registry/api/enumext.spec', enumext_file)
+
+
class Version():
def __init__(self, major, minor, core):
self.major = int(major)
@@ -100,26 +130,6 @@ def parse_profile(filename):
return version, extensions
-def download_spec(always_download = False):
-
- if not os.path.exists(spec_dir):
- os.makedirs(spec_dir)
-
- if ( not always_download and
- os.path.exists(spec_file) and
- os.path.exists(tm_file) and
- os.path.exists(enumext_file) ):
- return
-
-
- print ('Downloading gl.tm')
- urllib.request.urlretrieve('http://www.opengl.org/registry/api/gl.tm', tm_file)
- print ('Downloading gl.spec')
- urllib.request.urlretrieve('http://www.opengl.org/registry/api/gl.spec', spec_file)
- print ('Downloading enumext.spec')
- urllib.request.urlretrieve('http://www.opengl.org/registry/api/enumext.spec', enumext_file)
-
-
def parse_typemap():
typemap_pattern = re.compile('(\w+),\*,\*,\s*([A-Za-z0-9 \*_]+),*,*')
View
10 flextGLgen.py
@@ -5,20 +5,12 @@ def main():
options,profile = flext.parse_args()
version,extensions = flext.parse_profile(profile)
- flext.download_spec(False)
+ flext.download_spec(options.download)
typemap = flext.parse_typemap()
categories = flext.find_categories(version, extensions, False)
enums = flext.parse_enums()
functions, passthru = flext.parse_functions(categories, typemap)
- #print (sorted(categories))
- #print (enums)
- #for t in sorted(typemap.keys()):
- # print ('%s %s' % ((t+":").ljust(40), typemap[t]))
- # for cat,fs in sorted(functions.items()):
- # print ('Category %s' % cat)
- # for f in fs:
- # print ('\t%s' % f.to_string())
flext.generate_source(options, version, enums, functions, passthru, extensions)
Please sign in to comment.
Something went wrong with that request. Please try again.