Improve dll build
Still not perfect, but more user friendly now.
This commit is contained in:
parent
058c738da9
commit
4f27819fa2
14
meson.build
14
meson.build
@ -45,6 +45,8 @@ if buildtype == 'debug' or buildtype == 'debugoptimized'
|
||||
add_project_arguments([ '-DRT_DEBUG'], language : ['c', 'cpp'])
|
||||
endif
|
||||
|
||||
fs = import('fs')
|
||||
|
||||
# Gather dependencies
|
||||
thread_dep = dependency('threads')
|
||||
m_dep = compiler.find_library('m', required : false)
|
||||
@ -63,6 +65,10 @@ engine_incdir = include_directories('src')
|
||||
|
||||
contrib_dir = meson.project_source_root() / 'contrib'
|
||||
|
||||
# Targets append to this, to enable us to run shared library builds from IDEs
|
||||
engine_lib_paths = []
|
||||
engine_libs = []
|
||||
|
||||
subdir('src')
|
||||
|
||||
# Handle linking against both runtime and renderer if we build static libs
|
||||
@ -90,4 +96,12 @@ assetc_dep = declare_dependency(link_with : asset_compiler,
|
||||
# "inline" game
|
||||
if get_option('game_as_subdir')
|
||||
subdir('src/game')
|
||||
|
||||
# If we are building shared libraries, copy them to the games output directory.
|
||||
# This ensures that we can debug with visual studio.
|
||||
foreach lib_path : engine_lib_paths
|
||||
run_target('copy'+fs.name(lib_path),
|
||||
command : [copy_util, lib_path, join_paths(game_build_dir, fs.name(lib_path))],
|
||||
depends : engine_libs)
|
||||
endforeach
|
||||
endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "processor.h"
|
||||
#include "description_parser.h"
|
||||
#include "processor.h"
|
||||
#include "shader_compiler.h"
|
||||
|
||||
#include "runtime/buffer_manager.h"
|
||||
@ -10,8 +10,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
rt_attribute_binding *uniform_bindings;
|
||||
@ -39,7 +39,7 @@ enum {
|
||||
RT_SHADER_NOT_PRESENT = RT_ASSET_PROCESSING_FAILED + 1
|
||||
};
|
||||
|
||||
extern rt_cvar rt_Renderer;
|
||||
extern RT_DLLIMPORT rt_cvar rt_Renderer;
|
||||
|
||||
static bool ParseBindingIndex(rt_text_span span, unsigned int *index) {
|
||||
if (span.length == 0)
|
||||
@ -446,8 +446,10 @@ RT_ASSET_PROCESSOR_FN(PipelineProcessor) {
|
||||
goto out;
|
||||
|
||||
rt_resource_id shader_resources[3] = {0};
|
||||
result = rtCreateResources(pipeline.shader_count, pipeline.shader_names, pipeline.shaders,
|
||||
shader_resources);
|
||||
result = rtCreateResources(pipeline.shader_count,
|
||||
pipeline.shader_names,
|
||||
pipeline.shaders,
|
||||
shader_resources);
|
||||
if (result != RT_SUCCESS)
|
||||
goto out;
|
||||
|
||||
@ -494,7 +496,7 @@ RT_ASSET_PROCESSOR_FN(PipelineProcessor) {
|
||||
}
|
||||
rt_resource_id pipeline_id;
|
||||
const char *name = rtGetFilePath(file);
|
||||
result = rtCreateResources(1, &name, &pipeline_resource, &pipeline_id);
|
||||
result = rtCreateResources(1, &name, &pipeline_resource, &pipeline_id);
|
||||
if (result == RT_SUCCESS) {
|
||||
new_resources[0] = pipeline_id;
|
||||
memcpy(&new_resources[1], shader_resources, sizeof(shader_resources));
|
||||
@ -503,4 +505,4 @@ RT_ASSET_PROCESSOR_FN(PipelineProcessor) {
|
||||
out:
|
||||
rtReleaseBuffer(asset.buffer, asset.size);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
vy_link_libs = engine_link_libs
|
||||
vy_link_libs += asset_compiler
|
||||
|
||||
executable('voyage',
|
||||
game = executable('voyage',
|
||||
'entry.c',
|
||||
'main.c',
|
||||
link_with : vy_link_libs,
|
||||
include_directories : engine_incdir,
|
||||
c_pch : 'pch/game_pch.h',
|
||||
win_subsystem : 'windows')
|
||||
win_subsystem : 'windows',
|
||||
install : true)
|
||||
|
||||
game_build_dir = fs.parent(game.full_path())
|
@ -31,6 +31,10 @@ if vk_dep.found()
|
||||
c_pch : 'pch/vk_pch.h',
|
||||
c_args : platform_defs,
|
||||
cpp_pch : 'pch/vk_pch.h',
|
||||
cpp_args : platform_defs)
|
||||
cpp_args : platform_defs,
|
||||
install : true)
|
||||
|
||||
engine_libs = vk_renderer_lib
|
||||
engine_lib_paths += vk_renderer_lib.full_path()
|
||||
endif
|
||||
|
||||
|
@ -18,7 +18,7 @@ rt_renderer_api g_renderer;
|
||||
static rt_dynlib _renderer_lib;
|
||||
static bool _renderer_loaded = false;
|
||||
|
||||
RT_CVAR_S(rt_Renderer, "Select the render backend. Available options: [vk], Default: vk", "vk");
|
||||
RT_DLLEXPORT RT_CVAR_S(rt_Renderer, "Select the render backend. Available options: [vk], Default: vk", "vk");
|
||||
|
||||
#ifdef RT_STATIC_LIB
|
||||
extern void RT_RENDERER_API_FN(RegisterCVars)(void);
|
||||
|
@ -52,4 +52,8 @@ runtime_lib = library('rt',
|
||||
contrib_dir / 'lz4/lz4.c',
|
||||
dependencies : runtime_deps,
|
||||
include_directories : [engine_incdir, runtime_incdirs],
|
||||
c_pch : 'pch/rt_pch.h')
|
||||
c_pch : 'pch/rt_pch.h',
|
||||
install : true)
|
||||
|
||||
engine_libs += runtime_lib
|
||||
engine_lib_paths += runtime_lib.full_path()
|
@ -13,8 +13,10 @@ extern "C" {
|
||||
|
||||
#if defined(_MSC_VER) && !defined(RT_STATIC_LIB)
|
||||
#define RT_DLLEXPORT __declspec(dllexport)
|
||||
#define RT_DLLIMPORT __declspec(dllimport)
|
||||
#else
|
||||
#define RT_DLLEXPORT
|
||||
#define RT_DLLIMPORT
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
Loading…
Reference in New Issue
Block a user