-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 8634958
Showing
102 changed files
with
12,140 additions
and
0 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,2 @@ | ||
build | ||
CMakeLists.txt.user |
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,27 @@ | ||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) | ||
PROJECT(xdog-demo) | ||
|
||
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ) | ||
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE) | ||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
|
||
INCLUDE(Utils) | ||
INCLUDE(SetupCPack) | ||
|
||
INCLUDE(CPack) | ||
CONFIGURE_FILE(version.h.in ${PROJECT_BINARY_DIR}/version.h @ONLY) | ||
|
||
INCLUDE(SetupCUDA) | ||
|
||
FIND_PACKAGE(Libav QUIET) | ||
IF(LIBAV_FOUND) | ||
ADD_DEFINITIONS(/DHAVE_LIBAV) | ||
ENDIF() | ||
|
||
FIND_PACKAGE(Qt4) | ||
|
||
ADD_SUBDIRECTORY(gpu) | ||
ADD_SUBDIRECTORY(src) | ||
ADD_SUBDIRECTORY(util) |
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 @@ | ||
@echo off | ||
cd /d %~dp0 | ||
cmake -E make_directory build || exit /B 1 | ||
cd build | ||
if "%1"=="x64" ( | ||
cmake -G "Visual Studio 9 2008 Win64" .. || exit /B 1 | ||
) else ( | ||
cmake -G "Visual Studio 9 2008" .. || exit /B 1 | ||
) | ||
cmake --build . --config Release || exit /B 1 | ||
cpack --config CPackConfig.cmake || exit /B 1 | ||
cd /d %~dp0 |
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,6 @@ | ||
#!/bin/sh | ||
cmake -E make_directory build | ||
cd build | ||
cmake .. | ||
make | ||
cpack --config CPackConfig.cmake |
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,58 @@ | ||
# LIBAV_FOUND - system has Libav libraries | ||
# LIBAV_INCLUDE_DIR - the Libav include directory | ||
# LIBAV_LIBRARIES - link these to use Libav | ||
|
||
IF(WIN32) | ||
FIND_PATH( LIBAV_DIR include/libavformat/avformat.h PATH_SUFFIXES .. ) | ||
GET_FILENAME_COMPONENT(LIBAV_DIR ${LIBAV_DIR} ABSOLUTE ) | ||
SET(LIBAV_DIR ${LIBAV_DIR} CACHE FILEPATH "" FORCE) | ||
|
||
FIND_PATH( LIBAV_INCLUDE_DIR libavformat/avformat.h HINTS ${LIBAV_DIR}/include ) | ||
|
||
FIND_LIBRARY( LIBAV_avutil_LIBRARY avutil HINTS ${LIBAV_DIR}/lib ) | ||
FIND_LIBRARY( LIBAV_avcodec_LIBRARY avcodec HINTS ${LIBAV_DIR}/lib ) | ||
FIND_LIBRARY( LIBAV_avformat_LIBRARY avformat HINTS ${LIBAV_DIR}/lib ) | ||
FIND_LIBRARY( LIBAV_swscale_LIBRARY swscale HINTS ${LIBAV_DIR}/lib ) | ||
|
||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBAV DEFAULT_MSG | ||
LIBAV_INCLUDE_DIR | ||
LIBAV_avutil_LIBRARY | ||
LIBAV_avcodec_LIBRARY | ||
LIBAV_avformat_LIBRARY | ||
LIBAV_swscale_LIBRARY ) | ||
|
||
IF(LIBAV_FOUND) | ||
SET(LIBAV_LIBRARIES | ||
${LIBAV_avcodec_LIBRARY} | ||
${LIBAV_avformat_LIBRARY} | ||
${LIBAV_avutil_LIBRARY} | ||
${LIBAV_swscale_LIBRARY} ) | ||
ENDIF() | ||
ELSE() | ||
INCLUDE(FindPkgConfig) | ||
PKG_CHECK_MODULES( LIBAV_PKGCONF QUIET libavutil libavcodec libavformat libswscale ) | ||
|
||
FIND_PATH(LIBAV_INCLUDE_DIR libavformat/avformat.h HINTS ${LIBAV_PKGCONG_INCLUDE_DIRS}) | ||
|
||
FIND_LIBRARY( LIBAV_avutil_LIBRARY avutil HINTS ${LIBAV_PKGCONF_LIBRARY_DIRS} ) | ||
FIND_LIBRARY( LIBAV_avcodec_LIBRARY avcodec HINTS ${LIBAV_PKGCONF_LIBRARY_DIRS} ) | ||
FIND_LIBRARY( LIBAV_avformat_LIBRARY avformat HINTS ${LIBAV_PKGCONF_LIBRARY_DIRS} ) | ||
FIND_LIBRARY( LIBAV_swscale_LIBRARY swscale HINTS ${LIBAV_PKGCONF_LIBRARY_DIRS} ) | ||
|
||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBAV DEFAULT_MSG | ||
LIBAV_INCLUDE_DIR | ||
LIBAV_avcodec_LIBRARY | ||
LIBAV_avformat_LIBRARY | ||
LIBAV_avutil_LIBRARY | ||
LIBAV_swscale_LIBRARY ) | ||
|
||
IF(LIBAV_FOUND) | ||
SET(LIBAV_LIBRARIES | ||
${LIBAV_avcodec_LIBRARY} | ||
${LIBAV_avformat_LIBRARY} | ||
${LIBAV_avutil_LIBRARY} | ||
${LIBAV_swscale_LIBRARY} | ||
${LIBAV_PKGCONF_LDFLAGS_OTHER} ) | ||
ENDIF() | ||
ENDIF() | ||
|
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,47 @@ | ||
SET(CPACK_PACKAGE_VERSION_MAJOR "0") | ||
SET(CPACK_PACKAGE_VERSION_MINOR "0") | ||
SET(CPACK_PACKAGE_VERSION_PATCH "0") | ||
IF(APPLE) | ||
SET(CPACK_GENERATOR "DragNDrop") | ||
ELSE() | ||
SET(CPACK_GENERATOR "ZIP") | ||
ENDIF() | ||
set(CPACK_SOURCE_GENERATOR ZIP) | ||
|
||
IF(EXISTS ${PROJECT_SOURCE_DIR}/.git) | ||
FIND_PROGRAM(git_PROG NAMES git git.cmd) | ||
MARK_AS_ADVANCED(git_PROG) | ||
IF(git_PROG) | ||
EXECUTE_PROCESS( | ||
COMMAND ${git_PROG} describe --long | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||
OUTPUT_VARIABLE git_OUTPUT | ||
RESULT_VARIABLE git_RESULT) | ||
IF(${git_RESULT} EQUAL 0) | ||
STRING(REGEX REPLACE "v([0-9])+.[0-9]+-[0-9]+-g[0-9a-f]+.*" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${git_OUTPUT}") | ||
STRING(REGEX REPLACE "v[0-9]+.([0-9])+-[0-9]+-g[0-9a-f]+.*" "\\1" CPACK_PACKAGE_VERSION_MINOR "${git_OUTPUT}") | ||
STRING(REGEX REPLACE "v[0-9]+.[0-9]+-([0-9]+-g[0-9a-f]+).*" "\\1" CPACK_PACKAGE_VERSION_PATCH "${git_OUTPUT}") | ||
ELSE() | ||
MESSAGE(WARNING ${git_OUTPUT}) | ||
ENDIF() | ||
ENDIF() | ||
ENDIF() | ||
|
||
SET(CPACK_PACKAGE_VERSION "v${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_PACKAGE_VERSION_PATCH}") | ||
MESSAGE(STATUS "VERSION: ${CPACK_PACKAGE_VERSION}") | ||
|
||
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) | ||
IF(${CPACK_SYSTEM_NAME} MATCHES Windows) | ||
IF(CMAKE_CL_64) | ||
SET(CPACK_SYSTEM_NAME win64) | ||
ELSE() | ||
SET(CPACK_SYSTEM_NAME win32) | ||
ENDIF() | ||
ENDIF() | ||
IF(${CPACK_SYSTEM_NAME} MATCHES Darwin) | ||
SET(CPACK_SYSTEM_NAME mac) | ||
ENDIF() | ||
|
||
SET(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}) | ||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-src") | ||
SET(CPACK_SOURCE_IGNORE_FILES "/build/;/.git/") |
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,28 @@ | ||
SET(CUDA_ARCH "sm_10" CACHE STRING "CUDA architecture") | ||
SET_PROPERTY(CACHE CUDA_ARCH PROPERTY STRINGS sm_10 sm_11 sm_20 sm_21 none) | ||
IF(NOT (${CUDA_ARCH} STREQUAL none)) | ||
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};;-arch=${CUDA_ARCH}") | ||
ENDIF() | ||
OPTION(CUDA_PTXAS_VERBOSE "Show ptxas verbose information" OFF) | ||
IF(${CUDA_PTXAS_VERBOSE}) | ||
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};;--ptxas-options=-v") | ||
ENDIF() | ||
FIND_PACKAGE(CUDA 4.0 REQUIRED) | ||
|
||
IF(WIN32) | ||
IF(CMAKE_CL_64) | ||
SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib/x64") | ||
ELSE() | ||
SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib/Win32") | ||
ENDIF() | ||
ELSEIF(APPLE) | ||
SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib") | ||
ELSE() | ||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib64") | ||
ELSE() | ||
SET(CUDA_LIB_DIR "${CUDA_TOOLKIT_ROOT_DIR}/lib") | ||
ENDIF() | ||
ENDIF() | ||
FIND_LIBRARY(CUDA_npp_LIBRARY npp HINTS "${CUDA_LIB_DIR}") | ||
FIND_LIBRARY(CUDA_curand_LIBRARY curand HINTS "${CUDA_LIB_DIR}") |
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,91 @@ | ||
MACRO(QT4_AUTO_WRAP outfiles) | ||
FOREACH(fileName ${ARGN}) | ||
IF(fileName MATCHES "\\.h$") | ||
FILE(STRINGS ${fileName} lines REGEX Q_OBJECT) | ||
IF(lines) | ||
SET(moc_headers ${moc_headers} ${fileName}) | ||
#MESSAGE(STATUS "moc: ${fileName}") | ||
ENDIF() | ||
ENDIF() | ||
IF(fileName MATCHES "\\.ui$") | ||
SET(ui_files ${ui_files} ${fileName}) | ||
#MESSAGE(STATUS "uic: ${fileName}") | ||
ENDIF() | ||
IF(fileName MATCHES "\\.qrc$") | ||
SET(qrc_files ${qrc_files} ${fileName}) | ||
#MESSAGE(STATUS "qrc: ${fileName}") | ||
ENDIF() | ||
ENDFOREACH() | ||
QT4_WRAP_CPP(${outfiles} ${moc_headers}) | ||
QT4_WRAP_UI(${outfiles} ${ui_files}) | ||
QT4_ADD_RESOURCES(${outfiles} ${qrc_files}) | ||
ENDMACRO() | ||
|
||
|
||
MACRO(SOURCE_GROUP_BY_PATH) | ||
FOREACH(filename ${ARGV}) | ||
GET_FILENAME_COMPONENT(path "${filename}" REALPATH) | ||
FILE(RELATIVE_PATH path ${PROJECT_SOURCE_DIR} ${path}) | ||
GET_FILENAME_COMPONENT(path "${path}" PATH) | ||
string(REPLACE "/" "\\" path "${path}") | ||
IF(${filename} MATCHES "ui_|cxx$") | ||
SOURCE_GROUP("generated" FILES ${filename}) | ||
ELSEIF(${filename} MATCHES "h$|hpp$|cpp$|c$|cu$|ui$|qrc$") | ||
SOURCE_GROUP("${path}" FILES ${filename}) | ||
ENDIF() | ||
ENDFOREACH() | ||
ENDMACRO(SOURCE_GROUP_BY_PATH) | ||
|
||
|
||
MACRO(DEPLOY_QT_CUDA target) | ||
IF(WIN32) | ||
INSTALL(CODE " | ||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/qt.conf\" \"\") | ||
include(BundleUtilities) | ||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${target}.exe\" \"\" \"\") | ||
" COMPONENT Runtime) | ||
ELSEIF(APPLE) | ||
INSTALL(CODE " | ||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${target}.app/Contents/Resources/qt.conf\" \"\") | ||
include(BundleUtilities) | ||
function(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var) | ||
IF (\${item} STREQUAL \"@rpath/libcudart.dylib\") | ||
#message(\"RI: \${item} \${\${resolved_item_var}} \${\${resolved_var}}\") | ||
set(\${resolved_item_var} \"/usr/local/cuda/lib/libcudart.dylib\" PARENT_SCOPE) | ||
set(\${resolved_var} 1 PARENT_SCOPE) | ||
ENDIF() | ||
IF (\${item} STREQUAL \"@rpath/libcurand.dylib\") | ||
#message(\"RI: \${item} \${\${resolved_item_var}} \${\${resolved_var}}\") | ||
set(\${resolved_item_var} \"/usr/local/cuda/lib/libcurand.dylib\" PARENT_SCOPE) | ||
set(\${resolved_var} 1 PARENT_SCOPE) | ||
ENDIF() | ||
IF (\${item} STREQUAL \"@rpath/libnpp.dylib\") | ||
#message(\"RI: \${item} \${\${resolved_item_var}} \${\${resolved_var}}\") | ||
set(\${resolved_item_var} \"/usr/local/cuda/lib/libnpp.dylib\" PARENT_SCOPE) | ||
set(\${resolved_var} 1 PARENT_SCOPE) | ||
ENDIF() | ||
IF (\${item} STREQUAL \"@rpath/libtlshook.dylib\") | ||
#message(\"RI: \${item} \${\${resolved_item_var}} \${\${resolved_var}}\") | ||
set(\${resolved_item_var} \"/usr/local/cuda/lib/libtlshook.dylib\" PARENT_SCOPE) | ||
set(\${resolved_var} 1 PARENT_SCOPE) | ||
ENDIF() | ||
endfunction() | ||
function(gp_resolved_file_type_override file type_var) | ||
IF(\${file} MATCHES \"(CUDA.framework|libcuda.dylib)\") | ||
#message(\"GP: \${file} \${\${type_var}}\") | ||
set(\${type_var} \"system\" PARENT_SCOPE) | ||
ENDIF() | ||
endfunction() | ||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${target}.app\" \"\" \"\") | ||
" COMPONENT Runtime) | ||
ENDIF() | ||
ENDMACRO() | ||
|
||
|
||
IF(WIN32) | ||
OPTION(INSTALL_MSVCRT "Install Microsoft CRT" OFF) | ||
IF(${INSTALL_MSVCRT}) | ||
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".") | ||
INCLUDE(InstallRequiredSystemLibraries) | ||
ENDIF() | ||
ENDIF() |
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,3 @@ | ||
FILE(GLOB sources *.cpp *.h *.cu) | ||
CUDA_ADD_LIBRARY(gpu ${sources}) | ||
SOURCE_GROUP(src REGULAR_EXPRESSION "c$|cpp$|hpp$|h$|ui$|qrc$|cu$") |
Oops, something went wrong.