*/}}

CMakeLists.txt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. cmake_minimum_required(VERSION 3.1)
  2. project (lagui)
  3. if (POLICY CMP0072)
  4. set(OpenGL_GL_PREFERENCE GLVND)
  5. endif()
  6. find_package(OpenGL REQUIRED)
  7. find_package(X11 REQUIRED)
  8. find_package(Freetype REQUIRED)
  9. find_package(GLEW REQUIRED)
  10. file(GLOB_RECURSE SOURCE_FILES
  11. ./*.c ./*.cpp ./resources/*.c ./resources/*.cpp)
  12. file(GLOB_RECURSE HEADER_FILES
  13. ./*.h ./*.hpp ./resources/*.h ./resources/*.hpp)
  14. add_definitions(-w)
  15. include_directories(
  16. ${CMAKE_SOURCE_DIR}
  17. ${X11_INCLUDE_DIR}
  18. ${GLEW_INCLUDE_PATH}
  19. ${GLM_INCLUDE_PATH}
  20. ${FREETYPE_INCLUDE_DIRS}
  21. lagui
  22. )
  23. set(LAGUI_FONTS
  24. "fonts/NotoEmoji-Regular.ttf"
  25. "fonts/NotoSansCJK-Regular.ttc"
  26. "fonts/NotoSansMono-Regular.ttf"
  27. "fonts/NotoSansSymbols-Regular.ttf"
  28. "fonts/NotoSansSymbols2-Regular.ttf"
  29. )
  30. add_library(lagui ${HEADER_FILES} ${SOURCE_FILES})
  31. execute_process(
  32. COMMAND git rev-parse --abbrev-ref HEAD
  33. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  34. OUTPUT_VARIABLE LAGUI_GIT_BRANCH
  35. OUTPUT_STRIP_TRAILING_WHITESPACE)
  36. execute_process(
  37. COMMAND git rev-parse --short=12 HEAD
  38. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  39. OUTPUT_VARIABLE LAGUI_GIT_HASH
  40. OUTPUT_STRIP_TRAILING_WHITESPACE)
  41. target_compile_definitions(lagui PRIVATE "-DLAGUI_GIT_BRANCH=\"${LAGUI_GIT_BRANCH}\"")
  42. target_compile_definitions(lagui PRIVATE "-DLAGUI_GIT_HASH=\"${LAGUI_GIT_HASH}\"")
  43. install(FILES ${HEADER_FILES} DESTINATION include/lagui)
  44. install(TARGETS lagui EXPORT lagui-targets DESTINATION lib/lagui)
  45. install(EXPORT lagui-targets DESTINATION lib/lagui)
  46. install(FILES lagui-config.cmake DESTINATION lib/lagui)
  47. install(FILES ${LAGUI_FONTS} DESTINATION $ENV{HOME}/.local/share/fonts/lagui)