-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6324b9d
commit edf3806
Showing
146 changed files
with
106,232 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
|
||
# Explicitly declare text files you want to always be normalized and converted | ||
# to native line endings on checkout. | ||
*.c text eol=lf | ||
*.cpp text eol=lf | ||
*.cc text eol=lf | ||
*.h text eol=lf | ||
*.hpp text eol=lf | ||
*.txt text eol=lf | ||
Makefile text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
cmake_minimum_required (VERSION 3.0.2) | ||
project(cudagl LANGUAGES CXX) | ||
|
||
#### Check Dependencies #### | ||
# https://cmake.org/cmake/help/v3.0/module/FindOpenGL.html | ||
find_package(OpenGL REQUIRED) | ||
find_package(CUDA REQUIRED) | ||
|
||
|
||
#### Directory definition #### | ||
|
||
set (PROJECT_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include") | ||
set (PROJECT_SRC_DIR "${PROJECT_SOURCE_DIR}/src") | ||
set (PROJECT_DEPS_DIR "${PROJECT_SOURCE_DIR}/deps") | ||
# PROJECT_SOURCE_DIR points to the project root folder | ||
# PROJECT_BINARY_DIR points to the project build folder | ||
|
||
|
||
#### Adding dependencies #### | ||
|
||
# Adding external libs | ||
add_subdirectory(${PROJECT_DEPS_DIR}) | ||
|
||
|
||
#### Source Files #### | ||
|
||
# Gets the list of files inside the src directory | ||
file(GLOB_RECURSE SOURCES "${PROJECT_SRC_DIR}/*.cpp" "${PROJECT_SRC_DIR}/*.c") | ||
file(GLOB_RECURSE SOURCES_CUDA "${PROJECT_SRC_DIR}/*.cu") | ||
|
||
|
||
#### Header Files #### | ||
|
||
# -- CUDA -- | ||
include_directories(${CUDA_INCLUDE_DIRS}) | ||
|
||
# -- Project Includes -- | ||
include_directories("${PROJECT_INCLUDE_DIRS}") | ||
cuda_include_directories("${PROJECT_INCLUDE_DIRS}") | ||
|
||
## External includes | ||
|
||
# -- FreeGLUT 3 -- | ||
include_directories(${FreeGLUT3_INCLUDE_DIRS}) | ||
cuda_include_directories("${FreeGLUT3_INCLUDE_DIRS}") | ||
|
||
# -- GLEW 2 -- | ||
include_directories(${GLEW_INCLUDE_DIRS}) | ||
cuda_include_directories("${GLEW_INCLUDE_DIRS}") | ||
|
||
|
||
#### Compilation #### | ||
|
||
# Compilation Flags | ||
set(COMPILE_FLAGS "") | ||
set(LINKER_FLAGS "") | ||
|
||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) | ||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -W -Wall -pedantic -std=c++11 -Wshadow -O2 -g") | ||
set(LINKER_FLAGS "${LINKER_FLAGS} -lm") | ||
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) | ||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -W -Wall -pedantic -std=c++11 -Wshadow -O2 -g") | ||
set(LINKER_FLAGS "${LINKER_FLAGS} -lm") | ||
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL Intel) | ||
# using Intel Compiler | ||
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) | ||
set(COMPILE_FLAGS "${COMPILE_FLAGS} /Wall") | ||
set(LINKER_FLAGS "${LINKER_FLAGS}") | ||
endif() | ||
|
||
# Cmake compilation flags redefinition | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}") | ||
|
||
set(cuda_additional_flags "--std=c++11") | ||
|
||
# findCUDA Options | ||
set(CUDA_VERBOSE_BUILD ON) | ||
set(CUDA_SEPARABLE_COMPILATION ON) # Allow multiple CUDA files compilation | ||
|
||
# Generating the commands to compile .cu into .ptx | ||
CUDA_WRAP_SRCS(cudagl PTX CUDA_PTX_FILES ${SOURCES_CUDA} | ||
OPTIONS ${cuda_additional_flags}) | ||
|
||
cuda_add_executable(cudagl ${SOURCES} ${SOURCES_CUDA} ${CUDA_PTX_FILES} | ||
OPTIONS ${cuda_additional_flags}) | ||
|
||
target_link_libraries(cudagl | ||
freeglut_static | ||
GLEW | ||
${CUDA_LIBRARIES} | ||
${CUDA_CUDA_LIBRARY} | ||
${CUDA_curand_LIBRARY} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,50 @@ | ||
# cuda_opengl_cmake | ||
This project shows how to integrate CUDA and OpenGL. Generating the Makefile with Cmake | ||
# Cuda + OpenGL (with CMake) | ||
This project shows how to integrate CUDA and OpenGL. Generating the Makefile with CMake | ||
|
||
## Expected Output | ||
|
||
After building and running the project (see below). You should see this: | ||
|
||
 | ||
|
||
## Dependencies | ||
|
||
You need to install: | ||
|
||
* CUDA SDK | ||
* OpenGL | ||
* CMake 3.0+ | ||
|
||
## How to build (Windows) | ||
|
||
To build on windows. Open the command line (or use the cmake gui) | ||
|
||
|
||
* Check your Visual Studio version and change it if needed on the last step | ||
* The CUDA SDK may be installed as 64bit version. If so, you need to use the `Win64` on the last command, otherwise you can omit it. If you omit it on 64bit versions you won't have access to libraries like: CURand or CUBLAS | ||
|
||
``` | ||
mkdir build | ||
cd build | ||
cmake .. -G "Visual Studio 12 2013 Win64" | ||
``` | ||
|
||
Open the project in Visual Studio. | ||
|
||
|
||
## How to build (MacOS and Linux) | ||
|
||
This step couldn't be tested, if you test it email me or create an issue saying | ||
if it works or not. | ||
|
||
``` | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make | ||
``` | ||
|
||
|
||
## Contributors | ||
|
||
* Matheus Faria (matheus.sousa.faria@gmail.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -- FreeGLUT 3 -- | ||
set(FREEGLUT_BUILD_SHARED_LIBS OFF) | ||
add_subdirectory(freeglut3) | ||
set(FreeGLUT3_INCLUDE_DIRS "deps/freeglut3/include" PARENT_SCOPE) | ||
|
||
# -- GLEW 2 -- | ||
add_subdirectory("glew2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Makefile.in | ||
Makefile | ||
INSTALL | ||
.deps | ||
aclocal.m4 | ||
autom4te.cache | ||
compile | ||
config.guess | ||
config.sub | ||
configure | ||
configure.cache | ||
config.log | ||
config.status | ||
# config.h.in is now static and used with CMake, keep it: | ||
#config.h.in | ||
config.h | ||
depcomp | ||
install-sh | ||
ltmain.sh | ||
missing | ||
stamp-h1 | ||
*.tar | ||
*.tar.gz | ||
*.tar.bz2 | ||
*.zip | ||
*.o | ||
*.a | ||
*~ | ||
# my build dirs: | ||
cross-android | ||
cross-woe | ||
native |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Pawel W. Olszta <olszta@sourceforge.net> | ||
the person to be blamed for freeglut | ||
|
||
Andreas Umbach <marvin@dataway.ch> | ||
the first person to contribute to the freeglut project, | ||
contributed the cube and sphere geometry code | ||
|
||
Steve Baker <sjbaker1@airmail.net> | ||
joystick code (from his great PLIB), numerous hints | ||
tips on the freeglut usability | ||
and for taking the project over when Pawel bowed out | ||
|
||
Christopher John Purnell | ||
Don Heyse | ||
Dave McClurg | ||
John F. Fay | ||
Norman Vine | ||
Daniel Wagner | ||
Sven Panne <sven.panne@aedion.de> | ||
contributing to the project, using the product, and generally keeping it going | ||
|
||
Brian Paul | ||
Eric Sandall | ||
giving us the oomph! to make an official release | ||
|
||
James 'J.C.' Jones | ||
designing the new website | ||
|
||
John Tsiombikas <nuclear@member.fsf.org> | ||
Linux spaceball support, XR&R gamemode, misc linux fixes and breakages | ||
|
||
Sylvain Beucler | ||
support for Android, X11/EGL, OpenGL(ES) 2.x, misc fixes | ||
|
||
Diederick C. Niehorster | ||
Chris Marshall | ||
Clive McCarthy | ||
Eero Pajarre | ||
Florian Echtler | ||
Matti Lehtonen | ||
|
||
Vincent Simonetti | ||
support for BlackBerry | ||
|
||
...and all the opengl-gamedev-l people that made Pawel start this project :) |
Oops, something went wrong.