forked from CIS565-Fall-2017/Project1-CUDA-Flocking
-
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 b41cfd3
Showing
300 changed files
with
89,745 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,87 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project(cis565_boids) | ||
|
||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) | ||
|
||
# Set up include and lib paths | ||
set(EXTERNAL "external") | ||
include_directories("${EXTERNAL}/include") | ||
include_directories("${EXTERNAL}/src") | ||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
set(EXTERNAL_LIB_PATH "${EXTERNAL}/lib/osx") | ||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
set(EXTERNAL_LIB_PATH "${EXTERNAL}/lib/linux" "/usr/lib64") | ||
elseif(WIN32) | ||
set(EXTERNAL_LIB_PATH "${EXTERNAL}/lib/win") | ||
endif() | ||
link_directories(${EXTERNAL_LIB_PATH}) | ||
list(APPEND CMAKE_LIBRARY_PATH "${EXTERNAL_LIB_PATH}") | ||
|
||
# Find up and set up core dependency libs | ||
|
||
set(GLFW_INCLUDE_DIR "${EXTERNAL}/include") | ||
set(GLFW_LIBRARY_DIR "${CMAKE_LIBRARY_PATH}") | ||
find_library(GLFW_LIBRARY "glfw3" HINTS "${GLFW_LIBRARY_DIR}") | ||
|
||
set(GLEW_INCLUDE_DIR "${EXTERNAL}/include") | ||
set(GLEW_LIBRARY_DIR "${CMAKE_LIBRARY_PATH}") | ||
add_definitions(-DGLEW_STATIC) | ||
find_package(GLEW) | ||
|
||
find_package(OpenGL) | ||
|
||
set(CORELIBS | ||
"${GLFW_LIBRARY}" | ||
"${OPENGL_LIBRARY}" | ||
"${GLEW_LIBRARY}" | ||
) | ||
|
||
# Enable C++11 for host code | ||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
# Enable CUDA debug info in debug mode builds | ||
list(APPEND CUDA_NVCC_FLAGS_DEBUG -G -g) | ||
|
||
# OSX-specific hacks/fixes | ||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
list(APPEND CORELIBS "-framework IOKit") | ||
list(APPEND CORELIBS "-framework Cocoa") | ||
list(APPEND CORELIBS "-framework CoreVideo") | ||
endif() | ||
|
||
# Linux-specific hacks/fixes | ||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lX11 -lXxf86vm -lXrandr -lXi") | ||
endif() | ||
|
||
# Crucial magic for CUDA linking | ||
find_package(Threads REQUIRED) | ||
find_package(CUDA REQUIRED) | ||
|
||
set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE ON) | ||
set(CUDA_SEPARABLE_COMPILATION ON) | ||
|
||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
set(CUDA_PROPAGATE_HOST_FLAGS OFF) | ||
endif() | ||
|
||
add_subdirectory(src) | ||
|
||
cuda_add_executable(${CMAKE_PROJECT_NAME} | ||
"src/main.hpp" | ||
"src/main.cpp" | ||
) | ||
|
||
target_link_libraries(${CMAKE_PROJECT_NAME} | ||
src | ||
${CORELIBS} | ||
) | ||
|
||
add_custom_command( | ||
TARGET ${CMAKE_PROJECT_NAME} | ||
PRE_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory | ||
${CMAKE_SOURCE_DIR}/shaders | ||
${CMAKE_BINARY_DIR}/shaders | ||
) |
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,31 @@ | ||
CMAKE_ALT1 := /usr/local/bin/cmake | ||
CMAKE_ALT2 := /Applications/CMake.app/Contents/bin/cmake | ||
CMAKE := $(shell \ | ||
which cmake 2>/dev/null || \ | ||
([ -e ${CMAKE_ALT1} ] && echo "${CMAKE_ALT1}") || \ | ||
([ -e ${CMAKE_ALT2} ] && echo "${CMAKE_ALT2}") \ | ||
) | ||
|
||
all: Release | ||
|
||
|
||
Debug: build | ||
(cd build && ${CMAKE} -DCMAKE_BUILD_TYPE=$@ .. && make) | ||
|
||
MinSizeRel: build | ||
(cd build && ${CMAKE} -DCMAKE_BUILD_TYPE=$@ .. && make) | ||
|
||
Release: build | ||
(cd build && ${CMAKE} -DCMAKE_BUILD_TYPE=$@ .. && make) | ||
|
||
RelWithDebugInfo: build | ||
(cd build && ${CMAKE} -DCMAKE_BUILD_TYPE=$@ .. && make) | ||
|
||
|
||
build: | ||
mkdir -p build | ||
|
||
clean: | ||
((cd build && make clean) 2>&- || true) | ||
|
||
.PHONY: all Debug MinSizeRel Release RelWithDebugInfo clean |
Oops, something went wrong.