As the repo name says, this is a simple framework of SDL with using conan and cmake. The purpose of this repo is to make it easier to setup a SDL environment.
- conan (Simply execute
pip install conan
if you havepip
)- conan is a module of python, so you have to install python first.
- cmake
- Build Tools, e.g.,
Visual Studio
,g++
and etc.
python /path/to/sdl-cli.py -p new_proj /path/to/output_dir
"new_proj" may be replaced by your project name.
"/path/to/output_dir" may be replaced by another proper path.
Besides, you can use -e
to specify the entrypoint name (default: 'entrypoint'
) and -std
to specify the standard of C++ (default: 'c++14'
).
cd
to the generated project's directory, and
mkdir build && cd build
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
conan install ..
cmake ..
In some circumstances, you may modify the commands above.
- On Windows
- It is recommended to use Visual Studio to build this project, because conan may find pre-built package for Visual Studio (but not for MinGW). If you use Visual Studio, you can:
conan install -s compiler="Visual Studio" -s compiler.version=15 ..
- This specifys the compiler to be Visual Studio. Depending on your Visual Studio version, you may modify
compiler.version
. If you use Visual Studio 2017 then the version is15
, or if you use VS 2015, the version is14
. (These seem like the version of Visual C++ ...)
- If you find that
cmake
generated a x86 solution, but you want to generate a x64 solution, you can delete the build directory and repeat the commands above, except changingcmake ..
tocmake -G "Visual Studio 15 2017 Win64" ..
- It is recommended to use Visual Studio to build this project, because conan may find pre-built package for Visual Studio (but not for MinGW). If you use Visual Studio, you can:
conan install ..
may take a few minutes.
After cmake
:
- On Windows, you may use
MSBuild
to build the project inbuild/
or just directly openSDL_CONAN_CMAKE.sln
with Visual Studio and build. - On Linux / MacOS, you may use
make
to build.
hello.cpp
is a simple test to make sure that you can now use SDL and also SDL_image. It shows the SDL logo for about 3 seconds. If the window just flashes and disappears, don't panic! It's probably that it didn't find the fileSDL_logo.png
. Copy it to your working directory (where you run the built project) and it can work.
Maybe you can start your project now... Enjoy.