Changes to help with static build, allow linking OpenAL statically

This commit is contained in:
rdb 2016-04-29 19:54:24 +02:00
parent 369df86096
commit 288452a861
6 changed files with 41 additions and 15 deletions

View File

@ -4036,7 +4036,8 @@ if (not RUNTIME):
TargetAdd('core.pyd', input='p3display_pythonGraphicsWindowProc.obj')
TargetAdd('core.pyd', input='core_module.obj')
TargetAdd('core.pyd', input='libp3tinyxml.ilb')
if not GetLinkAllStatic() and GetTarget() != 'emscripten':
TargetAdd('core.pyd', input='libp3tinyxml.ilb')
TargetAdd('core.pyd', input='libp3interrogatedb.dll')
TargetAdd('core.pyd', input=COMMON_PANDA_LIBS)
TargetAdd('core.pyd', opts=['PYTHON', 'WINSOCK2'])

View File

@ -9,6 +9,6 @@
#include "pandabase.h"
EXPCL_PANDAEGG void init_libpandaegg();
extern "C" EXPCL_PANDAEGG void init_libpandaegg();
#endif

View File

@ -36,25 +36,35 @@ namespace {
}
}
Create_AudioManager_proc* AudioManager::_create_AudioManager
=create_NullAudioManager;
Create_AudioManager_proc *AudioManager::_create_AudioManager = NULL;
void AudioManager::register_AudioManager_creator(Create_AudioManager_proc* proc) {
nassertv(_create_AudioManager==create_NullAudioManager);
_create_AudioManager=proc;
void AudioManager::
register_AudioManager_creator(Create_AudioManager_proc* proc) {
nassertv(_create_AudioManager == NULL);
_create_AudioManager = proc;
}
// Factory method for getting a platform specific AudioManager:
PT(AudioManager) AudioManager::create_AudioManager() {
audio_debug("create_AudioManager()\n audio_library_name=\""<<audio_library_name<<"\"");
if (_create_AudioManager != NULL) {
// Someone was already so good as to register an audio manager creation function,
// perhaps by statically linking the requested library. Let's use that, then.
PT(AudioManager) am = (*_create_AudioManager)();
if (!am->is_exact_type(NullAudioManager::get_class_type()) && !am->is_valid()) {
audio_error(" " << am->get_type() << " is not valid, will use NullAudioManager");
am = create_NullAudioManager();
}
return am;
}
static bool lib_load = false;
if (!lib_load) {
lib_load = true;
if (!audio_library_name.empty() && !(audio_library_name == "null")) {
if (!audio_library_name.empty() && audio_library_name != "null") {
Filename dl_name = Filename::dso_filename(
"lib"+string(audio_library_name)+".so");
"lib" + string(audio_library_name) + ".so");
dl_name.to_os_specific();
audio_debug(" dl_name=\""<<dl_name<<"\"");
void *handle = load_dso(get_plugin_path().get_value(), dl_name);
@ -84,11 +94,20 @@ PT(AudioManager) AudioManager::create_AudioManager() {
} else {
typedef Create_AudioManager_proc *FuncType();
Create_AudioManager_proc *factory_func = (*(FuncType *)dso_symbol)();
AudioManager::register_AudioManager_creator(factory_func);
// Note that the audio manager module may register itself upon load.
if (_create_AudioManager == NULL) {
AudioManager::register_AudioManager_creator(factory_func);
}
}
}
}
}
if (_create_AudioManager == NULL) {
_create_AudioManager = create_NullAudioManager;
}
PT(AudioManager) am = (*_create_AudioManager)();
if (!am->is_exact_type(NullAudioManager::get_class_type()) && !am->is_valid()) {
audio_error(" " << am->get_type() << " is not valid, will use NullAudioManager");

View File

@ -48,6 +48,8 @@ init_libOpenALAudio() {
OpenALAudioManager::init_type();
OpenALAudioSound::init_type();
AudioManager::register_AudioManager_creator(&Create_OpenALAudioManager);
PandaSystem *ps = PandaSystem::get_global_ptr();
ps->add_system("OpenAL");
ps->add_system("audio");

View File

@ -22,7 +22,7 @@
ConfigureDecl(config_openalAudio, EXPCL_OPENAL_AUDIO, EXPTP_OPENAL_AUDIO);
NotifyCategoryDecl(openalAudio, EXPCL_OPENAL_AUDIO, EXPTP_OPENAL_AUDIO);
extern EXPCL_OPENAL_AUDIO void init_libOpenALAudio();
extern "C" EXPCL_OPENAL_AUDIO void init_libOpenALAudio();
extern "C" EXPCL_OPENAL_AUDIO Create_AudioManager_proc *get_audio_manager_func_openal_audio();
extern ConfigVariableString openal_device;

View File

@ -31,6 +31,12 @@
#include "transformState.h"
#include "renderState.h"
#ifdef LINK_ALL_STATIC
#ifdef HAVE_EGG
#include "pandaegg.h"
#endif
#endif
LoaderOptions PandaFramework::_loader_options;
/**
@ -101,10 +107,8 @@ open_framework(int &argc, char **&argv) {
// We also want the egg loader.
#ifdef HAVE_EGG
extern EXPCL_PANDAEGG void init_libpandaegg();
init_libpandaegg();
#endif
#endif
// Let's explicitly make a call to the image type library to ensure it gets