Coder Social home page Coder Social logo

sdl-cmake-workflowtest's Introduction

SDL2 on Windows through CMake

People think this is easy, just throw SDL2 on the C:\ root, install CMake if you really need it, and generate a VS project. But the problem is that it's not that easy because you end up with something that's a) not as elegant as what you'd normally find on other platforms and b) a big mess that's hard to clean up. Remember, Windows was built for the user, not the developer. Proper workspaces should be easy to set up and clean up, which is why I've invested some time to make a workflow that is cross-platform and keeps external dependencies to an absolute minimum.

To begin, you should download the SDL includes and libraries and place them in SDL/. In lib you will find x86 and x64 so choose one (it'll be x86 unless you are specifically compiling a 64-bit executable) and bring the contents of that folder up one level (so you'll have SDL/lib/SDL2.lib instead of SDL/lib/x86/SDL2.lib). You can leave the include folder alone.

Once you have that dependency taken care of, you should invoke cmake in a new folder to separate our source code from our generated project files. We can do this very simply:

> mkdir build
> cd build
> cmake ..

Text will fly and cmake might yell at you for not having pthreads. Threads are not a required dependency, but it gave me compiler errors anyway and held up the project generation. If you encounter this problem, I've found installing TDM-GCC-64 seems to fix the problem somehow. (Must be a coincidence, but I'll document it anyway.)

After that, just open up your Visual Studio project and hack away!

sdl-cmake-workflowtest's People

Contributors

oldmud0 avatar

Stargazers

Fireflash avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.