123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- cmake_minimum_required(VERSION 3.1)
- project (lagui)
- if (POLICY CMP0072)
- set(OpenGL_GL_PREFERENCE GLVND)
- endif()
- SET(LAGUI_FONT_CUSTOM_PATH $ENV{HOME}/.local/share/fonts/lagui CACHE STRING "Where to install lagui fonts")
- if (NOT DEFINED ${LAGUI_FONT_CUSTOM_PATH})
- set(LAGUI_FONT_CUSTOM_PATH $ENV{HOME}/.local/share/fonts/lagui)
- endif()
- find_package(OpenGL REQUIRED)
- find_package(X11 REQUIRED)
- find_package(Freetype REQUIRED)
- find_package(GLEW REQUIRED)
- file(GLOB_RECURSE SOURCE_FILES
- ./*.c ./*.cpp ./resources/*.c ./resources/*.cpp)
- file(GLOB_RECURSE HEADER_FILES
- ./*.h ./*.hpp ./resources/*.h ./resources/*.hpp)
- add_definitions(-DLAGUI_FONT_CUSTOM_PATH=\"${LAGUI_FONT_CUSTOM_PATH}\")
- add_definitions(-w)
- include_directories(
- ${CMAKE_SOURCE_DIR}
- ${X11_INCLUDE_DIR}
- ${GLEW_INCLUDE_PATH}
- ${GLM_INCLUDE_PATH}
- ${FREETYPE_INCLUDE_DIRS}
- lagui
- )
- set(LAGUI_FONTS
- "fonts/NotoEmoji-Regular.ttf"
- "fonts/NotoSansCJK-Regular.ttc"
- "fonts/NotoSansMono-Regular.ttf"
- "fonts/NotoSansSymbols-Regular.ttf"
- "fonts/NotoSansSymbols2-Regular.ttf"
- )
- add_library(lagui ${HEADER_FILES} ${SOURCE_FILES})
- execute_process(
- COMMAND git rev-parse --abbrev-ref HEAD
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_VARIABLE LAGUI_GIT_BRANCH
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- execute_process(
- COMMAND git rev-parse --short=12 HEAD
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_VARIABLE LAGUI_GIT_HASH
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- target_compile_definitions(lagui PRIVATE "-DLAGUI_GIT_BRANCH=\"${LAGUI_GIT_BRANCH}\"")
- target_compile_definitions(lagui PRIVATE "-DLAGUI_GIT_HASH=\"${LAGUI_GIT_HASH}\"")
- install(FILES ${HEADER_FILES} DESTINATION include/lagui)
- install(TARGETS lagui EXPORT lagui-targets DESTINATION lib/lagui)
- install(EXPORT lagui-targets DESTINATION lib/lagui)
- install(FILES lagui-config.cmake DESTINATION lib/lagui)
- install(FILES ${LAGUI_FONTS} DESTINATION ${LAGUI_FONT_CUSTOM_PATH})
|