Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create project structure based on cmake-init (ab6df11fbf9771a29261083…
…eb7feb8a20f3d839e)
- Loading branch information
Stefan Buschmann
committed
Feb 18, 2017
0 parents
commit 50b2c6a
Showing
362 changed files
with
158,237 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,38 @@ | ||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
|
||
# Build dir | ||
build* | ||
debug_build | ||
release_build | ||
/bin | ||
/lib | ||
/install | ||
|
||
# Qt cache | ||
CMakeLists.txt.user | ||
CMakeLists.txt.user.* | ||
|
||
# IDE project files | ||
*.sublime-project | ||
*.sublime-workspace | ||
|
||
# Local config windows | ||
_configure.bat | ||
_open-project.bat | ||
_start-cmake-gui.bat | ||
_start-cmd.bat | ||
|
||
# Local config unix | ||
.localconfig |
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,38 @@ | ||
language: cpp | ||
|
||
sudo: required | ||
dist: trusty | ||
|
||
os: | ||
- linux | ||
- osx | ||
|
||
compiler: | ||
- gcc | ||
- clang | ||
|
||
env: | ||
global: | ||
- CMAKE_OPTIONS="-DOPTION_BUILD_EXAMPLES=On" | ||
matrix: | ||
- CMAKE_CONFIGURATION=release BUILD_DIR=build | ||
- CMAKE_CONFIGURATION=debug BUILD_DIR=build-debug | ||
|
||
matrix: | ||
exclude: | ||
- os: osx | ||
compiler: gcc | ||
|
||
before_install: | ||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -qq cmake qt5-default cppcheck clang-tidy-3.8; fi | ||
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install qt5 cppcheck; fi | ||
|
||
before_script: | ||
- ./configure | ||
- if [ $CMAKE_CONFIGURATION == release ]; then ./configure; fi | ||
- if [ $CMAKE_CONFIGURATION == debug ]; then ./configure debug; fi | ||
|
||
script: | ||
- cmake --build $BUILD_DIR | ||
- cmake --build $BUILD_DIR --target test | ||
- cmake --build $BUILD_DIR --target check-all |
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 @@ | ||
|
||
Stefan Buschmann <stefan.buschmann@hpi.de> <buschmann@cginternals.com> | ||
Daniel Limberger <daniel.limberger@hpi.de> <limberger@cginternals.com> | ||
Willy Scheibel <willy.scheibel@hpi.de> <scheibel@cginternals.com> | ||
|
||
Thanks to all Contributors |
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,192 @@ | ||
|
||
# | ||
# CMake options | ||
# | ||
|
||
# CMake version | ||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR) | ||
|
||
# Include cmake modules | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
include(GenerateExportHeader) | ||
|
||
set(WriterCompilerDetectionHeaderFound NOTFOUND) | ||
# This module is only available with CMake >=3.1, so check whether it could be found | ||
# BUT in CMake 3.1 this module doesn't recognize AppleClang as compiler, so just use it as of CMake 3.2 | ||
if (${CMAKE_VERSION} VERSION_GREATER "3.2") | ||
include(WriteCompilerDetectionHeader OPTIONAL RESULT_VARIABLE WriterCompilerDetectionHeaderFound) | ||
endif() | ||
|
||
include(cmake/GetGitRevisionDescription.cmake) | ||
include(cmake/Custom.cmake) | ||
include(cmake/HealthCheck.cmake) | ||
|
||
# Set policies | ||
set_policy(CMP0028 NEW) # ENABLE CMP0028: Double colon in target name means ALIAS or IMPORTED target. | ||
set_policy(CMP0054 NEW) # ENABLE CMP0054: Only interpret if() arguments as variables or keywords when unquoted. | ||
set_policy(CMP0042 NEW) # ENABLE CMP0042: MACOSX_RPATH is enabled by default. | ||
set_policy(CMP0063 NEW) # ENABLE CMP0063: Honor visibility properties for all target types. | ||
|
||
|
||
# | ||
# Project description and (meta) information | ||
# | ||
|
||
# Get git revision | ||
get_git_head_revision(GIT_REFSPEC GIT_SHA1) | ||
string(SUBSTRING "${GIT_SHA1}" 0 12 GIT_REV) | ||
if(NOT GIT_SHA1) | ||
set(GIT_REV "0") | ||
endif() | ||
|
||
# Meta information about the project | ||
set(META_PROJECT_NAME "cppfs") | ||
set(META_PROJECT_DESCRIPTION "Cross-platform C++ file system library supporting multiple backends (Local-FS, SSH)") | ||
set(META_AUTHOR_ORGANIZATION "CG Internals GmbH") | ||
set(META_AUTHOR_DOMAIN "https://github.com/cginternals/cppfs/") | ||
set(META_AUTHOR_MAINTAINER "opensource@cginternals.com") | ||
set(META_VERSION_MAJOR "0") | ||
set(META_VERSION_MINOR "9") | ||
set(META_VERSION_PATCH "0") | ||
set(META_VERSION_REVISION "${GIT_REV}") | ||
set(META_VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}") | ||
set(META_NAME_VERSION "${META_PROJECT_NAME} v${META_VERSION} (${META_VERSION_REVISION})") | ||
set(META_CMAKE_INIT_SHA "${GIT_SHA1}") | ||
|
||
string(MAKE_C_IDENTIFIER ${META_PROJECT_NAME} META_PROJECT_ID) | ||
string(TOUPPER ${META_PROJECT_ID} META_PROJECT_ID) | ||
|
||
|
||
# | ||
# Project configuration options | ||
# | ||
|
||
# Project options | ||
option(BUILD_SHARED_LIBS "Build shared instead of static libraries." ON) | ||
option(OPTION_SELF_CONTAINED "Create a self-contained install with all dependencies." OFF) | ||
option(OPTION_BUILD_TESTS "Build tests." ON) | ||
option(OPTION_BUILD_DOCS "Build documentation." OFF) | ||
option(OPTION_BUILD_EXAMPLES "Build examples." OFF) | ||
|
||
|
||
# | ||
# Declare project | ||
# | ||
|
||
# Generate folders for IDE targets (e.g., VisualStudio solutions) | ||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
set(IDE_FOLDER "") | ||
|
||
# Declare project | ||
project(${META_PROJECT_NAME} C CXX) | ||
|
||
# Set output directories | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) | ||
|
||
# Create version file | ||
file(WRITE "${PROJECT_BINARY_DIR}/VERSION" "${META_NAME_VERSION}") | ||
|
||
|
||
# | ||
# Compiler settings and options | ||
# | ||
|
||
include(cmake/CompileOptions.cmake) | ||
|
||
|
||
# | ||
# Project Health Check Setup | ||
# | ||
|
||
enable_cppcheck(On) | ||
enable_clang_tidy(On) | ||
|
||
|
||
# | ||
# Deployment/installation setup | ||
# | ||
|
||
# Get project name | ||
set(project ${META_PROJECT_NAME}) | ||
|
||
# Check for system dir install | ||
set(SYSTEM_DIR_INSTALL FALSE) | ||
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local") | ||
set(SYSTEM_DIR_INSTALL TRUE) | ||
endif() | ||
|
||
# Installation paths | ||
if(UNIX AND SYSTEM_DIR_INSTALL) | ||
# Install into the system (/usr/bin or /usr/local/bin) | ||
set(INSTALL_ROOT "share/${project}") # /usr/[local]/share/<project> | ||
set(INSTALL_CMAKE "share/${project}/cmake") # /usr/[local]/share/<project>/cmake | ||
set(INSTALL_EXAMPLES "share/${project}") # /usr/[local]/share/<project> | ||
set(INSTALL_DATA "share/${project}") # /usr/[local]/share/<project> | ||
set(INSTALL_BIN "bin") # /usr/[local]/bin | ||
set(INSTALL_SHARED "lib") # /usr/[local]/lib | ||
set(INSTALL_LIB "lib") # /usr/[local]/lib | ||
set(INSTALL_INCLUDE "include") # /usr/[local]/include | ||
set(INSTALL_DOC "share/doc/${project}") # /usr/[local]/share/doc/<project> | ||
set(INSTALL_SHORTCUTS "share/applications") # /usr/[local]/share/applications | ||
set(INSTALL_ICONS "share/pixmaps") # /usr/[local]/share/pixmaps | ||
set(INSTALL_INIT "/etc/init") # /etc/init (upstart init scripts) | ||
else() | ||
# Install into local directory | ||
set(INSTALL_ROOT ".") # ./ | ||
set(INSTALL_CMAKE "cmake") # ./cmake | ||
set(INSTALL_EXAMPLES ".") # ./ | ||
set(INSTALL_DATA ".") # ./ | ||
set(INSTALL_BIN ".") # ./ | ||
set(INSTALL_SHARED "lib") # ./lib | ||
set(INSTALL_LIB "lib") # ./lib | ||
set(INSTALL_INCLUDE "include") # ./include | ||
set(INSTALL_DOC "doc") # ./doc | ||
set(INSTALL_SHORTCUTS "misc") # ./misc | ||
set(INSTALL_ICONS "misc") # ./misc | ||
set(INSTALL_INIT "misc") # ./misc | ||
endif() | ||
|
||
# Set runtime path | ||
set(CMAKE_SKIP_BUILD_RPATH FALSE) # Add absolute path to all dependencies for BUILD | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # Use CMAKE_INSTALL_RPATH for INSTALL | ||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) # Do NOT add path to dependencies for INSTALL | ||
|
||
if(NOT SYSTEM_DIR_INSTALL) | ||
# Find libraries relative to binary | ||
if(APPLE) | ||
set(CMAKE_INSTALL_RPATH "@loader_path/../../../${INSTALL_LIB}") | ||
else() | ||
set(CMAKE_INSTALL_RPATH "$ORIGIN/${INSTALL_LIB}") | ||
endif() | ||
endif() | ||
|
||
|
||
# | ||
# Project modules | ||
# | ||
|
||
add_subdirectory(source) | ||
add_subdirectory(docs) | ||
add_subdirectory(deploy) | ||
|
||
|
||
# | ||
# Deployment (global project files) | ||
# | ||
|
||
# Install version file | ||
install(FILES "${PROJECT_BINARY_DIR}/VERSION" DESTINATION ${INSTALL_ROOT} COMPONENT runtime) | ||
|
||
# Install cmake find script for the project | ||
install(FILES ${META_PROJECT_NAME}-config.cmake DESTINATION ${INSTALL_ROOT} COMPONENT dev) | ||
|
||
# Install the project meta files | ||
install(FILES AUTHORS DESTINATION ${INSTALL_ROOT} COMPONENT runtime) | ||
install(FILES LICENSE DESTINATION ${INSTALL_ROOT} COMPONENT runtime) | ||
install(FILES README.md DESTINATION ${INSTALL_ROOT} COMPONENT runtime) | ||
|
||
# Install runtime data | ||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/data DESTINATION ${INSTALL_DATA} COMPONENT runtime) |
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,8 @@ | ||
|
||
Copyright (c) 2017-2017 Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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 @@ | ||
# Cross-platform C++ file system library supporting multiple backends (Local-FS, SSH) |
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,49 @@ | ||
|
||
# | ||
# Get cmake-init latest commit SHA on master | ||
# | ||
|
||
file(DOWNLOAD | ||
"https://api.github.com/repos/cginternals/cmake-init/commits/master" | ||
"${PROJECT_BINARY_DIR}/cmake-init.github.data" | ||
) | ||
file(READ | ||
"${PROJECT_BINARY_DIR}/cmake-init.github.data" | ||
CMAKE_INIT_INFO | ||
) | ||
|
||
string(REGEX MATCH | ||
"\"sha\": \"([0-9a-f]+)\"," | ||
CMAKE_INIT_SHA | ||
${CMAKE_INIT_INFO}) | ||
|
||
string(SUBSTRING | ||
${CMAKE_INIT_SHA} | ||
8 | ||
40 | ||
CMAKE_INIT_SHA | ||
) | ||
|
||
# | ||
# Get latest cmake-init commit on this repository | ||
# | ||
|
||
# APPLIED_CMAKE_INIT_SHA can be set by parent script | ||
if(NOT APPLIED_CMAKE_INIT_SHA) | ||
# [TODO]: Get from git commit list (see cmake_init/source/scripts/check_template.sh) | ||
set(APPLIED_CMAKE_INIT_SHA "") | ||
endif () | ||
|
||
if("${APPLIED_CMAKE_INIT_SHA}" STREQUAL "") | ||
message(WARNING | ||
"No cmake-init version detected, could not verify up-to-dateness. " | ||
"Set the cmake-init version by defining a META_CMAKE_INIT_SHA for your project." | ||
) | ||
return() | ||
endif() | ||
|
||
if(${APPLIED_CMAKE_INIT_SHA} STREQUAL ${CMAKE_INIT_SHA}) | ||
message(STATUS "cmake-init template is up-to-date (${CMAKE_INIT_SHA})") | ||
else() | ||
message(STATUS "cmake-init template needs an update https://github.com/cginternals/cmake-init/compare/${APPLIED_CMAKE_INIT_SHA}...master") | ||
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,18 @@ | ||
|
||
# Function to register a target for clang-tidy | ||
function(perform_clang_tidy check_target target) | ||
set(includes "$<TARGET_PROPERTY:${target},INCLUDE_DIRECTORIES>") | ||
|
||
add_custom_target( | ||
${check_target} | ||
COMMAND | ||
${clang_tidy_EXECUTABLE} | ||
-p\t${PROJECT_BINARY_DIR} | ||
${ARGN} | ||
-checks=* | ||
"$<$<NOT:$<BOOL:${CMAKE_EXPORT_COMPILE_COMMANDS}>>:--\t$<$<BOOL:${includes}>:-I$<JOIN:${includes},\t-I>>>" | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
|
||
add_dependencies(${check_target} ${target}) | ||
endfunction() |
Oops, something went wrong.