OSX 10.11.3 下编译安装 GLFW-3.2

原创
2016/06/06 14:05
阅读数 1.5K

OSX 10.11.3 下编译安装 GLFW-3.2

版本说明

  • OSX 10.11.3
  • GLFW 3.2

安装过程

下载源码包

GLFW官网 下载最新的 GLFW-3.2, 解压.

编译安装

进入解压后的目录:

Air:sbcl admin$ cd ~/Downloads/glfw-3.2

新建一个 glfw-build 目录用来存放编译文件:

Air:glfw-3.2 admin$ 
Air:glfw-3.2 admin$ mkdir glfw-build
Air:glfw-3.2 admin$ cd glfw-build

然后操作如下:

Air:glfw-build admin$ cmake ../
-- The C compiler identification is AppleClang 7.3.0.7030031
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Could NOT find Vulkan (missing:  VULKAN_LIBRARY VULKAN_INCLUDE_DIR) 
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Using Cocoa for window creation
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/admin/Downloads/glfw-3.2/glfw-build
Air:glfw-build admin$ 

查看下现在目录下有些什么:

Air:glfw-build admin$ ls
CMakeCache.txt		Makefile		cmake_uninstall.cmake	src
CMakeFiles		cmake_install.cmake	examples		tests
Air:glfw-build admin$ cmake ..
-- Could NOT find Vulkan (missing:  VULKAN_LIBRARY VULKAN_INCLUDE_DIR) 
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Using Cocoa for window creation
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/admin/Downloads/glfw-3.2/glfw-build
Air:glfw-build admin$ ls
CMakeCache.txt		Makefile		cmake_uninstall.cmake	src
CMakeFiles		cmake_install.cmake	examples		tests
Air:glfw-build admin$ 

正式开始执行 make 进行编译:

Air:glfw-build admin$ make
Scanning dependencies of target glfw
[  1%] Building C object src/CMakeFiles/glfw.dir/context.c.o
[  2%] Building C object src/CMakeFiles/glfw.dir/init.c.o
[  3%] Building C object src/CMakeFiles/glfw.dir/input.c.o
[  4%] Building C object src/CMakeFiles/glfw.dir/monitor.c.o
[  5%] Building C object src/CMakeFiles/glfw.dir/vulkan.c.o
[  6%] Building C object src/CMakeFiles/glfw.dir/window.c.o
[  7%] Building C object src/CMakeFiles/glfw.dir/cocoa_init.m.o
[  8%] Building C object src/CMakeFiles/glfw.dir/cocoa_joystick.m.o
[  9%] Building C object src/CMakeFiles/glfw.dir/cocoa_monitor.m.o
/Users/admin/Downloads/glfw-3.2/src/cocoa_monitor.m:52:42: warning: 'CGDisplayIOServicePort' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
    info = IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID),
                                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:372:24: note: 
      'CGDisplayIOServicePort' has been explicitly marked deprecated here
CG_EXTERN io_service_t CGDisplayIOServicePort(CGDirectDisplayID display)
                       ^
/Users/admin/Downloads/glfw-3.2/src/cocoa_monitor.m:91:26: warning: 'CGDisplayModeCopyPixelEncoding' is deprecated: first deprecated in OS X 10.11 [-Wdeprecated-declarations]
    CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:174:34: note: 
      'CGDisplayModeCopyPixelEncoding' has been explicitly marked deprecated here
