Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [DFHack] [plugin compiling] Not too sure how to start  (Read 3038 times)

jeancallisti

  • Bay Watcher
    • View Profile
[DFHack] [plugin compiling] Not too sure how to start
« on: November 04, 2013, 07:48:51 am »

Hi everyone!

I've followed the great tutorial explaining how to compile DFHack on Windows (I have Vista 32-bits. Yes I know, nobody's perfect) : https://github.com/peterix/dfhack/blob/0.34.11-r2/Compile.rst#windows

It all worked smoothly and I want to bless DFHack's developers for having made the compiling process so automated and intuitive!

Now I'm running into a small issue: I want to create a plugin similar in structure to "dfstream" (i.e. using renderer.h). I know that "renderer.h" is generated from an XML file, and, if I understood properly, the headers get embedded directly into the .lib files, so I don't need to worry if I don't see the actual header file.

However, I don't see "dfstream" itself in the Visual C++ 2010 solution. Yet I've seen it in the git repo. Is it because it's only experimental?  I've generated the project files using the batch "all" (not "minimal"), to make sure absolutely every subproject would be generated. And I've built in "RelWithDebInfo" (not that it matters here, just mentionning it). I would have expected all plugins to be included in the project files?

I've read the tutorial section "Using the library as a developer" and it's much more synthetic than previous sections -- Maybe as a workaround I should just duplicate and rename any other plugin project set of files, add it to the solution, and then copy and paste into it the code from "dfstream". I'll have nice, ready-to-use plugin of my own. Am I missing a step?
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: [DFHack] [plugin compiling] Not too sure how to start
« Reply #1 on: November 04, 2013, 08:04:28 am »

<...>
However, I don't see "dfstream" itself in the Visual C++ 2010 solution. Yet I've seen it in the git repo. Is it because it's only experimental?  I've generated the project files using the batch "all" (not "minimal"), to make sure absolutely every subproject would be generated. And I've built in "RelWithDebInfo" (not that it matters here, just mentionning it). I would have expected all plugins to be included in the project files?
<...>

It's afaik is commented out in: https://github.com/peterix/dfhack/blob/master/plugins/CMakeLists.txt#L148

jeancallisti

  • Bay Watcher
    • View Profile
Re: [DFHack] [plugin compiling] Not too sure how to start
« Reply #2 on: November 04, 2013, 09:51:11 am »

dfstream is commented out

Anybody knows why? Is it because it's unfinished, or is it because it has an obvious flaw in its structure?
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: [DFHack] [plugin compiling] Not too sure how to start
« Reply #3 on: November 04, 2013, 10:01:34 am »

I think because it's useless without client and/or is unfinished. Now it was replaced by dfterm2 (afaik using same idea).

jeancallisti

  • Bay Watcher
    • View Profile
Re: [DFHack] [plugin compiling] Not too sure how to start
« Reply #4 on: November 04, 2013, 11:56:53 am »

it was replaced by dfterm2

In that thread Quietus said dfterm3 (not dfterm2) has an awkward time management. It would be sort-of asynchronous.
I don't really know what to think, I'll have a closer look at the design. (if you have more elements aboutr that topic, please answer in that thread, not this one).

Two more questions :

1. There are several build scripts such as : "build", "install", "package". Is there a way to run those directly from within Visual C++ (especially "install-debug.bat", so that building the plugin installs it instantly and allows testing)? Considering how much attention the DFHack team paid to details, it's probably already in there somewhere. I've tried setting "INSTALL" as the "start project", but generating the solution doesn't seem to run the install script, like when I run manually "install-debug.bat".

2. What are the exact steps to create a brand new plugin? My guess :
     i. Edit plugins\CMakeLists.txt (that's the main one) and add the plugin's source file/libraries/protobufs in there, following the syntax
     ii. Run the build scripts. But does that also create the vcproj file and add it to the solution?
« Last Edit: November 04, 2013, 12:28:40 pm by jeancallisti »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: [DFHack] [plugin compiling] Not too sure how to start
« Reply #5 on: November 04, 2013, 01:19:41 pm »

I think because it's useless without client and/or is unfinished.
It is indeed useless without its client, and it was mainly a proof of concept which isn't intended to be used by players in general.

In that thread Quietus said dfterm3 (not dfterm2) has an awkward time management. It would be sort-of asynchronous.
I don't really know what to think, I'll have a closer look at the design. (if you have more elements aboutr that topic, please answer in that thread, not this one).
1. The time management issue is merely how I was reading the code - it's possible that something else I didn't see is providing proper synchronization.
2. You misspelled my name - it's "Quietust", not "Quietus".

1. There are several build scripts such as : "build", "install", "package". Is there a way to run those directly from within Visual C++ (especially "install-debug.bat", so that building the plugin installs it instantly and allows testing)? Considering how much attention the DFHack team paid to details, it's probably already in there somewhere. I've tried setting "INSTALL" as the "start project", but generating the solution doesn't seem to run the install script, like when I run manually "install-debug.bat".
If you select the "INSTALL" project and explicitly build it, it will install everything. Do be aware, though, that if DF is currently running, this install process will fail because all of the files will be in use.

2. What are the exact steps to create a brand new plugin? My guess :
     i. Edit plugins\CMakeLists.txt (that's the main one) and add the plugin's source file/libraries/protobufs in there, following the syntax
     ii. Run the build scripts. But does that also create the vcproj file and add it to the solution?
That is the correct process - running CMake will produce all of the project files, and building those project files will get you the plugins.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

jeancallisti

  • Bay Watcher
    • View Profile
Re: [DFHack] [plugin compiling] Not too sure how to start
« Reply #6 on: November 04, 2013, 01:55:13 pm »

1. The time management issue is merely how I was reading the code
OK, I'll look closely as soon as I manage to have a proper work environment.

2. You misspelled my name - it's "Quietust", not "Quietus".
Woops, sorry  :o


If you select the "INSTALL" project and explicitly build it, it will install everything.
Alright, indeed it needs to be explicitly done (right-click on INSTALL --> Generate). Making it the main project and generating the solution is not enough. Thanks!

Overall, thanks for everything! You guys are a great community.
« Last Edit: November 05, 2013, 05:10:20 am by jeancallisti »
Logged