*/}}
1
0

CMakeLists.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. cmake_minimum_required(VERSION 3.1)
  2. project (lagui)
  3. if (POLICY CMP0072)
  4. set(OpenGL_GL_PREFERENCE GLVND)
  5. endif()
  6. SET(LAGUI_FONT_CUSTOM_PATH $ENV{HOME}/.local/share/fonts/lagui CACHE STRING "Where to install lagui fonts")
  7. if (NOT DEFINED ${LAGUI_FONT_CUSTOM_PATH})
  8. set(LAGUI_FONT_CUSTOM_PATH $ENV{HOME}/.local/share/fonts/lagui)
  9. endif()
  10. find_package(OpenGL REQUIRED)
  11. find_package(X11 REQUIRED)
  12. find_package(Freetype REQUIRED)
  13. find_package(GLEW REQUIRED)
  14. add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
  15. add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
  16. file(GLOB SOURCE_FILES
  17. ./*.c ./*.cpp ./resources/*.c ./resources/*.cpp)
  18. file(GLOB HEADER_FILES
  19. ./*.h ./*.hpp ./resources/*.h ./resources/*.hpp)
  20. add_definitions(-DLAGUI_FONT_CUSTOM_PATH=\"${LAGUI_FONT_CUSTOM_PATH}\")
  21. add_definitions(-w)
  22. include_directories(
  23. ${CMAKE_SOURCE_DIR}
  24. ${X11_INCLUDE_DIR}
  25. ${GLEW_INCLUDE_PATH}
  26. ${GLM_INCLUDE_PATH}
  27. ${FREETYPE_INCLUDE_DIRS}
  28. lagui
  29. )
  30. if(WIN32)
  31. list(APPEND SOURCE_FILES ./wintab/wintab_utils.c)
  32. file(GLOB wintabfiles ./wintab/*.h )
  33. list(APPEND HEADER_FILES ${wintabfiles})
  34. include_directories(wintab)
  35. endif()
  36. set(LAGUI_FONTS
  37. "fonts/NotoEmoji-Regular.ttf"
  38. "fonts/NotoSansCJK-Regular.ttc"
  39. "fonts/NotoSansMono-Regular.ttf"
  40. "fonts/NotoSansSymbols-Regular.ttf"
  41. "fonts/NotoSansSymbols2-Regular.ttf"
  42. )
  43. add_library(lagui ${HEADER_FILES} ${SOURCE_FILES})
  44. execute_process(
  45. COMMAND git rev-parse --abbrev-ref HEAD
  46. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  47. OUTPUT_VARIABLE LAGUI_GIT_BRANCH
  48. OUTPUT_STRIP_TRAILING_WHITESPACE)
  49. execute_process(
  50. COMMAND git rev-parse --short=12 HEAD
  51. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  52. OUTPUT_VARIABLE LAGUI_GIT_HASH
  53. OUTPUT_STRIP_TRAILING_WHITESPACE)
  54. target_compile_definitions(lagui PRIVATE "-DLAGUI_GIT_BRANCH=\"${LAGUI_GIT_BRANCH}\"")
  55. target_compile_definitions(lagui PRIVATE "-DLAGUI_GIT_HASH=\"${LAGUI_GIT_HASH}\"")
  56. install(FILES ${HEADER_FILES} DESTINATION include/lagui)
  57. install(TARGETS lagui EXPORT lagui-targets DESTINATION lib/lagui)
  58. install(EXPORT lagui-targets DESTINATION lib/lagui)
  59. install(FILES lagui-config.cmake DESTINATION lib/lagui)
  60. install(FILES ${LAGUI_FONTS} DESTINATION ${LAGUI_FONT_CUSTOM_PATH})