• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2link_libraries(glfw)
3
4include_directories(${glfw_INCLUDE_DIRS})
5
6if (BUILD_SHARED_LIBS)
7    link_libraries("${MATH_LIBRARY}")
8endif()
9
10if (MSVC)
11    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
12endif()
13
14include_directories("${GLFW_SOURCE_DIR}/deps")
15
16if (WIN32)
17    set(ICON glfw.rc)
18elseif (APPLE)
19    set(ICON glfw.icns)
20    set_source_files_properties(glfw.icns PROPERTIES
21        MAXOSX_PACKAGE_LOCATION "Resources")
22endif()
23
24set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h"
25         "${GLFW_SOURCE_DIR}/deps/glad.c")
26set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
27           "${GLFW_SOURCE_DIR}/deps/getopt.c")
28set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
29                "${GLFW_SOURCE_DIR}/deps/tinycthread.c")
30
31add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD})
32add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD})
33add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD})
34add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD})
35add_executable(simple WIN32 MACOSX_BUNDLE simple.c ${ICON} ${GLAD})
36add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD})
37add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD})
38
39target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")
40
41set(WINDOWS_BINARIES boing gears heightmap particles simple splitview wave)
42
43set_target_properties(${WINDOWS_BINARIES} PROPERTIES FOLDER "GLFW3/Examples")
44
45if (MSVC)
46    # Tell MSVC to use main instead of WinMain for Windows subsystem executables
47    set_target_properties(${WINDOWS_BINARIES} PROPERTIES
48                          LINK_FLAGS "/ENTRY:mainCRTStartup")
49endif()
50
51if (APPLE)
52    set_target_properties(boing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Boing")
53    set_target_properties(gears PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gears")
54    set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap")
55    set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles")
56    set_target_properties(simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple")
57    set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView")
58    set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")
59
60    set_target_properties(${WINDOWS_BINARIES} PROPERTIES
61                          RESOURCE glfw.icns
62                          MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION}
63                          MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL}
64                          MACOSX_BUNDLE_ICON_FILE glfw.icns
65                          MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in")
66endif()
67
68