Code Monkey home page Code Monkey logo

sokol-samples's Introduction

sokol-samples

Sample code for https://github.com/floooh/sokol

WASM live demos:

Build Status:

Platform Build Status
GH Actions (OSX/Linux/Win+VS2019/iOS/WASM/Android) Build Status

How to Build on Windows, Linux and macOS

First check that the following tools are in the path. Exact versions shouldn't matter (on Windows you can use scoop.sh to easily install the required tools from the command line):

> git --version
2.x.x (any version should do)
> python3 --version
Python 3.x
> cmake --version
cmake version 3.21.x or later
# on OSX (on Windows you just need a recent VS)
> xcodebuild -version
Xcode xx.x (newer is better, older version are no longer tested)
# ninja is recommended for cmdline builds, faster and also cleaner terminal output
> ninja --version
1.x.y

NOTE in Linux you'll also need to install the OpenGL, X11 and ALSA development packages (e.g. mesa-common-dev, libx11-dev and libasound2-dev).

Create a scratch/workspace dir and clone the project:

> mkdir ~/scratch
> cd ~/scratch
> git clone https://github.com/floooh/sokol-samples
> cd sokol-samples

Select a build config for your platform and 3D backend combination:

# macOS with Metal:
> ./fips set config sapp-metal-osx-ninja-debug
# macOS with OpenGL:
> ./fips set config sapp-osx-ninja-debug
# Windows with D3D11:
> ./fips set config sapp-d3d11-win64-vstudio-debug
# Windows with OpenGL:
> ./fips set config sapp-win64-vstudio-debug
# Linux:
> ./fips set config sapp-linux-ninja-debug

Build the project (this will also fetch additional dependencies):

> ./fips build

List and run the build targets:

> ./fips list targets
...
> ./fips run triangle-sapp

...to open the project in Visual Studio or Xcode:

> ./fips gen
> ./fips open

...you can also open the project in VSCode (with the MS C/C++ extension), for instance on Linux:

> ./fips set config linux-vscode-debug
> ./fips gen
> ./fips open

For additional platforms (like iOS/Android), continue reading the README past the What's New section.

For more information on the fips build system see here: https://floooh.github.io/fips/

Building the platform-agnostic sokol_app.h + sokol_gfx.h samples for additional platforms:

Building the sokol_app.h samples is currently supported for MacOS, Windows, Linux, iOS, HTML5 and Android.

Use any of the following custom build configs starting with sapp- which matches your platform and build system:

> ./fips list configs | grep sapp-
  sapp-android-ninja-debug
  ...
  sapp-d3d11-win64-vs2017-debug
  sapp-d3d11-win64-vs2017-release
  sapp-d3d11-win64-vscode-debug
  sapp-d3d11-win64-vstudio-debug
  sapp-d3d11-win64-vstudio-release
  sapp-ios-xcode-debug
  ...
  sapp-win64-vstudio-debug
  sapp-win64-vstudio-release
  ...
  sapp-webgl2-wasm-ninja-debug
  sapp-webgl2-wasm-ninja-release
  sapp-webgl2-wasm-vscode-debug
  sapp-webgl2-wasm-vscode-release
  ...
  sapp-wgpu-wasm-ninja-debug
  sapp-wgpu-wasm-ninja-release
  sapp-wgpu-wasm-vscode-debug
  sapp-wgpu-wasm-vscode-release

> ./fips set config sapp-...
> ./fips build
> ./fips list targets
> ./fips run cube-sapp

Note the following caveats:

  • for HTML5, first install the emscripten SDK as described above in the native HTML5 sample section
  • for iOS, set the developer team id, as described above in the iOS section

Building the platform-specific samples

There are two types of samples, platform-specific samples in the folders d3d11, glfw, html5 and metal, and platform-agnostic samples using the sokol_app.h application-wrapper header in the folder sapp.

To build the GLFW samples on Linux, MacOS and Windows:

> mkdir ~/scratch
> cd ~/scratch
> git clone https://github.com/floooh/sokol-samples
> cd sokol-samples
> ./fips build
...
> ./fips list targets
...
> ./fips run triangle-glfw
...

On Linux you'll need to install a couple of development packages for GLFW: http://www.glfw.org/docs/latest/compile.html#compile_deps_x11

To build for Metal on OSX:

> cd ~/scratch/sokol-samples
> ./fips set config metal-osx-xcode-debug
> ./fips build
...
> ./fips list targets
...
> ./fips run triangle-metal

To build for Metal on iOS:

> cd ~/scratch/sokol-samples
> ./fips set config metal-ios-xcode-debug
> ./fips set iosteam [YOUR-TEAM-ID]
> ./fips gen
> ./fips open
# Xcode should open now, where you can build and run the iOS code as usual

The [YOUR-TEAM-ID] must be replaced with your Apple Developer Team ID, this is a 10-character string which you can look up on https://developer.apple.com/account/#/membership. If you get build errors about 32-bit targets, exit Xcode, run ./fips clean, ./fips gen and ./fips open again. This is a known but unsolved issue which I need to investigate.

Another known issue: The arraytex-metal sample currently has a weird rendering artefact at least on my iPad Mini4 which looks like Z-fighting.

To build for D3D11 on Windows:

> cd /scratch/sokol-samples
> fips set config d3d11-win64-vstudio-debug
> fips build
...
> fips list targets
...
> fips run triangle-d3d11

To build for WebGL2+WASM on Emscripten:

> cd ~/scratch/sokol-samples
> ./fips setup emscripten
[...this will take a while]
> ./fips set config webgl2-wasm-ninja-release
> ./fips build
...
> ./fips list targets
...
> ./fips run triangle-emsc
...

To build for WebGPU+WASM on Emscripten:

> cd ~/scratch/sokol-samples
> ./fips setup emscripten
[...this will take a while]
> ./fips set config wgpu-wasm-ninja-release
> ./fips build
...
> ./fips list targets
...
> ./fips run triangle-wgpu
...

To build for Android:

Plug an Android device into your computer, and then:

> cd ~/scratch/sokol-samples
> ./fips setup android
[...this will install a local Android SDK/NDK under ../fips-sdks/android]
> ./fips set config sapp-android-ninja-debug
> ./fips build
...
> ./fips list targets
...
> ./fips run triangle-sapp
...

The last command should install and run the triangle-sapp sample on the connected Android device.

To debug Android applications I recommend using Android Studio with "Profile or debug APK". You can find the compiled APK files under ../fips-deploy/[project]/[config].

How to build without a build system

Many samples are simple enough to be built directly on the command line without a build system, and the following examples of that might be helpful for integrating the sokol headers and/or the sokol sample code into your own project with the build system of your choice.

The expected directory structure for building the sokol-samples manually is as follows (e.g. those directories must be cloned side-by-side):

sokol-samples
sokol
sokol-tools-bin

For instance:

> mkdir scratch
> cd scratch
> git clone https://github.com/floooh/sokol-samples
> git clone https://github.com/floooh/sokol
> git clone https://github.com/floooh/sokol-tools-bin

Of course, in your own project you can put the sokol headers wherever you want (I recommend copying them somewhere into your source directory), and you don't have to use the prebuilt sokol-shdc shader compiler either.

NOTE: for Release builds, you might want to add the compiler's respective optimization flags, and provide an NDEBUG define so that assert() checks and the sokol-gfx validation layer are removed (BUT please don't do this for the Debug/Dev builds because asserts() and the validation layer give useful feedback if something goes wrong).

Building manually on macOS with clang

To build one of the Metal samples:

> cd sokol-samples/metal
> cc cube-metal.c osxentry.m sokol_gfx.m -o cube-metal -fobjc-arc -I../../sokol -framework Metal -framework Cocoa -framework MetalKit -framework Quartz

To build one of the GLFW samples (requires a system-wide glfw install, e.g. brew install glfw):

> cd sokol-samples/glfw
> cc cube-glfw.c flextgl/flextGL.c -o cube-glfw -I../../sokol -lglfw -framework OpenGL -framework Cocoa

To build one of the sokol-app samples for Metal:

> cd sokol-samples/sapp
> ../../sokol-tools-bin/bin/osx/sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l metal_macos
> cc cube-sapp.c ../libs/sokol/sokol.m -o cube-sapp -DSOKOL_METAL -fobjc-arc -I../../sokol -I ../libs -framework Metal -framework Cocoa -framework MetalKit -framework Quartz -framework AudioToolbox

To build one of the sokol-app samples for GL on macOS:

> cd sokol-samples/sapp
> ../../sokol-tools-bin/bin/osx/sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l glsl330
> cc cube-sapp.c ../libs/sokol/sokol.m -o cube-sapp -fobjc-arc -DSOKOL_GLCORE -I../../sokol -I../libs -framework OpenGL -framework Cocoa -framework AudioToolbox

Building manually on Windows with MSVC

From the VSxxxx x64 Native Tools Command Prompt (for 64-bit builds) or Developer Command Prompt for VSxxxx (for 32-bit builds):

To build one of the D3D11 samples:

> cd sokol-samples\d3d11
> cl cube-d3d11.c d3d11entry.c /I..\..\sokol

To build one of the sokol-app samples for D3D11:

