2
0

CMake+MinGW.txt 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. 0. Start from readme.txt
  2. 1. How to build and run Oxygine on Windows with CMake and MINGW with CodeBlocks or CLion. Steps:
  3. =================================================================================================
  4. - Prepare SDL2 for building:
  5. - open SDL\src\dynapi\SDL_dynapi.h and find these lines:
  6. #ifdef SDL_DYNAMIC_API /* Tried to force it on the command line? */
  7. #error Nope, you have to edit this file to force this off.
  8. #endif
  9. - add lines below:
  10. #if __MINGW32__
  11. #define SDL_DYNAMIC_API 0
  12. #endif
  13. - result:
  14. #ifdef SDL_DYNAMIC_API /* Tried to force it on the command line? */
  15. #error Nope, you have to edit this file to force this off.
  16. #endif
  17. #if __MINGW32__
  18. #define SDL_DYNAMIC_API 0
  19. #endif
  20. - Build SDL2. Add these options to CMake command line:
  21. -DRENDER_D3D=0 -DVIDEO_OPENGLES=0
  22. example for codeblocks:
  23. cmake .. -G"CodeBlocks - MinGW Makefiles" -DRENDER_D3D=0 -DVIDEO_OPENGLES=0
  24. example for CLion:
  25. - open SDL2 cmake project
  26. - go to menu->File->Settings->Build,Execution,Deployment->
  27. - and add -DRENDER_D3D=0 -DVIDEO_OPENGLES=0 to CMake options
  28. - build...
  29. - Find compiled libraries and dlls: libSDL2.dll, libSDL2.dll.a, libSDL2.a, libSDL2main.a
  30. and copy it to oxygine-framework\libs
  31. 2. now you are ready to open and build examples.
  32. =================================================================================================
  33. - select any example from examples folder. I chose Demo
  34. - copy libSDL2.dll and dlls from oxygine-framework\oxygine\third_party\win32_mingw\dlls\ to data folder :
  35. oxygine-framework\examples\Demo\data\
  36. CLion:
  37. - open Demo project in CLion: oxygine-framework/examples/Demo/proj.cmake/CMakeLists.txt
  38. - go to menu->Run->Edit Configurations
  39. - find Demo in the list of Apllications and set working directory to Demo "data" folder (where you copied dlls)
  40. - menu->Run->Build and Run Demo application
  41. CodeBlocks:
  42. - go to folder oxygine-framework/examples/Demo/proj.cmake/
  43. - create "build" folder inside
  44. - go to "build" folder:
  45. - run command:
  46. cmake .. -G"CodeBlocks - MinGW Makefiles"
  47. - open generated project Demo.cbp in CodeBlocks
  48. - menu->Build->select target->Demo
  49. - menu->Project->Properties->Build targets-> find target "Demo" and set Execution directory to Demo "data" folder (where you copied dlls)
  50. - menu->Build->Build
  51. - menu->Build->Run!