-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
84 lines (67 loc) · 3.25 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
cmake_minimum_required(VERSION 3.12)
if (WIN32)
if( EXISTS $ENV{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake )
message(STATUS "Found $ENV{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake; using it!")
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake
CACHE STRING "Vcpkg toolchain file")
endif()
endif(WIN32)
set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project("texgui")
if (BUILD_STATIC_LIBS)
add_library(texgui STATIC)
endif()
if (BUILD_SHARED_LIBS)
add_library(texgui SHARED)
endif()
find_package(OpenGL REQUIRED)
find_package(glfw3 CONFIG REQUIRED)
find_package(Freetype REQUIRED)
#find_package(msdfgen REQUIRED)
add_subdirectory(msdf-atlas-gen)
set(MSDF_ATLAS_NO_ARTERY_FONT=ON)
set(MSDF_ATLAS_USE_SKIA=OFF)
set(MSDF_ATLAS_USE_VCPKG=OFF)
set(MSDF_ATLAS_MSDFGEN_EXTERNAL=ON)
foreach(TARGET texgui)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "${PROJECT}")
add_dependencies(${TARGET} msdf-atlas-gen)
target_link_libraries(${TARGET} PRIVATE OpenGL::GL)
target_link_libraries(${TARGET} PRIVATE glfw)
target_link_libraries(${TARGET} PRIVATE Freetype::Freetype)
target_link_libraries(${TARGET} PRIVATE ${CMAKE_BINARY_DIR}/msdf-atlas-gen/libmsdf-atlas-gen.a)
target_link_libraries(${TARGET} PRIVATE ${CMAKE_BINARY_DIR}/msdf-atlas-gen/msdfgen/libmsdfgen-core.a)
target_link_libraries(${TARGET} PRIVATE ${CMAKE_BINARY_DIR}/msdf-atlas-gen/msdfgen/libmsdfgen-ext.a)
target_include_directories(${TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(${TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/")
target_include_directories(${TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/resources/")
target_include_directories(${TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/msdf-atlas-gen")
target_include_directories(${TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/msdf-atlas-gen/msdfgen")
endforeach(TARGET)
if (BUILD_EXAMPLE)
add_executable(example1)
list(APPEND Examples example1)
add_custom_target(resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/resources ${CMAKE_CURRENT_BINARY_DIR}/resources
)
foreach(X IN LISTS Examples)
add_dependencies(${X} texgui)
add_dependencies(${X} resources)
add_dependencies(${X} msdf-atlas-gen)
target_link_libraries(${X} PRIVATE glfw)
target_link_libraries(${X} PRIVATE OpenGL::GL)
target_link_libraries(${X} PRIVATE ${CMAKE_BINARY_DIR}/libtexgui.a)
target_link_libraries(${X} PRIVATE ${CMAKE_BINARY_DIR}/msdf-atlas-gen/libmsdf-atlas-gen.a)
target_link_libraries(${X} PRIVATE ${CMAKE_BINARY_DIR}/msdf-atlas-gen/libmsdf-atlas-gen.a)
target_link_libraries(${X} PRIVATE ${CMAKE_BINARY_DIR}/msdf-atlas-gen/msdfgen/libmsdfgen-core.a)
target_link_libraries(${X} PRIVATE ${CMAKE_BINARY_DIR}/msdf-atlas-gen/msdfgen/libmsdfgen-ext.a)
target_link_libraries(${X} PRIVATE Freetype::Freetype)
target_include_directories(${X} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(${X} PRIVATE "include/")
endforeach()
add_subdirectory(examples)
endif()
add_subdirectory(src)
add_subdirectory(include/src)