Commit 23824449 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #436 from dagar/cmake-configure

cmake configure script
parents 82bf53d8 fb285ff2
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project(pyston C CXX ASM) project(pyston C CXX ASM)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(CheckTypeSize)
include(ExternalProject) include(ExternalProject)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set(DEPS_DIR $ENV{HOME}/pyston_deps) set(DEPS_DIR $ENV{HOME}/pyston_deps)
# set build type to release by default # set build type to release by default
...@@ -160,6 +162,17 @@ find_package(LibLZMA REQUIRED) ...@@ -160,6 +162,17 @@ find_package(LibLZMA REQUIRED)
link_directories(${CMAKE_BINARY_DIR}/libunwind/lib) link_directories(${CMAKE_BINARY_DIR}/libunwind/lib)
link_directories(${LLVM_LIBRARY_DIRS}) link_directories(${LLVM_LIBRARY_DIRS})
# generate config.h - must be after LLVM is configured
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_SOURCE_DIR}/src/runtime/types.h)
set(CMAKE_REQUIRED_DEFINITIONS "-DNVALGRIND -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS")
set(CMAKE_REQUIRED_INCLUDES ${DEPS_DIR}/llvm-trunk/include
${CMAKE_BINARY_DIR}/llvm/include
${CMAKE_SOURCE_DIR}/from_cpython/Include
${CMAKE_SOURCE_DIR}/src)
check_type_size("pyston::BoxedDict" SIZEOF_BOXEDDICT LANGUAGE CXX)
configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
add_subdirectory(lib_pyston) add_subdirectory(lib_pyston)
add_subdirectory(from_cpython) add_subdirectory(from_cpython)
add_subdirectory(src) add_subdirectory(src)
......
/* Pyston: This file is included from cmake 3 for compatability
* downloaded 2015-04-03
* https://github.com/Kitware/CMake/blob/master/Modules/CheckTypeSize.c.in
*/
@headers@
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(@type@))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}
This diff is collapsed.
/*--------------------------------------------------------------------------
* This file is autogenerated from config.h.in
* during the cmake configuration of your project.
* --------------------------------------------------------------------------*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
#define SIZEOF_BOXEDDICT @SIZEOF_BOXEDDICT@
#endif
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