diff --git a/scripts/Readme.md b/scripts/Readme.md index 9faafce..ddb6b84 100644 --- a/scripts/Readme.md +++ b/scripts/Readme.md @@ -17,7 +17,7 @@ A custom version of the vendor:stb/truetype is maintained by this library: * Added ability to set the stb_truetype allocator for `STBTT_MALLOC` and `STBTT_FREE`. * Changed procedure signatures to pass the font_info struct by immutable ptr (#by_ptr) when the C equivalent has their parameter as `const*`. -All other dependencies are provided directly into the thirdparty directory. However they can be cloned from their corresponding github repos: +All other dependencies are provided directly into the thirdparty directory (EXCEPT sokol-tools, its cloned). However they can be cloned from their corresponding github repos: [harfbuzz](https://github.com/Ed94/odin_harfbuzz) is configured to pull & build the C++ library, it will use the MSVC toolchain (you can change it to use meson instead of preferred). [sokol](https://github.com/floooh/sokol) built using `build_sokol_library.ps1`. @@ -57,7 +57,7 @@ Build sokol manually if not using a fresh clone. #### Note on dependency packages -All other dependencies are provided directly into the thirdparty directory. However they can be cloned from their corresponding github repos: +All other dependencies are provided directly into the thirdparty directory (EXCEPT sokol-tools, its cloned). However they can be cloned from their corresponding github repos: [harfbuzz](https://github.com/Ed94/odin_harfbuzz) is configured to pull & build the C++ library, it will use the gcc toolchain (you can change it to use meson instead of preferred). diff --git a/thirdparty/sokol-tools/.gitignore b/thirdparty/sokol-tools/.gitignore deleted file mode 100644 index bfe2935..0000000 --- a/thirdparty/sokol-tools/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.vscode/ -.zig-cache/ -zig-out/ -*.pyc diff --git a/thirdparty/sokol-tools/LICENSE b/thirdparty/sokol-tools/LICENSE deleted file mode 100644 index 396f640..0000000 --- a/thirdparty/sokol-tools/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Andre Weissflog - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/thirdparty/sokol-tools/README.md b/thirdparty/sokol-tools/README.md deleted file mode 100644 index 4128d4d..0000000 --- a/thirdparty/sokol-tools/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# sokol-tools-bin -Binaries and fips integration for https://github.com/floooh/sokol-tools diff --git a/thirdparty/sokol-tools/bin/linux/readme.txt b/thirdparty/sokol-tools/bin/linux/readme.txt deleted file mode 100644 index c315007..0000000 --- a/thirdparty/sokol-tools/bin/linux/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -Precompiled binaries for Linux go here (64-bit statically linked). - diff --git a/thirdparty/sokol-tools/bin/linux/sokol-shdc b/thirdparty/sokol-tools/bin/linux/sokol-shdc deleted file mode 100644 index 2ce2e7e..0000000 Binary files a/thirdparty/sokol-tools/bin/linux/sokol-shdc and /dev/null differ diff --git a/thirdparty/sokol-tools/bin/linux_arm64/sokol-shdc b/thirdparty/sokol-tools/bin/linux_arm64/sokol-shdc deleted file mode 100644 index 7dd984a..0000000 Binary files a/thirdparty/sokol-tools/bin/linux_arm64/sokol-shdc and /dev/null differ diff --git a/thirdparty/sokol-tools/bin/osx/readme.txt b/thirdparty/sokol-tools/bin/osx/readme.txt deleted file mode 100644 index ff18fea..0000000 --- a/thirdparty/sokol-tools/bin/osx/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -Precompiled binaries for macOS go here. - diff --git a/thirdparty/sokol-tools/bin/osx/sokol-shdc b/thirdparty/sokol-tools/bin/osx/sokol-shdc deleted file mode 100644 index 2e9b81f..0000000 Binary files a/thirdparty/sokol-tools/bin/osx/sokol-shdc and /dev/null differ diff --git a/thirdparty/sokol-tools/bin/osx_arm64/sokol-shdc b/thirdparty/sokol-tools/bin/osx_arm64/sokol-shdc deleted file mode 100644 index 5372830..0000000 Binary files a/thirdparty/sokol-tools/bin/osx_arm64/sokol-shdc and /dev/null differ diff --git a/thirdparty/sokol-tools/bin/win32/readme.txt b/thirdparty/sokol-tools/bin/win32/readme.txt deleted file mode 100644 index f0ec175..0000000 --- a/thirdparty/sokol-tools/bin/win32/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -Precompiled binaries for Windows (64-bit) go here. - diff --git a/thirdparty/sokol-tools/bin/win32/sokol-shdc.exe b/thirdparty/sokol-tools/bin/win32/sokol-shdc.exe deleted file mode 100644 index 140a187..0000000 Binary files a/thirdparty/sokol-tools/bin/win32/sokol-shdc.exe and /dev/null differ diff --git a/thirdparty/sokol-tools/build.zig b/thirdparty/sokol-tools/build.zig deleted file mode 100644 index 06f3bf8..0000000 --- a/thirdparty/sokol-tools/build.zig +++ /dev/null @@ -1,143 +0,0 @@ -//! Helper code to invoke sokol-shdc from the Zig build system. -//! See https://github.com/floooh/sokol-zig for an example -//! of how to use sokol-tools-bin as a lazy dependency and -//! compile shaders (search for `shdc.compile` in the sokol-zig build.zig) -const std = @import("std"); -const builtin = @import("builtin"); -const Allocator = std.mem.Allocator; -const Build = std.Build; - -pub const Options = struct { - dep_shdc: *Build.Dependency, - input: Build.LazyPath, - output: Build.LazyPath, - slang: Slang, - format: Format = .sokol_zig, - tmp_dir: ?Build.LazyPath = null, - defines: ?[][]const u8 = null, - module: ?[]const u8 = null, - reflection: bool = false, - bytecode: bool = false, - dump: bool = false, - genver: ?[]const u8 = null, - ifdef: bool = false, - noifdef: bool = false, - save_intermediate_spirv: bool = false, - no_log_cmdline: bool = true, -}; - -pub fn compile(b: *Build, opts: Options) !*Build.Step.Run { - const shdc_path = try getShdcLazyPath(opts.dep_shdc); - const args = try optsToArgs(opts, b, shdc_path); - var step = b.addSystemCommand(args); - step.addFileArg(opts.input); - return step; -} - -/// target shader languages -/// NOTE: make sure that field names match the cmdline arg string -pub const Slang = packed struct(u10) { - glsl410: bool = false, - glsl430: bool = false, - glsl300es: bool = false, - glsl310es: bool = false, - hlsl4: bool = false, - hlsl5: bool = false, - metal_macos: bool = false, - metal_ios: bool = false, - metal_sim: bool = false, - wgsl: bool = false, -}; - -fn slangToString(slang: Slang, a: Allocator) ![]const u8 { - var strings: [16][]const u8 = undefined; - var num_strings: usize = 0; - inline for (std.meta.fields(Slang)) |field| { - if (@field(slang, field.name)) { - strings[num_strings] = field.name; - num_strings += 1; - } - } - return std.mem.join(a, ":", strings[0..num_strings]); -} - -/// the code-generation target language -/// NOTE: make sure that the item names match the cmdline arg string -pub const Format = enum { - sokol, - sokol_impl, - sokol_zig, - sokol_nim, - sokol_odin, - sokol_rust, - sokol_d, - sokol_jai, -}; - -fn formatToString(f: Format) []const u8 { - return @tagName(f); -} - -fn getShdcLazyPath(dep_shdc: *Build.Dependency) !Build.LazyPath { - const intel = builtin.cpu.arch.isX86(); - const opt_sub_path: ?[]const u8 = switch (builtin.os.tag) { - .windows => "bin/win32/sokol-shdc.exe", - .linux => if (intel) "bin/linux/sokol-shdc" else "bin/linux_arm64/sokol-shdc", - .macos => if (intel) "bin/osx/sokol-shdc" else "bin/osx_arm64/sokol-shdc", - else => null, - }; - if (opt_sub_path) |sub_path| { - return dep_shdc.path(sub_path); - } else { - return error.ShdcUnsupportedPlatform; - } -} - -fn optsToArgs(opts: Options, b: *Build, tool_path: Build.LazyPath) ![]const []const u8 { - const a = b.allocator; - var arr: std.ArrayListUnmanaged([]const u8) = .empty; - try arr.append(a, tool_path.getPath(b)); - try arr.appendSlice(a, &.{ "-o", opts.output.getPath(b) }); - try arr.appendSlice(a, &.{ "-l", try slangToString(opts.slang, a) }); - try arr.appendSlice(a, &.{ "-f", formatToString(opts.format) }); - if (opts.tmp_dir) |tmp_dir| { - try arr.appendSlice(a, &.{ "--tmpdir", tmp_dir.getPath(b) }); - } - if (opts.defines) |defines| { - try arr.appendSlice(a, &.{ "--defines", try std.mem.join(a, ":", defines) }); - } - if (opts.module) |module| { - try arr.appendSlice(a, &.{ "--module", b.dupe(module) }); - } - if (opts.reflection) { - try arr.append(a, "--reflection"); - } - if (opts.bytecode) { - try arr.append(a, "--bytecode"); - } - if (opts.dump) { - try arr.append(a, "--dump"); - } - if (opts.genver) |genver| { - try arr.appendSlice(a, &.{ "--genver", b.dupe(genver) }); - } - if (opts.ifdef) { - try arr.append(a, "--ifdef"); - } - if (opts.noifdef) { - try arr.append(a, "--noifdef"); - } - if (opts.save_intermediate_spirv) { - try arr.append(a, "--save-intermediate-spirv"); - } - if (opts.no_log_cmdline) { - try arr.append(a, "--no-log-cmdline"); - } - // important: keep this last - try arr.append(a, "-i"); - return arr.toOwnedSlice(a); -} - -pub fn build(b: *Build) void { - _ = b; -} diff --git a/thirdparty/sokol-tools/build.zig.zon b/thirdparty/sokol-tools/build.zig.zon deleted file mode 100644 index ced1d9e..0000000 --- a/thirdparty/sokol-tools/build.zig.zon +++ /dev/null @@ -1,7 +0,0 @@ -.{ - .name = .sokolshdc, - .fingerprint = 0xe0596dde0e9962af, - .version = "0.1.0", - .minimum_zig_version = "0.14.0", - .paths = .{ "bin", "build.zig", "build.zig.zon" }, -} diff --git a/thirdparty/sokol-tools/fips-files/generators/SokolShader.py b/thirdparty/sokol-tools/fips-files/generators/SokolShader.py deleted file mode 100644 index 2f29dfd..0000000 --- a/thirdparty/sokol-tools/fips-files/generators/SokolShader.py +++ /dev/null @@ -1,62 +0,0 @@ -#------------------------------------------------------------------------------- -# SokolShader.py -# -# Fips code-generator script for invoking sokol-shdc during the build. -# -# Use the cmake macro 'sokol_shader([glsl-file] [shader-dialects])' inside a -# fips target (fips_begin_* / fips_end_*) to hook the code-generation -# build job into the build process. -#------------------------------------------------------------------------------- - -Version = 5 - -import os, platform, subprocess -import genutil as util -from mod import log - -#------------------------------------------------------------------------------- -def find_shdc(): - shdc_path = os.path.dirname(os.path.abspath(__file__)) - shdc_path += '/../../bin/' - if platform.system() == 'Windows': - shdc_path += 'win32/' - elif platform.system() == 'Darwin': - if platform.machine() == 'arm64': - shdc_path += 'osx_arm64/' - else: - shdc_path += 'osx/' - elif platform.system() == 'Linux': - if platform.machine() in ['aarch64', 'arm64']: - shdc_path += 'linux_arm64/' - else: - shdc_path += 'linux/' - else: - log.error('Unknown host system {}'.format(platform.system())) - return shdc_path + 'sokol-shdc' - -#------------------------------------------------------------------------------- -def generate(input, out_src, out_hdr, args): - errfmt = 'msvc' if args['compiler']=='MSVC' else 'gcc' - if util.isDirty(Version, [input], [out_hdr]): - print('## sokol-shdc: {} {} {}'.format(input, out_hdr, str(args))) - cmd = [find_shdc(), - '--input', input, - '--output', out_hdr, - '--slang', args['slang'], - '--genver', str(Version), - '--errfmt', errfmt, - '--format', 'sokol'] - if 'defines' in args: - cmd.extend(['--defines', args['defines']]) - if 'module' in args: - cmd.extend(['--module', args['module']]) - if 'reflection' in args: - if args['reflection']: - cmd.extend(['--reflection']) - if 'debuggable' in args and args['debuggable']: - pass - else: - cmd.extend(['--bytecode']) - res = subprocess.call(cmd) - if res != 0: - log.error('sokol-shdc returned with error code {}'.format(res)) diff --git a/thirdparty/sokol-tools/fips-files/include.cmake b/thirdparty/sokol-tools/fips-files/include.cmake deleted file mode 100644 index 9a7879d..0000000 --- a/thirdparty/sokol-tools/fips-files/include.cmake +++ /dev/null @@ -1,25 +0,0 @@ -macro(sokol_shader shd slang) - set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}' }") - fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.h OUT_OF_SOURCE ARGS ${args}) -endmacro() - -# special version which doesn't generate binary output, this allows shaders to be debugged -macro(sokol_shader_debuggable shd slang) - set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}', debuggable: true }") - fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.h OUT_OF_SOURCE ARGS ${args}) -endmacro() - -macro(sokol_shader_variant shd slang module defines) - set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}', defines: '${defines}', module: '${module}' }") - fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.${module}.h OUT_OF_SOURCE ARGS ${args}) -endmacro() - -macro(sokol_shader_with_reflection shd slang) - set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}', reflection: true }") - fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.h OUT_OF_SOURCE ARGS ${args}) -endmacro() - -macro(sokol_shader_variant_with_reflection shd slang module defines) - set(args "{slang: '${slang}', compiler: '${CMAKE_C_COMPILER_ID}', defines: '${defines}', module: '${module}', reflection: true }") - fips_generate(TYPE SokolShader FROM ${shd} HEADER ${shd}.${module}.h OUT_OF_SOURCE ARGS ${args}) -endmacro()