Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some problems #1

Closed
Aloshi opened this issue Aug 7, 2013 · 4 comments
Closed

Some problems #1

Aloshi opened this issue Aug 7, 2013 · 4 comments
Assignees

Comments

@Aloshi
Copy link

Aloshi commented Aug 7, 2013

Working on getting this to work for ES. Here's a few problems I've run into.

I'm invoking res2h with res2h ./resources ./converted -s -h Resources.h -u ResourceUtil.cpp

  1. Output .cpp files are #including the header incorrectly. I see #include "Resources.h" when it should be #include "../Resources.h" (or just don't include the header...as far as I can tell it's not necessary, at least for my uses)
  2. The output header is missing #include <string>, #include <vector> and #include <map>.
  3. The initializers in the utilities file don't work on VS2010. This isn't res2h's fault, but a work-around to support VS2010 would be nice...maybe just use an array instead of a vector, maybe initialize the vector with an array.
  4. For some reason all my .cpp array sizes seem to be off by one (too small for all the values).
@HorstBaerbel
Copy link
Owner

Thanks for the bug report.

    1. and 2. should hopefully be fixed. How the has_... functions of boost path iterators work (and when and then again why not) is a bit beyond me.
    1. I should have probably noticed... :/
  • I'll see what I can do about 4. Initializer lists should work in C++11, but I'll see how I can work around it. I didn't test that very well too, shame on me :/

@ghost ghost assigned HorstBaerbel Aug 7, 2013
HorstBaerbel pushed a commit that referenced this issue Aug 7, 2013
Update description too. This has a bit of memory overhead, but should
work everywhere. Hooray for C++11 initializer lists.
@HorstBaerbel
Copy link
Owner

It tried making the map (imo the important part) work. The vector is now a regular C array. Works too... Update to head and try it out.
Including the common header in the output .cpp files should be necessary to not get linker errors...

@Aloshi
Copy link
Author

Aloshi commented Aug 7, 2013

Awesome, got it working just fine with ES's ResourceManager. Worked perfectly, no modifications to the output files necessary!

It'd be nice to set up CMake to automatically include every .cpp file in the data/converted folder instead of manually adding them (and even better, put all the resources in a different folder/filter in Visual Studio), but I don't know enough about CMake to do it. But that's not a res2h problem. :)

@Aloshi Aloshi closed this as completed Aug 7, 2013
@HorstBaerbel
Copy link
Owner

To automatically include the files, try:

file(GLOB RESOURCE_FILES
    resources/*.h
    resources/*.cpp
)

LIST(APPEND TARGET_SOURCES
    ${RESOURCE_FILES}
)

After defining the targets header and source files (in TARGET_SOURCES).

You can build a VS filter "FILTER_NAME" for the folder "FOLDER_NAME" with the source_group CMake command and some regular expression magic:

source_group("<FILTER_NAME>" REGULAR_EXPRESSION <FOLDER_NAME>\\/.*)

What does NOT work (and is a bug imo) is to put all other files into a main filter (so the "header files" and "source files" filters go away). I tried lots of stuff, e.g.

source_group("main" REGULAR_EXPRESSION ^[^\\/]*$)

But why that does not work is beyond me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants