switch: enable nxlink only in debug builds

This commit is contained in:
fgsfds 2021-05-24 05:12:52 +03:00 committed by Alibek Omarov
parent d0471823c8
commit 110be8bdd3
2 changed files with 10 additions and 0 deletions

View File

@ -22,7 +22,9 @@ GNU General Public License for more details.
#include <solder.h>
#include <SDL.h>
#ifdef NSWITCH_DEBUG
static int nxlink_sock = -1;
#endif
// HACKHACK: force these lads to link in
const solder_export_t solder_extra_exports[] =
@ -37,7 +39,9 @@ const solder_export_t solder_extra_exports[] =
void userAppInit( void )
{
socketInitializeDefault();
#ifdef NSWITCH_DEBUG
nxlink_sock = nxlinkStdio();
#endif
if ( solder_init( 0 ) < 0 )
{
fprintf( stderr, "solder_init() failed: %s\n", solder_dlerror() );
@ -49,11 +53,13 @@ void userAppInit( void )
void userAppExit( void )
{
solder_quit();
#ifdef NSWITCH_DEBUG
if ( nxlink_sock >= 0 )
{
close( nxlink_sock );
nxlink_sock = -1;
}
#endif
socketExit();
}

View File

@ -161,4 +161,8 @@ def get_optimization_flags(conf):
if conf.options.POLLY:
cflags += conf.get_flags_by_compiler(POLLY_CFLAGS, conf.env.COMPILER_CC)
if conf.env.DEST_OS == 'nswitch' and conf.options.BUILD_TYPE == 'debug':
# enable remote debugger
cflags.append('-DNSWITCH_DEBUG')
return cflags, linkflags