Initial import
This commit is contained in:
commit
56a50eead3
820 changed files with 192077 additions and 0 deletions
1061
cmake_modules/FetchContent.cmake
Normal file
1061
cmake_modules/FetchContent.cmake
Normal file
File diff suppressed because it is too large
Load diff
23
cmake_modules/FetchContent/CMakeLists.cmake.in
Normal file
23
cmake_modules/FetchContent/CMakeLists.cmake.in
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
|
||||
# We name the project and the target for the ExternalProject_Add() call
|
||||
# to something that will highlight to the user what we are working on if
|
||||
# something goes wrong and an error message is produced.
|
||||
|
||||
project(${contentName}-populate NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(${contentName}-populate
|
||||
${ARG_EXTRA}
|
||||
SOURCE_DIR "${ARG_SOURCE_DIR}"
|
||||
BINARY_DIR "${ARG_BINARY_DIR}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
USES_TERMINAL_DOWNLOAD YES
|
||||
USES_TERMINAL_UPDATE YES
|
||||
)
|
167
cmake_modules/FindJulia.cmake
Normal file
167
cmake_modules/FindJulia.cmake
Normal file
|
@ -0,0 +1,167 @@
|
|||
# Inspiration from https://gist.github.com/JayKickliter/06d0e7c4f84ef7ccc7a9
|
||||
#
|
||||
|
||||
find_program(JULIA_EXECUTABLE julia DOC "Julia executable")
|
||||
IF (NOT JULIA_EXECUTABLE)
|
||||
cmessage(STATUS "Julia executable has not been found")
|
||||
return()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Julia version
|
||||
#
|
||||
execute_process(
|
||||
COMMAND ${JULIA_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE JULIA_VERSION_STRING
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
if(RESULT EQUAL 0)
|
||||
string(REGEX REPLACE ".*([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1"
|
||||
JULIA_VERSION_STRING ${JULIA_VERSION_STRING})
|
||||
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "JULIA_VERSION_MAJOR=\\1;JULIA_VERSION_MINOR=\\2;JULIA_VERSION_FIX=\\3" JULIA_VERSION_DEFS ${JULIA_VERSION_STRING})
|
||||
endif()
|
||||
|
||||
cmessage(STATUS "Julia version: ${JULIA_VERSION_STRING}")
|
||||
|
||||
#
|
||||
# Julia home
|
||||
#
|
||||
IF (JULIA_VERSION_STRING VERSION_GREATER_EQUAL "0.7.0")
|
||||
IF (JULIA_VERSION_STRING VERSION_LESS "1.7.0")
|
||||
execute_process(
|
||||
COMMAND ${JULIA_EXECUTABLE} -E "abspath(Sys.BINDIR)"
|
||||
OUTPUT_VARIABLE JULIA_BINDIR
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
if(RESULT EQUAL 0)
|
||||
string(REGEX REPLACE "\"" "" JULIA_BINDIR ${JULIA_BINDIR})
|
||||
string(STRIP "${JULIA_BINDIR}" JULIA_BINDIR)
|
||||
get_filename_component(JULIA_HOME "${JULIA_BINDIR}/../" ABSOLUTE)
|
||||
else()
|
||||
cmessage(ERROR "Cannot find JULIA_HOME")
|
||||
endif()
|
||||
ELSE()
|
||||
cmessage(ERROR "Unknown Julia version ${JULIA_VERSION}")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
execute_process(
|
||||
COMMAND ${JULIA_EXECUTABLE} -E "abspath(JULIA_HOME)"
|
||||
OUTPUT_VARIABLE JULIA_HOME
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
if(RESULT EQUAL 0)
|
||||
string(REGEX REPLACE "\"" "" JULIA_HOME ${JULIA_HOME})
|
||||
string(STRIP "${JULIA_HOME}" JULIA_HOME)
|
||||
set(JULIA_BINDIR "${JULIA_HOME}")
|
||||
else()
|
||||
cmessage(ERROR "Cannot find JULIA_HOME")
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
|
||||
cmessage(STATUS "Julia: Executable is ${JULIA_EXECUTABLE} (${JULIA_VERSION_STRING})")
|
||||
cmessage(STATUS "Julia: HOME is ${JULIA_HOME}")
|
||||
cmessage(STATUS "Julia: BINDIR is ${JULIA_BINDIR}")
|
||||
|
||||
#
|
||||
# Check threading
|
||||
#
|
||||
execute_process(
|
||||
COMMAND ${JULIA_EXECUTABLE} -E "ccall(:jl_threading_enabled, Cint, ()) != 0"
|
||||
OUTPUT_VARIABLE JULIA_THREADING_STATE
|
||||
RESULT_VARIABLE RESULT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
cmessage(STATUS "Julia: threading state is '${JULIA_THREADING_STATE}'")
|
||||
if(RESULT EQUAL 0)
|
||||
string(STRIP "${JULIA_THREADING_STATE}" JULIA_THREADING_STATE)
|
||||
if (JULIA_THREADING_STATE STREQUAL "true")
|
||||
set(JULIA_DEFS "JULIA_ENABLE_THREADING=1")
|
||||
elseif(JULIA_THREADING_STATE STREQUAL "false")
|
||||
set(JULIA_DEFS "")
|
||||
else()
|
||||
cmessage(CWARNING "Julia: unknown return value of threading")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(JULIA_DEFS ${JULIA_DEFS};JULIA_HOME=\"${JULIA_HOME}\";JULIA_BINDIR=\"${JULIA_BINDIR}\";${JULIA_VERSION_DEFS})
|
||||
|
||||
|
||||
#
|
||||
# Julia includes
|
||||
#
|
||||
|
||||
IF (JULIA_VERSION_STRING VERSION_GREATER_EQUAL "0.7.0")
|
||||
IF (JULIA_VERSION_STRING VERSION_LESS "1.7.0")
|
||||
execute_process(
|
||||
COMMAND ${JULIA_EXECUTABLE} -E "abspath(Sys.BINDIR, Base.INCLUDEDIR, \"julia\")"
|
||||
OUTPUT_VARIABLE JULIA_INCLUDE_DIRS
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
ELSE()
|
||||
cmessage(ERROR "Unknown Julia version ${JULIA_VERSION}")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
execute_process(
|
||||
COMMAND ${JULIA_EXECUTABLE} -E "abspath(\"${JULIA_HOME}\", Base.INCLUDEDIR, \"julia\")"
|
||||
OUTPUT_VARIABLE JULIA_INCLUDE_DIRS
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
if(RESULT EQUAL 0)
|
||||
string(REGEX REPLACE "\"" "" JULIA_INCLUDE_DIRS ${JULIA_INCLUDE_DIRS})
|
||||
string(STRIP "${JULIA_INCLUDE_DIRS}" JULIA_INCLUDE_DIRS)
|
||||
set(JULIA_INCLUDE_DIRS ${JULIA_INCLUDE_DIRS}
|
||||
CACHE PATH "Location of Julia include files")
|
||||
ELSE()
|
||||
cmessage(ERROR "Cannot find location of Julia header files")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Julia libs
|
||||
#
|
||||
execute_process(
|
||||
COMMAND ${JULIA_EXECUTABLE} -E "using Libdl; dirname(abspath(Libdl.dlpath(\"libjulia\")))"
|
||||
OUTPUT_VARIABLE JULIA_LIBRARY_DIR
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
if(RESULT EQUAL 0)
|
||||
string(REGEX REPLACE "\"" "" JULIA_LIBRARY_DIR "${JULIA_LIBRARY_DIR}")
|
||||
string(STRIP "${JULIA_LIBRARY_DIR}" JULIA_LIBRARY_DIR)
|
||||
cmessage(STATUS "Julia: library dir is ${JULIA_LIBRARY_DIR}")
|
||||
set(JULIA_LIBRARY_DIRS ${JULIA_LIBRARY_DIR}
|
||||
CACHE PATH "Location of Julia lib dirs")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${JULIA_EXECUTABLE} -E "abspath(\"${JULIA_BINDIR}\", Base.PRIVATE_LIBDIR)"
|
||||
OUTPUT_VARIABLE JULIA_PRIVATE_LIBRARY_DIR
|
||||
RESULT_VARIABLE RESULT
|
||||
)
|
||||
if(RESULT EQUAL 0)
|
||||
string(REGEX REPLACE "\"" "" JULIA_PRIVATE_LIBRARY_DIR "${JULIA_PRIVATE_LIBRARY_DIR}")
|
||||
string(STRIP "${JULIA_PRIVATE_LIBRARY_DIR}" JULIA_PRIVATE_LIBRARY_DIR)
|
||||
cmessage(STATUS "Julia: private library dir is ${JULIA_PRIVATE_LIBRARY_DIR}")
|
||||
set(JULIA_PRIVATE_LIBRARY_DIRS ${JULIA_PRIVATE_LIBRARY_DIR}
|
||||
CACHE PATH "Location of Julia lib dirs")
|
||||
|
||||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "${JULIA_PRIVATE_LIBRARY_DIRS}")
|
||||
endif()
|
||||
|
||||
|
||||
find_library( JULIA_LIBRARY
|
||||
NAMES julia.${JULIA_VERSION_STRING} julia
|
||||
PATHS ${JULIA_LIBRARY_DIRS}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
cmessage(STATUS "Julia: library is ${JULIA_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
Julia
|
||||
REQUIRED_VARS JULIA_LIBRARY JULIA_LIBRARY_DIR JULIA_PRIVATE_LIBRARY_DIR JULIA_INCLUDE_DIRS JULIA_DEFS
|
||||
VERSION_VAR JULIA_VERSION_STRING
|
||||
FAIL_MESSAGE "Julia not found"
|
||||
)
|
70
cmake_modules/GenOptMacro.cmake
Normal file
70
cmake_modules/GenOptMacro.cmake
Normal file
|
@ -0,0 +1,70 @@
|
|||
|
||||
find_program(GENGETOPT gengetopt)
|
||||
|
||||
|
||||
macro(add_genopt _sourcelist _ggofile _basefile)
|
||||
|
||||
unset(_structname)
|
||||
unset(_funcname)
|
||||
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${_ggofile})
|
||||
set(_ggofile2 ${CMAKE_CURRENT_SOURCE_DIR}/${_ggofile})
|
||||
else(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${_ggofile})
|
||||
set(_ggofile2 ${CMAKE_CURRENT_BINARY_DIR}/${_ggofile})
|
||||
endif(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${_ggofile})
|
||||
|
||||
set(_add_depends "")
|
||||
|
||||
SET(USE_PREBUILT_IF_NECESSARY OFF)
|
||||
foreach(arg ${ARGN})
|
||||
if ("x${arg}" MATCHES "^x(STRUCTNAME|FUNCNAME|DEPENDS|PREBUILT_C|PREBUILT_H)$")
|
||||
SET(doing "${arg}")
|
||||
elseif(doing STREQUAL "STRUCTNAME")
|
||||
SET(_structname ${arg})
|
||||
unset(doing)
|
||||
elseif(doing STREQUAL "FUNCNAME")
|
||||
SET(_funcname ${arg})
|
||||
unset(doing)
|
||||
elseif(doing STREQUAL "DEPENDS")
|
||||
SET(_add_depends ${_add_depends} ${arg})
|
||||
elseif(doing STREQUAL "PREBUILT_C")
|
||||
SET(USE_PREBUILT_IF_NECESSARY ON)
|
||||
SET(_prebuilt_c ${arg})
|
||||
elseif(doing STREQUAL "PREBUILT_H")
|
||||
SET(USE_PREBUILT_IF_NECESSARY ON)
|
||||
SET(_prebuilt_h ${arg})
|
||||
endif()
|
||||
endforeach(arg ${ARGN})
|
||||
|
||||
if(NOT DEFINED _structname)
|
||||
set(_structname ${_basefile})
|
||||
endif(NOT DEFINED _structname)
|
||||
|
||||
if(NOT DEFINED _funcname)
|
||||
set(_funcname ${_basefile})
|
||||
endif(NOT DEFINED _funcname)
|
||||
|
||||
set(_cfile ${CMAKE_CURRENT_BINARY_DIR}/${_basefile}.c)
|
||||
set(_hfile ${CMAKE_CURRENT_BINARY_DIR}/${_basefile}.h)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
IF(GENGETOPT)
|
||||
add_custom_command(
|
||||
OUTPUT ${_cfile} ${_hfile}
|
||||
COMMAND ${GENGETOPT} -i ${_ggofile2} -f ${_funcname} -a ${_structname} -F ${_basefile} -C
|
||||
DEPENDS ${_ggofile2} ${_add_depends}
|
||||
)
|
||||
ELSE(GENGETOPT)
|
||||
IF(NOT USE_PREBUILT_IF_NECESSARY)
|
||||
message(FATAL_ERROR "Gengetopt has not been found and is required to build intermediate files")
|
||||
ELSE(NOT USE_PREBUILT_IF_NECESSARY)
|
||||
message(WARNING "Using prebuilt configuration parser")
|
||||
configure_file(${_prebuilt_c} ${_cfile} COPYONLY)
|
||||
configure_file(${_prebuilt_h} ${_hfile} COPYONLY)
|
||||
ENDIF(NOT USE_PREBUILT_IF_NECESSARY)
|
||||
ENDIF(GENGETOPT)
|
||||
|
||||
set(${_sourcelist} ${_cfile} ${${_sourcelist}})
|
||||
|
||||
endmacro(add_genopt)
|
134
cmake_modules/GetGitRevisionDescription.cmake
Normal file
134
cmake_modules/GetGitRevisionDescription.cmake
Normal file
|
@ -0,0 +1,134 @@
|
|||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
||||
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
||||
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
|
||||
# We have reached the root directory, we are not in git
|
||||
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
endwhile()
|
||||
# check if this is a submodule
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
if (IS_ABSOLUTE ${GIT_DIR_RELATIVE})
|
||||
get_filename_component(GIT_DIR ${GIT_DIR_RELATIVE} ABSOLUTE)
|
||||
else()
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
|
||||
endif()
|
||||
endif()
|
||||
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||
if(NOT EXISTS "${GIT_DATA}")
|
||||
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${GIT_DIR}/HEAD")
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
|
||||
|
||||
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||
"${GIT_DATA}/grabRef.cmake"
|
||||
@ONLY)
|
||||
include("${GIT_DATA}/grabRef.cmake")
|
||||
|
||||
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
||||
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
describe
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
41
cmake_modules/GetGitRevisionDescription.cmake.in
Normal file
41
cmake_modules/GetGitRevisionDescription.cmake.in
Normal file
|
@ -0,0 +1,41 @@
|
|||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
else()
|
||||
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
1504
cmake_modules/UseLATEX.cmake
Normal file
1504
cmake_modules/UseLATEX.cmake
Normal file
File diff suppressed because it is too large
Load diff
38
cmake_modules/ares_module.cmake
Normal file
38
cmake_modules/ares_module.cmake
Normal file
|
@ -0,0 +1,38 @@
|
|||
macro(add_liblss_module module)
|
||||
set(_module_fname "${CMAKE_SOURCE_DIR}/extra/${module}/libLSS/${module}.cmake")
|
||||
if (EXISTS ${_module_fname})
|
||||
set(BUILD_ARES_MODULE_${module} ON)
|
||||
set(_ARES_current_parse_module ${module})
|
||||
set(ARES_MODULE_DIR "${CMAKE_SOURCE_DIR}/extra/${module}")
|
||||
# Add the libLSS in the module to the search path
|
||||
SET(ARES_INCLUDE_PATH ${ARES_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/extra/${module})
|
||||
include(${_module_fname})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(add_liblss_test_module module)
|
||||
set(_module_fname_base "${CMAKE_SOURCE_DIR}/extra/${module}/libLSS/${module}.cmake")
|
||||
set(_module_fname "${CMAKE_SOURCE_DIR}/extra/${module}/libLSS/tests/tests.cmake")
|
||||
if (EXISTS ${_module_fname_base} AND EXISTS ${_module_fname})
|
||||
set(_ARES_current_parse_module ${module})
|
||||
set(ARES_MODULE_DIR "${CMAKE_SOURCE_DIR}/extra/${module}")
|
||||
include(${_module_fname})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(check_ares_module _my_var)
|
||||
set(${_my_var} TRUE PARENT_SCOPE)
|
||||
foreach(module IN LISTS ARGN)
|
||||
list(FIND ARES_MODULES ${module} _module_found)
|
||||
if(${_module_found} EQUAL -1)
|
||||
set(${_my_var} FALSE PARENT_SCOPE)
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(require_ares_module)
|
||||
check_ares_module(_result ${ARGV})
|
||||
if (NOT ${_result})
|
||||
cmessage(FATAL_ERROR "Module(s) ${ARGV} are necessary to build ${_ARES_current_parse_module}")
|
||||
endif()
|
||||
endfunction()
|
32
cmake_modules/clang-format.cmake
Normal file
32
cmake_modules/clang-format.cmake
Normal file
|
@ -0,0 +1,32 @@
|
|||
find_program(CLANG_FORMAT clang-format)
|
||||
|
||||
function(setup_formatter MODULES)
|
||||
|
||||
if(CLANG_FORMAT)
|
||||
|
||||
SET(_glob_pattern
|
||||
${CMAKE_SOURCE_DIR}/libLSS/*.cpp
|
||||
${CMAKE_SOURCE_DIR}/libLSS/*.hpp
|
||||
)
|
||||
foreach(module IN LISTS ${MODULES})
|
||||
set(_glob_module
|
||||
${CMAKE_SOURCE_DIR}/extra/${module}/libLSS/*.cpp
|
||||
${CMAKE_SOURCE_DIR}/extra/${module}/libLSS/*.hpp
|
||||
)
|
||||
SET(_glob_pattern ${_glob_pattern} ${_glob_module})
|
||||
|
||||
file(GLOB_RECURSE module_sources ${_glob_module})
|
||||
add_custom_target(clangformat-${module}
|
||||
COMMAND ${CLANG_FORMAT} -style=file -i ${module_sources}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
file(GLOB_RECURSE ALL_SOURCE_FILES ${_glob_pattern})
|
||||
|
||||
add_custom_target(clangformat
|
||||
COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
endfunction()
|
42
cmake_modules/color_msg.cmake
Normal file
42
cmake_modules/color_msg.cmake
Normal file
|
@ -0,0 +1,42 @@
|
|||
if(NOT WIN32)
|
||||
string(ASCII 27 Esc)
|
||||
set(ColourReset "${Esc}[m")
|
||||
set(ColourBold "${Esc}[1m")
|
||||
set(Red "${Esc}[31m")
|
||||
set(Green "${Esc}[32m")
|
||||
set(Yellow "${Esc}[33m")
|
||||
set(Blue "${Esc}[34m")
|
||||
set(Magenta "${Esc}[35m")
|
||||
set(Cyan "${Esc}[36m")
|
||||
set(White "${Esc}[37m")
|
||||
set(BoldRed "${Esc}[1;31m")
|
||||
set(BoldGreen "${Esc}[1;32m")
|
||||
set(BoldYellow "${Esc}[1;33m")
|
||||
set(BoldBlue "${Esc}[1;34m")
|
||||
set(BoldMagenta "${Esc}[1;35m")
|
||||
set(BoldCyan "${Esc}[1;36m")
|
||||
set(BoldWhite "${Esc}[1;37m")
|
||||
endif()
|
||||
|
||||
function(cmessage)
|
||||
list(GET ARGV 0 MessageType)
|
||||
if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
message(${MessageType} "${BoldRed}${ARGV}${ColourReset}")
|
||||
elseif(MessageType STREQUAL CWARNING)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
message(STATUS "${BoldYellow}${ARGV}${ColourReset}")
|
||||
elseif(MessageType STREQUAL WARNING)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
message(${MessageType} "${BoldYellow}${ARGV}${ColourReset}")
|
||||
elseif(MessageType STREQUAL AUTHOR_WARNING)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
message(${MessageType} "${BoldCyan}${ARGV}${ColourReset}")
|
||||
elseif(MessageType STREQUAL STATUS)
|
||||
list(REMOVE_AT ARGV 0)
|
||||
message(${MessageType} "${Green}${ARGV}${ColourReset}")
|
||||
else()
|
||||
message("${ARGV}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
243
cmake_modules/git-archive-all.sh
Normal file
243
cmake_modules/git-archive-all.sh
Normal file
|
@ -0,0 +1,243 @@
|
|||
#+
|
||||
# This is ABYSS (./cmake_modules/git-archive-all.sh) -- Copyright (C) Guilhem Lavaux (2009-2014)
|
||||
#
|
||||
# guilhem.lavaux@gmail.com
|
||||
#
|
||||
# This software is a computer program whose purpose is to provide to do full sky
|
||||
# bayesian analysis of random fields (e.g., non exhaustively,
|
||||
# wiener filtering, power spectra, lens reconstruction, template fitting).
|
||||
#
|
||||
# This software is governed by the CeCILL license under French law and
|
||||
# abiding by the rules of distribution of free software. You can use,
|
||||
# modify and/ or redistribute the software under the terms of the CeCILL
|
||||
# license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
# "http://www.cecill.info".
|
||||
#
|
||||
# As a counterpart to the access to the source code and rights to copy,
|
||||
# modify and redistribute granted by the license, users are provided only
|
||||
# with a limited warranty and the software's author, the holder of the
|
||||
# economic rights, and the successive licensors have only limited
|
||||
# liability.
|
||||
#
|
||||
# In this respect, the user's attention is drawn to the risks associated
|
||||
# with loading, using, modifying and/or developing or reproducing the
|
||||
# software by the user in light of its specific status of free software,
|
||||
# that may mean that it is complicated to manipulate, and that also
|
||||
# therefore means that it is reserved for developers and experienced
|
||||
# professionals having in-depth computer knowledge. Users are therefore
|
||||
# encouraged to load and test the software's suitability as regards their
|
||||
# requirements in conditions enabling the security of their systems and/or
|
||||
# data to be ensured and, more generally, to use and operate it in the
|
||||
# same conditions as regards security.
|
||||
#
|
||||
# The fact that you are presently reading this means that you have had
|
||||
# knowledge of the CeCILL license and that you accept its terms.
|
||||
#+
|
||||
#!/bin/bash -
|
||||
#
|
||||
# File: git-archive-all.sh
|
||||
#
|
||||
# Description: A utility script that builds an archive file(s) of all
|
||||
# git repositories and submodules in the current path.
|
||||
# Useful for creating a single tarfile of a git super-
|
||||
# project that contains other submodules.
|
||||
#
|
||||
# Examples: Use git-archive-all.sh to create archive distributions
|
||||
# from git repositories. To use, simply do:
|
||||
#
|
||||
# cd $GIT_DIR; git-archive-all.sh
|
||||
#
|
||||
# where $GIT_DIR is the root of your git superproject.
|
||||
#
|
||||
# License: GPL3
|
||||
#
|
||||
###############################################################################
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
# DEBUGGING
|
||||
set -e
|
||||
set -C # noclobber
|
||||
|
||||
# TRAP SIGNALS
|
||||
trap 'cleanup' QUIT EXIT
|
||||
|
||||
# For security reasons, explicitly set the internal field separator
|
||||
# to newline, space, tab
|
||||
OLD_IFS=$IFS
|
||||
IFS='
|
||||
'
|
||||
|
||||
function cleanup () {
|
||||
rm -f $TMPFILE
|
||||
rm -f $TOARCHIVE
|
||||
IFS="$OLD_IFS"
|
||||
}
|
||||
|
||||
function usage () {
|
||||
echo "Usage is as follows:"
|
||||
echo
|
||||
echo "$PROGRAM <--version>"
|
||||
echo " Prints the program version number on a line by itself and exits."
|
||||
echo
|
||||
echo "$PROGRAM <--usage|--help|-?>"
|
||||
echo " Prints this usage output and exits."
|
||||
echo
|
||||
echo "$PROGRAM [--format <fmt>] [--prefix <path>] [--separate|-s] [output_file]"
|
||||
echo " Creates an archive for the entire git superproject, and its submodules"
|
||||
echo " using the passed parameters, described below."
|
||||
echo
|
||||
echo " If '--format' is specified, the archive is created with the named"
|
||||
echo " git archiver backend. Obviously, this must be a backend that git-archive"
|
||||
echo " understands. The format defaults to 'tar' if not specified."
|
||||
echo
|
||||
echo " If '--prefix' is specified, the archive's superproject and all submodules"
|
||||
echo " are created with the <path> prefix named. The default is to not use one."
|
||||
echo
|
||||
echo " If '--separate' or '-s' is specified, individual archives will be created"
|
||||
echo " for each of the superproject itself and its submodules. The default is to"
|
||||
echo " concatenate individual archives into one larger archive."
|
||||
echo
|
||||
echo " If 'output_file' is specified, the resulting archive is created as the"
|
||||
echo " file named. This parameter is essentially a path that must be writeable."
|
||||
echo " When combined with '--separate' ('-s') this path must refer to a directory."
|
||||
echo " Without this parameter or when combined with '--separate' the resulting"
|
||||
echo " archive(s) are named with a dot-separated path of the archived directory and"
|
||||
echo " a file extension equal to their format (e.g., 'superdir.submodule1dir.tar')."
|
||||
}
|
||||
|
||||
function version () {
|
||||
echo "$PROGRAM version $VERSION"
|
||||
}
|
||||
|
||||
# Internal variables and initializations.
|
||||
readonly PROGRAM=`basename "$0"`
|
||||
readonly VERSION=0.2
|
||||
|
||||
OLD_PWD="`pwd`"
|
||||
TMPDIR=${TMPDIR:-/tmp}
|
||||
TMPFILE=`mktemp "$TMPDIR/$PROGRAM.XXXXXX"` # Create a place to store our work's progress
|
||||
TOARCHIVE=`mktemp "$TMPDIR/$PROGRAM.toarchive.XXXXXX"`
|
||||
OUT_FILE=$OLD_PWD # assume "this directory" without a name change by default
|
||||
SEPARATE=0
|
||||
|
||||
FORMAT=tar
|
||||
PREFIX=
|
||||
TREEISH=HEAD
|
||||
|
||||
# RETURN VALUES/EXIT STATUS CODES
|
||||
readonly E_BAD_OPTION=254
|
||||
readonly E_UNKNOWN=255
|
||||
|
||||
# Process command-line arguments.
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--format )
|
||||
shift
|
||||
FORMAT="$1"
|
||||
shift
|
||||
;;
|
||||
|
||||
--prefix )
|
||||
shift
|
||||
PREFIX="$1"
|
||||
shift
|
||||
;;
|
||||
|
||||
--separate | -s )
|
||||
shift
|
||||
SEPARATE=1
|
||||
;;
|
||||
|
||||
--version )
|
||||
version
|
||||
exit
|
||||
;;
|
||||
|
||||
-? | --usage | --help )
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
|
||||
-* )
|
||||
echo "Unrecognized option: $1" >&2
|
||||
usage
|
||||
exit $E_BAD_OPTION
|
||||
;;
|
||||
|
||||
* )
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
OUT_FILE="$1"
|
||||
shift
|
||||
fi
|
||||
|
||||
# Validate parameters; error early, error often.
|
||||
if [ $SEPARATE -eq 1 -a ! -d $OUT_FILE ]; then
|
||||
echo "When creating multiple archives, your destination must be a directory."
|
||||
echo "If it's not, you risk being surprised when your files are overwritten."
|
||||
exit
|
||||
elif [ `git config -l | grep -q '^core\.bare=false'; echo $?` -ne 0 ]; then
|
||||
echo "$PROGRAM must be run from a git working copy (i.e., not a bare repository)."
|
||||
exit
|
||||
fi
|
||||
|
||||
# Create the superproject's git-archive
|
||||
git archive --format=$FORMAT --prefix="$PREFIX" $TREEISH > $TMPDIR/$(basename $(pwd)).$FORMAT
|
||||
echo $TMPDIR/$(basename $(pwd)).$FORMAT >| $TMPFILE # clobber on purpose
|
||||
superfile=`head -n 1 $TMPFILE`
|
||||
|
||||
# find all '.git' dirs, these show us the remaining to-be-archived dirs
|
||||
find . -name '.git' -type d -print | sed -e 's/^\.\///' -e 's/\.git$//' | grep -v '^$' >> $TOARCHIVE
|
||||
|
||||
while read path; do
|
||||
TREEISH=$(git submodule | grep "^ .*${path%/} " | cut -d ' ' -f 2) # git-submodule does not list trailing slashes in $path
|
||||
cd "$path"
|
||||
git archive --format=$FORMAT --prefix="${PREFIX}$path" ${TREEISH:-HEAD} > "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT
|
||||
if [ $FORMAT == 'zip' ]; then
|
||||
# delete the empty directory entry; zipped submodules won't unzip if we don't do this
|
||||
zip -d "$(tail -n 1 $TMPFILE)" "${PREFIX}${path%/}" >/dev/null # remove trailing '/'
|
||||
fi
|
||||
echo "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT >> $TMPFILE
|
||||
cd "$OLD_PWD"
|
||||
done < $TOARCHIVE
|
||||
|
||||
# Concatenate archives into a super-archive.
|
||||
if [ $SEPARATE -eq 0 ]; then
|
||||
if [ $FORMAT == 'tar' ]; then
|
||||
sed -e '1d' $TMPFILE | while read file; do
|
||||
tar --concatenate -f "$superfile" "$file" && rm -f "$file"
|
||||
done
|
||||
elif [ $FORMAT == 'zip' ]; then
|
||||
sed -e '1d' $TMPFILE | while read file; do
|
||||
# zip incorrectly stores the full path, so cd and then grow
|
||||
cd `dirname "$file"`
|
||||
zip -g "$superfile" `basename "$file"` && rm -f "$file"
|
||||
done
|
||||
cd "$OLD_PWD"
|
||||
fi
|
||||
|
||||
echo "$superfile" >| $TMPFILE # clobber on purpose
|
||||
fi
|
||||
|
||||
while read file; do
|
||||
mv "$file" "$OUT_FILE"
|
||||
done < $TMPFILE
|
36
cmake_modules/run_test.cmake
Normal file
36
cmake_modules/run_test.cmake
Normal file
|
@ -0,0 +1,36 @@
|
|||
# https://cmake.org/pipermail/cmake/2009-July/030788.html
|
||||
#-------------------------------------------------
|
||||
# some argument checking:
|
||||
# test_cmd is the command to run with all its arguments
|
||||
if( NOT test_cmd )
|
||||
message( FATAL_ERROR "Variable test_cmd not defined" )
|
||||
endif( NOT test_cmd )
|
||||
|
||||
# output_blessed contains the name of the "blessed" output file
|
||||
if( NOT output_blessed )
|
||||
message( FATAL_ERROR "Variable output_blessed not defined" )
|
||||
endif( NOT output_blessed )
|
||||
|
||||
# output_test contains the name of the output file the test_cmd will produce
|
||||
if( NOT output_test )
|
||||
message( FATAL_ERROR "Variable output_test not defined" )
|
||||
endif( NOT output_test )
|
||||
|
||||
# convert the space-separated string to a list
|
||||
separate_arguments( test_args )
|
||||
message( "ARGUMENTS: ${test_cmd} ${test_args}" )
|
||||
|
||||
execute_process(
|
||||
COMMAND ${test_cmd} ${test_args}
|
||||
OUTPUT_FILE ${output_test}
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E compare_files ${output_blessed} ${output_test}
|
||||
RESULT_VARIABLE test_not_successful
|
||||
)
|
||||
|
||||
if( test_not_successful )
|
||||
message( SEND_ERROR "${output_test} does not match ${output_blessed}!" )
|
||||
endif( test_not_successful )
|
||||
#-------------------------------------------------
|
10
cmake_modules/test_compile_template.cmake
Normal file
10
cmake_modules/test_compile_template.cmake
Normal file
|
@ -0,0 +1,10 @@
|
|||
include_directories(@TEST_INCLUDE_DIRS@)
|
||||
try_compile(COMPILE_SUCCEEDED
|
||||
${CMAKE_BINARY_DIR}/compile_tests
|
||||
@COMPILE_SOURCE@
|
||||
)
|
||||
|
||||
if(COMPILE_SUCCEEDED)
|
||||
message("Success!")
|
||||
else()
|
||||
endif()
|
51
cmake_modules/test_macros.cmake
Normal file
51
cmake_modules/test_macros.cmake
Normal file
|
@ -0,0 +1,51 @@
|
|||
SET(TEST_DIR ${CMAKE_BINARY_DIR}/_test_dir)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_DIR})
|
||||
|
||||
macro(ADD_FAILING_TEST NAME SOURCE_FILE )
|
||||
set(NAME_BIN ${NAME}.exe)
|
||||
|
||||
add_executable(${NAME_BIN} ${SOURCE_FILE})
|
||||
|
||||
set_target_properties(${NAME_BIN} PROPERTIES
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
|
||||
add_test(NAME ${NAME}
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target ${NAME_BIN} --config $<CONFIGURATION>
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
set_tests_properties(${NAME} PROPERTIES WILL_FAIL TRUE)
|
||||
endmacro()
|
||||
|
||||
macro(add_test_to_run NAME bin)
|
||||
add_test(NAME ${NAME} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${bin} WORKING_DIRECTORY ${TEST_DIR})
|
||||
endmacro()
|
||||
|
||||
macro(add_direct_test NAME SOURCE_FILE)
|
||||
set(NAME_BIN ${NAME}_exe)
|
||||
|
||||
add_executable(${NAME_BIN} ${SOURCE_FILE})
|
||||
target_link_libraries(${NAME_BIN} test_library_LSS LSS ${LIBS})
|
||||
|
||||
add_test(NAME ${NAME} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${NAME_BIN} WORKING_DIRECTORY ${TEST_DIR})
|
||||
endmacro()
|
||||
|
||||
macro(add_check_output_test NAME SOURCE_FILE ARG)
|
||||
set(NAME_BIN ${NAME}_exe)
|
||||
|
||||
add_executable(${NAME_BIN} ${SOURCE_FILE})
|
||||
target_link_libraries(${NAME_BIN} test_library_LSS LSS ${LIBS})
|
||||
|
||||
# The output must match
|
||||
add_test(NAME ${NAME_BIN}.output
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D test_cmd=${CMAKE_CURRENT_BINARY_DIR}/${NAME_BIN}
|
||||
-D test_args:string=${ARG}
|
||||
-D output_blessed=${SOURCE_FILE}.expected
|
||||
-D output_test=${TEST_DIR}/${NAME_BIN}.out
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake_modules/run_test.cmake
|
||||
WORKING_DIRECTORY ${TEST_DIR})
|
||||
|
||||
endmacro()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue