Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(3 edits)

There are standard development tools available for this.
You need the development sdl2 package installed though.

```
pkgman install libsdl2 libsdl2_devel
```

now, libsdl2 shows up in the standard pkg-config...

```

$ pkg-config sdl2 --libs

-L/packages/libsdl2-2.0.20-3/.self/develop/lib -lSDL2

```


And static...

```

$ pkg-config sdl2 --libs --static

-L/packages/libsdl2-2.0.20-3/.self/develop/lib -lSDL2 -ltextencoding -ldevice -lgame -lmedia -lbe -lroot -lGL -lm -Wl,--no-undefined -lSDL2
```


You can even make an operating system package with SDL2 dependencies:

```
cd ~
ls mcpixel3_haiku_x64   # bin gfx scr etc

cat .PackageInfo

name  mcpixel3
version 1.7-1  (whatever)
architecture x86_64
summary  "save the world"
description  "saving the world, one McPixel at a time"
vendor "Devolver Digital"
packager "staff@devolverdigital.com"
copyrights {"(C) 2012-2023 Devolver Digital"}
licenses  {"Closed"}
provides {
  cmd:mcpixel
}
requires {
  haiku >= r1beta4
  lib:libSDL2
}

package create -b -I /boot/system/apps/McPixel McPixel.hpkg
package add -C mcpixel3_haiku_x64 McPixel.hpkg *
```

Perhaps some additions to FindSDL2.cmake (if present) might also be needed if not statically linking?

Something like this:

SET(SDL2_SEARCH_PATHS
  ~/Library/Frameworks
  /Library/Frameworks
  /usr/local
  /usr
  /sw # Fink
  /opt/local # DarwinPorts
  /opt/csw # Blastwave
  /opt
  /boot/system/lib # Haiku
)

FIND_PATH(SDL2_INCLUDE_DIR SDL.h
  HINTS
  $ENV{SDL2DIR}
  PATH_SUFFIXES include/SDL2 include headers/SDL2 headers/x86/SDL2    # Last two are for Haiku
  PATHS ${SDL2_SEARCH_PATHS}
)

Source