Merge branch 'macos-compat'

Building on MacOS is now supported!
This commit is contained in:
Epicalert 2021-01-12 18:36:10 +08:00
commit 8b231720b5
No known key found for this signature in database
GPG key ID: CAA46F858D0979BD
4 changed files with 19 additions and 5 deletions

View file

@ -1,14 +1,21 @@
cmake_minimum_required( VERSION 3.0 )
project( FaceCam2D VERSION 0.1.0 )
find_package( OpenCV REQUIRED )
find_package( VTK REQUIRED )
find_package( HDF5 REQUIRED )
find_package( GLEW REQUIRED )
message (STATUS "Found OpenCV at: " ${OpenCV_INCLUDE_DIRS} )
find_package( OpenGL REQUIRED )
message (STATUS "Found OpenGL at: " ${OPENGL_INCLUDE_DIR} )
find_package( GLEW REQUIRED )
message (STATUS "Found GLEW at: " ${GLEW_INCLUDE_DIRS} )
find_package( glm REQUIRED )
message (STATUS "Found glm at: " ${GLM_INCLUDE_DIRS} )
find_package( FreeGLUT REQUIRED )
message (STATUS "Found FreeGLUT at: " ${GLUT_INCLUDE_DIR} )
include_directories( ${OpenCV_INCLUDE_DIRS} )
include_directories( ${OPENGL_INCLUDE_DIR} )
include_directories( ${GLEW_INCLUDE_DIRS} )
include_directories( ${GLM_INCLUDE_DIRS} )
include_directories( ${GLUT_INCLUDE_DIR} )
include_directories( ${PROJECT_SOURCE_DIR}/src )
add_executable( fc2d src/main.cpp src/graphics.cpp src/modelpart.cpp src/cv.cpp )
target_link_libraries( fc2d ${OpenCV_LIBS} -lOpenGL -lglut -lGLEW )
target_link_libraries( fc2d ${OpenCV_LIBS} ${OPENGL_LIBRARIES} FreeGLUT::freeglut GLEW::glew )
set( CMAKE_BUILD_TYPE Debug )

View file

@ -1,5 +1,6 @@
#include <GL/glew.h>
#include <GL/freeglut.h> //includes glu.h and gl.h
#include <GL/freeglut.h>
#include <glm/mat4x4.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

View file

@ -1,7 +1,12 @@
#ifndef GRAPHICS_H
#define GRAPHICS_H
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include <glm/vec2.hpp>
void initGraphics ();

View file

@ -1,4 +1,5 @@
#include <GL/glew.h>
#include <glm/mat4x4.hpp>
#include <glm/gtc/type_ptr.hpp>