Skip to content

Instantly share code, notes, and snippets.

@TheFrostlixen
Last active December 14, 2015 16:43
Show Gist options
  • Save TheFrostlixen/619a1964450c0547ad06 to your computer and use it in GitHub Desktop.
Save TheFrostlixen/619a1964450c0547ad06 to your computer and use it in GitHub Desktop.
How to compile Python Ogre to EXE

How To Compile Python Ogre to Standalone Executable

  1. Install python ogre. I recommend using this guide followed by this.

  2. Download and install py2exe for your Python version.

  3. Create setup.py:

    # setup.py
    from distutils.core import setup
    import py2exe
    setup(console=['main.py'])
    
  4. Copy the following Python DLL's to your Ogre project directory:

  • C:\Python26\Lib\site-packages\ogre\renderer\OGRE\cg.dll
  • C:\Python26\Lib\site-packages\ogre\renderer\OGRE\OgreMain.dll
  • C:\Python26\Lib\site-packages\ogre\renderer\OGRE\boost_python-vc90-mt-1_42.dll
  1. In the command line enter python setup.py py2exe.

  2. Copy Ogre plugins, the above DLL's, config files, and any media/resource files (basically anything not python code) to dist\ folder inside your project.

Congrats, you now have your Python Ogre executable! You may rename it to whatever you want. If you want to pack your dist folder into the executable, I recommend using UPX Tools. If you want to add an application icon, I recommend using Resource Hacker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment