Install and CPack ?
Hi,
While trying to use the sokol-samples on macOS, I'm not sure to understand what this line does:
To me, it parses the cgltf-assets.yml files and copies the assets referred in it on install, in the case of macOS to the resource of the bundle, but it doesn't seem to be doing anything?
Looking at the doc of fips I did not find anything related to installing, but it seems to be doing it as it isolates everything in the fips-deploy folder?
I ask because except with the ./fips run xxx command I can't run the deployed apps on their own, even using a release config.
Thanks a lot for the sokol headers ;)
Hi, apologies for replying late.
fipsutil_copy() is a cmake helper macro which adds a custom build job to the build, which in turn copies files from the project directory to the "deploy directory" under fips-deploy. The basic idea is explained here (although this isn't a code-generator-script in the strict sense):
https://floooh.github.io/fips/docs/codegen/
There's no concept of a (system-wide) install step in fips, instead there are two special output directories, one is fips_build where all the intermediate build files are located, and the other is fips_deploy where the compiled executables go. "Core fips" itself has no concept of an asset pipeline (which would convert asset files and place them in the deploy directory), but a simple asset pipeline can be implemented with such custom "generator scripts".
I'm surprised though that fipsutil_copy() doesn't appear to work, for the cgltf-sample the steps would be (from within the sokol-samples project directory):
# start with a clean slate:
> ./fips clean all
# select a sokol-app sample build config:
> ./fips set config sapp-metal-osx-make-debug
# generate cmake project files under fips-build:
> ./fips gen
# build the cgltf-sapp target, this should also copy asset files
> ./fips make cgltf-sapp
# run the cgltf-sapp target:
> ./fips run cgltf-sapp
During the build you should see output lines like this, this is output from the fipsutil_copy() script:
## cp 'DamagedHelmet.bin' => '/Users/floh/projects/fips-deploy/sokol-samples/sapp-metal-osx-make-debug/DamagedHelmet.bin'
## cp 'DamagedHelmet.gltf' => '/Users/floh/projects/fips-deploy/sokol-samples/sapp-metal-osx-make-debug/DamagedHelmet.gltf'
## cp 'Default_albedo.basis' => '/Users/floh/projects/fips-deploy/sokol-samples/sapp-metal-osx-make-debug/Default_albedo.basis'
## cp 'Default_AO.basis' => '/Users/floh/projects/fips-deploy/sokol-samples/sapp-metal-osx-make-debug/Default_AO.basis'
## cp 'Default_emissive.basis' => '/Users/floh/projects/fips-deploy/sokol-samples/sapp-metal-osx-make-debug/Default_emissive.basis'
## cp 'Default_metalRoughness.basis' => '/Users/floh/projects/fips-deploy/sokol-samples/sapp-metal-osx-make-debug/Default_metalRoughness.basis'
## cp 'Default_normal.basis' => '/Users/floh/projects/fips-deploy/sokol-samples/sapp-metal-osx-make-debug/Default_normal.basis'
...and when looking in the fips-deploy directory, the files should be there:
~/projects/sokol-samples webgpu ls -al ../fips-deploy/sokol-samples/sapp-metal-osx-make-debug
total 100272
drwxr-xr-x 72 floh staff 2304 Feb 5 12:06 .
drwxr-xr-x 3 floh staff 96 Feb 5 12:05 ..
-rw-r--r-- 1 floh staff 558504 Feb 5 12:06 DamagedHelmet.bin
-rw-r--r-- 1 floh staff 4547 Feb 5 12:06 DamagedHelmet.gltf
-rw-r--r-- 1 floh staff 135415 Feb 5 12:06 Default_AO.basis
-rw-r--r-- 1 floh staff 210704 Feb 5 12:06 Default_albedo.basis
-rw-r--r-- 1 floh staff 15492 Feb 5 12:06 Default_emissive.basis
-rw-r--r-- 1 floh staff 247715 Feb 5 12:06 Default_metalRoughness.basis
-rw-r--r-- 1 floh staff 342292 Feb 5 12:06 Default_normal.basis
-rw-r--r-- 1 floh staff 1174432 Feb 5 12:06 DroidSansJapanese.ttf
-rw-r--r-- 1 floh staff 172012 Feb 5 12:06 DroidSerif-Bold.ttf
-rw-r--r-- 1 floh staff 155220 Feb 5 12:06 DroidSerif-Italic.ttf
-rw-r--r-- 1 floh staff 162864 Feb 5 12:06 DroidSerif-Regular.ttf
Yes sorry, since then I got more familiar with fips and I'm trying to convert a few CMake only projects to fips.
I'm still experimenting on a few harder cases project (mix of shared and static libraries, assets, etc..) right now so it's too early to report back properly but the idea was to be able to create a contained .app (windowed in fips terms) with everything inside:
- binaries in
macOS - assets in
Resources - Proper plist etc.. CPack does most of this automatically with OS-specific needs (.desktop and such on Linux, .msi on Windows, .dmg with self-contained dependencies or .pkg installer on macOS) I have to spend more time reading the CMake sources of fips to think of the best approach to add CPack to fips but I think it could be a good addition.
Of course, using CMake commands directly is an option, but I like the ways fips 'constrain' libs and app declaration and that would not fit that philosophy (I might be wrong ?)
In the case of the sokol-samples I was referring to, the assets DO get copied to the fips-deploy folder for some reason I missed that, but (I think you get it now :) ) I expected them to go to the Resources of the .app package.