Commit 47461afd authored by Daniel Agar's avatar Daniel Agar

rename cmake CheckTypeSize to CheckTypeSizeof

parent 7904c1b6
...@@ -3,7 +3,7 @@ project(pyston C CXX ASM) ...@@ -3,7 +3,7 @@ project(pyston C CXX ASM)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(CheckTypeSize) include(CheckTypeSizeof)
include(ExternalProject) include(ExternalProject)
set(DEPS_DIR $ENV{HOME}/pyston_deps) set(DEPS_DIR $ENV{HOME}/pyston_deps)
...@@ -113,11 +113,11 @@ ExternalProject_Add(libunwind ...@@ -113,11 +113,11 @@ ExternalProject_Add(libunwind
LOG_INSTALL ON) LOG_INSTALL ON)
# libpypa # libpypa
add_subdirectory(libpypa) add_subdirectory(libpypa EXCLUDE_FROM_ALL)
add_dependencies(pypa gitsubmodules) add_dependencies(pypa gitsubmodules)
# lz4 # lz4
add_subdirectory(lz4/cmake_unofficial) add_subdirectory(lz4/cmake_unofficial EXCLUDE_FROM_ALL)
add_dependencies(lz4 gitsubmodules) add_dependencies(lz4 gitsubmodules)
# valgrind # valgrind
...@@ -174,7 +174,7 @@ set(CMAKE_REQUIRED_INCLUDES ${DEPS_DIR}/llvm-trunk/include ...@@ -174,7 +174,7 @@ set(CMAKE_REQUIRED_INCLUDES ${DEPS_DIR}/llvm-trunk/include
${CMAKE_BINARY_DIR}/llvm/include ${CMAKE_BINARY_DIR}/llvm/include
${CMAKE_SOURCE_DIR}/from_cpython/Include ${CMAKE_SOURCE_DIR}/from_cpython/Include
${CMAKE_SOURCE_DIR}/src) ${CMAKE_SOURCE_DIR}/src)
check_type_size("pyston::BoxedDict" SIZEOF_BOXEDDICT LANGUAGE CXX) check_type_sizeof("pyston::BoxedDict" SIZEOF_BOXEDDICT LANGUAGE CXX)
configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h) configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
add_subdirectory(lib_pyston) add_subdirectory(lib_pyston)
......
#.rst: #.rst:
# CheckTypeSize # CheckTypeSizeof
# ------------- # -------------
# #
# Pyston: This file is included from cmake 3 for compatability # Pyston: This file is included from cmake 3 for compatability
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# :: # ::
# #
# CHECK_TYPE_SIZE(TYPE VARIABLE [BUILTIN_TYPES_ONLY] # CHECK_TYPE_SIZEOF(TYPE VARIABLE [BUILTIN_TYPES_ONLY]
# [LANGUAGE <language>]) # [LANGUAGE <language>])
# #
# Check if the type exists and determine its size. On return, # Check if the type exists and determine its size. On return,
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
# #
# :: # ::
# #
# check_type_size("((struct something*)0)->member" SIZEOF_MEMBER) # check_type_sizeof("((struct something*)0)->member" SIZEOF_MEMBER)
# #
# #
# #
...@@ -89,11 +89,11 @@ include(CheckIncludeFileCXX) ...@@ -89,11 +89,11 @@ include(CheckIncludeFileCXX)
cmake_policy(PUSH) cmake_policy(PUSH)
cmake_policy(VERSION 2.8) cmake_policy(VERSION 2.8)
get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) get_filename_component(__check_type_sizeof_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Helper function. DO NOT CALL DIRECTLY. # Helper function. DO NOT CALL DIRECTLY.
function(__check_type_size_impl type var map builtin language) function(__check_type_sizeof_impl type var map builtin language)
if(NOT CMAKE_REQUIRED_QUIET) if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Check size of ${type}") message(STATUS "Check size of ${type}")
endif() endif()
...@@ -118,14 +118,14 @@ function(__check_type_size_impl type var map builtin language) ...@@ -118,14 +118,14 @@ function(__check_type_size_impl type var map builtin language)
# Perform the check. # Perform the check.
if("${language}" STREQUAL "C") if("${language}" STREQUAL "C")
set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.c) set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSizeof/${var}.c)
elseif("${language}" STREQUAL "CXX") elseif("${language}" STREQUAL "CXX")
set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.cpp) set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSizeof/${var}.cpp)
else() else()
message(FATAL_ERROR "Unknown language:\n ${language}\nSupported languages: C, CXX.\n") message(FATAL_ERROR "Unknown language:\n ${language}\nSupported languages: C, CXX.\n")
endif() endif()
set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin) set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSizeof/${var}.bin)
configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY) configure_file(${__check_type_sizeof_dir}/CheckTypeSizeof.c.in ${src} @ONLY)
try_compile(HAVE_${var} ${CMAKE_BINARY_DIR} ${src} try_compile(HAVE_${var} ${CMAKE_BINARY_DIR} ${src}
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
...@@ -170,14 +170,14 @@ function(__check_type_size_impl type var map builtin language) ...@@ -170,14 +170,14 @@ function(__check_type_size_impl type var map builtin language)
# Update the architecture-to-size map. # Update the architecture-to-size map.
if(mismatch AND keys) if(mismatch AND keys)
configure_file(${__check_type_size_dir}/CheckTypeSizeMap.cmake.in ${map} @ONLY) configure_file(${__check_type_sizeof_dir}/CheckTypeSizeMap.cmake.in ${map} @ONLY)
set(${var} 0) set(${var} 0)
else() else()
file(REMOVE ${map}) file(REMOVE ${map})
endif() endif()
if(mismatch AND NOT keys) if(mismatch AND NOT keys)
message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") message(SEND_ERROR "CHECK_TYPE_SIZEOF found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
endif() endif()
if(NOT CMAKE_REQUIRED_QUIET) if(NOT CMAKE_REQUIRED_QUIET)
...@@ -185,7 +185,7 @@ function(__check_type_size_impl type var map builtin language) ...@@ -185,7 +185,7 @@ function(__check_type_size_impl type var map builtin language)
endif() endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining size of ${type} passed with the following output:\n${output}\n\n") "Determining size of ${type} passed with the following output:\n${output}\n\n")
set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})") set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZEOF: sizeof(${type})")
else() else()
# The check failed to compile. # The check failed to compile.
if(NOT CMAKE_REQUIRED_QUIET) if(NOT CMAKE_REQUIRED_QUIET)
...@@ -194,24 +194,24 @@ function(__check_type_size_impl type var map builtin language) ...@@ -194,24 +194,24 @@ function(__check_type_size_impl type var map builtin language)
file(READ ${src} content) file(READ ${src} content)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n") "Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n")
set(${var} "" CACHE INTERNAL "CHECK_TYPE_SIZE: ${type} unknown") set(${var} "" CACHE INTERNAL "CHECK_TYPE_SIZEOF: ${type} unknown")
file(REMOVE ${map}) file(REMOVE ${map})
endif() endif()
endfunction() endfunction()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
macro(CHECK_TYPE_SIZE TYPE VARIABLE) macro(CHECK_TYPE_SIZEOF TYPE VARIABLE)
# parse arguments # parse arguments
unset(doing) unset(doing)
foreach(arg ${ARGN}) foreach(arg ${ARGN})
if("x${arg}" STREQUAL "xBUILTIN_TYPES_ONLY") if("x${arg}" STREQUAL "xBUILTIN_TYPES_ONLY")
set(_CHECK_TYPE_SIZE_${arg} 1) set(_CHECK_TYPE_SIZEOF_${arg} 1)
unset(doing) unset(doing)
elseif("x${arg}" STREQUAL "xLANGUAGE") # change to MATCHES for more keys elseif("x${arg}" STREQUAL "xLANGUAGE") # change to MATCHES for more keys
set(doing "${arg}") set(doing "${arg}")
set(_CHECK_TYPE_SIZE_${doing} "") set(_CHECK_TYPE_SIZEOF_${doing} "")
elseif("x${doing}" STREQUAL "xLANGUAGE") elseif("x${doing}" STREQUAL "xLANGUAGE")
set(_CHECK_TYPE_SIZE_${doing} "${arg}") set(_CHECK_TYPE_SIZEOF_${doing} "${arg}")
unset(doing) unset(doing)
else() else()
message(FATAL_ERROR "Unknown argument:\n ${arg}\n") message(FATAL_ERROR "Unknown argument:\n ${arg}\n")
...@@ -220,17 +220,17 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE) ...@@ -220,17 +220,17 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE)
if("x${doing}" MATCHES "^x(LANGUAGE)$") if("x${doing}" MATCHES "^x(LANGUAGE)$")
message(FATAL_ERROR "Missing argument:\n ${doing} arguments requires a value\n") message(FATAL_ERROR "Missing argument:\n ${doing} arguments requires a value\n")
endif() endif()
if(DEFINED _CHECK_TYPE_SIZE_LANGUAGE) if(DEFINED _CHECK_TYPE_SIZEOF_LANGUAGE)
if(NOT "x${_CHECK_TYPE_SIZE_LANGUAGE}" MATCHES "^x(C|CXX)$") if(NOT "x${_CHECK_TYPE_SIZEOF_LANGUAGE}" MATCHES "^x(C|CXX)$")
message(FATAL_ERROR "Unknown language:\n ${_CHECK_TYPE_SIZE_LANGUAGE}.\nSupported languages: C, CXX.\n") message(FATAL_ERROR "Unknown language:\n ${_CHECK_TYPE_SIZEOF_LANGUAGE}.\nSupported languages: C, CXX.\n")
endif() endif()
set(_language ${_CHECK_TYPE_SIZE_LANGUAGE}) set(_language ${_CHECK_TYPE_SIZEOF_LANGUAGE})
else() else()
set(_language C) set(_language C)
endif() endif()
# Optionally check for standard headers. # Optionally check for standard headers.
if(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY) if(_CHECK_TYPE_SIZEOF_BUILTIN_TYPES_ONLY)
set(_builtin 0) set(_builtin 0)
else() else()
set(_builtin 1) set(_builtin 1)
...@@ -244,14 +244,14 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE) ...@@ -244,14 +244,14 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE)
check_include_file_cxx(stddef.h HAVE_STDDEF_H) check_include_file_cxx(stddef.h HAVE_STDDEF_H)
endif() endif()
endif() endif()
unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY) unset(_CHECK_TYPE_SIZEOF_BUILTIN_TYPES_ONLY)
unset(_CHECK_TYPE_SIZE_LANGUAGE) unset(_CHECK_TYPE_SIZEOF_LANGUAGE)
# Compute or load the size or size map. # Compute or load the size or size map.
set(${VARIABLE}_KEYS) set(${VARIABLE}_KEYS)
set(_map_file ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${VARIABLE}.cmake) set(_map_file ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CheckTypeSizeof/${VARIABLE}.cmake)
if(NOT DEFINED HAVE_${VARIABLE}) if(NOT DEFINED HAVE_${VARIABLE})
__check_type_size_impl(${TYPE} ${VARIABLE} ${_map_file} ${_builtin} ${_language}) __check_type_sizeof_impl(${TYPE} ${VARIABLE} ${_map_file} ${_builtin} ${_language})
endif() endif()
include(${_map_file} OPTIONAL) include(${_map_file} OPTIONAL)
set(_map_file) set(_map_file)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment