Made iwa compile as an S++ library.
This commit is contained in:
parent
1d44ecc0ee
commit
ddb4f67735
13
LibConf
13
LibConf
@ -33,7 +33,7 @@ lib_argparse = env.Cook('argparse', git_ref = 'refs/tags/v3.0')
|
|||||||
lib_yaml_cpp = env.Cook('yaml-cpp', git_ref = 'refs/tags/0.8.0')
|
lib_yaml_cpp = env.Cook('yaml-cpp', git_ref = 'refs/tags/0.8.0')
|
||||||
|
|
||||||
# Generated files
|
# Generated files
|
||||||
env.Jinja('public/iwa/util/vertex_attribute_semantic.gen.hpp')
|
env.Jinja('include/iwa/util/vertex_attribute_semantic.gen.hpp')
|
||||||
|
|
||||||
# Iwa
|
# Iwa
|
||||||
src_files = Split("""
|
src_files = Split("""
|
||||||
@ -77,16 +77,21 @@ src_files = Split("""
|
|||||||
source/util/vkutil.cpp
|
source/util/vkutil.cpp
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
include_dir = env.Dir('include')
|
||||||
|
|
||||||
|
env.Append(JINJA_TEMPLATE_SEARCHPATH = [env.Dir('data/jinja')])
|
||||||
|
env.Append(JINJA_CONFIG_SEARCHPATH = [env.Dir('data/config')])
|
||||||
lib_iwa = env.UnityStaticLibrary(
|
lib_iwa = env.UnityStaticLibrary(
|
||||||
target = env['LIB_DIR'] + '/iwa',
|
target = env['LIB_DIR'] + '/iwa',
|
||||||
source = src_files,
|
source = src_files,
|
||||||
dependencies = [lib_fmt, lib_glslang, lib_glm, lib_magic_enum, lib_mijin, lib_sdl, lib_stb, lib_vulkan_headers,
|
dependencies = [lib_fmt, lib_glslang, lib_glm, lib_magic_enum, lib_mijin, lib_sdl, lib_stb, lib_vulkan_headers,
|
||||||
lib_argparse, lib_yaml_cpp]
|
lib_argparse, lib_yaml_cpp],
|
||||||
|
CPPPATH = [include_dir]
|
||||||
)
|
)
|
||||||
|
|
||||||
LIB_CONFIG = {
|
LIB_CONFIG = {
|
||||||
'CPPPATH': [env.Dir('include')],
|
'CPPPATH': [include_dir],
|
||||||
'DEPENDENCIES': [lib_iwa]
|
'DEPENDENCIES': [lib_iwa],
|
||||||
}
|
}
|
||||||
|
|
||||||
Return('LIB_CONFIG')
|
Return('LIB_CONFIG')
|
||||||
|
12
data/config/iwa_enums.yml
Normal file
12
data/config/iwa_enums.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Data source for enums that are shared between CPP and GLSL
|
||||||
|
vertex_input_semantic:
|
||||||
|
cpp_type_name: VertexAttributeSemantic
|
||||||
|
glsl_prefix: IWA_VAS_
|
||||||
|
entries:
|
||||||
|
CUSTOM: 0
|
||||||
|
POSITION: 1
|
||||||
|
NORMAL: 2
|
||||||
|
TANGENT: 3
|
||||||
|
BITANGENT: 4
|
||||||
|
TEXCOORDS: 5
|
||||||
|
COLOR: 6
|
26
data/jinja/iwa_enums.jinja
Normal file
26
data/jinja/iwa_enums.jinja
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
{%- set enum_config = 'iwa_enums' | load_config -%}
|
||||||
|
{% macro cpp_enum(name) -%}
|
||||||
|
enum class {{ enum_config[name].cpp_type_name }}
|
||||||
|
{
|
||||||
|
{%- for key, value in enum_config[name].entries.items(): %}
|
||||||
|
{{ key }} = {{ value }},
|
||||||
|
{%- endfor %}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline mijin::Optional<{{ enum_config[name].cpp_type_name }}> {{ enum_config[name].cpp_type_name[0] | lower }}{{ enum_config[name].cpp_type_name[1:] }}FromString(std::string_view name)
|
||||||
|
{
|
||||||
|
{%- for key in enum_config[name].entries.keys(): %}
|
||||||
|
if (name == "{{ key | lower }}") {
|
||||||
|
return {{ enum_config[name].cpp_type_name }}::{{ key }};
|
||||||
|
}
|
||||||
|
{%- endfor %}
|
||||||
|
return mijin::NULL_OPTIONAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
{%- endmacro %}
|
||||||
|
{% macro glsl_enum(name) -%}
|
||||||
|
{%- for key, value in enum_config[name].entries.items(): -%}
|
||||||
|
const int {{ enum_config[name].glsl_prefix }}{{ key }} = {{ value }};
|
||||||
|
{% endfor -%}
|
||||||
|
{%- endmacro %}
|
@ -1,4 +1,4 @@
|
|||||||
{% import 'enums.jinja' as enums -%}
|
{% import 'iwa_enums.jinja' as enums -%}
|
||||||
// auto-generated using Jinja, do not edit!
|
// auto-generated using Jinja, do not edit!
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#include "iwa/util/shader_meta.hpp"
|
#include "iwa/util/shader_meta.hpp"
|
||||||
|
|
||||||
#include "iwa/log.hpp"
|
#include "iwa/log.hpp"
|
||||||
#include "kazan/resource/mesh.hpp"
|
|
||||||
#include "iwa/util/glsl_compiler.hpp"
|
#include "iwa/util/glsl_compiler.hpp"
|
||||||
|
#include "iwa/util/vertex_layout.hpp"
|
||||||
#include "iwa/util/vkutil.hpp"
|
#include "iwa/util/vkutil.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
Loading…
x
Reference in New Issue
Block a user