• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2link_libraries(glfw)
3
4if (BUILD_SHARED_LIBS)
5    link_libraries("${MATH_LIBRARY}")
6endif()
7
8if (MSVC)
9    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
10endif()
11
12include_directories("${GLFW_SOURCE_DIR}/deps")
13
14set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h"
15         "${GLFW_SOURCE_DIR}/deps/glad.c")
16set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
17           "${GLFW_SOURCE_DIR}/deps/getopt.c")
18set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
19                "${GLFW_SOURCE_DIR}/deps/tinycthread.c")
20
21add_executable(clipboard clipboard.c ${GETOPT} ${GLAD})
22add_executable(events events.c ${GETOPT} ${GLAD})
23add_executable(msaa msaa.c ${GETOPT} ${GLAD})
24add_executable(gamma gamma.c ${GETOPT} ${GLAD})
25add_executable(glfwinfo glfwinfo.c ${GETOPT} ${GLAD})
26add_executable(iconify iconify.c ${GETOPT} ${GLAD})
27add_executable(joysticks joysticks.c ${GLAD})
28add_executable(monitors monitors.c ${GETOPT} ${GLAD})
29add_executable(reopen reopen.c ${GLAD})
30add_executable(cursor cursor.c ${GLAD})
31
32add_executable(empty WIN32 MACOSX_BUNDLE empty.c ${TINYCTHREAD} ${GLAD})
33add_executable(icon WIN32 MACOSX_BUNDLE icon.c ${GLAD})
34add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${GLAD})
35add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GETOPT} ${GLAD})
36add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD})
37add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD})
38add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD})
39add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GETOPT} ${GLAD})
40
41target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")
42target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")
43
44set(WINDOWS_BINARIES empty icon sharing tearing threads timeout title windows)
45set(CONSOLE_BINARIES clipboard events msaa gamma glfwinfo
46                     iconify joysticks monitors reopen cursor)
47
48if (VULKAN_FOUND)
49    add_executable(vulkan WIN32 vulkan.c ${ICON})
50    target_include_directories(vulkan PRIVATE "${VULKAN_INCLUDE_DIR}")
51    if (NOT GLFW_VULKAN_STATIC)
52        target_link_libraries(vulkan "${VULKAN_LIBRARY}")
53    endif()
54    list(APPEND WINDOWS_BINARIES vulkan)
55endif()
56
57set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
58                      FOLDER "GLFW3/Tests")
59
60if (MSVC)
61    # Tell MSVC to use main instead of WinMain for Windows subsystem executables
62    set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
63                          LINK_FLAGS "/ENTRY:mainCRTStartup")
64endif()
65
66if (APPLE)
67    set_target_properties(empty PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Empty Event")
68    set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing")
69    set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing")
70    set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads")
71    set_target_properties(timeout PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Timeout")
72    set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title")
73    set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows")
74
75    set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
76                          MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
77                          MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL}
78                          MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in")
79endif()
80
81