-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace GLEW with glbinding #89
Changes from 19 commits
95e69ac
06e1ef3
eea8099
3d309a6
f8fdb68
4d012a8
7c93806
33cff2b
493aa67
7313c52
f07f44f
6aaf3e7
4ddebdd
e2558b1
d07ae62
c26386d
aa92b8d
b2da6f0
4ef9c6d
27a7c3a
f6a578f
b24529d
adb16af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
INCLUDE(ExternalProject) | ||
|
||
SET(prefix ${CMAKE_BINARY_DIR}/third_party/glb) | ||
|
||
SET(LIB_POSTFIX "") | ||
IF (${CMAKE_BUILD_TYPE} STREQUAL "Debug") | ||
SET(LIB_POSTFIX "d") | ||
ENDIF() | ||
|
||
SET(glbinding_location ${prefix}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}glbinding${LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
|
||
IF(CMAKE_VERSION VERSION_LESS 3.2) | ||
IF(CMAKE_GENERATOR MATCHES "Ninja") | ||
MESSAGE(WARNING "Building with Ninja has known issues with CMake older than 3.2") | ||
endif() | ||
SET(byproducts) | ||
ELSE() | ||
SET(byproducts BYPRODUCTS ${glbinding_location}) | ||
ENDIF() | ||
|
||
IF(UNIX) | ||
SET(CXXFLAGS "${CMAKE_CXX_FLAGS} -w -fPIC") | ||
SET(CFLAGS "${CMAKE_C_FLAGS} -w -fPIC") | ||
ENDIF(UNIX) | ||
|
||
ExternalProject_Add( | ||
glb-ext | ||
GIT_REPOSITORY https://github.com/cginternals/glbinding.git | ||
GIT_TAG v2.1.1 | ||
UPDATE_COMMAND "" | ||
PREFIX "${prefix}" | ||
INSTALL_DIR "${prefix}" | ||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -Wno-dev "-G${CMAKE_GENERATOR}" <SOURCE_DIR> | ||
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} | ||
-DCMAKE_CXX_FLAGS:STRING=${CXXFLAGS} | ||
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} | ||
-DCMAKE_C_FLAGS:STRING=${CFLAGS} | ||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
-DBUILD_SHARED_LIBS:BOOL=OFF | ||
-DOPTION_BUILD_TESTS:BOOL=OFF | ||
${byproducts} | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Insert:
|
||
ADD_LIBRARY(glbinding IMPORTED STATIC) | ||
|
||
ExternalProject_Get_Property(glb-ext install_dir) | ||
|
||
SET_TARGET_PROPERTIES(glbinding PROPERTIES IMPORTED_LOCATION ${glbinding_location}) | ||
|
||
ADD_DEPENDENCIES(glbinding glb-ext) | ||
|
||
SET(GLBINDING_INCLUDE_DIRS ${install_dir}/include CACHE INTERNAL "" FORCE) | ||
SET(GLBINDING_LIBRARIES ${glbinding_location} CACHE INTERNAL "" FORCE) | ||
SET(GLBINDING_FOUND ON CACHE INTERNAL "" FORCE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fill the "" with comments about the variables. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,10 @@ goal of Forge is to provide high performance OpenGL visualizations for C/C++ | |
applications that use CUDA/OpenCL. | ||
|
||
## Upstream dependencies | ||
* [GLEW](http://glew.sourceforge.net/) | ||
* [glbinding](https://github.com/cginternals/glbinding) | ||
* [GLFW](http://www.glfw.org/) | ||
* [freetype](http://www.freetype.org/) | ||
* [FreeImage](http://freeimage.sourceforge.net/) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is FreeImage necessary for the library or is it necessary for the demos ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is needed to save frame buffers to disks. |
||
* On `Linux` and `OS X`, [fontconfig](http://www.freedesktop.org/wiki/Software/fontconfig/) is required. | ||
|
||
Above dependecies are available through package managers on most of the | ||
|
@@ -30,5 +31,13 @@ Currently supported alternatives: | |
Alternatives to GLFW which are currently under consideration are given below: | ||
* [Qt5](https://wiki.qt.io/Qt_5) | ||
|
||
## Example Dependencies | ||
* CPU examples doesn't need any additional dependencies. | ||
* CUDA Interop examples requires [CUDA toolkit](https://developer.nvidia.com/cuda-toolkit) | ||
* OpenCL Interop examples requires OpenCL libraries. | ||
- [AMD](http://developer.amd.com/tools-and-sdks/opencl-zone/) | ||
- [INTEL](https://software.intel.com/en-us/intel-opencl) | ||
- [NVIDIA](https://developer.nvidia.com/opencl) | ||
|
||
* Engineering: [email protected] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,29 +27,35 @@ MACRO(BUILD_EXAMPLE EX_NAME EX_SRC COMPUTE_NAME FG_LIBS COMPUTE_LIBS) | |
ENDMACRO() | ||
|
||
IF(TARGET forge) | ||
|
||
# Building with Forge Source | ||
SET(FORGE_FOUND False) | ||
|
||
ELSE(TARGET forge) | ||
|
||
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) | ||
FIND_PACKAGE(GLEWmx REQUIRED) | ||
FIND_PACKAGE(FreeImage REQUIRED) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is FreeImage required for compiling the examples too? Do we call any API directly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya, i noticed that too, it may not be needed i think. Will check on that. |
||
FIND_PACKAGE(OpenGL REQUIRED) | ||
FIND_PACKAGE(Forge REQUIRED) | ||
|
||
SET(X11_LIBS "") | ||
IF(APPLE) | ||
FIND_PACKAGE(X11 REQUIRED) | ||
INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR}) | ||
ENDIF(APPLE) | ||
|
||
INCLUDE_DIRECTORIES( | ||
${FORGE_INCLUDE_DIRS} | ||
${OPENGL_INCLUDE_DIR} | ||
${GLEW_INCLUDE_DIR} | ||
${FREEIMAGE_INCLUDE_PATH} | ||
) | ||
ADD_DEFINITIONS(-DGLEW_MX) | ||
|
||
# OS Definitions | ||
IF(UNIX) | ||
ADD_DEFINITIONS(-Wall -std=c++11 -fvisibility=hidden) | ||
|
||
# GCC 5.3 and above give errors for mempcy from <string.h> | ||
# This is a (temporary) fix for that | ||
IF("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.3.0") | ||
ADD_DEFINITIONS(-D_FORCE_INLINES) | ||
ENDIF() | ||
|
||
# MacOS specific environment settings | ||
IF(APPLE) | ||
ADD_DEFINITIONS(-DOS_MAC) | ||
SET(CMAKE_MACOSX_RPATH ON) | ||
|
@@ -62,6 +68,10 @@ ELSE(TARGET forge) | |
IF("${isSystemDir}" STREQUAL "-1") | ||
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}") | ||
ENDIF("${isSystemDir}" STREQUAL "-1") | ||
|
||
FIND_PACKAGE(X11 REQUIRED) | ||
INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR}) | ||
|
||
ELSE(APPLE) | ||
ADD_DEFINITIONS(-DOS_LNX) | ||
ENDIF(APPLE) | ||
|
@@ -70,6 +80,10 @@ ELSE(TARGET forge) | |
ENDIF(UNIX) | ||
ENDIF(TARGET forge) | ||
|
||
IF(UNIX) | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-unused-function") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You missed adding |
||
ENDIF() | ||
|
||
FILE(GLOB CPU_EXAMPLE_SRC_FILES "cpu/*.cpp") | ||
FOREACH(FILE ${CPU_EXAMPLE_SRC_FILES}) | ||
GET_FILENAME_COMPONENT(EXAMPLE ${FILE} NAME_WE) | ||
|
@@ -78,10 +92,10 @@ FOREACH(FILE ${CPU_EXAMPLE_SRC_FILES}) | |
|
||
IF(TARGET forge) | ||
BUILD_EXAMPLE(${EXAMPLE} ${FILE} ${DIR_NAME} forge | ||
"${FREEIMAGE_LIBRARY};${GLEWmx_LIBRARY};${OPENGL_gl_LIBRARY}") | ||
"${FREEIMAGE_LIBRARY};${OPENGL_gl_LIBRARY}") | ||
ELSE(TARGET forge) | ||
BUILD_EXAMPLE(${EXAMPLE} ${FILE} ${DIR_NAME} ${FORGE_LIBRARIES} | ||
"${FREEIMAGE_LIBRARY};${GLEWmx_LIBRARY};${OPENGL_gl_LIBRARY};${X11_LIBS};") | ||
"${FREEIMAGE_LIBRARY};${OPENGL_gl_LIBRARY};${X11_LIBS};") | ||
ENDIF() | ||
ENDFOREACH() | ||
|
||
|
@@ -116,7 +130,7 @@ IF (BUILD_EXAMPLES_CUDA) | |
"${FREEIMAGE_LIBRARY};${CUDA_LIBRARIES}") | ||
ELSE(TARGET forge) | ||
BUILD_EXAMPLE(${EXAMPLE} ${FILE} ${DIR_NAME} ${FORGE_LIBRARIES} | ||
"${FREEIMAGE_LIBRARY};${GLEWmx_LIBRARY};${OPENGL_gl_LIBRARY};${X11_LIBS};${CUDA_LIBRARIES}") | ||
"${FREEIMAGE_LIBRARY};${OPENGL_gl_LIBRARY};${X11_LIBS};${CUDA_LIBRARIES}") | ||
ENDIF() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a commit locally that moves
to the outside of any build conditions from line ~130. This is currently under It also adds I am unable to add a comment on the specific line so adding it here. |
||
ENDFOREACH() | ||
ELSE() | ||
|
@@ -127,9 +141,6 @@ ENDIF() | |
IF (BUILD_EXAMPLES_OPENCL) | ||
FIND_PACKAGE(OpenCL QUIET) | ||
IF(OpenCL_FOUND) | ||
IF(UNIX) | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-unused-function") | ||
ENDIF() | ||
FILE(GLOB OpenCL_EXAMPLE_SRC_FILES "opencl/*.cpp") | ||
INCLUDE_DIRECTORIES( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/opencl" | ||
|
@@ -143,10 +154,10 @@ IF (BUILD_EXAMPLES_OPENCL) | |
|
||
IF(TARGET forge) | ||
BUILD_EXAMPLE(${EXAMPLE} ${FILE} ${DIR_NAME} forge | ||
"${FREEIMAGE_LIBRARY};${GLEWmx_LIBRARY};${OPENGL_gl_LIBRARY};${OpenCL_LIBRARIES}") | ||
"${FREEIMAGE_LIBRARY};${OPENGL_gl_LIBRARY};${OpenCL_LIBRARIES}") | ||
ELSE(TARGET forge) | ||
BUILD_EXAMPLE(${EXAMPLE} ${FILE} ${DIR_NAME} ${FORGE_LIBRARIES} | ||
"${FREEIMAGE_LIBRARY};${GLEWmx_LIBRARY};${OPENGL_gl_LIBRARY};${X11_LIBS};${OpenCL_LIBRARIES}") | ||
"${FREEIMAGE_LIBRARY};${OPENGL_gl_LIBRARY};${X11_LIBS};${OpenCL_LIBRARIES}") | ||
ENDIF() | ||
ENDFOREACH() | ||
ELSE() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use these: