![]() This page is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License. Buildingįollowing the standard cmake procedure: mkdir build InputCommon::SDL::SDLState later tries to initialize the game. ![]() Target_link_libraries (MyProject SDL2::Main SDL2::Net SDL2::Mixer SDL2::Image SDL2::TTF SDL2::GFX)Īnd thats it! Now you can remove the SDL2 components you don't want to use. I ended up with Citra Nightly 1784 and I find with my Windows 10 64 bit Ryzen 5 3500X. Or you can use this simple command: cd cmake vcvars64.bat This sets necessary environment variables for running the cl.exe compiler. If you are on Linux and only need SDL2 you don't even need the FindSDL2. Using these Find modules will also work on Windows. They can be based of the ones that work for SDL 1.2 which are included in CMake already. You can find the cmake files to find SDL2 and it's components here. Basically you need a FindSDL2.cmake and FindSDL2image.cmake module. Make sure you create your main () function like so: int main (int argc, char argv ) If you want explanations. Here is a common directory structure when using cmake to find packages: cmake FindSDL2.cmake FindSDL2mixer.cmake FindSDL2net.cmake CMakeLists.txt src main.cpp. You can find the cmake files to find SDL2 and it's components here How to build SDL applications on Windows build.bat will get you started compiling an SDL application with Visual C++. Here is a common directory structure when using cmake to find packages: ├── cmake I know that there is another way around using findfile which is easy. To practice, I am trying to link SDL2 manually. Maintained by the Microsoft C++ team and open source contributors. sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev libsdl2-gfx-dev How to link SDL2 manually in CMake Ask Question Asked 3 years, 2 months ago Modified 3 years, 2 months ago Viewed 1k times 1 Recently I have started to learn CMake. in a single step or add your own private libraries to simplify your build process. I only know about the debian based ones, if you are on another distro you should look them up. Most common distributions have cmake available on their package manager repostories: # Debian based
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |