simple shader program for testing purposes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.3KB

  1. cmake_minimum_required(VERSION 2.4)
  2. if(COMMAND cmake_policy)
  3. cmake_policy(SET CMP0003 NEW)
  4. endif()
  5. set(PROJ_NAME fxt)
  6. set(SRC .)
  7. project(${PROJ_NAME})
  8. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR})
  9. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake")
  10. find_package(SDL2 REQUIRED)
  11. find_package(OpenGL REQUIRED)
  12. if(CMAKE_C_COMPILER_ID STREQUAL MSVC)
  13. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT /Oy /Oi /W3 /FAcs /GF /fp:fast /wd4996 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS")
  14. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT /Oy /Oi /W3 /FAcs /GF /fp:fast /wd4996 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS")
  15. add_definitions(-DHAVE_FAST_MATH)
  16. endif()
  17. if(CMAKE_C_COMPILER_ID STREQUAL GNU OR CMAKE_C_COMPILER_ID STREQUAL Clang)
  18. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
  19. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
  20. set(MATHLIB m)
  21. endif()
  22. if(MINGW)
  23. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
  24. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libstdc++ -static-libgcc")
  25. endif()
  26. include_directories(
  27. ${SRC}
  28. ${SDL2_INCLUDE_DIRS}
  29. ${OPENGL_INCLUDE_DIR}
  30. )
  31. add_executable(${PROJ_NAME} WIN32
  32. ${SRC}/main.c
  33. ${SRC}/gl_2_1.c
  34. )
  35. target_link_libraries(${PROJ_NAME}
  36. ${SDL2_LIBRARIES}
  37. ${MATHLIB}
  38. ${OPENGL_LIBRARIES}
  39. )