S2D CLI

Platform Support

S2D CLI supports Windows, Linux, and macOS with different levels of automation for each platform.

🔗 Overview

S2D CLI automatically detects your operating system and configures projects accordingly. However, the level of automation varies significantly between platforms:

Platform Library Setup Native Libraries Build Configuration
Windows ✅ Automatic ✅ DLLs copied ✅ Full paths configured
Linux ⚠️ Manual required ⚠️ System install needed ⚠️ Manual configuration
macOS ⚠️ Manual required ⚠️ Homebrew install needed ⚠️ Manual configuration

🔗 Windows

Windows has the best support with full automation. S2D CLI will:

Automatic Setup

Generated Configuration

The build configuration includes:

// SBT example
nativeConfig ~= { c =>
  c.withLinkingOptions(c.linkingOptions ++ Seq(
    "-LC:\\path\\to\\project\\libraries\\SDL2\\lib",
    "-LC:\\path\\to\\project\\libraries\\glew\\lib\\Release\\x64",
    "-LC:\\path\\to\\project\\libraries\\STB",
    "-lSDL2", "-lSDL2main", "-lglew32", "-lopengl32", "-lglu32"
  ))
}

Project Structure (Windows)

my-s2d-project/
├── SDL2.dll                    # Copied automatically
├── glew32.dll                  # Copied automatically
├── libraries/
│   ├── SDL2/
│   │   ├── lib/               # Windows libraries
│   │   └── include/           # Headers
│   ├── glew/
│   │   ├── lib/Release/x64/   # Windows libraries
│   │   └── include/           # Headers
│   └── STB/
│       └── include/           # Headers
└── main.scala

🔗 Linux

Linux requires manual setup of native libraries. S2D CLI will generate a project with commented configuration that you need to enable after installing dependencies.

Required Dependencies

Install development packages for SDL2, GLEW, and STB:

Ubuntu/Debian

sudo apt-get update
sudo apt-get install libsdl2-dev libglew-dev libstb-dev

Fedora/RHEL

sudo dnf install SDL2-devel glew-devel stb-devel

Arch Linux

sudo pacman -S sdl2 glew stb

Manual Configuration

After installing dependencies, uncomment and adjust the build configuration:

// Uncomment and adjust paths as needed
nativeConfig ~= { c =>
  c.withLinkingOptions(c.linkingOptions ++ Seq(
    "-lSDL2", "-lSDL2main", "-lGLEW", "-lGL"
  ))
}

Warning Message

When generating projects on Linux, you'll see:

WARNING: Generated project requires manual configuration on non-Windows systems
 - Install SDL2, GLEW, and STB development libraries for your platform
 - Update the native linking paths in your build configuration
 - For Ubuntu/Debian: sudo apt-get install libsdl2-dev libglew-dev

🔗 macOS

macOS requires manual setup using Homebrew or MacPorts.

Required Dependencies

Using Homebrew (Recommended)

brew install sdl2 glew

Using MacPorts

sudo port install libsdl2 glew

Manual Configuration

After installing dependencies, uncomment and adjust the build configuration:

// Uncomment and adjust for macOS
nativeConfig ~= { c =>
  c.withLinkingOptions(c.linkingOptions ++ Seq(
    "-lSDL2", "-lSDL2main", "-lGLEW",
    "-framework OpenGL"  // macOS-specific
  ))
}

Framework Linking

macOS uses frameworks instead of traditional libraries for OpenGL:

🔗 Troubleshooting

Common Issues

Library Not Found Errors

If you see linking errors like "library not found":

Header File Errors

If compilation fails with missing headers:

Runtime Errors

If the compiled program fails to start:

Getting Help

If you encounter platform-specific issues: