Skip to content

Commit e4d7813

Browse files
committed
Initial release
0 parents  commit e4d7813

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3442
-0
lines changed

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Compiled Object files
2+
*.slo
3+
*.lo
4+
*.o
5+
6+
# Compiled Dynamic libraries
7+
*.so
8+
*.dylib
9+
10+
# Compiled Static libraries
11+
*.lai
12+
*.la
13+
*.a
14+
15+
# Build dir
16+
build*
17+
debug_build
18+
release_build
19+
/bin
20+
/lib
21+
/install
22+
23+
# Qt cache
24+
CMakeLists.txt.user
25+
CMakeLists.txt.user.*
26+
27+
# IDE project files
28+
*.sublime-project
29+
*.sublime-workspace
30+
31+
# Local config windows
32+
_configure.bat
33+
_open-project.bat
34+
_start-cmake-gui.bat
35+
_start-cmd.bat
36+
37+
# Local config unix
38+
.localconfig
39+
40+
# Taken screenshots
41+
screenshots/*

AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+

CMakeLists.txt

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
2+
#
3+
# CMake options
4+
#
5+
6+
# CMake version
7+
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
8+
9+
# Include cmake modules
10+
11+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
12+
set(WriterCompilerDetectionHeaderFound NOTFOUND)
13+
14+
include(GenerateExportHeader)
15+
include(ExternalProject)
16+
17+
# This module is only available with CMake >=3.1, so check whether it could be found
18+
include(WriteCompilerDetectionHeader OPTIONAL RESULT_VARIABLE WriterCompilerDetectionHeaderFound)
19+
20+
include(cmake/GetGitRevisionDescription.cmake)
21+
include(cmake/Custom.cmake)
22+
23+
# Set policies
24+
set_policy(CMP0028 NEW) # ENABLE CMP0028: Double colon in target name means ALIAS or IMPORTED target.
25+
set_policy(CMP0054 NEW) # ENABLE CMP0054: Only interpret if() arguments as variables or keywords when unquoted.
26+
set_policy(CMP0042 NEW) # ENABLE CMP0042: MACOSX_RPATH is enabled by default.
27+
set_policy(CMP0063 NEW) # ENABLE CMP0063: Honor visibility properties for all target types.
28+
29+
30+
#
31+
# Project description and (meta) information
32+
#
33+
34+
# Get git revision
35+
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
36+
string(SUBSTRING "${GIT_SHA1}" 0 12 GIT_REV)
37+
38+
# Meta information about the project
39+
set(META_PROJECT_NAME "unifiedmemory")
40+
set(META_PROJECT_DESCRIPTION "Unified Memory Heterogenous Computing Showcase")
41+
set(META_AUTHOR_ORGANIZATION "CG Internals")
42+
set(META_AUTHOR_DOMAIN "[email protected]:willy.scheibel/unifiedmemory.git")
43+
set(META_AUTHOR_MAINTAINER "[email protected]")
44+
set(META_VERSION_MAJOR "0")
45+
set(META_VERSION_MINOR "0")
46+
set(META_VERSION_PATCH "0")
47+
set(META_VERSION_REVISION "${GIT_REV}")
48+
set(META_VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}")
49+
set(META_NAME_VERSION "${META_PROJECT_NAME} v${META_VERSION} (${META_VERSION_REVISION})")
50+
51+
52+
#
53+
# Project configuration options
54+
#
55+
56+
# Project options
57+
option(BUILD_SHARED_LIBS "Build shared instead of static libraries." ON)
58+
option(OPTION_SELF_CONTAINED "Create a self-contained install with all dependencies." OFF)
59+
option(OPTION_BUILD_DOCS "Build documentation." OFF)
60+
61+
62+
#
63+
# Declare project
64+
#
65+
66+
# Generate folders for IDE targets (e.g., VisualStudio solutions)
67+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
68+
set(IDE_FOLDER "")
69+
70+
# Declare project
71+
project(${META_PROJECT_NAME} C CXX)
72+
73+
# Set output directories
74+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
75+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
76+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
77+
78+
# Create version file
79+
file(WRITE "${PROJECT_BINARY_DIR}/VERSION" "${META_NAME_VERSION}")
80+
81+
82+
#
83+
# Compiler settings and options
84+
#
85+
86+
include(cmake/CompileOptions.cmake)
87+
88+
89+
#
90+
# Deployment/installation setup
91+
#
92+
93+
# Get project name
94+
set(project ${META_PROJECT_NAME})
95+
96+
# Check for system dir install
97+
set(SYSTEM_DIR_INSTALL FALSE)
98+
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
99+
set(SYSTEM_DIR_INSTALL TRUE)
100+
endif()
101+
102+
# Installation paths
103+
if(UNIX AND SYSTEM_DIR_INSTALL)
104+
# Install into the system (/usr/bin or /usr/local/bin)
105+
set(INSTALL_ROOT "share/${project}") # /usr/[local]/share/<project>
106+
set(INSTALL_CMAKE "share/${project}/cmake") # /usr/[local]/share/<project>/cmake
107+
set(INSTALL_EXAMPLES "share/${project}") # /usr/[local]/share/<project>
108+
set(INSTALL_DATA "share/${project}") # /usr/[local]/share/<project>
109+
set(INSTALL_BIN "bin") # /usr/[local]/bin
110+
set(INSTALL_SHARED "lib") # /usr/[local]/lib
111+
set(INSTALL_LIB "lib") # /usr/[local]/lib
112+
set(INSTALL_INCLUDE "include") # /usr/[local]/include
113+
set(INSTALL_DOC "share/doc/${project}") # /usr/[local]/share/doc/<project>
114+
set(INSTALL_SHORTCUTS "share/applications") # /usr/[local]/share/applications
115+
set(INSTALL_ICONS "share/pixmaps") # /usr/[local]/share/pixmaps
116+
set(INSTALL_INIT "/etc/init") # /etc/init (upstart init scripts)
117+
else()
118+
# Install into local directory
119+
set(INSTALL_ROOT ".") # ./
120+
set(INSTALL_CMAKE "cmake") # ./cmake
121+
set(INSTALL_EXAMPLES ".") # ./
122+
set(INSTALL_DATA ".") # ./
123+
set(INSTALL_BIN ".") # ./
124+
set(INSTALL_SHARED "lib") # ./lib
125+
set(INSTALL_LIB "lib") # ./lib
126+
set(INSTALL_INCLUDE "include") # ./include
127+
set(INSTALL_DOC "doc") # ./doc
128+
set(INSTALL_SHORTCUTS "misc") # ./misc
129+
set(INSTALL_ICONS "misc") # ./misc
130+
set(INSTALL_INIT "misc") # ./misc
131+
endif()
132+
133+
# Set runtime path
134+
set(CMAKE_SKIP_BUILD_RPATH FALSE) # Add absolute path to all dependencies for BUILD
135+
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # Use CMAKE_INSTALL_RPATH for INSTALL
136+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) # Do NOT add path to dependencies for INSTALL
137+
138+
if(NOT SYSTEM_DIR_INSTALL)
139+
# Find libraries relative to binary
140+
if(APPLE)
141+
set(CMAKE_INSTALL_RPATH "@loader_path/../../../${INSTALL_LIB}")
142+
else()
143+
set(CMAKE_INSTALL_RPATH "$ORIGIN/${INSTALL_LIB}")
144+
endif()
145+
endif()
146+
147+
148+
#
149+
# Project modules
150+
#
151+
152+
add_subdirectory(source)
153+
add_subdirectory(docs)
154+
add_subdirectory(deploy)
155+
156+
157+
#
158+
# Deployment (global project files)
159+
#
160+
161+
# Install version file
162+
install(FILES "${PROJECT_BINARY_DIR}/VERSION" DESTINATION ${INSTALL_ROOT} COMPONENT runtime)
163+
164+
# Install cmake find script for the project
165+
install(FILES ${META_PROJECT_NAME}-config.cmake DESTINATION ${INSTALL_ROOT} COMPONENT dev)
166+
167+
# Install the project meta files
168+
install(FILES AUTHORS DESTINATION ${INSTALL_ROOT} COMPONENT runtime)
169+
install(FILES LICENSE DESTINATION ${INSTALL_ROOT} COMPONENT runtime)
170+
install(FILES README.md DESTINATION ${INSTALL_ROOT} COMPONENT runtime)
171+
172+
# Install runtime data
173+
install(DIRECTORY ${PROJECT_SOURCE_DIR}/data DESTINATION ${INSTALL_DATA} COMPONENT runtime)

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Copyright (c) 2017-2018 CG Internals
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Unified Memory Heterogenous Computing Showcase

cmake/CompileOptions.cmake

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
2+
#
3+
# Platform and architecture setup
4+
#
5+
6+
# Get upper case system name
7+
string(TOUPPER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME_UPPER)
8+
9+
# Determine architecture (32/64 bit)
10+
set(X64 OFF)
11+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
12+
set(X64 ON)
13+
endif()
14+
15+
16+
#
17+
# Project options
18+
#
19+
20+
set(DEFAULT_PROJECT_OPTIONS
21+
DEBUG_POSTFIX "d"
22+
CXX_STANDARD 14 # Not available before CMake 3.1; see below for manual command line argument addition
23+
LINKER_LANGUAGE "CXX"
24+
POSITION_INDEPENDENT_CODE ON
25+
CXX_VISIBILITY_PRESET "hidden"
26+
)
27+
28+
29+
#
30+
# Include directories
31+
#
32+
33+
set(DEFAULT_INCLUDE_DIRECTORIES)
34+
35+
36+
#
37+
# Libraries
38+
#
39+
40+
set(DEFAULT_LIBRARIES)
41+
42+
43+
#
44+
# Compile definitions
45+
#
46+
47+
set(DEFAULT_COMPILE_DEFINITIONS
48+
SYSTEM_${SYSTEM_NAME_UPPER}
49+
)
50+
51+
# MSVC compiler options
52+
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
53+
set(DEFAULT_COMPILE_DEFINITIONS ${DEFAULT_COMPILE_DEFINITIONS}
54+
_SCL_SECURE_NO_WARNINGS # Calling any one of the potentially unsafe methods in the Standard C++ Library
55+
_CRT_SECURE_NO_WARNINGS # Calling any one of the potentially unsafe methods in the CRT Library
56+
)
57+
endif ()
58+
59+
60+
#
61+
# Compile options
62+
#
63+
64+
set(DEFAULT_COMPILE_OPTIONS)
65+
66+
# MSVC compiler options
67+
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
68+
set(DEFAULT_COMPILE_OPTIONS ${DEFAULT_COMPILE_OPTIONS}
69+
/MP # -> build with multiple processes
70+
/W4 # -> warning level 4
71+
# /WX # -> treat warnings as errors
72+
73+
/wd4251 # -> disable warning: 'identifier': class 'type' needs to have dll-interface to be used by clients of class 'type2'
74+
/wd4592 # -> disable warning: 'identifier': symbol will be dynamically initialized (implementation limitation)
75+
# /wd4201 # -> disable warning: nonstandard extension used: nameless struct/union (caused by GLM)
76+
# /wd4127 # -> disable warning: conditional expression is constant (caused by Qt)
77+
78+
#$<$<CONFIG:Debug>:
79+
#/RTCc # -> value is assigned to a smaller data type and results in a data loss
80+
#>
81+
82+
$<$<CONFIG:Release>:
83+
/Gw # -> whole program global optimization
84+
/GS- # -> buffer security check: no
85+
/GL # -> whole program optimization: enable link-time code generation (disables Zi)
86+
/GF # -> enable string pooling
87+
>
88+
89+
# No manual c++11 enable for MSVC as all supported MSVC versions for cmake-init have C++11 implicitly enabled (MSVC >=2013)
90+
)
91+
endif ()
92+
93+
# GCC and Clang compiler options
94+
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
95+
set(DEFAULT_COMPILE_OPTIONS ${DEFAULT_COMPILE_OPTIONS}
96+
-Wall
97+
-Wextra
98+
-Wunused
99+
100+
-Wreorder
101+
-Wignored-qualifiers
102+
-Wmissing-braces
103+
-Wreturn-type
104+
-Wswitch
105+
-Wswitch-default
106+
-Wuninitialized
107+
-Wmissing-field-initializers
108+
109+
$<$<CXX_COMPILER_ID:GNU>:
110+
-Wmaybe-uninitialized
111+
112+
$<$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.8>:
113+
-Wpedantic
114+
115+
-Wreturn-local-addr
116+
>
117+
>
118+
119+
$<$<CXX_COMPILER_ID:Clang>:
120+
-Wpedantic
121+
122+
-Wreturn-stack-address
123+
>
124+
125+
$<$<PLATFORM_ID:Darwin>:
126+
-pthread
127+
>
128+
129+
# Required for CMake < 3.1; should be removed if minimum required CMake version is raised.
130+
$<$<VERSION_LESS:${CMAKE_VERSION},3.1>:
131+
-std=c++14
132+
>
133+
)
134+
endif ()
135+
136+
137+
#
138+
# Linker options
139+
#
140+
141+
set(DEFAULT_LINKER_OPTIONS)
142+
143+
# Use pthreads on mingw and linux
144+
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
145+
set(DEFAULT_LINKER_OPTIONS
146+
-pthread
147+
)
148+
endif()

cmake/ComponentInstall.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
# Execute cmake_install.cmake wrapper that allows to pass both DESTDIR and COMPONENT environment variable
3+
4+
execute_process(
5+
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=$ENV{COMPONENT} -P cmake_install.cmake
6+
)

0 commit comments

Comments
 (0)