> cd sokol-samples\sapp
> ..\..\sokol-tools-bin\bin\win32\sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l hlsl5
> cl cube-sapp.c ..\libs\sokol\sokol.c /DSOKOL_D3D11 /I..\..\sokol /I..\libs

To build one of the sokol-app samples for GL on Windows:

> cd sokol-samples\sapp
> ..\..\sokol-tools-bin\bin\win32\sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l glsl330
> cl cube-sapp.c ..\libs\sokol\sokol.c /DSOKOL_GLCORE /I..\..\sokol /I..\libs kernel32.lib user32.lib gdi32.lib

Building manually on Windows with MSYS2/mingw gcc:

NOTE: compile with '-mwin32' (this defines _WIN32 for proper platform detection)

From the MSYS2 shell:

> cd sokol-samples/sapp
# compile shaders for HLSL and GLSL:
> ../../sokol-tools-bin/bin/win32/sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l hlsl5:glsl330
# build and run with D3D11 backend:
> gcc cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp-d3d11 -mwin32 -O2 -DSOKOL_D3D11 -I../../sokol -I ../libs -lkernel32 -luser32 -lshell32 -ldxgi -ld3d11 -lole32 -lgdi32
> ./cube-sapp-d3d11
# build and run with GL backend:
> gcc cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp-gl -mwin32 -O2 -DSOKOL_GLCORE -I../../sokol -I ../libs -lkernel32 -luser32 -lshell32 -lgdi32 -lole32
> ./cube-sapp-gl

Building manually on Windows with Clang:

NOTE: AFAIK Clang for Windows needs a working MSVC toolchain and Windows SDK installed, I haven't tested without.

Clang recognizes the #pragma comment(lib,...) statements in the Sokol headers, so you don't need to specify the link libraries manually.

> cd sokol-samples/sapp
# compile shaders for HLSL and GLSL:
> ..\..\sokol-tools-bin\bin\win32\sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l hlsl5:glsl330
# build and run with D3D11 backend:
> clang cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp-d3d11.exe -O2 -DSOKOL_D3D11 -I ../../sokol -I ../libs
> cube-sapp-d3d11
# build and run with GL backend:
> clang cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp-gl.exe -O2 -DSOKOL_GLCORE -I ../../sokol -I ../libs
> cube-sapp-gl

Building manually on Linux with gcc

