floooh / sokol

minimal cross-platform standalone C headers
https://floooh.github.io/sokol-html5
zlib License
6.55k stars 469 forks source link

sokol-samples : `fips build` error #957

Closed jeangit closed 6 months ago

jeangit commented 6 months ago

Hello,

OS : linux

fips diag tools (i’ve remove all « not found »)

git:    found
cmake:  found
ccmake: found
make:   found
ninja:  found
node:   found
vscode: found

My config:

~/sources/sokol/sokol-samples$ `cat .fips-settings.yml`
{config: linux-make-debug}

I’ve cloned sokol, sokol-samples and sokol-tools as stated in documentation. Then i've just launched fips build to generate targets.

~/sources/sokol/sokol-samples$ ./fips build
=== dependency: 'sokol':
dir '/home/jeangit/sources/sokol/sokol' exists
=== dependency: 'sokol-tools-bin':
dir '/home/jeangit/sources/sokol/sokol-tools-bin' exists
=== dependency: 'fips-glfw':
dir '/home/jeangit/sources/sokol/fips-glfw' exists
=== dependency: 'fips-cimgui':
dir '/home/jeangit/sources/sokol/fips-cimgui' exists
=== dependency: 'fips-imgui':
dir '/home/jeangit/sources/sokol/fips-imgui' exists
=== dependency: 'fips-imgui-dock':
dir '/home/jeangit/sources/sokol/fips-imgui-dock' exists
=== dependency: 'fips-libmodplug':
dir '/home/jeangit/sources/sokol/fips-libmodplug' exists
=== dependency: 'fips-utils':
dir '/home/jeangit/sources/sokol/fips-utils' exists
=== dependency: 'fips-dawn':
dir '/home/jeangit/sources/sokol/fips-dawn' exists
=== building: linux-make-debug
cmake --build . --parallel 14 --config Debug --
make: Makefile: No such file or directory
make: *** No rule to make target 'Makefile'.  Stop.
[ERROR] Failed to build config 'linux-make-debug' of project 'sokol-samples'

I believe fips build call internally fips gen, but i tried it anyway myself.

~/sources/sokol/sokol-samples$ ./fips gen
=== dependency: 'sokol':
dir '/home/jeangit/sources/sokol/sokol' exists
=== dependency: 'sokol-tools-bin':
dir '/home/jeangit/sources/sokol/sokol-tools-bin' exists
=== dependency: 'fips-glfw':
dir '/home/jeangit/sources/sokol/fips-glfw' exists
=== dependency: 'fips-cimgui':
dir '/home/jeangit/sources/sokol/fips-cimgui' exists
=== dependency: 'fips-imgui':
dir '/home/jeangit/sources/sokol/fips-imgui' exists
=== dependency: 'fips-imgui-dock':
dir '/home/jeangit/sources/sokol/fips-imgui-dock' exists
=== dependency: 'fips-libmodplug':
dir '/home/jeangit/sources/sokol/fips-libmodplug' exists
=== dependency: 'fips-utils':
dir '/home/jeangit/sources/sokol/fips-utils' exists
=== dependency: 'fips-dawn':
dir '/home/jeangit/sources/sokol/fips-dawn' exists
=== generating: linux-make-debug
config file: /home/jeangit/sources/sokol/fips/configs/linux-make-debug.yml
Preset CMake variables:

  CMAKE_BUILD_TYPE="Debug"
  CMAKE_EXPORT_COMPILE_COMMANDS="ON"
  FIPS_AUTO_IMPORT="OFF"
  FIPS_CONFIG="linux-make-debug"
  FIPS_LOCAL_BUILD="OFF"

CMAKE_BUILD_TYPE: Debug
FIPS_ROOT_DIR: /home/jeangit/sources/sokol/fips
FIPS_PROJECT_DIR: /home/jeangit/sources/sokol/sokol-samples
FIPS_BUILD_DIR: /home/jeangit/sources/sokol/fips-build
FIPS_DEPLOY_DIR: /home/jeangit/sources/sokol/fips-deploy
FIPS_PROJECT_NAME: sokol-samples
FIPS_AUTO_IMPORT: OFF
FIPS_CONFIG: linux-make-debug
FIPS_PROJECT_BUILD_DIR: /home/jeangit/sources/sokol/fips-build/sokol-samples/linux-make-debug
FIPS_PROJECT_DEPLOY_DIR: /home/jeangit/sources/sokol/fips-deploy/sokol-samples/linux-make-debug
Host system: Linux
CMAKE_CXX_COMPILER_ID: GNU
FIPS_GCC: 1
FIPS_PLATFORM: Linux
FIPS_PLATFORM_NAME: linux
-- Configuring done (0.1s)
CMake Error at /home/jeangit/sources/sokol/fips/cmake/fips_private.cmake:165 (target_sources):
  Cannot find source file:

    cimgui/imgui/imgui.h
Call Stack (most recent call first):
  /home/jeangit/sources/sokol/fips/cmake/fips.cmake:406 (fips_add_file)
  /home/jeangit/sources/sokol/fips-cimgui/CMakeLists.txt:15 (fips_files)

