Enable compiling PortMidi (nw)

Tested on: Linux x64, Mac OS X 10.8, Windows 8 x64 w/latest toolchain for both OSD=windows and OSD=sdl.  MIDI should auto-disable on other OSes (*BSD) but there may be problems.  Works fine on Linux when set to use the system's copy of the library as well, which many distros prefer.
This commit is contained in:
R. Belmont 2013-01-01 16:58:48 +00:00
parent ad80ff6c3f
commit 13c3e056aa
7 changed files with 64 additions and 8 deletions

View File

@ -221,6 +221,9 @@ BUILD_FLAC = 1
# uncomment next line to build jpeglib as part of MAME build # uncomment next line to build jpeglib as part of MAME build
BUILD_JPEGLIB = 1 BUILD_JPEGLIB = 1
# uncomment next line to build PortMidi as part of MAME/MESS build
BUILD_MIDILIB = 1
# uncomment next line to include the symbols # uncomment next line to include the symbols
# SYMBOLS = 1 # SYMBOLS = 1
@ -658,6 +661,15 @@ SOFTFLOAT = $(OBJ)/libsoftfloat.a
# add formats emulation library # add formats emulation library
FORMATS_LIB = $(OBJ)/libformats.a FORMATS_LIB = $(OBJ)/libformats.a
# add PortMidi MIDI library
ifeq ($(BUILD_MIDILIB),1)
INCPATH += -I$(SRC)/lib/portmidi
MIDI_LIB = $(OBJ)/portmidi.a
else
LIBS += -lportmidi
MIDI_LIB =
endif
#------------------------------------------------- #-------------------------------------------------
# 'default' target needs to go here, before the # 'default' target needs to go here, before the
# include files which define additional targets # include files which define additional targets
@ -752,7 +764,7 @@ $(sort $(OBJDIRS)):
ifndef EXECUTABLE_DEFINED ifndef EXECUTABLE_DEFINED
$(EMULATOR): $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(JPEG_LIB) $(FLAC_LIB) $(7Z_LIB) $(FORMATS_LIB) $(ZLIB) $(LIBOCORE) $(RESFILE) $(EMULATOR): $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBCPU) $(LIBEMU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(JPEG_LIB) $(FLAC_LIB) $(7Z_LIB) $(FORMATS_LIB) $(ZLIB) $(LIBOCORE) $(MIDI_LIB) $(RESFILE)
$(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ) $(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ)
@echo Linking $@... @echo Linking $@...
$(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $(VERSIONOBJ) $^ $(LIBS) -o $@ $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $(VERSIONOBJ) $^ $(LIBS) -o $@

View File

@ -91,6 +91,7 @@ const options_entry cli_options::s_option_entries[] =
{ CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0", OPTION_COMMAND, "verify known software for the system" }, { CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0", OPTION_COMMAND, "verify known software for the system" },
{ CLICOMMAND_GETSOFTLIST ";glist", "0", OPTION_COMMAND, "retrieve software list by name" }, { CLICOMMAND_GETSOFTLIST ";glist", "0", OPTION_COMMAND, "retrieve software list by name" },
{ CLICOMMAND_VERIFYSOFTLIST ";vlist", "0", OPTION_COMMAND, "verify software list by name" }, { CLICOMMAND_VERIFYSOFTLIST ";vlist", "0", OPTION_COMMAND, "verify software list by name" },
{ CLICOMMAND_LIST_MIDI_DEVICES ";mlist", "0", OPTION_COMMAND, "list available MIDI I/O devices" },
{ NULL } { NULL }
}; };
@ -733,6 +734,16 @@ void cli_frontend::listmedia(const char *gamename)
} }
} }
//-------------------------------------------------
// listmididevices - output the list of MIDI devices
// available in the current system to be used
//-------------------------------------------------
void cli_frontend::listmididevices(const char *gamename)
{
osd_list_midi_devices();
}
//------------------------------------------------- //-------------------------------------------------
// verifyroms - verify the ROM sets of one or // verifyroms - verify the ROM sets of one or
@ -1644,6 +1655,7 @@ void cli_frontend::execute_commands(const char *exename)
{ CLICOMMAND_ROMIDENT, &cli_frontend::romident }, { CLICOMMAND_ROMIDENT, &cli_frontend::romident },
{ CLICOMMAND_GETSOFTLIST, &cli_frontend::getsoftlist }, { CLICOMMAND_GETSOFTLIST, &cli_frontend::getsoftlist },
{ CLICOMMAND_VERIFYSOFTLIST, &cli_frontend::verifysoftlist }, { CLICOMMAND_VERIFYSOFTLIST, &cli_frontend::verifysoftlist },
{ CLICOMMAND_LIST_MIDI_DEVICES, &cli_frontend::listmididevices },
}; };
// find the command // find the command

