mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 07:10:06 +02:00
DRY up gpu library/header linking
This commit is contained in:
parent
9425ea2c17
commit
b202eb7dae
3 changed files with 24 additions and 74 deletions
|
@ -5,33 +5,7 @@ setup_hifi_library(Widgets OpenGL Network Script)
|
||||||
|
|
||||||
include_glm()
|
include_glm()
|
||||||
|
|
||||||
link_hifi_libraries(shared gpu)
|
link_hifi_libraries(shared gpu script-engine)
|
||||||
if (APPLE)
|
|
||||||
# link in required OS X frameworks and include the right GL headers
|
|
||||||
find_library(OpenGL OpenGL)
|
|
||||||
|
|
||||||
#target_link_libraries(${TARGET_NAME} ${OpenGL})
|
|
||||||
|
|
||||||
else (APPLE)
|
|
||||||
find_package(OpenGL REQUIRED)
|
|
||||||
|
|
||||||
if (${OPENGL_INCLUDE_DIR})
|
|
||||||
include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# link target to external libraries
|
|
||||||
if (WIN32)
|
|
||||||
find_package(GLEW REQUIRED)
|
|
||||||
include_directories(${GLEW_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
find_package(GLUT REQUIRED)
|
|
||||||
include_directories(SYSTEM "${GLUT_INCLUDE_DIRS}")
|
|
||||||
|
|
||||||
# we're using static GLEW, so define GLEW_STATIC
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
|
||||||
target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARIES}")
|
|
||||||
endif()
|
|
||||||
endif (APPLE)
|
|
||||||
|
|
||||||
# call macro to link our dependencies and bubble them up via a property on our target
|
# call macro to link our dependencies and bubble them up via a property on our target
|
||||||
link_shared_dependencies()
|
link_shared_dependencies()
|
||||||
|
|
|
@ -6,13 +6,32 @@ setup_hifi_library()
|
||||||
include_glm()
|
include_glm()
|
||||||
|
|
||||||
link_hifi_libraries(shared)
|
link_hifi_libraries(shared)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# link in required OS X frameworks and include the right GL headers
|
# link in required OS X frameworks and include the right GL headers
|
||||||
find_library(OpenGL OpenGL)
|
find_library(OpenGL OpenGL)
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} ${OpenGL})
|
target_link_libraries(${TARGET_NAME} ${OpenGL})
|
||||||
|
elseif (WIN32)
|
||||||
else (APPLE)
|
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}" opengl32.lib)
|
||||||
|
|
||||||
|
# need to bubble up the GLEW_INCLUDE_DIRS
|
||||||
|
list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES "${GLEW_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
# 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 ()
|
||||||
|
else ()
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
if (${OPENGL_INCLUDE_DIR})
|
if (${OPENGL_INCLUDE_DIR})
|
||||||
|
@ -21,25 +40,8 @@ else (APPLE)
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}")
|
target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}")
|
||||||
|
|
||||||
# link target to external libraries
|
# need to bubble up the OPENGL_INCLUDE_DIR
|
||||||
if (WIN32)
|
list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES "${OPENGL_INCLUDE_DIR}")
|
||||||
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)
|
endif (APPLE)
|
||||||
|
|
||||||
# call macro to link our dependencies and bubble them up via a property on our target
|
# call macro to link our dependencies and bubble them up via a property on our target
|
||||||
|
|
|
@ -6,32 +6,6 @@ setup_hifi_library(Widgets OpenGL Network Script)
|
||||||
include_glm()
|
include_glm()
|
||||||
|
|
||||||
link_hifi_libraries(shared gpu)
|
link_hifi_libraries(shared gpu)
|
||||||
if (APPLE)
|
|
||||||
# link in required OS X frameworks and include the right GL headers
|
|
||||||
find_library(OpenGL OpenGL)
|
|
||||||
|
|
||||||
#target_link_libraries(${TARGET_NAME} ${OpenGL})
|
|
||||||
|
|
||||||
else (APPLE)
|
|
||||||
find_package(OpenGL REQUIRED)
|
|
||||||
|
|
||||||
if (${OPENGL_INCLUDE_DIR})
|
|
||||||
include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# link target to external libraries
|
|
||||||
if (WIN32)
|
|
||||||
find_package(GLEW REQUIRED)
|
|
||||||
include_directories(${GLEW_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
find_package(GLUT REQUIRED)
|
|
||||||
include_directories(SYSTEM "${GLUT_INCLUDE_DIRS}")
|
|
||||||
|
|
||||||
# we're using static GLEW, so define GLEW_STATIC
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
|
||||||
target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARIES}")
|
|
||||||
endif()
|
|
||||||
endif (APPLE)
|
|
||||||
|
|
||||||
# call macro to link our dependencies and bubble them up via a property on our target
|
# call macro to link our dependencies and bubble them up via a property on our target
|
||||||
link_shared_dependencies()
|
link_shared_dependencies()
|
||||||
|
|
Loading…
Reference in a new issue