Moving GPU into it's own library

This commit is contained in:
Sam Gateau 2014-12-04 16:40:55 -08:00
parent 227f5a498f
commit 1102b4d633
14 changed files with 97 additions and 15 deletions

View file

@ -107,7 +107,7 @@ endif()
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
# link required hifi libraries
link_hifi_libraries(shared octree voxels fbx metavoxels networking entities avatars audio animation script-engine physics)
link_hifi_libraries(shared octree voxels gpu fbx metavoxels networking entities avatars audio animation script-engine physics)
# find any optional and required libraries
find_package(ZLIB REQUIRED)

View file

@ -0,0 +1,52 @@
set(TARGET_NAME gpu)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library()
include_glm()
link_hifi_libraries(shared)
if (APPLE)
# link in required OS X frameworks and include the right GL headers
find_library(CoreFoundation CoreFoundation)
find_library(OpenGL OpenGL)
target_link_libraries(${TARGET_NAME} ${CoreFoundation} ${OpenGL})
# install command for OS X bundle
INSTALL(TARGETS ${TARGET_NAME}
BUNDLE DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/install" COMPONENT Runtime
RUNTIME DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/install" COMPONENT Runtime
)
else (APPLE)
find_package(OpenGL REQUIRED)
if (${OPENGL_INCLUDE_DIR})
include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}")
endif ()
target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}")
# link target to external libraries
if (WIN32)
find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIRS})
# we're using static GLEW, so define GLEW_STATIC
add_definitions(-DGLEW_STATIC)
target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARIES}" "${NSIGHT_LIBRARIES}" opengl32.lib)
# try to find the Nsight package and add it to the build if we find it
find_package(NSIGHT)
if (NSIGHT_FOUND)
include_directories(${NSIGHT_INCLUDE_DIRS})
add_definitions(-DNSIGHT_FOUND)
target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}")
endif ()
endif()
endif (APPLE)
# call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies()

View file

@ -12,13 +12,13 @@
#define hifi_gpu_Batch_h
#include <assert.h>
#include "InterfaceConfig.h"
#include "GPUConfig.h"
#include "Transform.h"
#include <vector>
#include "gpu/Stream.h"
#include "Stream.h"
#if defined(NSIGHT_FOUND)
#include "nvToolsExt.h"

View file

@ -12,9 +12,9 @@
#define hifi_gpu_Context_h
#include <assert.h>
#include "InterfaceConfig.h"
#include "GPUConfig.h"
#include "gpu/Resource.h"
#include "Resource.h"
namespace gpu {

View file

@ -12,7 +12,7 @@
#define hifi_gpu_Format_h
#include <assert.h>
#include "InterfaceConfig.h"
#include "GPUConfig.h"
namespace gpu {

View file

@ -12,7 +12,7 @@
#include <QDebug>
#include "gpu/Batch.h"
#include "Batch.h"
using namespace gpu;

View file

@ -12,10 +12,10 @@
#define hifi_gpu_GLBackend_h
#include <assert.h>
#include "InterfaceConfig.h"
#include "GPUConfig.h"
#include "gpu/Context.h"
#include "gpu/Batch.h"
#include "Context.h"
#include "Batch.h"
#include <bitset>

View file

@ -0,0 +1,30 @@
//
// GPUConfig.h
// libraries/gpu/src/gpu
//
// Created by Sam Gateau on 12/4/14.
// Copyright 2013 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef gpu__GPUConfig__
#define gpu__GPUConfig__
#define GL_GLEXT_PROTOTYPES 1
#if defined(APPLE)
#include <OpenGL/glext.h>
#elif defined(UNIX)
#include <GL/gl.h>
#include <GL/glext.h>
#elif defined(WIN32)
#include <GL/glew.h>
#include <GL/wglew.h>
#endif
#endif

View file

@ -12,9 +12,9 @@
#define hifi_gpu_Resource_h
#include <assert.h>
#include "InterfaceConfig.h"
#include "GPUConfig.h"
#include "gpu/Format.h"
#include "Format.h"
#include <vector>

View file

@ -12,10 +12,10 @@
#define hifi_gpu_Stream_h
#include <assert.h>
#include "InterfaceConfig.h"
#include "GPUConfig.h"
#include "gpu/Resource.h"
#include "gpu/Format.h"
#include "Resource.h"
#include "Format.h"
#include <vector>
#include <map>