View File

@ -78,7 +78,7 @@
#define CLICOMMAND_VERIFYSOFTWARE "verifysoftware" #define CLICOMMAND_VERIFYSOFTWARE "verifysoftware"
#define CLICOMMAND_GETSOFTLIST "getsoftlist" #define CLICOMMAND_GETSOFTLIST "getsoftlist"
#define CLICOMMAND_VERIFYSOFTLIST "verifysoftlist" #define CLICOMMAND_VERIFYSOFTLIST "verifysoftlist"
#define CLICOMMAND_LIST_MIDI_DEVICES "listmidi"
//************************************************************************** //**************************************************************************
@ -128,6 +128,7 @@ public:
void romident(const char *filename); void romident(const char *filename);
void getsoftlist(const char *gamename = "*"); void getsoftlist(const char *gamename = "*");
void verifysoftlist(const char *gamename = "*"); void verifysoftlist(const char *gamename = "*");
void listmididevices(const char *gamename = "*");
private: private:
// internal helpers // internal helpers

View File

@ -79,6 +79,9 @@ NO_USE_XINPUT = 1
# uncomment to try the experimental new Qt debugger # uncomment to try the experimental new Qt debugger
#USE_QTDEBUG = 1 #USE_QTDEBUG = 1
# uncomment to disable MIDI
#NO_USE_MIDI = 1
########################################################################### ###########################################################################
################## END USER-CONFIGURABLE OPTIONS ###################### ################## END USER-CONFIGURABLE OPTIONS ######################
########################################################################### ###########################################################################
@ -185,6 +188,12 @@ ifeq ($(TARGETOS),linux)
BASE_TARGETOS = unix BASE_TARGETOS = unix
SYNC_IMPLEMENTATION = tc SYNC_IMPLEMENTATION = tc
SDL_NETWORK = taptun SDL_NETWORK = taptun
ifndef NO_USE_MIDI
INCPATH += `pkg-config --cflags alsa`
LIBS += `pkg-config --libs alsa`
endif
endif endif
ifeq ($(TARGETOS),freebsd) ifeq ($(TARGETOS),freebsd)
@ -198,24 +207,28 @@ CCOMFLAGS += -isystem /usr/local/include
# No clue here. There is a popmessage(NULL) in uimenu.c which # No clue here. There is a popmessage(NULL) in uimenu.c which
# triggers a non-null format warning on FreeBSD only. # triggers a non-null format warning on FreeBSD only.
CCOMFLAGS += -Wno-format CCOMFLAGS += -Wno-format
NO_USE_MIDI = 1
endif endif
ifeq ($(TARGETOS),openbsd) ifeq ($(TARGETOS),openbsd)
BASE_TARGETOS = unix BASE_TARGETOS = unix
SYNC_IMPLEMENTATION = ntc SYNC_IMPLEMENTATION = ntc
LIBS += -lutil LIBS += -lutil
NO_USE_MIDI = 1
endif endif
ifeq ($(TARGETOS),netbsd) ifeq ($(TARGETOS),netbsd)
BASE_TARGETOS = unix BASE_TARGETOS = unix
SYNC_IMPLEMENTATION = ntc SYNC_IMPLEMENTATION = ntc
LIBS += -lutil LIBS += -lutil
NO_USE_MIDI = 1
endif endif
ifeq ($(TARGETOS),solaris) ifeq ($(TARGETOS),solaris)
BASE_TARGETOS = unix BASE_TARGETOS = unix
DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
SYNC_IMPLEMENTATION = tc SYNC_IMPLEMENTATION = tc
NO_USE_MIDI = 1
endif endif
ifeq ($(TARGETOS),haiku) ifeq ($(TARGETOS),haiku)
@ -223,6 +236,7 @@ BASE_TARGETOS = unix
SYNC_IMPLEMENTATION = ntc SYNC_IMPLEMENTATION = ntc
NO_X11 = 1 NO_X11 = 1
NO_USE_XINPUT = 1 NO_USE_XINPUT = 1
NO_USE_MIDI = 1
LIBS += -lnetwork -lbsd LIBS += -lnetwork -lbsd
endif endif
@ -230,6 +244,10 @@ ifeq ($(TARGETOS),macosx)
BASE_TARGETOS = unix BASE_TARGETOS = unix
DEFS += -DSDLMAME_UNIX -DSDLMAME_MACOSX -DSDLMAME_DARWIN DEFS += -DSDLMAME_UNIX -DSDLMAME_MACOSX -DSDLMAME_DARWIN
ifndef NO_USE_MIDI
LIBS += -framework CoreAudio -framework CoreMIDI
endif
ifndef USE_QTDEBUG ifndef USE_QTDEBUG
DEBUGOBJS = $(SDLOBJ)/debugosx.o DEBUGOBJS = $(SDLOBJ)/debugosx.o
endif endif
@ -324,6 +342,7 @@ SYNC_IMPLEMENTATION = os2
NO_DEBUGGER = 1 NO_DEBUGGER = 1
NO_X11 = 1 NO_X11 = 1
NO_USE_XINPUT = 1 NO_USE_XINPUT = 1
NO_USE_MIDI = 1
# OS/2 can't have OpenGL (aww) # OS/2 can't have OpenGL (aww)
NO_OPENGL = 1 NO_OPENGL = 1
endif endif
@ -371,7 +390,12 @@ OSDOBJS = \
$(SDLOBJ)/drawsdl.o \ $(SDLOBJ)/drawsdl.o \
$(SDLOBJ)/window.o \ $(SDLOBJ)/window.o \
$(SDLOBJ)/output.o \ $(SDLOBJ)/output.o \
$(SDLOBJ)/watchdog.o $(SDLOBJ)/watchdog.o \
$(SDLOBJ)/sdlmidi.o
ifdef NO_USE_MIDI
DEFS += "-DDISABLE_MIDI=1"
endif
# Add SDL2.0 support # Add SDL2.0 support
@ -765,6 +789,8 @@ testkeys$(EXE): $(TESTKEYSOBJS) $(LIBUTIL) $(LIBOCORE) $(SDLUTILMAIN)
@echo Linking $@... @echo Linking $@...
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@ $(LD) $(LDFLAGS) $^ $(LIBS) -o $@
$(SDLOBJ)/sdlmidi.o: $(SRC)/osd/portmedia/pmmidi.c
#------------------------------------------------- #-------------------------------------------------
# clean up # clean up
#------------------------------------------------- #-------------------------------------------------

