|
Compiling MAME with visual studio's compiler
#229557 - 08/10/10 05:47 PM
|
|
|
Hey all,
Here are the main issues that I had to resolve to compile MAME with the visual studio compiler:
1) MSVC uses the file extension to decide whether it's c++ or c code, so all of the c++ files had to have their extensions changed to cpp. Also, I wrote a regex to convert all of the #include "*.c" to #include "*.cpp". 2) "interface" is a keyword in MSVC, so I had to prepend all of the "interface"s with something (e.g. dev_interface). 3) alloc and alloca don't exist, so I changed them to malloc and then freed them from the heap before the data went out of scope
If anyone wants these changes, you can grab the ClientServerMAME code and delete the NSM_* files and the code that references those files. All of the code that uses the ClientServer portion is wrapped around if(netClient) or if(netServer) so it isn't hard to remove. The current (0.2) version of ClientServerMAME is based on MAME 0.138.
|
Check out MAMEHub here: http://www.mamehub.info/
|
|
R. Belmont |
Cuckoo for IGAvania
|
|
|
Reged: 09/21/03
|
Posts: 9716
|
Loc: ECV-197 The Orville
|
|
Send PM
|
|
|
Re: Compiling MAME with visual studio's compiler
[Re: Digitalghost]
#229734 - 08/13/10 04:59 PM
|
|
|
MAME's makefile automatically handles all that without renaming or changing any files. Just engage the MSVC_BUILD=1 option and make sure the MSVC stuff's in your PATH (run the vcvars.bat that comes with MSVC).
|
|
|
|
Re: Compiling MAME with visual studio's compiler
[Re: Digitalghost]
#229762 - 08/14/10 01:09 AM
|
|
|
You can also use the /TC option for cl to make it compile a cpp file as .c. Or inversely /TP for c to cpp.
If you are using a solution file you can also change it in the solution properties and it will emit the correct /Tx command for you.
It sounds like the makefile will also take care of it for you.
|
|
|
|
Re: Compiling MAME with visual studio's compiler
[Re: R. Belmont]
#229888 - 08/15/10 07:50 PM
|
|
|
Alright, I'll look into it.
Does the makefile also fix the problem with the interface keyword?
|
Check out MAMEHub here: http://www.mamehub.info/
|
|
|
Re: Compiling MAME with visual studio's compiler
[Re: R. Belmont]
#229890 - 08/15/10 08:53 PM
|
|
|
> MAME's makefile automatically handles all that without renaming or changing any > files. Just engage the MSVC_BUILD=1 option and make sure the MSVC stuff's in your > PATH (run the vcvars.bat that comes with MSVC).
I went looking for MSVC_BUILD in the makefile and the .mak files and I didn't find it? Is this something new since 0.139?
|
Check out MAMEHub here: http://www.mamehub.info/
|
|
drewcifer |
One bad Mutha-(shut yo' mouth!)
|
|
|
Reged: 07/01/04
|
Posts: 428
|
Loc: Sweden
|
|
Send PM
|
|
|
Re: Compiling MAME with visual studio's compiler
[Re: Digitalghost]
#229899 - 08/16/10 12:28 AM
|
|
|
> I went looking for MSVC_BUILD in the makefile and the .mak files and I didn't find > it? Is this something new since 0.139?
osd/windows/windows.mak
|
|
|
|
Re: Compiling MAME with visual studio's compiler
[Re: drewcifer]
#229906 - 08/16/10 03:21 AM
|
|
|
> > I went looking for MSVC_BUILD in the makefile and the .mak files and I didn't find > > it? Is this something new since 0.139? > > osd/windows/windows.mak
Oh, so if I understand it right, you can't build all of the source code with the visual studio compiler, just the windows OSD?
|
Check out MAMEHub here: http://www.mamehub.info/
|
|
R. Belmont |
Cuckoo for IGAvania
|
|
|
Reged: 09/21/03
|
Posts: 9716
|
Loc: ECV-197 The Orville
|
|
Send PM
|
|
|
Re: Compiling MAME with visual studio's compiler
[Re: Digitalghost]
#230188 - 08/18/10 05:08 PM
|
|
|
> > > I went looking for MSVC_BUILD in the makefile and the .mak files and I didn't > find > > > it? Is this something new since 0.139? > > > > osd/windows/windows.mak > > Oh, so if I understand it right, you can't build all of the source code with the > visual studio compiler, just the windows OSD?
No, you can build 100% of MAME with MSVC. osd/xxx/xxx.mak globally overrides the rest of the makefiles for the specific OSD you're compiling for (SDL or Windows currently). Just add MSVC_BUILD=1 to the commandline when you make.
|
|
|
|
Re: Compiling MAME with visual studio's compiler
[Re: R. Belmont]
#230199 - 08/18/10 06:12 PM
|
|
|
|