TrenchBroom / TrenchBroom

Cross-Platform Level Editor
kristianduske.com/trenchbroom
GNU General Public License v3.0
1.88k stars 224 forks source link

cmake can't properly find wxgtk include path #1441

Closed tapir closed 5 years ago

tapir commented 7 years ago

I'm tyring to create a pacman package from release/v2.0.0 branch.

In arch linux the wxgtk include files are in /usr/include/wx-3.0/wx so eventhough cmake generates makefiles successfully, the build fails with gcc not finding <wx/dir.h>.

In order to test it, I created a symlink from /usr/include/wx-3.0/wx to /usr/include/wx and surely it now builds correctly.

Is there a way to set it while generating the makefiles with cmake?

ericwa commented 7 years ago

Yes, -DwxWidgets_PREFIX= when running cmake.

fyi, the distro's copy of wxWidgets won't work, because this patch is required. (It's not in the latest WX release.) (see https://github.com/kduske/TrenchBroom/issues/1367 ) So a pacman package for TB would have to build a patched copy of wxWidgets as well.

Here are the full build instructions on Linux: https://github.com/kduske/TrenchBroom/blob/release/v2.0.0/Build.txt#L58

tapir commented 7 years ago

No worries already done that https://aur.archlinux.org/packages/trenchbroom-git https://aur.archlinux.org/packages/wxgtk-trenchbroom/

tapir commented 7 years ago

Whoops... -DwxWidgets_PREFIX=/usr/include/wx-3.1 or -DwxWidgets_PREFIX=/usr/include/wx-3.1/wx does not fix the problem. Still can't find wx headers

ericwa commented 7 years ago

Ah, sorry. -DwxWidgets_PREFIX is meant to point to a directory containing bin, inculde, lib, etc., so I guess that would be /usr. I'm not sure what to do next.

tapir commented 7 years ago

OK I will create a sym link in the wxgtk-trenchbroom package

kduske commented 7 years ago

Thanks @ericwa and @tapir for providing the package.

tapir commented 5 years ago

I'm respectfully re-opening this issue because I would like to start using the wxgtk2-dev (3.1.1) package in aur repos instead of my own wxgtk-trenchbroom package.

I think the problem is somehow with the FindwxWidgetsTB.cmake and I'm really stuck with the cmake's unfriendly config files. (I assume this file is custom made for TB since it has such suffix)

On my system, with the wxgtk2-dev package installed from aur, I can successfully run wx-config --cppflags which gives the result

-I/usr/lib/wx/include/gtk2-unicode-3.1 -I/usr/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__

The include directory -I/usr/include/wx-3.1 is the correct one and yet when I run cmake it doesn't use that. I think the wxWidgets_CXX_FLAGS var comes up empty. Any ideas to track down the problem?

ericwa commented 5 years ago

@tapir It looks like when invoking cmake on TrenchBroom, you need to have the wxWidgets_PREFIX CMake variable set to the directory that contains bin/wx-config. I'm looking here: https://github.com/kduske/TrenchBroom/blob/master/cmake/Modules/FindwxWidgetsTB.cmake#L733

So if the system wx-config is in /usr/bin then it'd be cmake .. -DwxWidgets_PREFIX=/usr.

If that doesn't help, there are some debug logging macros you can try to uncomment on line 147 and 150: https://github.com/kduske/TrenchBroom/blob/master/cmake/Modules/FindwxWidgetsTB.cmake#L147

edit: what does which wx-config print?

tapir commented 5 years ago

That was it thanks. AUR package is updated to 2.0.5 and now it uses the wxgtk2-dev from AUR instead of my custom wxgtk-trenchbroom package. Hopefully wxwidgets 3.1 becomes stable soon so that no dep from AUR is left.