View File

@ -362,7 +362,7 @@ int main(int argc, char *argv[])
} }
#endif #endif
// osd_init_midi(); // this is a blues riff in B, watch me for the changes and try to keep up... osd_init_midi(); // this is a blues riff in B, watch me for the changes and try to keep up...
{ {
sdl_osd_interface osd; sdl_osd_interface osd;
@ -388,7 +388,7 @@ int main(int argc, char *argv[])
#endif #endif
#endif #endif
// osd_shutdown_midi(); osd_shutdown_midi();
exit(res); exit(res);

View File

@ -64,7 +64,6 @@
# DIRECTINPUT = 8 # DIRECTINPUT = 8
########################################################################### ###########################################################################
################## END USER-CONFIGURABLE OPTIONS ###################### ################## END USER-CONFIGURABLE OPTIONS ######################
########################################################################### ###########################################################################
@ -292,8 +291,8 @@ OSDCOREOBJS = \
$(WINOBJ)/winclip.o \ $(WINOBJ)/winclip.o \
$(WINOBJ)/winsocket.o \ $(WINOBJ)/winsocket.o \
$(WINOBJ)/winwork.o \ $(WINOBJ)/winwork.o \
$(WINOBJ)/winptty.o $(WINOBJ)/winptty.o \
$(WINOBJ)/winmidi.o
#------------------------------------------------- #-------------------------------------------------
@ -315,6 +314,7 @@ OSDOBJS = \
$(WINOBJ)/winmenu.o \ $(WINOBJ)/winmenu.o \
$(WINOBJ)/winmain.o $(WINOBJ)/winmain.o
ifdef USE_NETWORK ifdef USE_NETWORK
OSDOBJS += \ OSDOBJS += \
$(WINOBJ)/netdev.o \ $(WINOBJ)/netdev.o \
@ -330,6 +330,7 @@ endif
# extra dependencies # extra dependencies
$(WINOBJ)/drawdd.o : $(SRC)/emu/rendersw.c $(WINOBJ)/drawdd.o : $(SRC)/emu/rendersw.c
$(WINOBJ)/drawgdi.o : $(SRC)/emu/rendersw.c $(WINOBJ)/drawgdi.o : $(SRC)/emu/rendersw.c
$(WINOBJ)/winmidi.o: $(SRC)/osd/portmedia/pmmidi.c
# add debug-specific files # add debug-specific files
OSDOBJS += \ OSDOBJS += \

View File

@ -473,6 +473,8 @@ int main(int argc, char *argv[])
FreeConsole(); FreeConsole();
} }
osd_init_midi();
// parse config and cmdline options // parse config and cmdline options
DWORD result = 0; DWORD result = 0;
{ {
@ -482,6 +484,8 @@ int main(int argc, char *argv[])
result = frontend.execute(argc, argv); result = frontend.execute(argc, argv);
} }
osd_shutdown_midi();
// free symbols // free symbols
symbols = NULL; symbols = NULL;
return result; return result;