On Linux you need the "usual" development-packages for OpenGL development, and for the GLFW samples, also the GLFW development package (on Ubuntu it's called libglfw3-dev).

To build one of the GLFW samples on Linux:

> cd sokol-samples/glfw
> cc cube-glfw.c glfw_glue.c flextgl/flextGL.c -o cube-glfw -I../../sokol -lGL -ldl -lm -lglfw3

To build one of the sokol-app samples on Linux:

> cd sokol-samples/sapp
> ../../sokol-tools-bin/bin/linux/sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l glsl330
> cc cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp -DSOKOL_GLCORE -pthread -I../../sokol -I../libs -lGL -ldl -lm -lX11 -lasound -lXi -lXcursor

Building for WASM / WebGL2

Make sure emcc and emrun from the Emscripten SDK are in the path.

> cd sokol-samples/html5
> emcc cube-emsc.c -o cube-emsc.html -I../../sokol -sUSE_WEBGL2 --shell-file=../webpage/shell.html
> emrun cube-emsc.html

...and for the sokol-app samples:

> sokol-samples/sapp
> ../../sokol-tools-bin/bin/[platform]/sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l glsl300es
> emcc cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp.html -DSOKOL_GLES3 -I../../sokol -I../libs -sUSE_WEBGL2 --shell-file=../webpage/shell.html
> emrun cube-sapp.html

Many Thanks to:

Enjoy!

What's New:

(FIXME: this stuff really needs to go into a separate CHANGELOG.md)

  • 21-Oct-2023: Updated WebGPU support, and new samples .

(lots of stuff missing here)

  • 23-Sep-2020: samples can now be built for UWP using the sapp-uwp-vstudio-debug and sapp-uwp-vstudio-release build configs NOTE that fips support for UWP built apps is incomplete (e.g. fips run doesn't work, and UWP app bundle creation is also not supported)

  • 27-May-2020: four new test and demonstration samples for the new sokol_debugtext.h header

  • 30-Apr-2020: New sokol_gfx.h WebGPU backend samples, and updated all other samples for the breaking changes in sokol_gfx.h initialization, see the Updates section in the sokol_gfx.h README for details!

  • 24-Feb-2020: I have added a section to the readme with examples of how to build (most of) the examples without a build system by invoking the C compiler directly on the command line. This might be useful for integration of the sokol headers into your own projects using your own preferred build system.

  • 22-Jan-2020: New sample to demonstrate how to render from inside a Dear ImGui user draw callback: imgui-usercallback-sapp

  • 26-Aug-2019: New sample: fontstash-sapp

  • 06-Jul-2019: Two new samples for the new sokol_fetch.h header:

  • 04-Jun-2019: New sample on how to compile and use the sokol headers as DLL (currently only on Windows). This demonstrates the new SOKOL_DLL configuration define which annotates public function declarations with __declspec(dllexport) or __declspec(dllimport). See here for the DLL, and here for the example code using the DLL.

  • 15-May-2019: the sokol-app samples in the sapp directory have been "ported" to the new shader-cross-compiler solution (see here for details). Shaders are written as 'annotated GLSL', and cross-compiled to various GLSL dialects, HLSL and MSL through a custom-build job which invokes the sokol-shdc command line tool.

  • 01-Apr-2019: sample code for the new sokol_gl.h header:

  • 05-Mar-2019: the sokol-app samples (in the sapp directory) now come with optional debugging UIs implemented via the new Dear ImGui based debug-inspection headers, these are compiled as separate executables, so the executable-versions without UI are still as small as possible.

  • 19-Feb-2019: a new sokol_app.h sample has been added to demonstrate the new SOKOL_NO_ENTRY feature (in which sokol_app.h doesn't hijack the main function): sapp/noentry-sapp.c

  • 26-Jan-2019: The sokol_app.h samples now also work on Android. See below for build instructions.

  • 12-Apr-2018: New samples have been added to demonstrate the new optional vertex-buffer- and index-buffer-offsets in the sg_draw_state struct. Also the location of fips build-system files have changed, please update fips with a 'git pull' from the fips directory.

  • 27-Mar-2018: The Dear Imgui fips wrapper has recently been moved to a new repository at https://github.com/fips-libs/fips-imgui and updated to the latest ImGui version which required some code changes. If you already had checked out sokol-samples, perform the following steps to udpate:

    1. delete the fips-imgui directory
    2. in the sokol-samples directory, run ./fips fetch

sokol-samples's People

Contributors

aletts avatar angluca avatar cedric-h avatar dhilliard avatar eam avatar floooh avatar hirossan4049 avatar kevinw avatar medvednikov avatar wmerrifield avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sokol-samples's Issues

'vertex_layouts': is not a member of 'sg_pipeline_desc'

It looks that Sokol's d3d11 samples are now not compatible with recent modifications done in Sokol project itself.
Here is example of errors which are there during build process:

ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX
  86\x64\CL.exe /c /I"x:\GIT\fips-glfw\glfw\include" /I"x:\GIT\fips-imgui\imgui" /Ix:\GIT\sokol /Zi
   /nologo /W1 /WX /diagnostics:classic /MP /Od /Oy- /D WIN32 /D _DEBUG /D FIPS_DEBUG=1 /D FIPS_APP
  _WINDOWED=1 /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MTd /GS /fp:precise /Zc:wchar_t /Zc:forSco
  pe /Zc:inline /Fo"triangle-d3d11.dir\Debug\\" /Fd"triangle-d3d11.dir\Debug\vc141.pdb" /Gd /TC /er
  rorReport:queue "X:\GIT\sokol-samples\d3d11\triangle-d3d11.c"
  triangle-d3d11.c
X:\GIT\sokol-samples\d3d11\triangle-d3d11.c(72): error C2039: 'vertex_layouts': is not a member of
'sg_pipeline_desc' [X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\triangle-d3d11.
vcxproj]
  x:\GIT\sokol\sokol_gfx.h(1368): note: see declaration of 'sg_pipeline_desc'
X:\GIT\sokol-samples\d3d11\triangle-d3d11.c(72): error C2109: subscript requires array or pointer t
ype [X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\triangle-d3d11.vcxproj]
X:\GIT\sokol-samples\d3d11\triangle-d3d11.c(72): error C2224: left of '.stride' must have struct/un
ion type [X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\triangle-d3d11.vcxproj]
X:\GIT\sokol-samples\d3d11\triangle-d3d11.c(72): error C2224: left of '.attrs' must have struct/uni
on type [X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\triangle-d3d11.vcxproj]
X:\GIT\sokol-samples\d3d11\triangle-d3d11.c(72): error C2078: too many initializers [X:\GIT\fips-bu
ild\sokol-samples\d3d11-win64-vstudio-debug\d3d11\triangle-d3d11.vcxproj]
Done Building Project "X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\triangle-d3d
11.vcxproj" (default targets) -- FAILED.

PS: glfw version is OK.

build fails following Metal IOS instructions (mojave)

pc-138-1:sokol-samples oli$ ./fips set config metal-ios-xcode-debug
'config' set to 'metal-ios-xcode-debug' in project 'sokol-samples'
pc-138-1:sokol-samples oli$ ./fips set iosteam XXXXXXXXXX
'iosteam' set to 'xxxxx' in project 'sokol-samples'
pc-138-1:sokol-samples oli$ ./fips gen
=== dependency: 'fips-cimgui':
dir '/Users/oli/Dev/FrameworkTests/sokol/fips-cimgui' exists
=== dependency: 'sokol-tools-bin':
dir '/Users/oli/Dev/FrameworkTests/sokol/sokol-tools-bin' exists
=== dependency: 'sokol':
dir '/Users/oli/Dev/FrameworkTests/sokol/sokol' exists
=== dependency: 'fips-glfw':
dir '/Users/oli/Dev/FrameworkTests/sokol/fips-glfw' exists
=== dependency: 'fips-libmodplug':
dir '/Users/oli/Dev/FrameworkTests/sokol/fips-libmodplug' exists
=== dependency: 'fips-imgui':
dir '/Users/oli/Dev/FrameworkTests/sokol/fips-imgui' exists
=== generating: metal-ios-xcode-debug
config file: /Users/oli/Dev/FrameworkTests/sokol/sokol-samples/fips-files/configs/metal-ios-xcode-debug.yml
Using Toolchain File: /Users/oli/Dev/FrameworkTests/sokol/fips/cmake-toolchains/ios.toolchain.cmake
cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=/Users/oli/Dev/FrameworkTests/sokol/fips/cmake-toolchains/ios.toolchain.cmake -DFIPS_CONFIG=metal-ios-xcode-debug -DFIPS_IOS_USE_ARC=ON -DSOKOL_USE_METAL=ON -DFIPS_IOS_TEAMID=xxxxx -DFIPS_USE_CCACHE=OFF -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk -DFIPS_AUTO_IMPORT=OFF -B/Users/oli/Dev/FrameworkTests/sokol/fips-build/sokol-samples/metal-ios-xcode-debug -H/Users/oli/Dev/FrameworkTests/sokol/sokol-samples
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
System is unknown to cmake, create:
Platform/iOS to use this system, please send your config file to [email protected] so it can be added to cmake
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
System is unknown to cmake, create:
Platform/iOS to use this system, please send your config file to [email protected] so it can be added to cmake
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- broken
CMake Error at /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /Users/oli/Dev/FrameworkTests/sokol/fips-build/sokol-samples/metal-ios-xcode-debug/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/xcodebuild" "-project" "CMAKE_TRY_COMPILE.xcodeproj" "build" "-target" "cmTC_b4ff1" "-configuration" "Debug"
Prepare build
note: Using legacy build system

=== BUILD TARGET cmTC_b4ff1 OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===

Check dependencies
target specifies product type 'com.apple.product-type.tool', but there's no such product type for the 'iphoneos' platform
warning: The armv7 architecture is deprecated for your deployment target (iOS 12.4). You should update your ARCHS build setting to remove the armv7 architecture.

** BUILD FAILED **


The following build commands failed:
	Check dependencies
(1 failure)

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:5 (project)

-- Configuring incomplete, errors occurred!
See also "/Users/oli/Dev/FrameworkTests/sokol/fips-build/sokol-samples/metal-ios-xcode-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/oli/Dev/FrameworkTests/sokol/fips-build/sokol-samples/metal-ios-xcode-debug/CMakeFiles/CMakeError.log".
[ERROR] failed to generate build files for config 'metal-ios-xcode-debug'
[ERROR] 1 out of 1 configs failed!

Bad CPU type in executable

Getting "Bad CPU type in executable" when building sokol-samples on an iMac with an Intel Core i5

username@iMac sokol-samples % ./fips run quad-metal
=== run 'quad-metal' (config: metal-osx-xcode-debug, project: sokol-samples):
/bin/sh: /Users/username/fips-deploy/sokol-samples/metal-osx-xcode-debug/quad-metal.app/Contents/MacOS/quad-metal: Bad CPU type in executable

emsc error,javascript error

Hello Sir ,

i have the following error doing the next step :
./fips setup emscripten

./fips set config webgl2-emsc-make-release
./fips build
./fips list targets
./fips run triangle-emsc
failed with the next error :
'Document': The provided selector is empty.,Error: Failed to execute 'querySelector' on 'Document': The provided selector is empty.
at __findEventTarget (http://localhost:8080/triangle-emsc.js:1:15800)
at __registerUiEventCallback (http://localhost:8080/triangle-emsc.js:1:37924)
at _emscripten_set_resize_callback_on_thread (http://localhost:8080/triangle-emsc.js:1:38755)
at wasm-function[70]:0x3ea9
at wasm-function[75]:0x6ff7
at Module._main (http://localhost:8080/triangle-emsc.js:1:59226)
at callMain (http://localhost:8080/triangle-emsc.js:1:60012)
at doRun (http://localhost:8080/triangle-emsc.js:1:60590)
at http://localhost:8080/triangle-emsc.js:1:60745

ImGui highdpi demo overlay window example sets wrong window position

The issue to reproduce is simple.

Head to https://floooh.github.io/sokol-html5/wasm/imgui-highdpi-sapp.html with a display dpi > 1 (I tested with a 4K with dpi set to 2.5) and from the menu bar Examples->Sample Overlay.
Right click on the overlay window and change to one of the non-default options, such as Top-Right, Bottom-Left, Bottom-Right. The overlay window disappears.

What happens is the code will place the overlay window outside the window as if the dpi scaling is not taken into account (that's why the default 0,0 position seems to work properly).

If I divide window_pos by sapp_dpi_scale() the window is correctly positioned at the corners.

This is the demo code responsible for it. Do you think is a sokol issue or the ImGui demo is not properly written to support high dpi?

// Demonstrate creating a simple static window with no decoration + a context-menu to choose which corner of the screen to use.
static void ShowExampleAppSimpleOverlay(bool* p_open)
{
    const float DISTANCE = 10.0f;
    static int corner = 0;
    ImGuiIO& io = ImGui::GetIO();
    if (corner != -1)
    {
        ImVec2 window_pos = ImVec2((corner & 1) ? io.DisplaySize.x - DISTANCE : DISTANCE, (corner & 2) ? io.DisplaySize.y - DISTANCE : DISTANCE);
        ImVec2 window_pos_pivot = ImVec2((corner & 1) ? 1.0f : 0.0f, (corner & 2) ? 1.0f : 0.0f);
        ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);
    }
    ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background
    if (ImGui::Begin("Example: Simple overlay", p_open, (corner != -1 ? ImGuiWindowFlags_NoMove : 0) | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
    {
        ImGui::Text("Simple overlay\n" "in the corner of the screen.\n" "(right-click to change position)");
        ImGui::Separator();
        if (ImGui::IsMousePosValid())
            ImGui::Text("Mouse Position: (%.1f,%.1f)", io.MousePos.x, io.MousePos.y);
        else
            ImGui::Text("Mouse Position: <invalid>");
        if (ImGui::BeginPopupContextWindow())
        {
            if (ImGui::MenuItem("Custom",       NULL, corner == -1)) corner = -1;
            if (ImGui::MenuItem("Top-left",     NULL, corner == 0)) corner = 0;
            if (ImGui::MenuItem("Top-right",    NULL, corner == 1)) corner = 1;
            if (ImGui::MenuItem("Bottom-left",  NULL, corner == 2)) corner = 2;
            if (ImGui::MenuItem("Bottom-right", NULL, corner == 3)) corner = 3;
            if (p_open && ImGui::MenuItem("Close")) *p_open = false;
            ImGui::EndPopup();
        }
    }
    ImGui::End();
}

missing http-server referenced by "fips run triangle-emsc"

i followed instructions from scratch, i.e. git clone and build.
output from trying emscripten version:

=== run 'triangle-emsc' (config: webgl2-emsc-make-release, project: sokol-samples):
'http-server' is not recognized as an internal or external command,
operable program or batch file.
Traceback (most recent call last):
  File "fips", line 17, in <module>
    fips.run(fips_path, proj_path, sys.argv)
  File "d:\otherdev/fips\mod\fips.py", line 51, in run
    verb.verbs[verb_name].run(fips_path, proj_path, verb_args)
  File "d:/otherdev/fips/verbs\run.py", line 28, in run
    retcode = project.run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd)
  File "d:\otherdev/fips\mod\project.py", line 356, in run
    if cmd_line :
UnboundLocalError: local variable 'cmd_line' referenced before assignment

Renaming sokol-samples crashes fips

Hi,

After cloning this repo, if the repo directory (sokol-samples) is renamed to something else (eg. "sokol"), and then that directory is entered and any ./fips command is run, fips will clone/update itself but then python will get stuck and crash with a RuntimeError: maximum recursion depth exceeded.

(Everything works fine if I don't rename the directory.)

Thanks!

emscripten build error

root@e1c5d8668d31:/tmp/sokol-samples# ./fips setup emscripten
=== updating emscripten SDK at '/tmp/fips-sdks/emsdk'
Already up to date.
=== installing emscripten tools for 'latest'
Resolving SDK alias 'latest' to '3.1.20'
Resolving SDK version '3.1.20' to 'sdk-releases-upstream-d92c8639f406582d70a5dde27855f74ecf602f45-64bit'
Installing SDK 'sdk-releases-upstream-d92c8639f406582d70a5dde27855f74ecf602f45-64bit'..
Installing tool 'node-14.18.2-64bit'..
Downloading: /tmp/fips-sdks/emsdk/zips/node-v14.18.2-linux-x64.tar.xz from https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/node-v14.18.2-linux-x64.tar.xz, 21848416 Bytes
Unpacking '/tmp/fips-sdks/emsdk/zips/node-v14.18.2-linux-x64.tar.xz' to '/tmp/fips-sdks/emsdk/node/14.18.2_64bit'
tar (child): xz: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
['tar', '-xf', '/tmp/fips-sdks/emsdk/zips/node-v14.18.2-linux-x64.tar.xz', '--strip', '1'] failed with error code 2!
error: installation failed!
=== activating emscripten SDK version 'latest'
embedded mode is now the only mode available
Resolving SDK alias 'latest' to '3.1.20'
Resolving SDK version '3.1.20' to 'sdk-releases-upstream-d92c8639f406582d70a5dde27855f74ecf602f45-64bit'
error: error: tool is not installed and therefore cannot be activated: 'node-14.18.2-64bit'

clear-sapp: non-trivial designated initializers not supported when used g++ MinGW compiler

It looks that code like:

sg_setup(&(sg_desc){
.gl_force_gles2 = true,
.mtl_device = sapp_metal_get_device(),
.mtl_renderpass_descriptor_cb = sapp_metal_get_renderpass_descriptor,
.mtl_drawable_cb = sapp_metal_get_drawable,
.d3d11_device = sapp_d3d11_get_device(),
.d3d11_device_context = sapp_d3d11_get_device_context(),
.d3d11_render_target_view_cb = sapp_d3d11_get_render_target_view,
.d3d11_depth_stencil_view_cb = sapp_d3d11_get_depth_stencil_view
});

is not supported with MinGW g++ compiler:

g++.exe (x86_64-posix-seh-rev1, Built by MinGW-W64 project) 7.2.0
sokol-samples\sapp\clear-sapp.c: In function 'void init()':
sokol-samples\sapp\clear-sapp.c:20:5: sorry, unimplemented: non-trivial designated initializers not supported
     });
     ^
sokol-samples\sapp\clear-sapp.c:20:5: sorry, unimplemented: non-trivial designated initializers not supported
sokol-samples\sapp\clear-sapp.c:20:5: sorry, unimplemented: non-trivial designated initializers not supported
sokol-samples\sapp\clear-sapp.c:20:5: sorry, unimplemented: non-trivial designated initializers not supported
sokol-samples\sapp\clear-sapp.c:20:5: sorry, unimplemented: non-trivial designated initializers not supported
sokol-samples\sapp\clear-sapp.c:20:5: sorry, unimplemented: non-trivial designated initializers not supported
sokol-samples\sapp\clear-sapp.c:20:5: sorry, unimplemented: non-trivial designated initializers not supported
sokol-samples\sapp\clear-sapp.c:20:5: sorry, unimplemented: non-trivial designated initializers not supported
sokol-samples\sapp\clear-sapp.c:21:34: error: expected primary-expression before ')' token
     pass_action = (sg_pass_action) {
                                  ^
sokol-samples\sapp\clear-sapp.c: In function 'sapp_desc sokol_main(int, char**)':
sokol-samples\sapp\clear-sapp.c:51:5: sorry, unimplemented: non-trivial designated initializers not supported
     };
     ^
sokol-samples\sapp\clear-sapp.c:51:5: sorry, unimplemented: non-trivial designated initializers not supported
sokol-samples\sapp\clear-sapp.c:51:5: sorry, unimplemented: non-trivial designated initializers not supported
sokol-samples\sapp\clear-sapp.c:51:5: sorry, unimplemented: non-trivial designated initializers not supported

Fails to clone dependency `fips-imgui-dock`

Attempting to build the platform agnostic samples results in the following error:

=== dependency: 'fips-imgui-dock':
Cloning into 'fips-imgui-dock'...
warning: Could not find remote branch master to clone.
fatal: Remote branch master not found in upstream origin
[ERROR] failed to git clone https://github.com/fips-libs/fips-imgui-dock.git into C:/Users/Stuar/fips-imgui-dock
PS C:\Users\Stuar\sokol-samples> ./fips list configs
=== configs:

The build commands issued:

.\fips set config sapp-d3d11-win64-vs2017-debug
'config' set to 'sapp-d3d11-win64-vs2017-debug' in project 'sokol-samples'
.\fips build

small question about correctness

Hi, sorry to bug you, but I have a small question about correctness in a sample. Currently I've looked at sgl_ortho usage and by looking at the sgl-microui-sapp-sample I have the feeling does your usage works, but only because most matrices are identity ones.
https://github.com/floooh/sokol-samples/blob/master/sapp/sgl-microui-sapp.c#L432
here first sgl_defaults is called and the current matrix-mode is set to modelview, and later in the sample-function you call sgl_ortho without changing the matrix-mode to projection. it works because the other matrices are identity matrices, but the clean solution would be to switch to the projection-matrix and then call sgl_ortho, right?

[Idea] 360 Video

This is a harebrained idea that I don't have time to do but might make a good Sokol sample. (Or even full app...)

BACKSTORY: I've been thinking about 360 video for a while now and had an idea of doing green screen parallax with 360 mat plates. (er spheres in the case of 360) The idea came from watching Insta360 videos. (knowledge of their edit workflow is helpful to understand my theory...) My basic concept is that you would have three concentric video layers. The inner two would have transparent regions via chroma-key and the outer is the background mat. These would then be composited together for a two dimensional viewpoint (i.e. screen) with full parallax of the three spheres dependent on direction and "zoom".

IMPLEMENTATION: The first step would be rendering 360 video on a sphere and allowing navigation. (assuming basic PTZ) I figured that would be a good use-case for a sample. But you could easily go further and render multiple spheres with basic math to adjust the parallax. If you wanted to get even more wild you could add LUTs for color correction of each layer and connect it directly to mobile gyroscope and accelerometer to do something similar to the Insta360 app.

As I said above, I don't have time to work on this right now. But I thought this was worth doing and figured the Sokol community was probably the right place to share. I'd love to contribute to a bounty on this to see it developed. Just let me know where/how...

Cannot build sapp samples on macOS Catalina

When running ./fips build I get the following error:

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-macos10.15 -fmessage-length=158 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Debug\" -DFIPS_APP_WINDOWED=1 -DSOKOL_NO_DEPRECATED -DSOKOL_GLCORE33 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -I/Users/nils/Develop/fips-deploy/sokol-samples/sapp-osx-xcode-debug/include -I/Users/nils/Develop/fips-cimgui -I/Users/nils/Develop/fips-glfw/glfw/include -I/Users/nils/Develop/fips-imgui/imgui -I/Users/nils/Develop/fips-libmodplug/libmodplug/src -I/Users/nils/Develop/sokol -I/Users/nils/Develop/sokol/util -I/Users/nils/Develop/sokol-samples/libs -I/Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/sapp -I/Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/sapp/sokol-samples.build/Debug/pixelformats-sapp.build/DerivedSources-normal/x86_64 -I/Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/sapp/sokol-samples.build/Debug/pixelformats-sapp.build/DerivedSources/x86_64 -I/Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/sapp/sokol-samples.build/Debug/pixelformats-sapp.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/nils/Develop/fips-deploy/sokol-samples/sapp-osx-xcode-debug -fstrict-aliasing -Wno-multichar -Wall -Wextra -Wno-expansion-to-defined -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-unused-volatile-lvalue -Wno-deprecated-writable-strings -fno-stack-check -Wno-missing-field-initializers -D_DEBUG_ -D_DEBUG -DFIPS_DEBUG=1 -Wno-return-type-c-linkage -std=gnu99 -g -MMD -MT dependencies -MF /Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/sapp/sokol-samples.build/Debug/pixelformats-sapp.build/Objects-normal/x86_64/pixelformats-sapp.d --serialize-diagnostics /Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/sapp/sokol-samples.build/Debug/pixelformats-sapp.build/Objects-normal/x86_64/pixelformats-sapp.dia -c /Users/nils/Develop/sokol-samples/sapp/pixelformats-sapp.c -o /Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/sapp/sokol-samples.build/Debug/pixelformats-sapp.build/Objects-normal/x86_64/pixelformats-sapp.o
/Users/nils/Develop/sokol-samples/sapp/pixelformats-sapp.c:337:9: warning: implicit declaration of function 'igBeginChildStr' is invalid in C99
      [-Wimplicit-function-declaration]
        igBeginChildStr("#scrollregion", (ImVec2){0,0}, false, ImGuiWindowFlags_None);
        ^
1 warning generated.

Ld /Users/nils/Develop/fips-deploy/sokol-samples/sapp-osx-xcode-debug/pixelformats-sapp.app/Contents/MacOS/pixelformats-sapp normal x86_64 (in target 'pixelformats-sapp' from project 'sokol-samples')
    cd /Users/nils/Develop/sokol-samples
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-macos10.15 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/nils/Develop/fips-deploy/sokol-samples/sapp-osx-xcode-debug -F/Users/nils/Develop/fips-deploy/sokol-samples/sapp-osx-xcode-debug -filelist /Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/sapp/sokol-samples.build/Debug/pixelformats-sapp.build/Objects-normal/x86_64/pixelformats-sapp.LinkFileList -Xlinker -no_deduplicate -stdlib=libc++ -ObjC -dead_strip -lpthread -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/libs/sokol/Debug/libsokol.a /Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/fips-cimgui_cimgui/Debug/libcimgui.a -framework Foundation -framework IOKit -framework Cocoa -framework QuartzCore -framework OpenGL -framework AudioToolbox -Xlinker -dependency_info -Xlinker /Users/nils/Develop/fips-build/sokol-samples/sapp-osx-xcode-debug/sapp/sokol-samples.build/Debug/pixelformats-sapp.build/Objects-normal/x86_64/pixelformats-sapp_dependency_info.dat -o /Users/nils/Develop/fips-deploy/sokol-samples/sapp-osx-xcode-debug/pixelformats-sapp.app/Contents/MacOS/pixelformats-sapp
Undefined symbols for architecture x86_64:
  "_igBeginChildStr", referenced from:
      _frame in pixelformats-sapp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
    Ld /Users/nils/Develop/fips-deploy/sokol-samples/sapp-osx-xcode-debug/pixelformats-sapp.app/Contents/MacOS/pixelformats-sapp normal x86_64
(1 failure)
[ERROR] Failed to build config 'sapp-osx-xcode-debug' of project 'sokol-samples'

Since it complained about the implicit declaration of igBeginChildStr I tried including sokol_gfx_imgui.h. But this only fixed the warning and not the linker error. Why is the linker looking for _igBeginChildStr and not just igBeginChildStr?

My Xcode version:

sokol-samples ๐ŸŽ xcodebuild -version
Xcode 11.5
Build version 11E608c```

Need more texture type samples/tests...

  • static 3D texture
  • CPU-updated 3D texture
  • render to 3D texture slices
  • static cube texture
  • CPU-updated cube texture
  • render to cube texture faces
  • CPU-updated array texture
  • render to array texture layers

plmpeg example has choppy audio on the web demo

I've seen the note about sample rate conversion in the source. However, I would have expected it to work at least on WASM without problem. Is the problem I'm seeing related to sample rates? The video is crystal smooth so I don't thing internet transmission is a problem... Any ideas?

White-space in workspace path breaks in various places....

C:\Users\Oliver Larkin\Dev\scratch\sokol-samples>fips build
โ†[93m=== cloning fips build system to 'C:\Users\Oliver Larkin\Dev\scratch/fips':โ†[0m
Cloning into 'C:\Users\Oliver Larkin\Dev\scratch/fips'...
remote: Enumerating objects: 140, done.
remote: Counting objects: 100% (140/140), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 4159 (delta 79), reused 99 (delta 65), pack-reused 4019
Receiving objects: 100% (4159/4159), 1.49 MiB | 416.00 KiB/s, done.
Resolving deltas: 100% (2839/2839), done.
=== dependency: 'fips-glfw':
Cloning into 'fips-glfw'...
remote: Enumerating objects: 43, done.
remote: Counting objects: 100% (43/43), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 43 (delta 20), reused 41 (delta 19), pack-reused 0
Unpacking objects: 100% (43/43), done.
Submodule 'glfw' (https://github.com/glfw/glfw.git) registered for path 'glfw'
Cloning into 'C:/Users/Oliver Larkin/Dev/scratch/fips-glfw/glfw'...
remote: Enumerating objects: 71, done.
remote: Counting objects: 100% (71/71), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 23550 (delta 32), reused 49 (delta 28), pack-reused 23479
Receiving objects: 100% (23550/23550), 11.77 MiB | 416.00 KiB/s, done.
Resolving deltas: 100% (16490/16490), done.
Submodule path 'glfw': checked out '8055dad7e4d93069a72fdb8abecc131b3c3e5040'
=== dependency: 'fips-libmodplug':
Cloning into 'fips-libmodplug'...
remote: Enumerating objects: 19, done.
remote: Total 19 (delta 0), reused 0 (delta 0), pack-reused 19
Unpacking objects: 100% (19/19), done.
Submodule 'libmodplug' (https://github.com/floooh/libmodplug.git) registered for path 'libmodplug'
Cloning into 'C:/Users/Oliver Larkin/Dev/scratch/fips-libmodplug/libmodplug'...
remote: Enumerating objects: 1049, done.
remote: Total 1049 (delta 0), reused 0 (delta 0), pack-reused 1049
Receiving objects: 100% (1049/1049), 1.40 MiB | 417.00 KiB/s, done.
Resolving deltas: 100% (746/746), done.
Submodule path 'libmodplug': checked out 'c6ae092ab7c24f86920071c3bd6dc5cb5209ffc1'
=== dependency: 'fips-imgui':
Cloning into 'fips-imgui'...
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 36 (delta 14), reused 33 (delta 11), pack-reused 0
Unpacking objects: 100% (36/36), done.
Submodule 'imgui' (https://github.com/ocornut/imgui.git) registered for path 'imgui'
Cloning into 'C:/Users/Oliver Larkin/Dev/scratch/fips-imgui/imgui'...
remote: Enumerating objects: 83, done.
remote: Counting objects: 100% (83/83), done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 28244 (delta 46), reused 55 (delta 40), pack-reused 28161
Receiving objects: 100% (28244/28244), 36.70 MiB | 412.00 KiB/s, done.
Resolving deltas: 100% (20914/20914), done.
Submodule path 'imgui': checked out '8a4422b2fab4ec045ac04ede593845c47601fbb1'
=== dependency: 'sokol':
Cloning into 'sokol'...
remote: Enumerating objects: 48, done.
remote: Counting objects: 100% (48/48), done.
remote: Compressing objects: 100% (27/27), done.
remote: Total 48 (delta 24), reused 35 (delta 20), pack-reused 0
Unpacking objects: 100% (48/48), done.
=== building: win64-vstudio-debug
=== generating: win64-vstudio-debug
config file: C:/Users/Oliver Larkin/Dev/scratch/fips/configs/win64-vstudio-debug.yml
cmake -A "x64" -DCMAKE_BUILD_TYPE=Debug -DFIPS_CONFIG=win64-vstudio-debug -DFIPS_USE_CCACHE=OFF -DFIPS_AUTO_IMPORT=OFF -BC:/Users/Oliver Larkin/Dev/scratch/fips-build/sokol-samples/win64-vstudio-debug
-HC:/Users/Oliver Larkin/Dev/scratch/sokol-samples
CMake Error: The source directory "C:/Users/Oliver Larkin/Dev/scratch/fips-build/sokol-samples/win64-vstudio-debug/Larkin/Dev/scratch/sokol-samples" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
[ERROR] Failed to generate 'win64-vstudio-debug' of project 'sokol-samples'

Can't render to float on ios... number of extensions wrongly reported as zero

2020 Ipad pro, ios 14.something

glGetIntegerv(GL_NUM_EXTENSIONS, &num_ext);
gives no glGetError(), but num_ext is zero, (so extensions aren't initialiesd)

if I do print (char*)glGetString(7939) (GL_EXTENSIONS = 7939) in lldb, then it prints out

(char *) $2 = 0x000000010d067496 "GL_OES_standard_derivatives GL_KHR_texture_compression_astc_ldr GL_EXT_color_buffer_half_float GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_pvrtc_sRGB GL_EXT_read_format_bgra GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_texture_lod GL_EXT_shadow_samplers GL_EXT_texture_filter_anisotropic GL_APPLE_clip_distance GL_APPLE_color_buffer_packed_float GL_APPLE_copy_texture_levels GL_APPLE_rgb_422 GL_APPLE_texture_format_BGRA8888 GL_IMG_read_format GL_IMG_texture_compression_pvrtc "

Now, I can't remember if this is supposed to return null on ES 3.1...(as it's deprecated) but maybe it also suggests I haven't setup my GLKView properly (maybe I need to be explicit with level, as I do on osx's NSOpenglView)
Now, this might be a user(me) error... but maybe sokol should be falling back? (or detect this as the wrong ES version?)

I'm also trying to remember if I actually have rendered to a float before on native ios (I know it's missing from safari), but I thought I had... (maybe my old code fellback to half_float automatically)

Samples tiny window and full screen not working

I can get the emscripten samples to run, but they're in a tiny window, and the fullscreen doesn't work (Windows 10).

How can you get it to start either using all the browser area (without the powered by emscripten sillyness) or fullscreen?

Sokol_Emscripten Windows

[Reminder] Provide dummy launch images for iOS.

hello,

why fullscreen on ios is not real fullscreen? (sokol_app has same behaviour)

C13AA480-03CF-46A1-80F0-349D85A2D65D

to triangle-metal.c I have added:

state.pass_action = (sg_pass_action){.colors[0] = {.action = SG_ACTION_CLEAR, .value = {0.3f, 0.3f, 0.3f, 1.0f}}};

Build fails on Linux ARM64 (sokol-shdc not supported on this platform)

Hey, I'm trying to build the sokol-samples on Linux ARM64 (running virtualized inside a M1 mac), the build fails most probably because the sokol-tools-bin does not contain a precompiled version for arm64 linux:

=== building: sapp-linux-make-debug
cmake --build . --parallel 6 --config Debug -- 
[  2%] Built target imgui
[  3%] Built target microui
[  5%] Built target cimgui
[  7%] Built target imgui-dock
[ 19%] Built target libmodplug
[ 19%] Building C object libs/sokol/CMakeFiles/sokol.dir/sokol.c.o
Consolidate compiler generated dependencies of target stb
Consolidate compiler generated dependencies of target basisu
[ 20%] Building C object libs/sokol/CMakeFiles/sokol-noentry.dir/sokol-noentry.c.o
[ 20%] Building CXX object libs/sokol/CMakeFiles/sokol-cpp.dir/sokol.cc.o
[ 21%] Built target stb
[ 22%] Built target basisu
[ 23%] Building C object libs/sokol/CMakeFiles/sokol-dll.dir/sokol-dll.c.o
[ 24%] Building C object libs/nuklear/CMakeFiles/nuklear.dir/nuklear.c.o
[ 25%] Building CXX object libs/ozzanim/CMakeFiles/ozzanim.dir/src/ozz_base.cc.o
[ 25%] Building CXX object libs/ozzanim/CMakeFiles/ozzanim.dir/src/ozz_animation.cc.o
[ 26%] Linking C static library libsokol.a
[ 26%] Built target sokol
[ 27%] Building C object libs/util/CMakeFiles/fileutil.dir/fileutil.c.o
[ 27%] Linking CXX static library libsokol-cpp.a
[ 27%] Linking C shared library /home/parallels/dvl/fips-deploy/sokol-samples/sapp-linux-make-debug/libsokol-dll.so
[ 27%] Linking C static library libfileutil.a
[ 27%] Linking C static library libsokol-noentry.a
[ 27%] Built target sokol-cpp
[ 27%] Built target sokol-dll
[ 27%] Built target fileutil
[ 27%] Built target sokol-noentry
[ 27%] Building C object sapp/CMakeFiles/clear-sapp.dir/clear-sapp.c.o
[ 27%] Building CXX object libs/ozzanim/CMakeFiles/ozzanim.dir/src/mesh.cc.o
[ 27%] Building CXX object libs/dbgui/CMakeFiles/dbgui.dir/dbgui.cc.o
## sokol-shdc: /home/parallels/dvl/sokol-samples/sapp/triangle-sapp.glsl /home/parallels/dvl/fips-build/sokol-samples/sapp-linux-make-debug/sapp/triangle-sapp.glsl.h {'slang': 'glsl330', 'compiler': 'GNU'}
[ 27%] Linking C executable /home/parallels/dvl/fips-deploy/sokol-samples/sapp-linux-make-debug/clear-sapp
Traceback (most recent call last):
  File "/home/parallels/dvl/fips-build/sokol-samples/sapp-linux-make-debug/fips-gen.py", line 65, in <module>
    processFile(attrs)
  File "/home/parallels/dvl/fips-build/sokol-samples/sapp-linux-make-debug/fips-gen.py", line 56, in processFile
    module.generate(input, out_src, out_hdr, args)
  File "/home/parallels/dvl/sokol-tools-bin/fips-files/generators/SokolShader.py", line 57, in generate
    res = subprocess.call(cmd)
  File "/usr/lib/python3.10/subprocess.py", line 345, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/parallels/dvl/sokol-tools-bin/fips-files/generators/../../bin/linux/sokol-shdc'
gmake[2]: *** [sapp/CMakeFiles/ALL_GENERATE.dir/build.make:70: sapp/CMakeFiles/ALL_GENERATE] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1087: sapp/CMakeFiles/ALL_GENERATE.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
[ 27%] Built target clear-sapp
[ 28%] Linking CXX static library libdbgui.a
[ 28%] Built target dbgui
[ 29%] Linking CXX static library libozzanim.a
[ 29%] Built target ozzanim
[ 29%] Linking C static library libnuklear.a
[ 29%] Built target nuklear
gmake: *** [Makefile:91: all] Error 2
[ERROR] Failed to build config 'sapp-linux-make-debug' of project 'sokol-samples'
parallels@ubuntu-linux-22-04-desktop ~/d/sokol-samples (master) [10]> 
parallels@ubuntu-linux-22-04-desktop ~/d/sokol-samples (master) [10]> uname -a
Linux ubuntu-linux-22-04-desktop 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:08:11 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

Just wanted to report this, although probably not a high priority target and seems I can manually build the docker version of the sokol-shdc, at least I got it to compile but no idea how to run it (no experience with docker).

Anyway let me know if you need somebody to build the binary on, already succeeded on it but gave up as couldn't figure out how to run it or where the docker build actually ended up :)

Manual Build process for Emscripten and Mobile

I'd like to be able to build without fips for Emscripten and the Mobile platforms. But fips is so tightly integrated that I'm finding it hard to do a basic Makefiles. Could you add this to the documentation please?

ADVANCED TOPIC: Injecting native 3D-API textures

I know that you are in the middle of work on cgltf, but if you had some spare time, could you bring some light (sample) into the usage of native textures? Now there is only this and that mention so far.

Or is there some other documentation somewhere?

Sokol imgui load font

Did anybody manage to load a font using s(okol)imgui?
I do:
simgui_setup(&(simgui_desc_t){ 0 });
ImGuiIO *io = igGetIO();
F1 = ImFontAtlas_AddFontFromFileTTF(io->Fonts, "/res/fonts/RobotoMono-Regular.ttf", 25, NULL, NULL);

at the start. After as the documentation suggest this should already work as is the only font I load...

But, one more thing you can do is use igPushFont && igPopFont after simgui_new_frame but still no succes.. :'(

[REQUEST] CMake example project

For those of us who don't want to use another build system (or convince other people to use it), could there be a sample that uses cmake without fips? I have done this partially myself, but it gets really ugly around using sokol-shdc to compile the shaders.

Allow to configure min-sdk-version for macOS and iOS

Just did a fresh clone and run. Seem to get the following error when running a sample:

=== run 'imgui-glfw' (config: osx-xcode-debug, project: sokol-samples):
dyld: lazy symbol binding failed: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /Users/aking/projects/sokol/fips-deploy/sokol-samples/osx-xcode-debug/imgui-glfw (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libobjc.A.dylib

dyld: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /Users/aking/projects/sokol/fips-deploy/sokol-samples/osx-xcode-debug/imgui-glfw (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libobjc.A.dylib

aking@gem:~/projects/sokol/sokol-samples$ ./fips run triangle-glfw
=== run 'triangle-glfw' (config: osx-xcode-debug, project: sokol-samples):
dyld: lazy symbol binding failed: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /Users/aking/projects/sokol/fips-deploy/sokol-samples/osx-xcode-debug/triangle-glfw (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libobjc.A.dylib

dyld: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /Users/aking/projects/sokol/fips-deploy/sokol-samples/osx-xcode-debug/triangle-glfw (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libobjc.A.dylib```

The sequence of events:
> mkdir sokol
> cd sokol
> git clone [email protected]:floooh/sokol-samples
> cd sokol-samples
> ./fips build
> ./fips list targets
> ./fips run imgui-glfw  (see above)
> ./fips run triangle-glfw  (see above)

aking@gem:~/projects/sokol/sokol-samples$ python --version
Python 2.7.17
aking@gem:~/projects/sokol/sokol-samples$ cmake --version
cmake version 3.16.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
aking@gem:~/projects/sokol/sokol-samples$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
aking@gem:~/projects/sokol/sokol-samples$ xcodebuild -version
Xcode 11.2.1
Build version 11B500
aking@gem:~/projects/sokol/sokol-samples$ uname -a
Darwin gem.local 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec  1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64
aking@gem:~/projects/sokol/sokol-samples$

macOS Mojave Version 10.14.6.  Not sure why it's building for macOS 10.15 when I'm on 10.14.6?

Edit:
Just tried a metal build:
aking@gem:~/projects/sokol/sokol-samples$ ./fips run triangle-metal
=== run 'triangle-metal' (config: metal-osx-xcode-debug, project: sokol-samples):
application requires at least OS X version 10.15.0 (10.15), but is being run on 10.14.6 ( 10.14.6/18G2022), and so is exiting.aking@gem:~/projects/sokol/sokol-samples$

Metal samples crashes with: sg_apply_draw_state: pipeline object required

The samples for Metal config on OSX (v10.12.6) seems not to be working. This is what I get when I try to run them:

Davids-MBP:sokol-samples oldes$ ./fips run triangle-metal
=== run 'triangle-metal' (config: metal-osx-xcode-debug, project: sokol-samples):
2017-12-11 23:01:44.905 triangle-metal[45198:2300054] -[MTLRenderPipelineDescriptorInternal vertexBuffers]: unrecognized selector sent to instance 0x7fb8fed16f90
2017-12-11 23:01:44.905 triangle-metal[45198:2300054] -[MTLRenderPipelineDescriptorInternal vertexBuffers]: unrecognized selector sent to instance 0x7fb8fed16f90
sg_apply_draw_state: pipeline object required
^^^^  VALIDATION FAILED, TERMINATING ^^^^
Assertion failed: (0), function _sg_validate_end, file /Users/oldes/GIT/sokol/_sokol_gfx.impl.h, line 830.

Emscripten build issue on Mac

I am running macOs 10.14.2 and XCode 10.1 and python 3.6.5

error "CMake Error at /Users/root/Downloads/floooh/fips/cmake-toolchains/emscripten.toolchain.cmake:32 (message):
Could not find emscripten SDK! Please run 'fips setup emscripten'!"

How to reproduce:

  1. ./fips setup emscripten
  2. ./fips set config webgl2-emsc-make-release
  3. ./fips build

When executing step #3, the above-mentioned error occurs.

Observation: During the running of step #1, the following errors and warnings are issued, see: log.txt

Could the error message "return subprocess.check_output(['xcrun', '--show-sdk-version']).strip().split('.')
TypeError: a bytes-like object is required, not 'str'" be related with the fact that I am running python 3.6.5?

I don't know if this matters, but I already had emscripten installed via homebrew since a longer time and before running above mentioned steps #1, #2 and #3.

sapp samples requires imgui

Would it be possible to make use of dbgui optional in sapp samples?
There is used define USE_DBG_UI in the dbgui.h file:

#if defined(USE_DBG_UI)

but not reflected in the related C file.

I have fixed it on my side just using modified dbgui.cc file with blank functions, but still think, that you could do it better on your side.

(but maybe that I'm the only one affected as I don't use your fips build tool and don't have imgui ready yet:)

Build issue on Windows

Hi @floooh ,

I've been trying to build your impressive sokol-samples following instructions
on a Windows 10 system, using multiple method,

They all fail at various points in the process.
I was thinking you might be interested in these failures.

MinGW64

My preferred environment to compile on Windows is MSYS2/MinGW64.
It's a pretty good combination of familiar Unix environment and tools,
yet producing and using Windows binaries.
It's relatively easy to satisfy all dependency requirements (make, cmake, git, python)
using the pacman manager.

Yet, the build process fails at this point :

=== building: win64-vstudio-debug
=== generating: win64-vstudio-debug
config file: C:/path/fips/configs/win64-vstudio-debug.yml
cmake -A "x64" -DCMAKE_BUILD_TYPE=Debug -DFIPS_CONFIG=win64-vstudio-debug -DFIPS_USE_CCACHE=OFF -DFIPS_AUTO_IMPORT=OFF -BC:/path/fips-build/sokol-samples/win64-vstudio-debug -HC:/path/sokol-samples
CMake Error in C:/path/sokol-samples/CMakeLists.txt:
  Generator

    Unix Makefiles

  does not support platform specification, but platform

    x64

  was specified.


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
[ERROR] Failed to generate 'win64-vstudio-debug' of project 'sokol-samples'

It's not clear what the problem is.
The builder seems confused, between Unix and Windows.

MSYS2

My second environment for Windows is MSYS2/MSYS.
This is a close relative, but provides full Posix emulation.
It makes it possible to compile a source code which typically depends on some posix library not available on Windows (or different on Windows).
The problem is, the translation layer can be painfully slow, especially for I/O related events, so it's generally not my first choice.

Anyway, since it's full posix, one could hope that the previous failure would settle for unix and continue ?
Not a chance, it fails well before that point :

Cloning into '/c/path/fips'...
remote: Counting objects: 3859, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 3859 (delta 14), reused 21 (delta 10), pack-reused 3826
Receiving objects: 100% (3859/3859), 1.39 MiB | 395.00 KiB/s, done.
Resolving deltas: 100% (2631/2631), done.
Checking out files: 100% (270/270), done.
Traceback (most recent call last):
  File "./fips", line 17, in <module>
    fips.run(fips_path, proj_path, sys.argv)
  File "/c/path/fips/mod/fips.py", line 49, in run
    verb.verbs[verb_name].run(fips_path, proj_path, verb_args)
  File "/c/path/fips/verbs/build.py", line 18, in run
    cfg_name = settings.get(proj_dir, 'config')
  File "/c/path/fips/mod/settings.py", line 70, in get
    value = get_default(key)
  File "/c/path/fips/mod/settings.py", line 43, in get_default
    return config.get_default_config()
  File "/c/path/fips/mod/config.py", line 48, in get_default_config
    return default_config[util.get_host_platform()]
  File "/c/path/fips/mod/util.py", line 273, in get_host_platform
    return host_platforms[platform.system()]
KeyError: 'MSYS_NT-10.0'

It's worth nothing that, under this environment, the default python version is 3.6.2, which might explain the issue with python script. And although python2 is also installed, I'm unsure how to make it default.

Windows (pure) command prompt

Last attempt, using MS Windows environment, regular command prompt.
This is my least preferred choice, mainly because this one use different command and tools, doesn't have a package manager like pacman, so it's necessary to find each dependency, install them individually, pollute the path with each specific product directory, etc.
But at least, this is pure Windows, and I would expect the Visual Studio experience to work fine.

Well, my first attempt was pretty strange : although I have Visual Studio installed, cmake would nonetheless try to use the "GNU make" solution, and would fail, because the path to make is hard-coded to /usr/bin/make , which feels a bit too "posix" for Windows. I could manually ensure that make is present into the path, and manually checked that it works, but its path certainly does not look like a posix path.

(...)

Well, while writing this rather long report, I made a second attempt, and for some reasons unclear to me, this time, cmake selected the Visual Studio way. And now I've got a working Visual solution.
And apparently, I don't even need to use it, since nifty fips make it possible to select a project and run it directly from command line. Which is great.

I guess this was the intended experience.

Using STL on android builds fails on Windows

Pretty much what the title says, i'm trying to build for android on windows and whenever I build using the stl I have a

"fatal error: 'vector' file not found"

I'm using the sapp-android-make-debug config.

Maybe it's just not supported ?
Or maybe I'm missing some settings ?
I don't fully understand how fips works but I can take a look if somebody can point me to the right ressources.
Thanks !

RasPi 4 sample compile error

I am trying to compile the raspberry pi sample on a Pi 4. I believe I have installed all the necessary packages etc., however I am getting this error:

/usr/bin/ld: CMakeFiles/eval-engine.dir/main.cc.o: in function `_sg_gl_destroy_buffer(_sg_gl_buffer_t*)':
main.cc:(.text+0xe5c): undefined reference to `glDeleteBuffers'
/usr/bin/ld: main.cc:(.text+0x1008): undefined reference to `glDeleteBuffers'
/usr/bin/ld: main.cc:(.text+0x10fc): undefined reference to `glBindBuffer'
/usr/bin/ld: main.cc:(.text+0x1114): undefined reference to `glBindBuffer'
/usr/bin/ld: main.cc:(.text+0x112c): undefined reference to `glBindBuffer'
/usr/bin/ld: main.cc:(.text+0x1144): undefined reference to `glBindBuffer'

Has anyone else seen this?

[ERROR] Failed to build config 'd3d11-win64-vstudio-debug' of project 'sokol-samples'

Hello,
I was trying to build Sokol sample on Windows 10 using:

fips set config d3d11-win64-vstudio-debug
fips build

but have got compiler error:

Project "X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\ALL_BUILD.vcxproj" (1) is buildi
ng "X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\imgui-d3d11.vcxproj" (11) on no
de 1 (default targets).
InitializeBuildStatus:
  Touching "imgui-d3d11.dir\Debug\imgui-d3d11.tlog\unsuccessfulbuild".
CustomBuild:
  All outputs are up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX
  86\x64\CL.exe /c /I"x:\GIT\fips-glfw\glfw\include" /I"x:\GIT\fips-imgui\imgui" /Ix:\GIT\sokol\. /
  Zi /nologo /W1 /WX /diagnostics:classic /MP /Od /Oy- /D WIN32 /D _DEBUG /D FIPS_DEBUG=1 /D FIPS_A
  PP_WINDOWED=1 /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /MTd /GS /fp:precise /Zc:wchar_t /Z
  c:forScope /Zc:inline /Fo"imgui-d3d11.dir\Debug\\" /Fd"imgui-d3d11.dir\Debug\vc141.pdb" /Gd /TP /
  errorReport:queue "X:\GIT\sokol-samples\d3d11\imgui-d3d11.cc"
  imgui-d3d11.cc
X:\GIT\sokol-samples\d3d11\imgui-d3d11.cc(32): error C2065: 'ImDrawData': undeclared identifier [X:
\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\imgui-d3d11.vcxproj]
X:\GIT\sokol-samples\d3d11\imgui-d3d11.cc(32): error C2059: syntax error: ')' [X:\GIT\fips-build\so
kol-samples\d3d11-win64-vstudio-debug\d3d11\imgui-d3d11.vcxproj]
X:\GIT\sokol-samples\d3d11\imgui-d3d11.cc(57): error C2065: 'imgui_draw_cb': undeclared identifier
[X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\imgui-d3d11.vcxproj]
X:\GIT\sokol-samples\d3d11\imgui-d3d11.cc(206): error C2065: 'ImDrawData': undeclared identifier [X
:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\imgui-d3d11.vcxproj]
X:\GIT\sokol-samples\d3d11\imgui-d3d11.cc(206): error C2065: 'draw_data': undeclared identifier [X:
\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\imgui-d3d11.vcxproj]
X:\GIT\sokol-samples\d3d11\imgui-d3d11.cc(206): error C2182: 'imgui_draw_cb': illegal use of type '
void' [X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\imgui-d3d11.vcxproj]
X:\GIT\sokol-samples\d3d11\imgui-d3d11.cc(206): error C2448: 'imgui_draw_cb': function-style initia
lizer appears to be a function definition [X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debu
g\d3d11\imgui-d3d11.vcxproj]
Done Building Project "X:\GIT\fips-build\sokol-samples\d3d11-win64-vstudio-debug\d3d11\imgui-d3d11.
vcxproj" (default targets) -- FAILED.

Where is ImDrawData supposed to be defined?

Error when building for Emscripten

Hi!

I tried building for the emsc-ninja-release config and it mostly builds but seems to fail (at least) on the 'mipmap' target (I replaced my fips workspace path with /... here):

[51/74] Linking C executable /.../fips/fips-deploy/sokol-samples/emsc-ninja-release/mipmap-emsc.html
FAILED: /.../fips/fips-deploy/sokol-samples/emsc-ninja-release/mipmap-emsc.html
: && /.../fips/fips-sdks/emsdk/upstream/emscripten/emcc -s DISABLE_EXCEPTION_CATCHING=1 --em-config /.../fips/fips-sdks/emsdk/.emscripten --cache /.../fips/fips-sdks/emsdk/.emscripten_cache -fstrict-aliasing -Wall -Wextra -Wno-multichar -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-deprecated-writable-strings -Wno-unused-volatile-lvalue -Wno-warn-absolute-paths -Wno-expansion-to-defined -Wno-missing-field-initializers -O3  -flto -s ASSERTIONS=0 -DNDEBUG  -s DISABLE_EXCEPTION_CATCHING=1 --em-config /.../fips/fips-sdks/emsdk/.emscripten --cache /.../fips/fips-sdks/emsdk/.emscripten_cache  --memory-init-file 1 -s TOTAL_MEMORY=33554432 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_FILESYSTEM=1 -s WASM=1  --shell-file shell.html -O3  -flto -s ASSERTIONS=0 html5/CMakeFiles/mipmap-emsc.dir/mipmap-emsc.c.obj  -o /.../fips/fips-deploy/sokol-samples/emsc-ninja-release/mipmap-emsc.html   && :
error: undefined symbol: glBlitFramebuffer
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: _glBlitFramebuffer may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glCompressedTexImage3D
warning: _glCompressedTexImage3D may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glGetStringi
warning: _glGetStringi may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glReadBuffer
warning: _glReadBuffer may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glRenderbufferStorageMultisample
warning: _glRenderbufferStorageMultisample may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: glTexImage3D
warning: _glTexImage3D may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
emcc: error: '/.../fips/fips-sdks/emsdk/node/12.9.1_64bit/bin/node /.../fips/fips-sdks/emsdk/upstream/emscripten/src/compiler.js /var/folders/1l/9fgvlzmn4mn16_30l0b0fdh80000gn/T/tmpuedau8e7.txt' failed (1)
[52/74] Linking C executable /.../fips/fips-deploy/sokol-samples/emsc-ninja-release/noninterleaved-emsc.html
cache:INFO: generating system library: libgl.a... (this will be cached in "/.../fips/fips-sdks/emsdk/.emscripten_cache/wasm-lto/libgl.a" for subsequent builds)
cache:INFO:  - ok
[56/74] Linking C executable /.../fips/fips-deploy/sokol-samples/emsc-ninja-release/inject-emsc.html
ninja: build stopped: subcommand failed.
[ERROR] Failed to build config 'emsc-ninja-release' of project 'sokol-samples'
sokol-samples$

Whichever targets manage to get built before ninja stops due to this seem to actually run! osx-ninja-* and ios-xcode-* have worked fine for me.

wgpu_webpage build on Linux

I'm playing around with your wgpu build on Linux. It's asking for vscode...

./fips set config webgl2-emsc-make-release
./fips wgpu_webpage build
=== dependency: 'sokol-tools-bin':
dir '/home/frink/sokol-tools-bin' exists
=== dependency: 'fips-glfw':
dir '/home/frink/fips-glfw' exists
=== dependency: 'fips-libmodplug':
dir '/home/frink/fips-libmodplug' exists
=== dependency: 'fips-utils':
dir '/home/frink/fips-utils' exists
=== dependency: 'fips-cimgui':
dir '/home/frink/fips-cimgui' exists
=== dependency: 'sokol':
dir '/home/frink/sokol' exists
=== dependency: 'fips-imgui':
dir '/home/frink/fips-imgui' exists
=== dependency: 'fips-dawn':
dir '/home/frink/fips-dawn' exists
[ERROR] build tool(s) vscode not found
[ERROR] 'sapp-wgpu-wasm-vscode-release' is not a valid config
[ERROR] 1 out of 1 configs failed!

We need vscode to build from the command line?
What does an IDE have to do with it? Confused...

Unable to build the samples using fips on my Mac

I can't build the sapp-metal samples on my mac anymore. The Mac / Metal samples which do not use sapp work fine though (I tried metal-osx-xcode-debug).

After setting ./fips set config sapp-metal-osx-make-debug and calling ./fips build I get:

=== dependency: 'sokol-tools-bin':
dir '/Users/nils/Develop/sokol-tools-bin' exists
=== dependency: 'fips-imgui-dock':
dir '/Users/nils/Develop/fips-imgui-dock' exists
=== dependency: 'fips-glfw':
dir '/Users/nils/Develop/fips-glfw' exists
=== dependency: 'fips-libmodplug':
dir '/Users/nils/Develop/fips-libmodplug' exists
=== dependency: 'fips-utils':
dir '/Users/nils/Develop/fips-utils' exists
=== dependency: 'fips-cimgui':
dir '/Users/nils/Develop/fips-cimgui' exists
=== dependency: 'sokol':
dir '/Users/nils/Develop/sokol' exists
=== dependency: 'fips-imgui':
dir '/Users/nils/Develop/fips-imgui' exists
=== dependency: 'fips-dawn':
dir '/Users/nils/Develop/fips-dawn' exists
=== building: sapp-metal-osx-make-debug
=== generating: sapp-metal-osx-make-debug
config file: /Users/nils/Develop/sokol-samples/fips-files/configs/sapp-metal-osx-make-debug.yml
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DFIPS_CONFIG=sapp-metal-osx-make-debug -DUSE_SOKOL_APP=ON -DSOKOL_USE_METAL=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DFIPS_USE_CCACHE=OFF -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -DFIPS_AUTO_IMPORT=OFF -B/Users/nils/Develop/fips-build/sokol-samples/sapp-metal-osx-make-debug -H/Users/nils/Develop/sokol-samples
-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMAKE_BUILD_TYPE: Debug
FIPS_ROOT_DIR: /Users/nils/Develop/fips
FIPS_PROJECT_DIR: /Users/nils/Develop/sokol-samples
FIPS_BUILD_DIR: /Users/nils/Develop/fips-build
FIPS_DEPLOY_DIR: /Users/nils/Develop/fips-deploy
FIPS_PROJECT_NAME: sokol-samples
FIPS_AUTO_IMPORT: OFF
FIPS_CONFIG: sapp-metal-osx-make-debug
FIPS_PROJECT_BUILD_DIR: /Users/nils/Develop/fips-build/sokol-samples/sapp-metal-osx-make-debug
FIPS_PROJECT_DEPLOY_DIR: /Users/nils/Develop/fips-deploy/sokol-samples/sapp-metal-osx-make-debug
Host system: OSX
CMAKE_CXX_COMPILER_ID: AppleClang
Detected C++ Compiler: Clang (FIPS_CLANG)
FIPS_PLATFORM: OSX
FIPS_PLATFORM_NAME: osx
-- Found Python: /usr/local/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found version "3.9.1") found components: Interpreter 
CMake Error at sapp/CMakeLists.txt:703 (sokol_shader_variant_with_reflection):
  Unknown CMake command "sokol_shader_variant_with_reflection".


-- Configuring incomplete, errors occurred!
See also "/Users/nils/Develop/fips-build/sokol-samples/sapp-metal-osx-make-debug/CMakeFiles/CMakeOutput.log".
See also "/Users/nils/Develop/fips-build/sokol-samples/sapp-metal-osx-make-debug/CMakeFiles/CMakeError.log".
[ERROR] Failed to generate 'sapp-metal-osx-make-debug' of project 'sokol-samples'

When I use the xcode config instead of make I get the same error.

macOS version: Big Sur 11.4 (20F71)
Xcode version: Version 12.5.1 (12E507)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.