Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

New buildsystem based on Rake nearly completed!

Documentation is not automatically generated just yet - I had
it working for .html files in the same path as .pyx files, but
I'm having issues with the regex rule to put them in the doc
directory. For now I have them disabled as a build dependency
(cf line 52). At some point after homeworking tomorrow I'll write
a guardfile to automate all this, and get doc gen fixed.
  • Loading branch information...
commit 65fd297951c99b1033fe371b00b489444ae53dae 1 parent 70a7398
Alex Berghage authored
Showing with 124 additions and 118 deletions.
  1. +124 −0 Rakefile
  2. +0 −62 buildbat.py
  3. +0 −56 cyth.bat
  4. 0  {include/OGRE → lib}/OgreBuildSettings.h
  5. 0  {boost_libs → lib/boost}/libboost_date_time-vc100-mt-1_44.lib
  6. 0  {boost_libs → lib/boost}/libboost_thread-vc100-mt-1_44.lib
  7. 0  {ogre_libs → lib/ogre}/OgreMainStatic.lib
  8. 0  {ogre_libs → lib/ogre}/OgreMeshUpgrader.lib
  9. 0  {ogre_libs → lib/ogre}/OgrePagingStatic.lib
  10. 0  {ogre_libs → lib/ogre}/OgrePropertyStatic.lib
  11. 0  {ogre_libs → lib/ogre}/OgreRTShaderSystemStatic.lib
  12. 0  {ogre_libs → lib/ogre}/OgreTerrainStatic.lib
  13. 0  {ogre_libs → lib/ogre}/OgreXMLConverter.lib
  14. 0  {ogre_libs → lib/ogre}/Plugin_BSPSceneManagerStatic.lib
  15. 0  {ogre_libs → lib/ogre}/Plugin_CgProgramManagerStatic.lib
  16. 0  {ogre_libs → lib/ogre}/Plugin_OctreeSceneManagerStatic.lib
  17. 0  {ogre_libs → lib/ogre}/Plugin_OctreeZoneStatic.lib
  18. 0  {ogre_libs → lib/ogre}/Plugin_PCZSceneManagerStatic.lib
  19. 0  {ogre_libs → lib/ogre}/Plugin_ParticleFXStatic.lib
  20. 0  {ogre_libs → lib/ogre}/RenderSystem_Direct3D9Static.lib
  21. 0  {ogre_libs → lib/ogre}/RenderSystem_GLStatic.lib
  22. 0  {ogre_dep_libs → lib/ogre_dep}/FreeImage.lib
  23. 0  {ogre_dep_libs → lib/ogre_dep}/OIS.lib
  24. 0  {ogre_dep_libs → lib/ogre_dep}/cg.lib
  25. 0  {ogre_dep_libs → lib/ogre_dep}/freetype2311.lib
  26. 0  {ogre_dep_libs → lib/ogre_dep}/zlib.lib
  27. 0  {ogre_dep_libs → lib/ogre_dep}/zziplib.lib