CG_EXTERN CFStringRef __nullable CGDisplayModeCopyPixelEncoding(
                                 ^
/Users/admin/Downloads/glfw-3.2/src/cocoa_monitor.m:120:26: warning: 'CGDisplayModeCopyPixelEncoding' is deprecated: first deprecated in OS X 10.11 [-Wdeprecated-declarations]
    CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:174:34: note: 
      'CGDisplayModeCopyPixelEncoding' has been explicitly marked deprecated here
CG_EXTERN CFStringRef __nullable CGDisplayModeCopyPixelEncoding(
                                 ^
3 warnings generated.
[ 10%] Building C object src/CMakeFiles/glfw.dir/cocoa_window.m.o
[ 11%] Building C object src/CMakeFiles/glfw.dir/cocoa_time.c.o
[ 12%] Building C object src/CMakeFiles/glfw.dir/posix_tls.c.o
[ 13%] Building C object src/CMakeFiles/glfw.dir/nsgl_context.m.o
[ 14%] Linking C static library libglfw3.a
[ 14%] Built target glfw
Scanning dependencies of target heightmap
[ 15%] Building C object examples/CMakeFiles/heightmap.dir/heightmap.c.o
[ 16%] Building C object examples/CMakeFiles/heightmap.dir/__/deps/glad.c.o
[ 17%] Linking C executable heightmap.app/Contents/MacOS/heightmap
Copying OS X content examples/heightmap.app/Contents/Resources/glfw.icns
[ 17%] Built target heightmap
Scanning dependencies of target simple
[ 18%] Building C object examples/CMakeFiles/simple.dir/simple.c.o
[ 19%] Building C object examples/CMakeFiles/simple.dir/__/deps/glad.c.o
[ 20%] Linking C executable simple.app/Contents/MacOS/simple
Copying OS X content examples/simple.app/Contents/Resources/glfw.icns
[ 20%] Built target simple
Scanning dependencies of target wave
[ 21%] Building C object examples/CMakeFiles/wave.dir/wave.c.o
[ 22%] Building C object examples/CMakeFiles/wave.dir/__/deps/glad.c.o
[ 23%] Linking C executable wave.app/Contents/MacOS/wave
Copying OS X content examples/wave.app/Contents/Resources/glfw.icns
[ 23%] Built target wave
Scanning dependencies of target splitview
[ 24%] Building C object examples/CMakeFiles/splitview.dir/splitview.c.o
[ 25%] Building C object examples/CMakeFiles/splitview.dir/__/deps/glad.c.o
[ 26%] Linking C executable splitview.app/Contents/MacOS/splitview
Copying OS X content examples/splitview.app/Contents/Resources/glfw.icns
[ 26%] Built target splitview
Scanning dependencies of target particles
[ 27%] Building C object examples/CMakeFiles/particles.dir/particles.c.o
[ 28%] Building C object examples/CMakeFiles/particles.dir/__/deps/tinycthread.c.o
[ 29%] Building C object examples/CMakeFiles/particles.dir/__/deps/getopt.c.o
[ 30%] Building C object examples/CMakeFiles/particles.dir/__/deps/glad.c.o
[ 31%] Linking C executable particles.app/Contents/MacOS/particles
Copying OS X content examples/particles.app/Contents/Resources/glfw.icns
[ 31%] Built target particles
Scanning dependencies of target boing
[ 31%] Building C object examples/CMakeFiles/boing.dir/boing.c.o
[ 32%] Building C object examples/CMakeFiles/boing.dir/__/deps/glad.c.o
[ 33%] Linking C executable boing.app/Contents/MacOS/boing
Copying OS X content examples/boing.app/Contents/Resources/glfw.icns
[ 33%] Built target boing
Scanning dependencies of target gears
[ 34%] Building C object examples/CMakeFiles/gears.dir/gears.c.o
[ 35%] Building C object examples/CMakeFiles/gears.dir/__/deps/glad.c.o
[ 36%] Linking C executable gears.app/Contents/MacOS/gears
Copying OS X content examples/gears.app/Contents/Resources/glfw.icns
[ 36%] Built target gears
Scanning dependencies of target clipboard
[ 37%] Building C object tests/CMakeFiles/clipboard.dir/clipboard.c.o
[ 38%] Building C object tests/CMakeFiles/clipboard.dir/__/deps/getopt.c.o
[ 39%] Building C object tests/CMakeFiles/clipboard.dir/__/deps/glad.c.o
[ 40%] Linking C executable clipboard
[ 40%] Built target clipboard
Scanning dependencies of target title
[ 41%] Building C object tests/CMakeFiles/title.dir/title.c.o
[ 42%] Building C object tests/CMakeFiles/title.dir/__/deps/glad.c.o
[ 43%] Linking C executable title.app/Contents/MacOS/title
[ 43%] Built target title
Scanning dependencies of target windows
[ 44%] Building C object tests/CMakeFiles/windows.dir/windows.c.o
[ 45%] Building C object tests/CMakeFiles/windows.dir/__/deps/getopt.c.o
[ 46%] Building C object tests/CMakeFiles/windows.dir/__/deps/glad.c.o
[ 47%] Linking C executable windows.app/Contents/MacOS/windows
[ 47%] Built target windows
Scanning dependencies of target timeout
[ 48%] Building C object tests/CMakeFiles/timeout.dir/timeout.c.o
[ 49%] Building C object tests/CMakeFiles/timeout.dir/__/deps/glad.c.o
[ 50%] Linking C executable timeout.app/Contents/MacOS/timeout
[ 50%] Built target timeout
Scanning dependencies of target threads
[ 51%] Building C object tests/CMakeFiles/threads.dir/threads.c.o
[ 52%] Building C object tests/CMakeFiles/threads.dir/__/deps/tinycthread.c.o
[ 53%] Building C object tests/CMakeFiles/threads.dir/__/deps/glad.c.o
[ 54%] Linking C executable threads.app/Contents/MacOS/threads
[ 54%] Built target threads
Scanning dependencies of target gamma
[ 55%] Building C object tests/CMakeFiles/gamma.dir/gamma.c.o
[ 56%] Building C object tests/CMakeFiles/gamma.dir/__/deps/getopt.c.o
[ 57%] Building C object tests/CMakeFiles/gamma.dir/__/deps/glad.c.o
[ 58%] Linking C executable gamma
[ 58%] Built target gamma
Scanning dependencies of target tearing
[ 59%] Building C object tests/CMakeFiles/tearing.dir/tearing.c.o
[ 60%] Building C object tests/CMakeFiles/tearing.dir/__/deps/getopt.c.o
[ 61%] Building C object tests/CMakeFiles/tearing.dir/__/deps/glad.c.o
[ 62%] Linking C executable tearing.app/Contents/MacOS/tearing
[ 62%] Built target tearing
Scanning dependencies of target icon
[ 63%] Building C object tests/CMakeFiles/icon.dir/icon.c.o
[ 64%] Building C object tests/CMakeFiles/icon.dir/__/deps/glad.c.o
[ 65%] Linking C executable icon.app/Contents/MacOS/icon
[ 65%] Built target icon
Scanning dependencies of target empty
[ 66%] Building C object tests/CMakeFiles/empty.dir/empty.c.o
[ 67%] Building C object tests/CMakeFiles/empty.dir/__/deps/tinycthread.c.o
[ 68%] Building C object tests/CMakeFiles/empty.dir/__/deps/glad.c.o
[ 69%] Linking C executable empty.app/Contents/MacOS/empty
[ 69%] Built target empty
Scanning dependencies of target glfwinfo
[ 70%] Building C object tests/CMakeFiles/glfwinfo.dir/glfwinfo.c.o
[ 71%] Building C object tests/CMakeFiles/glfwinfo.dir/__/deps/getopt.c.o
[ 72%] Building C object tests/CMakeFiles/glfwinfo.dir/__/deps/glad.c.o
[ 73%] Linking C executable glfwinfo
[ 73%] Built target glfwinfo
Scanning dependencies of target msaa
[ 74%] Building C object tests/CMakeFiles/msaa.dir/msaa.c.o
[ 75%] Building C object tests/CMakeFiles/msaa.dir/__/deps/getopt.c.o
[ 76%] Building C object tests/CMakeFiles/msaa.dir/__/deps/glad.c.o
[ 77%] Linking C executable msaa
[ 77%] Built target msaa
Scanning dependencies of target cursor
[ 78%] Building C object tests/CMakeFiles/cursor.dir/cursor.c.o
[ 79%] Building C object tests/CMakeFiles/cursor.dir/__/deps/glad.c.o
[ 80%] Linking C executable cursor
[ 80%] Built target cursor
Scanning dependencies of target sharing
[ 81%] Building C object tests/CMakeFiles/sharing.dir/sharing.c.o
[ 82%] Building C object tests/CMakeFiles/sharing.dir/__/deps/glad.c.o
[ 83%] Linking C executable sharing.app/Contents/MacOS/sharing
[ 83%] Built target sharing
Scanning dependencies of target monitors
[ 84%] Building C object tests/CMakeFiles/monitors.dir/monitors.c.o
[ 85%] Building C object tests/CMakeFiles/monitors.dir/__/deps/getopt.c.o
[ 86%] Building C object tests/CMakeFiles/monitors.dir/__/deps/glad.c.o
[ 87%] Linking C executable monitors
[ 87%] Built target monitors
Scanning dependencies of target reopen
[ 88%] Building C object tests/CMakeFiles/reopen.dir/reopen.c.o
[ 89%] Building C object tests/CMakeFiles/reopen.dir/__/deps/glad.c.o
[ 90%] Linking C executable reopen
[ 90%] Built target reopen
Scanning dependencies of target iconify
[ 91%] Building C object tests/CMakeFiles/iconify.dir/iconify.c.o
[ 92%] Building C object tests/CMakeFiles/iconify.dir/__/deps/getopt.c.o
[ 92%] Building C object tests/CMakeFiles/iconify.dir/__/deps/glad.c.o
[ 93%] Linking C executable iconify
[ 93%] Built target iconify
Scanning dependencies of target joysticks
[ 94%] Building C object tests/CMakeFiles/joysticks.dir/joysticks.c.o
[ 95%] Building C object tests/CMakeFiles/joysticks.dir/__/deps/glad.c.o
[ 96%] Linking C executable joysticks
[ 96%] Built target joysticks
Scanning dependencies of target events
[ 97%] Building C object tests/CMakeFiles/events.dir/events.c.o
[ 98%] Building C object tests/CMakeFiles/events.dir/__/deps/getopt.c.o
[ 99%] Building C object tests/CMakeFiles/events.dir/__/deps/glad.c.o
[100%] Linking C executable events
[100%] Built target events
Air:glfw-build admin$ 

很好, 编译完了, 执行 make install 进行安装:

Air:glfw-build admin$ make install
[ 14%] Built target glfw
[ 17%] Built target heightmap
[ 20%] Built target simple
[ 23%] Built target wave
[ 26%] Built target splitview
[ 31%] Built target particles
[ 33%] Built target boing
[ 36%] Built target gears
[ 40%] Built target clipboard
[ 43%] Built target title
[ 47%] Built target windows
[ 50%] Built target timeout
[ 54%] Built target threads
[ 58%] Built target gamma
[ 62%] Built target tearing
[ 65%] Built target icon
[ 69%] Built target empty
[ 73%] Built target glfwinfo
[ 77%] Built target msaa
[ 80%] Built target cursor
[ 83%] Built target sharing
[ 87%] Built target monitors
[ 90%] Built target reopen
[ 93%] Built target iconify
[ 96%] Built target joysticks
[100%] Built target events
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/include/GLFW
-- Installing: /usr/local/include/GLFW/glfw3.h
-- Installing: /usr/local/include/GLFW/glfw3native.h
-- Installing: /usr/local/lib/cmake/glfw3/glfw3Config.cmake
-- Installing: /usr/local/lib/cmake/glfw3/glfw3ConfigVersion.cmake
-- Installing: /usr/local/lib/cmake/glfw3/glfw3Targets.cmake
-- Installing: /usr/local/lib/cmake/glfw3/glfw3Targets-noconfig.cmake
-- Installing: /usr/local/lib/pkgconfig/glfw3.pc
-- Installing: /usr/local/lib/libglfw3.a

非常不幸地发现最终编译出来的是一个 libglfw3.a 静态库文件, 但是我们需要的是一个 形如 libglfw3.dylib 的动态库, 所以得重新设置一下编译参数.

Air:glfw-build admin$ cmake -DBUILD_SHARED_LIBS=ON .
-- Could NOT find Vulkan (missing:  VULKAN_LIBRARY VULKAN_INCLUDE_DIR) 
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Using Cocoa for window creation
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/admin/Downloads/glfw-3.2/glfw-build
Air:glfw-build admin$ cmake ..
-- Could NOT find Vulkan (missing:  VULKAN_LIBRARY VULKAN_INCLUDE_DIR) 
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Using Cocoa for window creation
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/admin/Downloads/glfw-3.2/glfw-build
Air:glfw-build admin$

然后再编译

Air:glfw-build admin$ make
Scanning dependencies of target glfw
[  1%] Building C object src/CMakeFiles/glfw.dir/context.c.o
[  2%] Building C object src/CMakeFiles/glfw.dir/init.c.o
[  3%] Building C object src/CMakeFiles/glfw.dir/input.c.o
[  4%] Building C object src/CMakeFiles/glfw.dir/monitor.c.o
[  5%] Building C object src/CMakeFiles/glfw.dir/vulkan.c.o
[  6%] Building C object src/CMakeFiles/glfw.dir/window.c.o
[  7%] Building C object src/CMakeFiles/glfw.dir/cocoa_init.m.o
[  8%] Building C object src/CMakeFiles/glfw.dir/cocoa_joystick.m.o
[  9%] Building C object src/CMakeFiles/glfw.dir/cocoa_monitor.m.o
/Users/admin/Downloads/glfw-3.2/src/cocoa_monitor.m:52:42: warning: 'CGDisplayIOServicePort' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
    info = IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID),
                                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayConfiguration.h:372:24: note: 
      'CGDisplayIOServicePort' has been explicitly marked deprecated here
CG_EXTERN io_service_t CGDisplayIOServicePort(CGDirectDisplayID display)
                       ^
/Users/admin/Downloads/glfw-3.2/src/cocoa_monitor.m:91:26: warning: 'CGDisplayModeCopyPixelEncoding' is deprecated: first deprecated in OS X 10.11 [-Wdeprecated-declarations]
    CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:174:34: note: 
      'CGDisplayModeCopyPixelEncoding' has been explicitly marked deprecated here
CG_EXTERN CFStringRef __nullable CGDisplayModeCopyPixelEncoding(
                                 ^
/Users/admin/Downloads/glfw-3.2/src/cocoa_monitor.m:120:26: warning: 'CGDisplayModeCopyPixelEncoding' is deprecated: first deprecated in OS X 10.11 [-Wdeprecated-declarations]
    CFStringRef format = CGDisplayModeCopyPixelEncoding(mode);
                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:174:34: note: 
      'CGDisplayModeCopyPixelEncoding' has been explicitly marked deprecated here
CG_EXTERN CFStringRef __nullable CGDisplayModeCopyPixelEncoding(
                                 ^
3 warnings generated.
[ 10%] Building C object src/CMakeFiles/glfw.dir/cocoa_window.m.o
[ 11%] Building C object src/CMakeFiles/glfw.dir/cocoa_time.c.o
[ 12%] Building C object src/CMakeFiles/glfw.dir/posix_tls.c.o
[ 13%] Building C object src/CMakeFiles/glfw.dir/nsgl_context.m.o
[ 14%] Linking C shared library libglfw.dylib
[ 14%] Built target glfw
Scanning dependencies of target heightmap
[ 15%] Building C object examples/CMakeFiles/heightmap.dir/heightmap.c.o
[ 16%] Building C object examples/CMakeFiles/heightmap.dir/__/deps/glad.c.o
[ 17%] Linking C executable heightmap.app/Contents/MacOS/heightmap
[ 17%] Built target heightmap
Scanning dependencies of target simple
[ 18%] Building C object examples/CMakeFiles/simple.dir/simple.c.o
[ 19%] Building C object examples/CMakeFiles/simple.dir/__/deps/glad.c.o
[ 20%] Linking C executable simple.app/Contents/MacOS/simple
[ 20%] Built target simple
Scanning dependencies of target wave
[ 21%] Building C object examples/CMakeFiles/wave.dir/wave.c.o
[ 22%] Building C object examples/CMakeFiles/wave.dir/__/deps/glad.c.o
[ 23%] Linking C executable wave.app/Contents/MacOS/wave
[ 23%] Built target wave
Scanning dependencies of target splitview
[ 24%] Building C object examples/CMakeFiles/splitview.dir/splitview.c.o
[ 25%] Building C object examples/CMakeFiles/splitview.dir/__/deps/glad.c.o
[ 26%] Linking C executable splitview.app/Contents/MacOS/splitview
[ 26%] Built target splitview
Scanning dependencies of target particles
[ 27%] Building C object examples/CMakeFiles/particles.dir/particles.c.o
[ 28%] Building C object examples/CMakeFiles/particles.dir/__/deps/tinycthread.c.o
[ 29%] Building C object examples/CMakeFiles/particles.dir/__/deps/getopt.c.o
[ 30%] Building C object examples/CMakeFiles/particles.dir/__/deps/glad.c.o
[ 31%] Linking C executable particles.app/Contents/MacOS/particles
[ 31%] Built target particles
Scanning dependencies of target boing
[ 31%] Building C object examples/CMakeFiles/boing.dir/boing.c.o
[ 32%] Building C object examples/CMakeFiles/boing.dir/__/deps/glad.c.o
[ 33%] Linking C executable boing.app/Contents/MacOS/boing
[ 33%] Built target boing
Scanning dependencies of target gears
[ 34%] Building C object examples/CMakeFiles/gears.dir/gears.c.o
[ 35%] Building C object examples/CMakeFiles/gears.dir/__/deps/glad.c.o
[ 36%] Linking C executable gears.app/Contents/MacOS/gears
[ 36%] Built target gears
Scanning dependencies of target clipboard
[ 37%] Building C object tests/CMakeFiles/clipboard.dir/clipboard.c.o
[ 38%] Building C object tests/CMakeFiles/clipboard.dir/__/deps/getopt.c.o
[ 39%] Building C object tests/CMakeFiles/clipboard.dir/__/deps/glad.c.o
[ 40%] Linking C executable clipboard
[ 40%] Built target clipboard
Scanning dependencies of target title
[ 41%] Building C object tests/CMakeFiles/title.dir/title.c.o
[ 42%] Building C object tests/CMakeFiles/title.dir/__/deps/glad.c.o
[ 43%] Linking C executable title.app/Contents/MacOS/title
[ 43%] Built target title
Scanning dependencies of target windows
[ 44%] Building C object tests/CMakeFiles/windows.dir/windows.c.o
[ 45%] Building C object tests/CMakeFiles/windows.dir/__/deps/getopt.c.o
[ 46%] Building C object tests/CMakeFiles/windows.dir/__/deps/glad.c.o
[ 47%] Linking C executable windows.app/Contents/MacOS/windows
[ 47%] Built target windows
Scanning dependencies of target timeout
[ 48%] Building C object tests/CMakeFiles/timeout.dir/timeout.c.o
[ 49%] Building C object tests/CMakeFiles/timeout.dir/__/deps/glad.c.o
[ 50%] Linking C executable timeout.app/Contents/MacOS/timeout
[ 50%] Built target timeout
Scanning dependencies of target threads
[ 51%] Building C object tests/CMakeFiles/threads.dir/threads.c.o
[ 52%] Building C object tests/CMakeFiles/threads.dir/__/deps/tinycthread.c.o
[ 53%] Building C object tests/CMakeFiles/threads.dir/__/deps/glad.c.o
[ 54%] Linking C executable threads.app/Contents/MacOS/threads
[ 54%] Built target threads
Scanning dependencies of target gamma
[ 55%] Building C object tests/CMakeFiles/gamma.dir/gamma.c.o
[ 56%] Building C object tests/CMakeFiles/gamma.dir/__/deps/getopt.c.o
[ 57%] Building C object tests/CMakeFiles/gamma.dir/__/deps/glad.c.o
[ 58%] Linking C executable gamma
[ 58%] Built target gamma
Scanning dependencies of target tearing
[ 59%] Building C object tests/CMakeFiles/tearing.dir/tearing.c.o
[ 60%] Building C object tests/CMakeFiles/tearing.dir/__/deps/getopt.c.o
[ 61%] Building C object tests/CMakeFiles/tearing.dir/__/deps/glad.c.o
[ 62%] Linking C executable tearing.app/Contents/MacOS/tearing
[ 62%] Built target tearing
Scanning dependencies of target icon
[ 63%] Building C object tests/CMakeFiles/icon.dir/icon.c.o
[ 64%] Building C object tests/CMakeFiles/icon.dir/__/deps/glad.c.o
[ 65%] Linking C executable icon.app/Contents/MacOS/icon
[ 65%] Built target icon
Scanning dependencies of target empty
[ 66%] Building C object tests/CMakeFiles/empty.dir/empty.c.o
[ 67%] Building C object tests/CMakeFiles/empty.dir/__/deps/tinycthread.c.o
[ 68%] Building C object tests/CMakeFiles/empty.dir/__/deps/glad.c.o
[ 69%] Linking C executable empty.app/Contents/MacOS/empty
[ 69%] Built target empty
Scanning dependencies of target glfwinfo
[ 70%] Building C object tests/CMakeFiles/glfwinfo.dir/glfwinfo.c.o
[ 71%] Building C object tests/CMakeFiles/glfwinfo.dir/__/deps/getopt.c.o
[ 72%] Building C object tests/CMakeFiles/glfwinfo.dir/__/deps/glad.c.o
[ 73%] Linking C executable glfwinfo
[ 73%] Built target glfwinfo
Scanning dependencies of target msaa
[ 74%] Building C object tests/CMakeFiles/msaa.dir/msaa.c.o
[ 75%] Building C object tests/CMakeFiles/msaa.dir/__/deps/getopt.c.o
[ 76%] Building C object tests/CMakeFiles/msaa.dir/__/deps/glad.c.o
[ 77%] Linking C executable msaa
[ 77%] Built target msaa
Scanning dependencies of target cursor
[ 78%] Building C object tests/CMakeFiles/cursor.dir/cursor.c.o
[ 79%] Building C object tests/CMakeFiles/cursor.dir/__/deps/glad.c.o
[ 80%] Linking C executable cursor
[ 80%] Built target cursor
Scanning dependencies of target sharing
[ 81%] Building C object tests/CMakeFiles/sharing.dir/sharing.c.o
[ 82%] Building C object tests/CMakeFiles/sharing.dir/__/deps/glad.c.o
[ 83%] Linking C executable sharing.app/Contents/MacOS/sharing
[ 83%] Built target sharing
Scanning dependencies of target monitors
[ 84%] Building C object tests/CMakeFiles/monitors.dir/monitors.c.o
[ 85%] Building C object tests/CMakeFiles/monitors.dir/__/deps/getopt.c.o
[ 86%] Building C object tests/CMakeFiles/monitors.dir/__/deps/glad.c.o
[ 87%] Linking C executable monitors
[ 87%] Built target monitors
Scanning dependencies of target reopen
[ 88%] Building C object tests/CMakeFiles/reopen.dir/reopen.c.o
[ 89%] Building C object tests/CMakeFiles/reopen.dir/__/deps/glad.c.o
[ 90%] Linking C executable reopen
[ 90%] Built target reopen
Scanning dependencies of target iconify
[ 91%] Building C object tests/CMakeFiles/iconify.dir/iconify.c.o
[ 92%] Building C object tests/CMakeFiles/iconify.dir/__/deps/getopt.c.o
[ 92%] Building C object tests/CMakeFiles/iconify.dir/__/deps/glad.c.o
[ 93%] Linking C executable iconify
[ 93%] Built target iconify
Scanning dependencies of target joysticks
[ 94%] Building C object tests/CMakeFiles/joysticks.dir/joysticks.c.o
[ 95%] Building C object tests/CMakeFiles/joysticks.dir/__/deps/glad.c.o
[ 96%] Linking C executable joysticks
[ 96%] Built target joysticks
Scanning dependencies of target events
[ 97%] Building C object tests/CMakeFiles/events.dir/events.c.o
[ 98%] Building C object tests/CMakeFiles/events.dir/__/deps/getopt.c.o
[ 99%] Building C object tests/CMakeFiles/events.dir/__/deps/glad.c.o
[100%] Linking C executable events
[100%] Built target events
Air:glfw-build admin$ 

编译完之后再执行 make install 安装:

Air:glfw-build admin$ make install
[ 14%] Built target glfw
[ 17%] Built target heightmap
[ 20%] Built target simple
[ 23%] Built target wave
[ 26%] Built target splitview
[ 31%] Built target particles
[ 33%] Built target boing
[ 36%] Built target gears
[ 40%] Built target clipboard
[ 43%] Built target title
[ 47%] Built target windows
[ 50%] Built target timeout
[ 54%] Built target threads
[ 58%] Built target gamma
[ 62%] Built target tearing
[ 65%] Built target icon
[ 69%] Built target empty
[ 73%] Built target glfwinfo
[ 77%] Built target msaa
[ 80%] Built target cursor
[ 83%] Built target sharing
[ 87%] Built target monitors
[ 90%] Built target reopen
[ 93%] Built target iconify
[ 96%] Built target joysticks
[100%] Built target events
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/include/GLFW
-- Up-to-date: /usr/local/include/GLFW/glfw3.h
-- Up-to-date: /usr/local/include/GLFW/glfw3native.h
-- Up-to-date: /usr/local/lib/cmake/glfw3/glfw3Config.cmake
-- Up-to-date: /usr/local/lib/cmake/glfw3/glfw3ConfigVersion.cmake
-- Old export file "/usr/local/lib/cmake/glfw3/glfw3Targets.cmake" will be replaced.  Removing files [/usr/local/lib/cmake/glfw3/glfw3Targets-noconfig.cmake].
-- Installing: /usr/local/lib/cmake/glfw3/glfw3Targets.cmake
-- Installing: /usr/local/lib/cmake/glfw3/glfw3Targets-noconfig.cmake
-- Installing: /usr/local/lib/pkgconfig/glfw3.pc
-- Installing: /usr/local/lib/libglfw.3.2.dylib
-- Installing: /usr/local/lib/libglfw.3.dylib
-- Installing: /usr/local/lib/libglfw.dylib
Air:glfw-build admin$ 

终于看到了 libglfw.dylib, 很好, 基本大功告成也!

试验一下, 在没有完成 GLFW 的编译安装之前, 在 SBCL 中加载 cl-glfw 会报下面的错误:

* (ql:quickload 'cl-glfw)
To load "cl-glfw":
  Load 1 ASDF system:
    cl-glfw
; Loading "cl-glfw"
.........
debugger invoked on a LOAD-FOREIGN-LIBRARY-ERROR in thread
#<THREAD "main thread" RUNNING {100294EC33}>:
  Unable to load any of the alternatives:
   ("libglfw.dylib" (:FRAMEWORK "GLFW"))

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

现在再试试:

* (ql:quickload 'cl-glfw)
To load "cl-glfw":
  Load 1 ASDF system:
    cl-glfw
; Loading "cl-glfw"
.................
(CL-GLFW)
* 

很好, 非常顺利就完成了!

参考文档

在 Mac OS X Yosemite 10.10.5 上配置 OpenGL 编程环境
Compiling GLFW

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部