Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFlynt committed Sep 3, 2021
1 parent d8faec5 commit f33fcdc
Show file tree
Hide file tree
Showing 14 changed files with 17,934 additions and 29 deletions.
41 changes: 12 additions & 29 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
# Prerequisites
*.d
#
# Files to ignore from git repo
#

# Compiled Object files
*.slo
*.lo
*.o
*.obj
# User created build directory if exists
build/*

# Precompiled Headers
*.gch
*.pch
# Eclipse Project Files
.project
.cproject
.pydevproject
.settings

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
# VSCode Files
.vscode
120 changes: 120 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#---------------------------------------------------------------------
# Build System for xstd
#---------------------------------------------------------------------
cmake_minimum_required(VERSION 3.1)
project(polycalc VERSION 1.0.0 LANGUAGES CXX)

#---------------------------------------------------------------------
# User Configure Build Process
#---------------------------------------------------------------------
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_COLOR_MAKEFILE TRUE)
set(DEFAULT_BUILD_TYPE "Release")

#---------------------------------------------------------------------
# Set location of *.cmake modules
#---------------------------------------------------------------------
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

#---------------------------------------------------------------------
# Force build in seperate directory
#---------------------------------------------------------------------
include(PreventInSourceBuilds)

#---------------------------------------------------------------------
# Locations of Installation (CMAKE_INSTALL_PREFIX)
#---------------------------------------------------------------------
#set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})

#---------------------------------------------------------------------
# Directory Report
#---------------------------------------------------------------------
message(VERBOSE "")
message(VERBOSE "--------------------- Directory Report -----------------------")
message(VERBOSE " ") # CMAKE directories are from top level CMakeLists.txt
message(VERBOSE "Top Level Directories:")
message(VERBOSE "CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}")
message(VERBOSE "CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}")
message(VERBOSE " ") # PROJECT directories are for recent project call
message(VERBOSE "Project Level Directories:")
message(VERBOSE "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
message(VERBOSE "PROJECT_BINARY_DIR = ${PROJECT_BINARY_DIR}")
message(VERBOSE " ") # My installation directories
message(VERBOSE "Installation Directories:")
message(VERBOSE "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")


#---------------------------------------------------------------------
# Locations of Installation & Report
#---------------------------------------------------------------------

# Source locations in source tree
set(MY_PROJECT_PREFIX ${PROJECT_SOURCE_DIR})
set(MY_PROJECT_INCDIR ${MY_PROJECT_PREFIX}/include)
set(MY_PROJECT_TSTDIR ${MY_PROJECT_PREFIX}/test)
set(MY_PROJECT_DOCDIR ${MY_PROJECT_PREFIX}/docs)

# Where to place all libraries
set(MY_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
set(MY_INSTALL_INCDIR ${MY_INSTALL_PREFIX}/include)
set(MY_INSTALL_TSTDIR ${MY_INSTALL_PREFIX}/test)
set(MY_INSTALL_DOCDIR ${MY_INSTALL_PREFIX}/docs)

message(STATUS " ")
message(STATUS "Using Directories:")
message(STATUS "--- Original Locations ---")
message(STATUS "MY_PROJECT_PREFIX = ${MY_PROJECT_PREFIX}")
message(STATUS "MY_PROJECT_INCDIR = ${MY_PROJECT_INCDIR}")
message(STATUS "MY_PROJECT_TSTDIR = ${MY_PROJECT_TSTDIR}")
message(STATUS "MY_PROJECT_DOCDIR = ${MY_PROJECT_DOCDIR}")
message(STATUS " ")
message(STATUS "--- Installation Locations ---")
message(STATUS "MY_INSTALL_PREFIX = ${MY_INSTALL_PREFIX}")
message(STATUS "MY_INSTALL_INCDIR = ${MY_INSTALL_INCDIR}")
message(STATUS "MY_INSTALL_TSTDIR = ${MY_INSTALL_TSTDIR}")
message(STATUS "MY_INSTALL_DOCDIR = ${MY_INSTALL_DOCDIR}")

#
#---------------------------------------------------------------------
# Compiler Feature Detection & Selection
#---------------------------------------------------------------------
#
message("")
message("--------------- Compiler Feature Detection -----------------")
message("")
message("CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}")
message("CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
message("CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}")
message("")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

#---------------------------------------------------------------------
# Detect Library includes, flags, etc.
#---------------------------------------------------------------------
message(VERBOSE "")
message(VERBOSE "================================================================")
message(VERBOSE " Searching for Libraries ")
message(VERBOSE "================================================================")
if(${CMAKE_VERSION} VERSION_GREATER "3.11.999")
cmake_policy(SET CMP0074 NEW) # find_package search <name>_ROOT
endif()

find_package(Doxygen)

#---------------------------------------------------------------------
#
#---------------------------------------------------------------------

# Build Libraries & Applications
add_subdirectory(src)

# Build Tests for Libraries
enable_testing()
add_subdirectory(test)

# Build Documentation (DOxygen)
if(DOXYGEN_FOUND)
# add_subdirectory(docs)
endif()
47 changes: 47 additions & 0 deletions cmake/PreventInSourceBuilds.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# This function will prevent in-source builds
function(AssureOutOfSourceBuilds)
# make sure the user doesn't play dirty with symlinks
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)

# disallow in-source builds
if("${srcdir}" STREQUAL "${bindir}")
message("######################################################")
message("# Should not be configured & built in the source directory")
message("# You must run cmake in a build directory.")
message("#")
message("# For example:")
message("# mkdir cxxstd-sandbox ; cd cxxstd-sandbox")
message("# git clone https://[email protected]/bryan_flynt/cxxstd.git")
message("# mkdir build")
message("# this will create the following directory structure")
message("#")
message("# cxxstd-sandbox")
message("# +--cxxstd")
message("# +--build")
message("#")
message("# Then you can proceed to configure and build")
message("# by using the following commands")
message("#")
message("# cd build")
message("# cmake ../cxxstd # or ccmake, or cmake-gui ")
message("# make")
message("#")
message("# NOTE: Given that you already tried to make an in-source build")
message("# CMake have already created several files & directories")
message("# in your source tree. run 'git status' to find them and")
message("# remove them by doing:")
message("#")
message("# cd cxxstd-sandbox/cxxstd")
message("# git clean -n -d")
message("# git clean -f -d")
message("# git checkout --")
message("#")
message("######################################################")
message(FATAL_ERROR "Quitting configuration")
endif()
endfunction()

AssureOutOfSourceBuilds()

Loading

0 comments on commit f33fcdc

Please sign in to comment.