Compiling using .pnml files

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
FulliAutomatix
Engineer
Engineer
Posts: 119
Joined: 24 Aug 2014 12:20
Location: Kaon Prison, Cybertron

Compiling using .pnml files

Post by FulliAutomatix »

So I've got to the point where I'm using a 1500 line .nml file, and I've found no useful explanation to get gcc.exe working to compile from multiple .pnml files.
Since I've been working on RUKTS with Gwyd for the past few months, he's always had to compile, even when testing, as I have no working method for compiling with .pnml files, nor have found any.
He's tried to give gcc.exe to me but I can't get it to work at all.

Could someone please give me a run down on how to compile with .pnml files please?
User avatar
Erato
Chief Executive
Chief Executive
Posts: 740
Joined: 25 May 2015 09:09
Location: The Netherlands

Re: Compiling using .pnml files

Post by Erato »

No pics no clicks. Seriously.
ImageImageImageImageImageImage
rowdog
Engineer
Engineer
Posts: 67
Joined: 24 May 2017 12:51
Location: East Texas

Re: Compiling using .pnml files

Post by rowdog »

My primary use of the pre-processor part of gcc is to combine partial source files together into one big file that I then pass to nmlc to compile.

Suppose I have a top level project file that only exists to collect the parts together. I then "include" the other files to substitute their content.

Code: Select all

#include "src_a.pnml"
#include "src_b.pnml"

Code: Select all

gcc -E project.pnml > project.nml
will combine the files in the specified order and redirect the output into the project.nml

A more advanced use is to #define strings and/or macros that can be substituted throughout your sources.

It's not all that difficult to roll your own makefile and project source structures but, in the long run, you'll be better off starting with the fully developed make-nml project that Erato recommended.
User avatar
FulliAutomatix
Engineer
Engineer
Posts: 119
Joined: 24 Aug 2014 12:20
Location: Kaon Prison, Cybertron

Re: Compiling using .pnml files

Post by FulliAutomatix »

rowdog wrote:

Code: Select all

gcc -E project.pnml > project.nml
will combine the files in the specified order and redirect the output into the project.nml

It's not all that difficult to roll your own makefile and project source structures but, in the long run, you'll be better off starting with the fully developed make-nml project that Erato recommended.
I've tried gcc, but it always throws an error "Failed: Create process" or something.
And I've looked into makefile, but it's from Ubuntu and any method I've tried to get it to work on Windows 10 have failed for many reasons
User avatar
FulliAutomatix
Engineer
Engineer
Posts: 119
Joined: 24 Aug 2014 12:20
Location: Kaon Prison, Cybertron

Re: Compiling using .pnml files

Post by FulliAutomatix »

andythenorth wrote:How about a Windows batch file? :twisted:
Umm, I suppose. But I have no idea how to do that.
It doesn't matter now, I've made my own python program for it
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling using .pnml files

Post by Transportman »

Just curious, how did you try setting up your environment? Did you use this guide, or something else?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
FulliAutomatix
Engineer
Engineer
Posts: 119
Joined: 24 Aug 2014 12:20
Location: Kaon Prison, Cybertron

Re: Compiling using .pnml files

Post by FulliAutomatix »

Transportman wrote:Just curious, how did you try setting up your environment? Did you use this guide, or something else?
Something else. Thanks btw, but I think I'll stick with my simple python program. I'll be giving that to the community at some point in the future because I think I've made it robust enough
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5649
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Compiling using .pnml files

Post by andythenorth »

FulliAutomatix wrote:It doesn't matter now, I've made my own python program for it
That's a good solution. I was trolling a bit with the batch file suggestion.

I'm guessing you've made something that concatenates files in python :) . IMHO it's a much better solution than the C Pre-Processor route.

You can also use python to template the nml ;) viewtopic.php?f=68&t=58390
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 4 guests