View
124 Rakefile
@@ -0,0 +1,124 @@
+# Setup for clean and clobber commands
+require 'rake/clean'
+CLEAN.include('*.o', '*.obj', '*.a', '*.lib', '*.exp', '*.manifest', '*.cpp')
+CLOBBER.include('*.o', '*.obj', '*.a', '*.lib', '*.exp', '*.manifest', '*.cpp', '*.log', '*.pyd')
+
+# Cython file lists
+PYX_INCLUDES = FileList['*.pxi', '*.pxd']
+SOURCES = FileList['*.pyx']
+
+# Header include paths
+OGRE_INCLUDES = [
+ '',
+ 'lib/', #OgreBuildSettings.h stays with the build it's from
+ 'include',
+ 'include/OGRE',
+ 'include/OGRE/RenderSystems/GL',
+ 'include/OGRE/RenderSystems/GL/GLSL',
+ 'include/OGRE/RenderSystems/GLES',
+ 'include/OGRE/RenderSystems/Direct3D9',
+ 'include/OIS',
+ 'include/boost',
+]
+INCLUDES = OGRE_INCLUDES
+
+# Build-local static libraries
+directory "lib/ogre"
+OGRE_LIBS = Dir.entries('lib/ogre')
+directory "lib/ogre_dep"
+OGRE_DEPS = Dir.entries('lib/ogre_dep')
+directory "lib/boost"
+BOOST_LIBS = Dir.entries('lib/boost')
+LIBRARIES = [''] + OGRE_LIBS + OGRE_DEPS + BOOST_LIBS
+LIBRARIES.delete('..')
+LIBRARIES.delete('.')
+LIBRARY_PATHS = [
+ '',
+ 'lib/ogre',
+ 'lib/ogre_dep',
+ 'lib/boost'
+]
+
+# Pick the appropriate per-platform build task on which `rake build`
+# will depend
+if ENV['OS'] == 'Windows_NT'
+ builder = "win:build"
+elsif RUBY_PLATFORM == 'darwin'
+ builder = "osx:build"
+else #Assume linux if it's not windows or mac
+ builder = "linux:build"
+end
+
+task :build => [builder] do#, 'doc:build'] do
+ desc "Build cyogre for the current system."
+end
+
+namespace :doc do
+ directory 'doc'
+ rule "/doc\/.*\.html/" => [
+ proc { |target|
+ target.sub(%r{doc/(.*)\.html}, "\1.pyx")
+ }
+ ] do |t|
+ sh "rocco -l python -o doc #{t.source}"
+ end
+ task :build => SOURCES.ext('html').map {|fname| "doc/#{fname}"}
+end
+
+# Windows-specific configuration and tasks
+namespace :win do
+ desc "Build cyogre for windows."
+
+ #Path to program files and python
+ pfpath = Dir['C:\Program Files (x86)'] ? 'C:\Program Files (x86)' : 'C:\Program Files'
+ pypath = 'C:\Python32'
+
+ #Include and library path fixup to add system python
+ INCLUDES += ["#{pypath}\\include"]
+ LIBRARY_PATHS += ["#{pypath}\\libs", "#{pypath}\\PCbuild"]
+
+ #Windows-specific cython command override
+ cython_command = 'python C:\Python32\Scripts\cython.py --cplus -3'
+
+ #Command to compile each pyx file
+ compile_command = "\"#{pfpath}" + '\Microsoft Visual Studio 10.0\VC\BIN\cl.exe" /EHsc /c /nologo /Ox /MD /W3 /GS- /DNDEBUG'
+
+ #List of system-specific libraries to link
+ LIBRARIES += [
+ 'kernel32.lib',
+ 'user32.lib',
+ 'gdi32.lib',
+ 'winspool.lib',
+ 'comdlg32.lib',
+ 'advapi32.lib',
+ 'shell32.lib',
+ 'ole32.lib',
+ 'oleaut32.lib',
+ 'uuid.lib',
+ 'odbc32.lib',
+ 'odbccp32.lib',
+ 'OpenGL32.lib',
+ 'GLU32.lib'
+ ]
+
+ #Command to link the resultant files
+ link_command = "\"#{pfpath}" + '\Microsoft Visual Studio 10.0\VC\BIN\link.exe" /DLL /nologo /INCREMENTAL:NO /MANIFESTFILE:cyogre.pyd.manifest /FORCE /MANIFEST'
+
+ #Command to embed the manifest
+ manifest_command = "\"#{pfpath}" + '\Microsoft SDKs\Windows\v7.0A\bin\mt.exe" -nologo'
+
+ #Build rule for producing pyds from pyx files
+ rule '.pyd' => '.pyx' do |t|
+ base = "#{t.name}".sub(/\.[^.]*$/, '')
+ sh cython_command + " #{base}.pyx"
+ sh compile_command + " /Tp#{base}.cpp /Fo#{base}.obj " + INCLUDES.join(' -I')
+ sh link_command + " #{base}.obj /OUT:#{base}.pyd /IMPLIB:#{base}.lib /EXPORT:PyInit_#{base} /MANIFESTFILE:#{base}.pyd.manifest " + LIBRARY_PATHS.join(' /LIBPATH:') + LIBRARIES.join(' ')
+ sh manifest_command + " -manifest #{base}.pyd.manifest -outputresource:#{base}.pyd;2"
+ end
+
+ #Build task (actually does the calling)
+ task :build => SOURCES.ext('pyd')
+end
+
+# Default task is build + doc + clean
+task :default => [:build, :clean]
View
62 buildbat.py
@@ -1,62 +0,0 @@
-import os, sys, platform
-
-pfpath = r"c:\Program Files (x86)" if os.path.exists("/Program Files (x86)") else r"C:\Program Files"
-
-cython_command = r'''python C:\Python32\Scripts\cython.py --cplus -3 cyogre.pyx'''
-
-compile_command = r'''"%s\Microsoft Visual Studio 10.0\VC\BIN\cl.exe" /EHsc /c /nologo /Ox /MD /W3 /GS- /DNDEBUG /Tpcyogre.cpp /Fobuild\cyogre.obj''' % pfpath
-compile_includes = [
- 'include',
- 'include/OGRE',
- 'include/OGRE/RenderSystems/GL',
- 'include/OGRE/RenderSystems/GL/GLSL',
- 'include/OGRE/RenderSystems/GLES',
- 'include/OGRE/RenderSystems/Direct3D9',
- 'include/OIS',
- 'include/boost',
- 'C:\python32\include',
- # 'C:\python32\PC',
-]
-compile_command = ' -I'.join([compile_command] + compile_includes)
-
-static_libs = []
-static_libs.extend(os.listdir('boost_libs'))
-static_libs.extend(os.listdir('ogre_libs'))
-static_libs.extend(os.listdir('ogre_dep_libs'))
-static_libs.extend([
- 'kernel32.lib',
- 'user32.lib',
- 'gdi32.lib',
- 'winspool.lib',
- 'comdlg32.lib',
- 'advapi32.lib',
- 'shell32.lib',
- 'ole32.lib',
- 'oleaut32.lib',
- 'uuid.lib',
- 'odbc32.lib',
- 'odbccp32.lib',
- 'OpenGL32.lib',
- 'GLU32.lib'
-])
-#filter extraneous entries in the lib folders
-static_libs = list(filter(lambda name: name.endswith('.lib'), static_libs))
-
-print ("Linking the following:")
-[print('\t'+lib) for lib in static_libs]
-
-link_command = r'''"%s\Microsoft Visual Studio 10.0\VC\BIN\link.exe" /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\python32\libs /LIBPATH:C:\python32\PCbuild /LIBPATH:ogre_libs /LIBPATH:ogre_dep_libs /LIBPATH:boost_libs /EXPORT:PyInit_cyogre build\cyogre.obj /OUT:build\cyogre.pyd /IMPLIB:build\cyogre.lib /MANIFESTFILE:build\cyogre.pyd.manifest /FORCE /MANIFEST ''' % pfpath
-link_command += ' '.join(static_libs)
-
-manifest_command = r'''"%s\Microsoft SDKs\Windows\v7.0A\bin\mt.exe" -nologo -manifest build\cyogre.pyd.manifest -outputresource:build\cyogre.pyd;2''' % pfpath
-
-with open('build.bat', 'w') as dst:
- dst.write("@echo off" + '\n')
- # dst.write("vcvarsall.bat x86" + '\n')
- dst.write("set USE_MSsdk=1" + '\n')
- dst.write("set DISTUTILS_USE_SDK=1" + '\n')
- dst.write("mkdir build" + '\n')
- dst.write(cython_command + '\n')
- dst.write(compile_command + '\n')
- dst.write(link_command + '\n')
- dst.write(manifest_command + '\n')
View
56 cyth.bat
@@ -1,56 +0,0 @@
-@echo off
-
-rem "Clear settings before run"
-set VERBOSE=
-set PBR=
-
-rem "Handle arguments in any order"
-:arghandle
-if "%1"=="--help" goto usage
-if "%1"=="-v" goto verbose
-if "%1"=="-p" goto pbr
-goto end_arghandle
-:verbose
- set VERBOSE=1
- echo on
- goto end_arghandle
-:usage
- echo -v for verbose
- echo --help for usage
- echo -p for post-build run
- goto EOF
-:pbr
- set PBR=1
- goto end_arghandle
-:end_arghandle
-shift
-if not "%1"=="" goto arghandle
-
-rem "Set echo according to verbosity"
-if "%VERBOSE%"=="1" @echo on
-
-rem "Clean up the build environment before rebuilding"
-rd /S/Q build
-del /Q cyogre.cpp
-
-@echo off
-echo ---------------------- > build.log
-echo - buildbat.py - >> build.log
-echo ---------------------- >> build.log
-if "%VERBOSE%"=="1" @echo on
-
-python buildbat.py >> build.log
-@echo off
-echo ---------------------- >> build.log
-echo - build.bat - >> build.log
-echo ---------------------- >> build.log
-if "%VERBOSE%"=="1" @echo on
-
-CALL build.bat >> build.log
-
-if "%VERBOSE%"=="1" more build.log
-
-@echo off
-if "%PBR%"=="1" cd build & python & cd ..
-
-:EOF
View
0  include/OGRE/OgreBuildSettings.h → lib/OgreBuildSettings.h
File renamed without changes
View
0  boost_libs/libboost_date_time-vc100-mt-1_44.lib → lib/boost/libboost_date_time-vc100-mt-1_44.lib
File renamed without changes
View
0  boost_libs/libboost_thread-vc100-mt-1_44.lib → lib/boost/libboost_thread-vc100-mt-1_44.lib
File renamed without changes
View
0  ogre_libs/OgreMainStatic.lib → lib/ogre/OgreMainStatic.lib
File renamed without changes
View
0  ogre_libs/OgreMeshUpgrader.lib → lib/ogre/OgreMeshUpgrader.lib
File renamed without changes
View
0  ogre_libs/OgrePagingStatic.lib → lib/ogre/OgrePagingStatic.lib
File renamed without changes
View
0  ogre_libs/OgrePropertyStatic.lib → lib/ogre/OgrePropertyStatic.lib
File renamed without changes
View
0  ogre_libs/OgreRTShaderSystemStatic.lib → lib/ogre/OgreRTShaderSystemStatic.lib
File renamed without changes
View
0  ogre_libs/OgreTerrainStatic.lib → lib/ogre/OgreTerrainStatic.lib
File renamed without changes
View
0  ogre_libs/OgreXMLConverter.lib → lib/ogre/OgreXMLConverter.lib
File renamed without changes
View
0  ogre_libs/Plugin_BSPSceneManagerStatic.lib → lib/ogre/Plugin_BSPSceneManagerStatic.lib
File renamed without changes
View
0  ogre_libs/Plugin_CgProgramManagerStatic.lib → lib/ogre/Plugin_CgProgramManagerStatic.lib
File renamed without changes
View
0  ogre_libs/Plugin_OctreeSceneManagerStatic.lib → lib/ogre/Plugin_OctreeSceneManagerStatic.lib
File renamed without changes
View
0  ogre_libs/Plugin_OctreeZoneStatic.lib → lib/ogre/Plugin_OctreeZoneStatic.lib
File renamed without changes
View
0  ogre_libs/Plugin_PCZSceneManagerStatic.lib → lib/ogre/Plugin_PCZSceneManagerStatic.lib
File renamed without changes
View
0  ogre_libs/Plugin_ParticleFXStatic.lib → lib/ogre/Plugin_ParticleFXStatic.lib
File renamed without changes
View
0  ogre_libs/RenderSystem_Direct3D9Static.lib → lib/ogre/RenderSystem_Direct3D9Static.lib
File renamed without changes
View
0  ogre_libs/RenderSystem_GLStatic.lib → lib/ogre/RenderSystem_GLStatic.lib
File renamed without changes
View
0  ogre_dep_libs/FreeImage.lib → lib/ogre_dep/FreeImage.lib
File renamed without changes
View
0  ogre_dep_libs/OIS.lib → lib/ogre_dep/OIS.lib
File renamed without changes
View
0  ogre_dep_libs/cg.lib → lib/ogre_dep/cg.lib
File renamed without changes
View
0  ogre_dep_libs/freetype2311.lib → lib/ogre_dep/freetype2311.lib
File renamed without changes
View
0  ogre_dep_libs/zlib.lib → lib/ogre_dep/zlib.lib
File renamed without changes
View
0  ogre_dep_libs/zziplib.lib → lib/ogre_dep/zziplib.lib
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.