Начало проекта
This commit is contained in:
19
MyxCMake/functions/MyxCMakeGenerateGitInfoHeader.cmake
Normal file
19
MyxCMake/functions/MyxCMakeGenerateGitInfoHeader.cmake
Normal file
@ -0,0 +1,19 @@
|
||||
function(myx_cmake_generate_git_info_header)
|
||||
set(output_file ${CMAKE_BINARY_DIR}/include/myx_cmake_git_info.hpp)
|
||||
if(MYX_CMAKE_GENERATED_HEADERS_PATH)
|
||||
set(output_file ${MYX_CMAKE_GENERATED_HEADERS_PATH}/myx_cmake_git_info.hpp)
|
||||
elseif(ARGV0)
|
||||
set(output_file ${ARGV0})
|
||||
endif()
|
||||
|
||||
# cmake-format: off
|
||||
if(NOT TARGET myx-cmake-git-info-header)
|
||||
add_custom_target(myx-cmake-git-info-header ALL
|
||||
${CMAKE_COMMAND} -DMYX_CMAKE_PROJECT_NAME_UPPER=${MYX_CMAKE_PROJECT_NAME_UPPER}
|
||||
-DMYX_CMAKE_MODULE_DIR=${MYX_CMAKE_MODULE_DIR}
|
||||
-DMYX_CMAKE_GIT_INFO_FILE=${output_file} -P ${CMAKE_CURRENT_LIST_DIR}/MyxCMakeGitInfo.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
# cmake-format: on
|
||||
endfunction()
|
||||
|
14
MyxCMake/functions/MyxCMakeGeneratePrivateConfigHeader.cmake
Normal file
14
MyxCMake/functions/MyxCMakeGeneratePrivateConfigHeader.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
function(myx_cmake_generate_private_config_header)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/MyxCMakeLargeFiles.cmake)
|
||||
myx_cmake_test_large_files(HAVE_LARGEFILES)
|
||||
|
||||
set(output_file ${CMAKE_BINARY_DIR}/include/myx_cmake_private_config.hpp)
|
||||
if(MYX_CMAKE_GENERATED_HEADERS_PATH)
|
||||
set(output_file ${CMLIB_GENERATED_HEADERS_PATH}/myx_cmake_private_config.hpp)
|
||||
elseif(ARGV0)
|
||||
set(output_file ${ARGV0})
|
||||
endif()
|
||||
|
||||
get_property(PROJECT_VERSION_INT GLOBAL PROPERTY PROJECT_VERSION_INT)
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/hpp/myx_cmake_private_config.hpp.in ${output_file})
|
||||
endfunction()
|
25
MyxCMake/functions/MyxCMakeGitInfo.cmake
Normal file
25
MyxCMake/functions/MyxCMakeGitInfo.cmake
Normal file
@ -0,0 +1,25 @@
|
||||
set(MYX_CMAKE_GIT_REV "N/A")
|
||||
set(MYX_CMAKE_GIT_DIFF "")
|
||||
set(MYX_CMAKE_GIT_TAG "N/A")
|
||||
set(MYX_CMAKE_GIT_BRANCH "N/A")
|
||||
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
if(GIT_EXECUTABLE)
|
||||
execute_process(COMMAND git log --pretty=format:'%h' -n 1 OUTPUT_VARIABLE MYX_CMAKE_GIT_REV ERROR_QUIET)
|
||||
|
||||
# Check whether we got any revision (which isn't always the case,
|
||||
# e.g. when someone downloaded a zip file from Github instead of a checkout)
|
||||
if(NOT "${MYX_CMAKE_GIT_REV}" STREQUAL "")
|
||||
execute_process(COMMAND bash -c "git diff --quiet --exit-code || echo +" OUTPUT_VARIABLE MYX_CMAKE_GIT_DIFF)
|
||||
execute_process(COMMAND git describe --exact-match --tags OUTPUT_VARIABLE MYX_CMAKE_GIT_TAG ERROR_QUIET)
|
||||
execute_process(COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE MYX_CMAKE_GIT_BRANCH)
|
||||
|
||||
string(STRIP "${MYX_CMAKE_GIT_REV}" MYX_CMAKE_GIT_REV)
|
||||
string(SUBSTRING "${MYX_CMAKE_GIT_REV}" 1 7 MYX_CMAKE_GIT_REV)
|
||||
string(STRIP "${MYX_CMAKE_GIT_DIFF}" MYX_CMAKE_GIT_DIFF)
|
||||
string(STRIP "${MYX_CMAKE_GIT_TAG}" MYX_CMAKE_GIT_TAG)
|
||||
string(STRIP "${MYX_CMAKE_GIT_BRANCH}" MYX_CMAKE_GIT_BRANCH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/hpp/mux_cmake_git_info.hpp.in ${MYX_CMAKE_GIT_VERSION_FILE})
|
11
MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake
Normal file
11
MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake
Normal file
@ -0,0 +1,11 @@
|
||||
find_package(Quadmath)
|
||||
if(QUADMATH_FOUND)
|
||||
add_definitions(-DHAVE_QUADMATH=1)
|
||||
else()
|
||||
find_package(MPFR)
|
||||
if(MPFR_FOUND)
|
||||
find_package(MPFRCppThirdparty)
|
||||
else()
|
||||
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
|
||||
endif()
|
||||
endif()
|
158
MyxCMake/functions/MyxCMakeLargeFiles.cmake
Normal file
158
MyxCMake/functions/MyxCMakeLargeFiles.cmake
Normal file
@ -0,0 +1,158 @@
|
||||
#
|
||||
# This file is part of the GROMACS molecular simulation package.
|
||||
#
|
||||
# Copyright (c) 2009,2010,2012,2014,2019, by the GROMACS development team, led by
|
||||
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
|
||||
# and including many others, as listed in the AUTHORS file in the
|
||||
# top-level source directory and at http://www.gromacs.org.
|
||||
#
|
||||
# GROMACS is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2.1
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# GROMACS 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with GROMACS; if not, see
|
||||
# http://www.gnu.org/licenses, or write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# If you want to redistribute modifications to GROMACS, please
|
||||
# consider that scientific software is very special. Version
|
||||
# control is crucial - bugs must be traceable. We will be happy to
|
||||
# consider code for inclusion in the official distribution, but
|
||||
# derived work must not be called official GROMACS. Details are found
|
||||
# in the README & COPYING files - if they are missing, get the
|
||||
# official version at http://www.gromacs.org.
|
||||
#
|
||||
# To help us fund GROMACS development, we humbly ask that you cite
|
||||
# the research papers on the package. Check out http://www.gromacs.org.
|
||||
|
||||
# Forked from Gromacs
|
||||
|
||||
# - Define macro to check large file support
|
||||
#
|
||||
# myx_cmake_test_large_files(VARIABLE)
|
||||
#
|
||||
# VARIABLE will be set to true if off_t is 64 bits, and fseeko/ftello present.
|
||||
# This macro will also set defines necessary enable large file support, for instance
|
||||
# _LARGE_FILES
|
||||
# _LARGEFILE_SOURCE
|
||||
# _FILE_OFFSET_BITS 64
|
||||
# HAVE_FSEEKO
|
||||
# HAVE__FSEEKI64
|
||||
#
|
||||
# However, it is YOUR job to make sure these defines are set in a cmakedefine so they
|
||||
# end up in a config.h file that is included in your source if necessary!
|
||||
|
||||
include(CheckTypeSize)
|
||||
|
||||
macro(myx_cmake_test_large_files VARIABLE)
|
||||
if(NOT DEFINED ${VARIABLE})
|
||||
|
||||
# On most platforms it is probably overkill to first test the flags for 64-bit off_t,
|
||||
# and then separately fseeko. However, in the future we might have 128-bit filesystems
|
||||
# (ZFS), so it might be dangerous to indiscriminately set e.g. _FILE_OFFSET_BITS=64.
|
||||
|
||||
message(STATUS "Checking for 64-bit off_t")
|
||||
|
||||
# First check without any special flags
|
||||
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_LIST_DIR}/largefiles/TestFileOffsetBits.c")
|
||||
if(FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - present")
|
||||
endif()
|
||||
|
||||
if(NOT FILE64_OK)
|
||||
# Test with _FILE_OFFSET_BITS=64
|
||||
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_LIST_DIR}/largefiles/TestFileOffsetBits.c"
|
||||
COMPILE_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
|
||||
if(FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - present with _FILE_OFFSET_BITS=64")
|
||||
set(_FILE_OFFSET_BITS 64 CACHE INTERNAL "64-bit off_t requires _FILE_OFFSET_BITS=64")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT FILE64_OK)
|
||||
# Test with _LARGE_FILES
|
||||
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_LIST_DIR}/largefiles/TestFileOffsetBits.c"
|
||||
COMPILE_DEFINITIONS "-D_LARGE_FILES")
|
||||
if(FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - present with _LARGE_FILES")
|
||||
set(_LARGE_FILES 1 CACHE INTERNAL "64-bit off_t requires _LARGE_FILES")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT FILE64_OK)
|
||||
# Test with _LARGEFILE_SOURCE
|
||||
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_LIST_DIR}/largefiles/TestFileOffsetBits.c"
|
||||
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE")
|
||||
if(FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - present with _LARGEFILE_SOURCE")
|
||||
set(_LARGEFILE_SOURCE 1 CACHE INTERNAL "64-bit off_t requires _LARGEFILE_SOURCE")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - not present")
|
||||
else()
|
||||
# 64-bit off_t found. Now check that ftello/fseeko is available.
|
||||
|
||||
# Set the flags we might have determined to be required above
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/largefiles/TestLargeFiles.c.in"
|
||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
|
||||
|
||||
message(STATUS "Checking for fseeko/ftello")
|
||||
# Test if ftello/fseeko are available
|
||||
try_compile(FSEEKO_COMPILE_OK "${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c")
|
||||
if(FSEEKO_COMPILE_OK)
|
||||
message(STATUS "Checking for fseeko/ftello - present")
|
||||
endif()
|
||||
|
||||
if(NOT FSEEKO_COMPILE_OK)
|
||||
# glibc 2.2 neds _LARGEFILE_SOURCE for fseeko (but not 64-bit off_t...)
|
||||
try_compile(
|
||||
FSEEKO_COMPILE_OK "${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestLargeFiles.c"
|
||||
COMPILE_DEFINITIONS "-D_LARGEFILE_SOURCE")
|
||||
if(FSEEKO_COMPILE_OK)
|
||||
message(STATUS "Checking for fseeko/ftello - present with _LARGEFILE_SOURCE")
|
||||
set(_LARGEFILE_SOURCE 1 CACHE INTERNAL "64-bit fseeko requires _LARGEFILE_SOURCE")
|
||||
else()
|
||||
set(FILE64_OK 0)
|
||||
message(STATUS "64-bit off_t present but fseeko/ftello not found!")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# cmake-lint: disable=C0103
|
||||
if(NOT FILE64_OK)
|
||||
# now check for Windows stuff
|
||||
try_compile(FILE64_OK "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_LIST_DIR}/largefiles/TestWindowsFSeek.c")
|
||||
if(FILE64_OK)
|
||||
message(STATUS "Checking for 64-bit off_t - present with _fseeki64")
|
||||
set(HAVE__FSEEKI64 1 CACHE INTERNAL "64-bit off_t requires _fseeki64")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FSEEKO_COMPILE_OK)
|
||||
set(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
|
||||
set(HAVE_FSEEKO 1 CACHE INTERNAL "64bit fseeko is available" FORCE)
|
||||
elseif(HAVE__FSEEKI64)
|
||||
set(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
|
||||
set(HAVE__FSEEKI64 1 CACHE INTERNAL "Windows 64-bit fseek" FORCE)
|
||||
else()
|
||||
check_type_size("long int" SIZEOF_LONG_INT)
|
||||
if(SIZEOF_LONG_INT EQUAL 8) #standard fseek is OK for 64bit
|
||||
set(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
|
||||
else()
|
||||
message(FATAL_ERROR "Checking for 64bit file support failed.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endmacro(myx_cmake_test_large_files VARIABLE)
|
58
MyxCMake/functions/MyxCMakeQtTranslation.cmake
Normal file
58
MyxCMake/functions/MyxCMakeQtTranslation.cmake
Normal file
@ -0,0 +1,58 @@
|
||||
function(myx_cmake_qt5_translation outfiles)
|
||||
find_package(Qt5 COMPONENTS LinguistTools REQUIRED)
|
||||
|
||||
set(options)
|
||||
set(oneValueArgs BASE_NAME OUTPUT_DIR)
|
||||
set(multiValueArgs SOURCES LANGUAGES)
|
||||
|
||||
cmake_parse_arguments(_QTTR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
set(_base_name ${_QTTR_BASE_NAME})
|
||||
set(_sources ${_QTTR_SOURCES})
|
||||
set(_output_dir ${_QTTR_OUTPUT_DIR})
|
||||
set(_languages ${_QTTR_LANGUAGES})
|
||||
|
||||
set(L10N_QRC_BODY "")
|
||||
make_directory(${_output_dir})
|
||||
|
||||
foreach(lang ${_languages})
|
||||
set(_ts "${_base_name}_${lang}.ts")
|
||||
set(_qm "${_base_name}_${lang}.qm")
|
||||
list(APPEND _ts_list ${_output_dir}/${_ts})
|
||||
list(APPEND _l10n_names_list "${_base_name}_l10n_${lang}")
|
||||
string(APPEND L10N_QRC_BODY "<file alias=\"${_qm}\">${CMAKE_BINARY_DIR}/${_qm}</file>\n")
|
||||
|
||||
add_custom_target(
|
||||
${_base_name}_l10n_${lang} COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${_sources} -ts ${_output_dir}/${_ts}
|
||||
-target-language ${lang} DEPENDS ${_sources})
|
||||
|
||||
if(NOT EXISTS "${_output_dir}/${_ts}")
|
||||
add_custom_target(${_ts} DEPENDS ${_base_name}_l10n_${lang})
|
||||
else()
|
||||
add_custom_target(${_ts} COMMAND echo "Skipping lupdate for ${_ts}")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/${_qm} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ARGS ${_output_dir}/${_ts} -qm
|
||||
${CMAKE_BINARY_DIR}/${_qm} DEPENDS ${_ts} ${_sources})
|
||||
endforeach()
|
||||
|
||||
# configure_file(${CMLIB_MODULE_DIR}/qrc/l10n.qrc.in ${CMAKE_BINARY_DIR}/${_base_name}_l10n.qrc)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/${_base_name}_l10n.qrc
|
||||
"<RCC>\n"
|
||||
" <qresource prefix="/qm">\n"
|
||||
" ${L10N_QRC_BODY}\n"
|
||||
" </qresource>\n"
|
||||
"</RCC>\n"
|
||||
)
|
||||
qt5_add_resources(${outfiles} ${CMAKE_BINARY_DIR}/${_base_name}_l10n.qrc)
|
||||
add_custom_target(${_base_name}_qrc DEPENDS ${_qrc})
|
||||
add_custom_target(${_base_name}_l10n DEPENDS ${_l10n_names_list})
|
||||
if(NOT TARGET l10n)
|
||||
add_custom_target(l10n)
|
||||
endif()
|
||||
add_dependencies(l10n ${_base_name}_l10n)
|
||||
|
||||
# add_dependencies(${_target} ${_target}_qrc)
|
||||
# target_sources(${_target} PUBLIC ${_qrc})
|
||||
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
|
||||
endfunction()
|
73
MyxCMake/functions/MyxCMakeRemoveFlag.cmake
Normal file
73
MyxCMake/functions/MyxCMakeRemoveFlag.cmake
Normal file
@ -0,0 +1,73 @@
|
||||
# https://stackoverflow.com/a/49216539
|
||||
#
|
||||
# Removes the specified compile flag from the specified target.
|
||||
# _target - The target to remove the compile flag from
|
||||
# _flag - The compile flag to remove
|
||||
#
|
||||
# Pre: apply_global_cxx_flags_to_all_targets() must be invoked.
|
||||
#
|
||||
# cmake-lint: disable=C0103
|
||||
macro(myx_cmake_remove_flag_from_target _target _flag)
|
||||
get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
|
||||
if(_target_cxx_flags)
|
||||
list(REMOVE_ITEM _target_cxx_flags ${_flag})
|
||||
set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "${_target_cxx_flags}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# Removes the specified compiler flag from the specified file.
|
||||
# _target - The target that _file belongs to
|
||||
# _file - The file to remove the compiler flag from
|
||||
# _flag - The compiler flag to remove.
|
||||
#
|
||||
# Pre: apply_global_cxx_flags_to_all_targets() must be invoked.
|
||||
#
|
||||
# cmake-lint: disable=C0103
|
||||
macro(myx_cmake_remove_flag_from_file _target _file _flag)
|
||||
get_target_property(_target_sources ${_target} SOURCES)
|
||||
# Check if a sync is required, in which case we'll force a rewrite of the cache variables.
|
||||
if(_flag_sync_required)
|
||||
unset(_cached_${_target}_cxx_flags CACHE)
|
||||
unset(_cached_${_target}_${_file}_cxx_flags CACHE)
|
||||
endif()
|
||||
get_target_property(_${_target}_cxx_flags ${_target} COMPILE_OPTIONS)
|
||||
# On first entry, cache the target compile flags and apply them to each source file
|
||||
# in the target.
|
||||
if(NOT _cached_${_target}_cxx_flags)
|
||||
# Obtain and cache the target compiler options, then clear them.
|
||||
get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
|
||||
set(_cached_${_target}_cxx_flags "${_target_cxx_flags}" CACHE INTERNAL "")
|
||||
set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "")
|
||||
# Apply the target compile flags to each source file.
|
||||
foreach(_source_file ${_target_sources})
|
||||
# Check for pre-existing flags set by set_source_files_properties().
|
||||
get_source_file_property(_source_file_cxx_flags ${_source_file} COMPILE_FLAGS)
|
||||
if(_source_file_cxx_flags)
|
||||
separate_arguments(_source_file_cxx_flags UNIX_COMMAND ${_source_file_cxx_flags})
|
||||
list(APPEND _source_file_cxx_flags "${_target_cxx_flags}")
|
||||
else()
|
||||
set(_source_file_cxx_flags "${_target_cxx_flags}")
|
||||
endif()
|
||||
# Apply the compile flags to the current source file.
|
||||
string(REPLACE ";" " " _source_file_cxx_flags_string "${_source_file_cxx_flags}")
|
||||
set_source_files_properties(${_source_file} PROPERTIES COMPILE_FLAGS "${_source_file_cxx_flags_string}")
|
||||
endforeach()
|
||||
endif()
|
||||
list(FIND _target_sources ${_file} _file_found_at)
|
||||
if(_file_found_at GREATER -1)
|
||||
if(NOT _cached_${_target}_${_file}_cxx_flags)
|
||||
# Cache the compile flags for the specified file.
|
||||
# This is the list that we'll be removing flags from.
|
||||
get_source_file_property(_source_file_cxx_flags ${_file} COMPILE_FLAGS)
|
||||
separate_arguments(_source_file_cxx_flags UNIX_COMMAND ${_source_file_cxx_flags})
|
||||
set(_cached_${_target}_${_file}_cxx_flags ${_source_file_cxx_flags} CACHE INTERNAL "")
|
||||
endif()
|
||||
# Remove the specified flag, then re-apply the rest.
|
||||
list(REMOVE_ITEM _cached_${_target}_${_file}_cxx_flags ${_flag})
|
||||
string(REPLACE ";" " " _cached_${_target}_${_file}_cxx_flags_string
|
||||
"${_cached_${_target}_${_file}_cxx_flags}")
|
||||
set_source_files_properties(${_file} PROPERTIES COMPILE_FLAGS
|
||||
"${_cached_${_target}_${_file}_cxx_flags_string}")
|
||||
endif()
|
||||
endmacro()
|
@ -0,0 +1,30 @@
|
||||
function(myx_cmake_write_compiler_detection_header)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.6.0")
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(WriteCompilerDetectionHeader)
|
||||
|
||||
set(OUTPUT_FILE ${CMAKE_BINARY_DIR}/include/compiler_features.hpp)
|
||||
if(MYX_CMAKE_GENERATED_HEADER_FILENAME)
|
||||
set(OUTPUT_FILE ${MYX_CMAKE_GENERATED_HEADER_FILENAME})
|
||||
endif()
|
||||
|
||||
write_compiler_detection_header(
|
||||
FILE ${OUTPUT_FILE}
|
||||
PREFIX ${MYX_CMAKE_PROJECT_NAME_CANONICAL}
|
||||
COMPILERS GNU Clang MSVC Intel
|
||||
FEATURES
|
||||
cxx_nullptr
|
||||
cxx_override
|
||||
cxx_alignas
|
||||
cxx_alignof
|
||||
cxx_attributes
|
||||
cxx_auto_type
|
||||
cxx_constexpr
|
||||
cxx_digit_separators
|
||||
cxx_range_for)
|
||||
unset(OUTPUT_FILE)
|
||||
endfunction()
|
||||
|
31
MyxCMake/functions/hpp/myx_cmake_git_info.hpp.in
Normal file
31
MyxCMake/functions/hpp/myx_cmake_git_info.hpp.in
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef @MYX_CMAKE_PROJECT_NAME_UPPER@_MYX_CMAKE_GIT_INFO_HPP_
|
||||
#define @MYX_CMAKE_PROJECT_NAME_UPPER@_MYX_CMAKE_GIT_INFO_HPP_
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined (@MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_REV)
|
||||
#error "Duplicate definition of macros @MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_REV"
|
||||
#else
|
||||
#define @MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_REV "@MYX_CMAKE_GIT_REV@"
|
||||
#endif
|
||||
|
||||
#if defined (@MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_DIFF)
|
||||
#error "Duplicate definition of macros @MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_DIFF"
|
||||
#else
|
||||
#define @MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_DIFF "@MYX_CMAKE_GIT_DIFF@"
|
||||
#endif
|
||||
|
||||
#if defined (@MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_BRANCH)
|
||||
#error "Duplicate definition of macros @MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_BRANCH"
|
||||
#else
|
||||
#define @MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_BRANCH "@MYX_CMAKE_GIT_BRANCH@"
|
||||
#endif
|
||||
|
||||
#if defined (@MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_TAG)
|
||||
#error "Duplicate definition of macros @MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_TAG"
|
||||
#else
|
||||
#define @MYX_CMAKE_PROJECT_NAME_UPPER@_GIT_TAG "@MYX_CMAKE_GIT_TAG@"
|
||||
#endif
|
||||
|
||||
#endif /* @MYX_CMAKE_PROJECT_NAME_UPPER@_MYX_CMAKE_GIT_INFO_HPP_ */
|
||||
|
94
MyxCMake/functions/hpp/myx_cmake_private_config.hpp.in
Normal file
94
MyxCMake/functions/hpp/myx_cmake_private_config.hpp.in
Normal file
@ -0,0 +1,94 @@
|
||||
#ifndef @CMLIB_PROJECT_NAME_UPPER@_CMLIB_CONFIG_HPP_
|
||||
#define @CMLIB_PROJECT_NAME_UPPER@_CMLIB_CONFIG_HPP_
|
||||
|
||||
#pragma once
|
||||
|
||||
#define @CMLIB_PROJECT_NAME_UPPER@_VERSION_STR "@PROJECT_VERSION@"
|
||||
#define @CMLIB_PROJECT_NAME_UPPER@_VERSION_INT @PROJECT_VERSION_INT@
|
||||
|
||||
#if defined (CMLIB_ORGANIZATION_NAME)
|
||||
#error "Duplicate definition of macros CMLIB_ORGANIZATION_NAME"
|
||||
#else
|
||||
#define CMLIB_ORGANIZATION_NAME "@CMLIB_ORGANIZATION_NAME@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_ORGANIZATION_NAME_LOWER)
|
||||
#error "Duplicate definition of macros CMLIB_ORGANIZATION_NAME_LOWER"
|
||||
#else
|
||||
#define CMLIB_ORGANIZATION_NAME_LOWER "@CMLIB_ORGANIZATION_NAME_LOWER@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_ORGANIZATION_NAME_UPPER)
|
||||
#error "Duplicate definition of macros CMLIB_ORGANIZATION_NAME_UPPER"
|
||||
#else
|
||||
#define CMLIB_ORGANIZATION_NAME_UPPER "@CMLIB_ORGANIZATION_NAME_UPPER@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_PROJECT_NAME)
|
||||
#error "Duplicate definition of macros CMLIB_PROJECT_NAME"
|
||||
#else
|
||||
#define CMLIB_PROJECT_NAME "@CMAKE_PROJECT_NAME@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_PROJECT_NAME_LOWER)
|
||||
#error "Duplicate definition of macros CMLIB_PROJECT_NAME_LOWER"
|
||||
#else
|
||||
#define CMLIB_PROJECT_NAME_LOWER "@CMLIB_PROJECT_NAME_LOWER@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_PROJECT_NAME_UPPER)
|
||||
#error "Duplicate definition of macros CMLIB_PROJECT_NAME_UPPER"
|
||||
#else
|
||||
#define CMLIB_PROJECT_NAME_UPPER "@CMLIB_PROJECT_NAME_UPPER@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_THEME_NAME)
|
||||
#error "Duplicate definition of macros CMLIB_THEME_NAME"
|
||||
#else
|
||||
#define CMLIB_THEME_NAME "@CMLIB_THEME_NAME@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_THEME_NAME_LOWER)
|
||||
#error "Duplicate definition of macros CMLIB_THEME_NAME_LOWER"
|
||||
#else
|
||||
#define CMLIB_THEME_NAME_LOWER "@CMLIB_THEME_NAME_LOWER@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_THEME_NAME_UPPER)
|
||||
#error "Duplicate definition of macros CMLIB_THEME_NAME_UPPER"
|
||||
#else
|
||||
#define CMLIB_THEME_NAME_UPPER "@CMLIB_THEME_NAME_UPPER@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_AUTHOR_NAME)
|
||||
#error "Duplicate definition of macros CMLIB_AUTHOR_NAME"
|
||||
#else
|
||||
#define CMLIB_AUTHOR_NAME "@CMLIB_AUTHOR_NAME@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_AUTHOR_EMAIL)
|
||||
#error "Duplicate definition of macros CMLIB_AUTHOR_EMAIL"
|
||||
#else
|
||||
#define CMLIB_AUTHOR_EMAIL "@CMLIB_AUTHOR_EMAIL@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_DESCRIPTION)
|
||||
#error "Duplicate definition of macros CMLIB_DESCRIPTION"
|
||||
#else
|
||||
#define CMLIB_DESCRIPTION "@CMLIB_DESCRIPTION@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_BUILD_TYPE)
|
||||
#error "Duplicate definition of macros CMLIB_BUILD_TYPE"
|
||||
#else
|
||||
#define CMLIB_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
|
||||
#endif
|
||||
|
||||
#if defined (CMLIB_BUILD_DATE)
|
||||
#error "Duplicate definition of macros CMLIB_BUILD_DATE"
|
||||
#else
|
||||
#define CMLIB_BUILD_DATE "@TODAY@"
|
||||
#endif
|
||||
|
||||
#endif /* @CMLIB_PROJECT_NAME_UPPER@_CMLIB_CONFIG_HPP_ */
|
||||
|
11
MyxCMake/functions/largefiles/TestFileOffsetBits.c
Normal file
11
MyxCMake/functions/largefiles/TestFileOffsetBits.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Cause a compile-time error if off_t is smaller than 64 bits */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
24
MyxCMake/functions/largefiles/TestLargeFiles.c.in
Normal file
24
MyxCMake/functions/largefiles/TestLargeFiles.c.in
Normal file
@ -0,0 +1,24 @@
|
||||
#cmakedefine _LARGEFILE_SOURCE
|
||||
#cmakedefine _LARGEFILE64_SOURCE
|
||||
#cmakedefine _LARGE_FILES
|
||||
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
/* Cause a compile-time error if off_t is smaller than 64 bits,
|
||||
* and make sure we have ftello / fseeko.
|
||||
*/
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
|
||||
FILE *fp = fopen(argv[0],"r");
|
||||
off_t offset = ftello( fp );
|
||||
|
||||
fseeko( fp, offset, SEEK_CUR );
|
||||
fclose(fp);
|
||||
return off_t_is_large[0] || argc;
|
||||
}
|
||||
|
11
MyxCMake/functions/largefiles/TestWindowsFSeek.c
Normal file
11
MyxCMake/functions/largefiles/TestWindowsFSeek.c
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__int64 off=0;
|
||||
|
||||
_fseeki64(NULL, off, SEEK_SET);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user