Skip to content

Commit

Permalink
Merges release 0.3
Browse files Browse the repository at this point in the history
Release 0.3 brings support for LLVM 3.3, fixes various bugs
and provides a good base for futher development.

* origin/develop: (44 commits)
  Bumps the version and year
  Fixes Baker MM reallocation
  Moves to llvm 3.3
  Fixes the deps of debian package.
  The code generated page fault during execution of movdqa instruction This SSE instruction requered the data to be alined by 16 bytes.
  Updates README.md
  Moves targets 'doc' and 'image' into their own CMakeLists.txt
  Adds FindPOD2MAN.cmake and FindGZIP.cmake
  Adds toolchain for mingw32
  Adds check for Threads in CMake script
  Adds cmake module to find LLVM
  Adds cmake module to find libreadline and libtinfo
  Moves common vars into cmake/variables.cmake
  Adds target `make uninstall`
  Adds CLI arg `-v, --version`
  Fixes -Wall -Wextra warnings
  Adds include guard to completion engine header
  Adds handling of READLINE option in cmake
  Adds a dumb version of CompletionEngine without libreadline
  Makes the code compile with MinGW
  ...
  • Loading branch information
0x7CFE committed Feb 8, 2015
2 parents ce3c6e4 + 3e69759 commit 4ca757b
Show file tree
Hide file tree
Showing 48 changed files with 4,847 additions and 385 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*man -diff
ChangeLog -diff
139 changes: 101 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,80 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.4)

project(llst_project)
set (CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_SOURCE_DIR}/cmake/variables.cmake")
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

if (LLVM)
if(LLVM_VERSION)
set (CONFIG_COMMAND "llvm-config-${LLVM_VERSION}")
else()
set (CONFIG_COMMAND "llvm-config")
endif()
project(llst-project)

# TODO Check that llvm-config is found and working
find_package(Threads REQUIRED QUIET)
find_package(READLINE)
find_package(TINFO)
find_package(LLVM 3.3 EXACT)
find_package(POD2MAN)
find_package(GZIP REQUIRED)

execute_process(COMMAND ${CONFIG_COMMAND} --cxxflags
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE LLVM_CXX_FLAGS)
option(USE_READLINE "Should we use the GNU readline and history libraries?" ON)
option(USE_LLVM "Should we use LLVM to build JIT?" OFF)
option(USE_POD2MAN "Should we use pod2man to build the documentation (we will create empty docs otherwise)?" ON)

execute_process(COMMAND ${CONFIG_COMMAND} --ldflags
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE LLVM_LD_FLAGS)
if (USE_LLVM)
if (LLVM_FOUND)
message(STATUS "Using LLVM ${LLVM_VERSION}")
set (CMAKE_C_FLAGS "${LLVM_C_FLAGS} ${CMAKE_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${LLVM_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${LLVM_LD_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")

execute_process(COMMAND ${CONFIG_COMMAND} --libs all
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE LLVM_LIBS)
# LLVM generates loads of warnings...
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")

add_definitions(-DLLVM)
set (LLVM_LIBS_TO_LINK ${LLVM_LIBS})
add_definitions(-DLLVM)
else()
message(FATAL_ERROR "\nInstall llvm-3.3-dev:i386 and try again.")
endif()
else()
message(STATUS "LLVM is disabled")
unset(LLVM_LIBS_TO_LINK)
endif()

set (CMAKE_CXX_FLAGS "${LLVM_CXX_FLAGS} -Wall -fexceptions -frtti -Wno-cast-qual")
set (CMAKE_CXX_FLAGS_DEBUG "-g -ggdb -O0")
set (CMAKE_CXX_FLAGS_RELEASE "-O3")
if (USE_READLINE)
if (READLINE_FOUND AND TINFO_FOUND)
message(STATUS "Using readline library")
set_source_files_properties(src/CompletionEngine.cpp PROPERTIES COMPILE_DEFINITIONS USE_READLINE)
set (READLINE_LIBS_TO_LINK ${READLINE_LIBRARIES} ${TINFO_LIBRARIES})
else()
if(NOT TINFO_FOUND)
message(SEND_ERROR "Library readline depends on tinfo.\nYou may configure with -DUSE_READLINE=OFF.")
endif()
if(NOT READLINE_FOUND)
message(SEND_ERROR "Library readline is not found.\nYou may configure with -DUSE_READLINE=OFF.")
endif()
endif()
else()
message(STATUS "Readline library is disabled")
unset(READLINE_LIBS_TO_LINK)
endif()

