Open tonitch opened 3 months ago
line 35 should be #include <SDL2/SDL_vulkan.h>
Both should work, but since we're using <SDL2/SDL.h> in the line above, and also use <SDL2/SDL_vulkan.h> in wiGraphicsDevice_Vulkan.cpp, I think that's a good change (you should also update imgui_impl_sdl.cpp)
I don't like cmake that much but I tried to compile the linux_template and got the same error.
How did you compile the linux_template? I compiled it around 2 days ago in an arch chroot and it worked out of the box.
$ git clone git@github.com:turanszkij/WickedEngine
$ cd WickedEngine/Template_Linux
$ cmake -S . -B build
$ cmake --build build -j 12
[ 50%] Building CXX object CMakeFiles/Template_Linux.dir/main.cpp.o
In file included from /home/tonitch/WickedEngine/Template_Linux/main.cpp:1:
/home/tonitch/WickedEngine/Template_Linux/stdafx.h:2:10: fatal error: WickedEngine.h: No such file or directory
2 | #include "WickedEngine.h"
| ^~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/Template_Linux.dir/build.make:76: CMakeFiles/Template_Linux.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/Template_Linux.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
as I installed wickedengine on my system using the aur I made myself so error is expected
I put #include "WickedEngine/WickedEngine.h"
in stdafx.h
$ cmake --build build -j 12 ±[●][master]
[ 50%] Building CXX object CMakeFiles/Template_Linux.dir/main.cpp.o
In file included from /usr/include/WickedEngine/wiApplication.h:3,
from /usr/include/WickedEngine/WickedEngine.h:13,
from /home/tonitch/WickedEngine/Template_Linux/stdafx.h:2,
from /home/tonitch/WickedEngine/Template_Linux/main.cpp:1:
/usr/include/WickedEngine/wiPlatform.h: In function ‘void wi::platform::GetWindowProperties(window_type, WindowProperties*)’:
/usr/include/WickedEngine/wiPlatform.h:87:17: error: ‘SDL_GetWindowSize’ was not declared in this scope
87 | SDL_GetWindowSize(window, &window_width, &window_height);
| ^~~~~~~~~~~~~~~~~
/usr/include/WickedEngine/wiPlatform.h:88:17: error: ‘SDL_Vulkan_GetDrawableSize’ was not declared in this scope
88 | SDL_Vulkan_GetDrawableSize(window, &dest->width, &dest->height);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tonitch/WickedEngine/Template_Linux/main.cpp: In function ‘int main(int, char**)’:
/home/tonitch/WickedEngine/Template_Linux/main.cpp:55:5: error: ‘sdl2’ has not been declared
55 | sdl2::sdlsystem_ptr_t system = sdl2::make_sdlsystem(SDL_INIT_EVERYTHING | SDL_INIT_EVENTS);
| ^~~~
/home/tonitch/WickedEngine/Template_Linux/main.cpp:56:5: error: ‘sdl2’ has not been declared
56 | sdl2::window_ptr_t window = sdl2::make_window(
| ^~~~
/home/tonitch/WickedEngine/Template_Linux/main.cpp:64:27: error: ‘window’ was not declared in this scope
64 | application.SetWindow(window.get());
| ^~~~~~
make[2]: *** [CMakeFiles/Template_Linux.dir/build.make:76: CMakeFiles/Template_Linux.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/Template_Linux.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
System
Archlinux x64
Problem
SDL2 is not defined by default. https://github.com/turanszkij/WickedEngine/blob/99c1d782115bea4ab1b87d7ea044bbbf4224e1f1/WickedEngine/wiPlatform.h#L33-L37 SDL2 is then never included and compilation is not possible
step to reproduce
With the simpliest program and compilation:
I don't like cmake that much but I tried to compile the linux_template and got the same error.
Solution
I think Line 33 should be checking PLATFORM_LINUX or SDL2 Should be set before hand on linux plateform.
Workaround and problem #2
I compile using
$ g++ main.cpp -DSDL2
and gotSolution
line 35 should be
#include <SDL2/SDL_vulkan.h>
Conclusion
I could make a pr about that but I just discovered the project and I would like your input on that. maybe I'm just missing something but this feels like a tiny bug more than anything to me ^^