Files
orisys-sdk/BUILD_INSTRUCTIONS.md
T
2025-12-22 15:02:01 +08:00

3.2 KiB

Building Orisys Sensor Demo Executable and Installer

This guide explains how to package camera_gui.py into a standalone executable (.exe) and create an installer.

Prerequisites

  1. Python 3.8+ installed

  2. All dependencies installed:

    pip install -r requirements.txt
    pip install PyQt5 pyqtgraph PyInstaller
    
  3. For creating installer (.exe installer):

    • Download and install Inno Setup (free, open-source)

Method 1: Using PyInstaller (Simple)

  1. Build the executable:

    pyinstaller camera_gui.spec
    
  2. The executable will be in the dist folder: dist\camera_gui.exe

Option B: Using the build script

  1. Run the build script:

    python build_exe.py
    
  2. The executable will be in the dist folder: dist\camera_gui.exe

Option C: Manual PyInstaller command

pyinstaller --name=camera_gui --onefile --windowed --icon=orisys_logo_notext.png --add-data="orisys_logo_notext.png;." camera_gui.py

Method 2: Creating an Installer (.exe installer)

Using Inno Setup

  1. Build the executable first using Method 1 above

  2. Open Inno Setup Compiler

  3. Open the script file: build_installer.iss

  4. Compile the installer:

    • Click "Build" → "Compile"
    • Or press F9
  5. The installer will be created in the installer folder: installer\OrisysSensorDemo_Setup.exe

Customizing the Installer

Edit build_installer.iss to customize:

  • App name and version
  • Installation directory
  • Start menu shortcuts
  • Desktop icons
  • License file
  • Additional files to include

Troubleshooting

Common Issues

  1. "Module not found" errors:

    • Add missing modules to hiddenimports in camera_gui.spec
    • Or use --hidden-import=module_name in PyInstaller command
  2. Large executable size:

    • This is normal - PyInstaller bundles Python interpreter and all dependencies
    • Consider using --onedir instead of --onefile for faster startup
  3. Missing DLL files:

    • Ensure Visual C++ Redistributable is installed on target machines
    • Include required DLLs using --add-binary option
  4. OpenCV/CUDA issues:

    • If using CUDA, ensure CUDA DLLs are available
    • May need to add CUDA paths to pathex in spec file

Testing the Executable

  1. Test on a clean Windows machine (without Python installed)
  2. Ensure all required DLLs are included
  3. Test camera functionality
  4. Test file saving functionality

File Structure

After building, you should have:

dist/
  └── camera_gui.exe          # Standalone executable

installer/
  └── OrisysSensorDemo_Setup.exe  # Installer (after compiling with Inno Setup)

Distribution

  • Standalone executable: Just distribute dist\camera_gui.exe
  • Installer: Distribute installer\OrisysSensorDemo_Setup.exe for easier installation

Notes

  • The executable is large (~100-200MB) because it includes Python interpreter and all dependencies
  • First launch may be slower as files are extracted
  • Antivirus software may flag PyInstaller executables - this is a false positive
  • Consider code signing for production releases