if (USE_POD2MAN)
if (POD2MAN_FOUND)
message(STATUS "Using pod2man to build the documentation")
else()
message(FATAL_ERROR "\npod2man is not found.\nYou may configure with -DUSE_POD2MAN=OFF.")
endif()
function(get_pod2man_cmd OUT)
get_pod2man_cmd_wrapper(CMD ${ARGN})
set("${OUT}" "${CMD}" PARENT_SCOPE)
endfunction()
else()
message(STATUS "Pod2man is disabled")
function(get_pod2man_cmd OUT)
get_pod2man_cmd_wrapper(CMD ${ARGN} STUB)
set("${OUT}" "${CMD}" PARENT_SCOPE)
endfunction()
endif()


add_subdirectory(doc)
add_subdirectory(image)
add_subdirectory(src)
add_subdirectory(include)
include_directories(include)
Expand All @@ -50,7 +95,7 @@ set(CPP_FILES
src/vm.cpp
)

if (LLVM)
if (USE_LLVM)
# LLVM specific sources
list(APPEND CPP_FILES
src/LLVMMemoryManager.cpp
Expand All @@ -62,21 +107,39 @@ if (LLVM)
endif()

add_executable(llst ${CPP_FILES})
target_link_libraries(llst ${LLVM_LIBS} readline ${LLVM_LD_FLAGS})
target_link_libraries(llst ${LLVM_LIBS_TO_LINK} ${READLINE_LIBS_TO_LINK} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
add_dependencies(llst image)

if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
# this is a 64-bit OS
add_definitions(-m32 -L/usr/lib32)
set(CMAKE_EXE_LINKER_FLAGS "-m32 -L/usr/lib32")
endif()
set(changelog_compressed "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz")
gzip_compress("compress_changelog" "${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog" ${changelog_compressed})

set (IMAGE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/image)
add_custom_command(
OUTPUT ${IMAGE_DIR}/LittleSmalltalk.image
COMMAND ${IMAGE_DIR}/imageBuilder
DEPENDS ${IMAGE_DIR}/imageSource.st
WORKING_DIRECTORY ${IMAGE_DIR}
COMMENT "Building image"
)
install(TARGETS llst DESTINATION bin)
install(FILES LICENSE DESTINATION share/doc/${PROJECT_NAME} RENAME copyright)
install(FILES ${changelog_compressed} DESTINATION share/doc/${PROJECT_NAME})
install(FILES misc/bash-completion.sh DESTINATION share/bash-completion/completions RENAME llst)


set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "LLVM powered Little Smalltalk")
set (CPACK_DEBIAN_PACKAGE_DESCRIPTION # The format of Description: http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
"LLVM powered Little Smalltalk
LLST is a virtual machine with integrated JIT.
")
set (CPACK_PACKAGE_CONTACT "[email protected]")
set (CPACK_PACKAGE_VERSION_MAJOR "0")
set (CPACK_PACKAGE_VERSION_MINOR "3")
set (CPACK_PACKAGE_VERSION_PATCH "0")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set (CPACK_SOURCE_GENERATOR "TGZ")
set (CPACK_SOURCE_IGNORE_FILES "build/" "\\\\.kdev.*" "\\\\.git.*" "\\\\.hgignore" ".*\\\\.image")
set (CPACK_STRIP_FILES "llst")


set (CPACK_GENERATOR "DEB")
set (CPACK_DEBIAN_PACKAGE_MAINTAINER "Team <[email protected]>")
set (CPACK_DEBIAN_PACKAGE_DEPENDS "libc6")

include(CPack)

add_custom_target(image ALL DEPENDS ${IMAGE_DIR}/LittleSmalltalk.image)
# uninstall target
configure_file( "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in" uninstall.cmake @ONLY)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P uninstall.cmake)
Loading

0 comments on commit 4ca757b

Please sign in to comment.