CMake Error at /home/jeangit/sources/sokol/fips/cmake/fips_private.cmake:165 (target_sources):
  Cannot find source file:

    imgui-dock/imconfig.h
Call Stack (most recent call first):
  /home/jeangit/sources/sokol/fips/cmake/fips.cmake:406 (fips_add_file)
  /home/jeangit/sources/sokol/fips-imgui-dock/CMakeLists.txt:15 (fips_files)

CMake Error at /home/jeangit/sources/sokol/fips/cmake/fips.cmake:230 (add_library):
  No SOURCES given to target: imgui-dock
Call Stack (most recent call first):
  /home/jeangit/sources/sokol/fips-imgui-dock/CMakeLists.txt:13 (fips_begin_lib)

CMake Generate step failed.  Build files cannot be regenerated correctly.
[ERROR] failed to generate build files for config 'linux-make-debug'
[ERROR] 1 out of 1 configs failed!

Thank you.

floooh commented 6 months ago

This looks like dependencies are missing git submodules.

Can you start from scratch like this in a new directory?

git clone https://github.com/floooh/sokol-samples
cd sokol-samples
./fips build

In general, when using ./fips you should never have to clone dependencies manually, this is only needed if you want to build the samples "manually" without a build system as described here: https://github.com/floooh/sokol-samples?tab=readme-ov-file#how-to-build-without-a-build-system

jeangit commented 6 months ago

Thank you, recloning the whole directory and then relaunch a new build was enough.

But still i have 2 questions

1) why when i list targets, i get that:

./fips list targets
=== targets:
  config: linux-make-debug
  app:
    glfw3
    imgui
    cimgui
    imgui-dock
    libmodplug
    flextgl12
    clear-glfw
    triangle-glfw
    quad-glfw
    cube-glfw
    texcube-glfw
    instancing-glfw
    offscreen-glfw
    mrt-glfw
    arraytex-glfw
    imgui-glfw
    dyntex-glfw
    mipmap-glfw
    blend-glfw
    inject-glfw
    bufferoffsets-glfw
    noninterleaved-glfw
    multiwindow-glfw
    uniformarrays-glfw
    sgl-test-glfw

but indeed it miss some tests:

~/sources/sokol/samples/sokol-samples$ ls ../fips-deploy/sokol-samples/linux-make-debug/
total 24M
1.2M arraytex-glfw*       1.2M dyntex-glfw*      1.2M mrt-glfw*             776K sgl-test-glfw*
1.2M blend-glfw*          3.9M imgui-glfw*       1.2M multiwindow-glfw*     1.2M texcube-glfw*
1.1M bufferoffsets-glfw*  1.2M inject-glfw*      1.2M noninterleaved-glfw*  1.1M triangle-glfw*
1.1M clear-glfw*          1.2M instancing-glfw*  1.2M offscreen-glfw*       1.2M uniformarrays-glfw*
1.2M cube-glfw*           1.2M mipmap-glfw*      1.1M quad-glfw*

2) i see in sapp directory a sample using OZZ. But it is not available in targets , and unfortunately i couldn't manage to compile it by hand (i can compile simpler samples by hand in sapp , but not this one).

BTW, i have understood that sapp directory is « agnostic » samples locations (does not need glfw or metal or D3D to be compiled), can you confirm ? You will probably tell me that's the goal of Sokol is to be agnostic, but then, what is the interest to provides glfw / d3d samples ? As Sokol must probably use « under the hood » one of them to initialize contexts, windows…

Thank you.

ps: if you think that this is rather a forum discussion than an issue report, i would be glad to have the location where i could post this ;)

floooh commented 6 months ago

1) The targets glfw3, imgui, cimgui, imgui-dock, libmodplug, flextgl12 are actually static link library targets, not applications (not sure actually why they are listed as apps, must be a regression in fips).

2) Different build configs have different build targets. For instance when you switch to one of the sapp-configs:

./fips set config sapp-linux-make-debug
./fips gen
./fips list targets

...you'll see all the sokol_app.h + sokol_gfx.h samples (in the sapp directory).

3) sokol_gfx.h can be used without sokol_app.h, and without a shader-cross-compiler like sokol-shdc. The minimal samples under glfw/, d3d11/ and metal basically demonstrate how to do that, while the 'cross-platform samples' under sapp/ are the "full package" demonstrating how to write fully platform-agnostic samples via sokol_app.h and the sokol-shdc shader compiler.

floooh commented 6 months ago

PS: I just fixed that bug that targets are listed as the wrong type, e.g. it now looks like this:

sokol-samples ➤ ./fips list targets 
=== targets:
  config: osx-make-debug
  lib:
    glfw3
    imgui
    cimgui
    imgui-dock
    libmodplug
    flextgl12
  app:
    clear-glfw
    triangle-glfw
    quad-glfw
    cube-glfw
    texcube-glfw
    instancing-glfw
    offscreen-glfw
    mrt-glfw
    arraytex-glfw
    imgui-glfw
    dyntex-glfw
    mipmap-glfw
    blend-glfw
    inject-glfw
    bufferoffsets-glfw
    noninterleaved-glfw
    multiwindow-glfw
    uniformarrays-glfw
    sgl-test-glfw
    metal-glfw