Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial commit of CMake build system #992

Merged
merged 1 commit into from
Apr 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
###############################################################################
#
# (c) Copyright IBM Corp. 2017
#
# This program and the accompanying materials are made available
# under the terms of the Eclipse Public License v1.0 and
# Apache License v2.0 which accompanies this distribution.
#
# The Eclipse Public License is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# The Apache License v2.0 is available at
# http://www.opensource.org/licenses/apache2.0.php
#
# Contributors:
# Multiple authors (IBM Corp.) - initial implementation and documentation
###############################################################################

platform: x64
configuration: Debug
shallow_clone: true
clone_depth: 1

environment:
GTEST_FILTER: '*dump_test_create_dump_*:*NumaSetAffinity:*NumaSetAffinitySuspended'
GTEST_COLOR: '1'

before_build:
- ps: cmake -Wdev -G "Visual Studio 14 2015 Win64" .

build:
project: omr.sln
parallel: true

test_script:
- ps: ctest -V -C Debug
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################################
#
# (c) Copyright IBM Corp. 2014, 2016
# (c) Copyright IBM Corp. 2014, 2017
#
# This program and the accompanying materials are made available
# under the terms of the Eclipse Public License v1.0 and
Expand All @@ -16,6 +16,15 @@
# Multiple authors (IBM Corp.) - initial implementation and documentation
###############################################################################
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

general comment: modified files should have their "rightmost" copyright date updated to the current year


build/
CMakeFiles/
CMakeCache.txt
omrcfg.h
omrversionstrings.h
CTestTestfile.cmake
Makefile
cmake_install.cmake

# configure artifacts
autom4te.cache
config.cache
Expand Down
66 changes: 37 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,53 @@
# Contributors:
# Multiple authors (IBM Corp.) - initial implementation and documentation
###############################################################################

language: c++
os:
- linux
- osx
language: cpp
sudo: false

# https://docs.travis-ci.com/user/caching/
cache: ccache

cache: ccache # https://docs.travis-ci.com/user/caching/
dist: trusty
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test
packages:
- libnuma-dev
- bison
- gcc-multilib
- g++-multilib
- clang-3.4
- libclang-3.4-dev
- llvm-3.4

before_script:
- ulimit -c unlimited
- export GTEST_FILTER=-*dump_test_create_dump_*:*NumaSetAffinity:*NumaSetAffinitySuspended
# Disable the core dump tests as container based builds don't allow setting
# core_pattern and don't have apport installed. This can be removed when
# apport is available in apt whitelist

- libnuma-dev
- bison
- clang-3.4
- libclang-3.4-dev
- llvm-3.4
- gcc-multilib
- g++-multilib
env:
matrix:
- BUILD_WITH_CMAKE=yes
global:
- GTEST_COLOR=1
- GTEST_FILTER=-*dump_test_create_dump_*:*NumaSetAffinity:*NumaSetAffinitySuspended
# Disable the core dump tests as container based builds don't allow setting
# core_pattern and don't have apport installed. This can be removed when
# apport is available in apt whitelist
matrix:
allow_failures:
- env: BUILD_WITH_CMAKE=yes
exclude:
- os: osx
env: BUILD_WITH_CMAKE=yes
include:
- os: linux
env: SPEC=linux_x86 PLATFORM=amd64-linux-gcc
- os: linux
env: SPEC=linux_x86-64 PLATFORM=amd64-linux64-gcc
env: SPEC=linux_x86-64 PLATFORM=amd64-linux64-gcc
- os: linux
env: SPEC=linux_x86-64_cmprssptrs PLATFORM=amd64-linux64-gcc
- os: linux
env: RUN_LINT=yes RUN_BUILD=no SPEC=linux_x86-64 PLATFORM=amd64-linux64-gcc
dist: precise
- os: linux
env: SPEC=linux_x86 PLATFORM=amd64-linux-gcc
- os: osx
env: SPEC=osx_x86-64

before_script:
- ulimit -c unlimited
script:
- make -f run_configure.mk OMRGLUE=./example/glue
- make && make test && ([ "$SPEC" != "linux_x86-64" ] || make lint)

- bash ./scripts/build-on-travis.sh
113 changes: 113 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
###############################################################################
#
# (c) Copyright IBM Corp. 2017
#
# This program and the accompanying materials are made available
# under the terms of the Eclipse Public License v1.0 and
# Apache License v2.0 which accompanies this distribution.
#
# The Eclipse Public License is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# The Apache License v2.0 is available at
# http://www.opensource.org/licenses/apache2.0.php
#
# Contributors:
# Multiple authors (IBM Corp.) - initial implementation and documentation
###############################################################################

cmake_minimum_required(VERSION 3.2 FATAL_ERROR)

#TODO figure out method of sharing version info with makefile build
set(OMR_VERSION_MAJOR 0)
set(OMR_VERSION_MINOR 0)
set(OMR_VERSION_PATCH 1)
set(OMR_VERSION ${OMR_VERSION_MAJOR}.${OMR_VERSION_MINOR}.${OMR_VERSION_PATCH})

project(omr VERSION ${OMR_VERSION} LANGUAGES CXX C)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})

###
### Getting the glue directory
###

set(OMR_GLUE "./example/glue" CACHE PATH "The glue directory")

# TODO: OMR_EXAMPLE flag
# TODO: OMR_RTTI flag

# TODO: Version things

set(OMR_VERSION_STRING "<Unknown>" CACHE STRING "") # TODO: Set the version
set(OMR_JIT_VERSION_STRING "<Unknown>" CACHE STRING "") # TODO: Set the version

###
### Versions and stuff
###

include(cmake/platform.cmake)
include(cmake/config.cmake)

enable_testing()

#include current source dir and current bin dir automatically
set(CMAKE_INCLUDE_CURRENT_DIR ON)

function(VPathResolve inlist dirlist outlist)
set(output "")
foreach(currentFile ${${inlist}})
set(fileFound False)
foreach(currentDir ${${dirlist}})
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${currentDir}/${currentFile}")
list(APPEND output "${currentDir}/${currentFile}")
set(fileFound True)
break()
endif()
endforeach()
if(NOT fileFound)
message(FATAL_ERROR "Could not find file ${currentFile}")
endif()
endforeach()
set(${outlist} ${output} PARENT_SCOPE)
endfunction()

include_directories(
${PROJECT_BINARY_DIR}
./include/
./include_core/
./third_party/
)

add_definitions(
-DUT_DIRECT_TRACE_REGISTRATION # TODO: Deal with that stupid jni issue in tracegen
)

configure_file(./omrcfg.CMakeTemplate.h omrcfg.h)
configure_file(./omrversionstrings.CMakeTemplate.h omrversionstrings.h)

add_subdirectory(tools)
# Yeah, its dumb doing this here. Read note in tools/CMakeLists.txt
if(CMAKE_CROSSCOMPILING)
include(${OMR_TOOLS_IMPORTFILE})
endif()
add_subdirectory(thread)
add_subdirectory(port)
add_subdirectory(util)
add_subdirectory(omrtrace)
add_subdirectory(omr)
add_subdirectory(third_party)
add_subdirectory(omrsigcompat)

#TODO should be wrapped in if()
add_subdirectory(fvtest)

if(OMR_GC)
add_subdirectory(gc)
add_subdirectory("${OMR_GLUE}")
endif(OMR_GC)

if(OMR_COMPILER)
# TODO: Actually support the compiler
add_subdirectory(compiler)
endif(OMR_COMPILER)
15 changes: 15 additions & 0 deletions cmake/caches/Travis.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
set(OMR_EXAMPLE ON CACHE BOOL "")
set(OMR_JIT ON CACHE BOOL "")
set(OMR_GC ON CACHE BOOL "")
set(OMR_PORT ON CACHE BOOL "")
set(OMR_THREAD ON CACHE BOOL "")
set(OMR_OMRSIG ON CACHE BOOL "")
set(OMR_FVTEST ON CACHE BOOL "")
set(OMR_GLUE ${CMAKE_SOURCE_DIR}/example/glue)
set(OMR_GC_SEGREGATED_HEAP ON CACHE BOOL "")
set(OMR_GC_MODRON_SCAVENGER ON CACHE BOOL "")
set(OMR_GC_MODRON_CONCURRENT_MARK ON CACHE BOOL "")
set(OMR_THR_CUSTOM_SPIN_OPTIONS ON CACHE BOOL "")
set(OMR_NOTIFY_POLICY_CONTROL ON CACHE BOOL "")
set(OMR_THR_SPIN_WAKE_CONTROL ON CACHE BOOL "")
set(OMR_THR_SPIN_CODE_REFACTOR ON CACHE BOOL "")
119 changes: 119 additions & 0 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
###############################################################################
#
# (c) Copyright IBM Corp. 2017
#
# This program and the accompanying materials are made available
# under the terms of the Eclipse Public License v1.0 and
# Apache License v2.0 which accompanies this distribution.
#
# The Eclipse Public License is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# The Apache License v2.0 is available at
# http://www.opensource.org/licenses/apache2.0.php
#
# Contributors:
# Multiple authors (IBM Corp.) - initial implementation and documentation
###############################################################################

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a generated file? is that why there is no copyright header?

###
### Major Feature Flags
###

set(OMR_GC ON CACHE BOOL "Enable the GC")
set(OMR_COMPILER OFF CACHE BOOL "Enable the compiler")
set(OMR_JITBUILDER OFF CACHE BOOL "Enable building JitBuilder")
set(OMR_TEST_COMPILER OFF CACHE BOOL "Enable building the test compiler")
set(OMR_PORT ON CACHE BOOL "Enable portability library")
set(OMR_THREAD ON CACHE BOOL "Enable thread library")
set(OMR_OMRSIG ON CACHE BOOL "Enable the OMR signal compatibility library")
# set(OMR_TOOLS On CACHE BOOL "Enable the build tools")
# TODO: Support building only tools for cross-compilation build



###
### Boolean Feature Flags
###

# TODO: This is a pretty crazy list, can we move it to their subprojects?

set(OMR_GC_ALLOCATION_TAX ON CACHE BOOL "TODO: Document")
set(OMR_GC_ARRAYLETS ON CACHE BOOL "TODO: Document")
set(OMR_GC_BATCH_CLEAR_TLH ON CACHE BOOL "TODO: Document")
set(OMR_GC_COMBINATION_SPEC ON CACHE BOOL "TODO: Document")
set(OMR_GC_DEBUG_ASSERTS ON CACHE BOOL "TODO: Document")
set(OMR_GC_HEAP_CARD_TABLE ON CACHE BOOL "TODO: Document")
set(OMR_GC_LARGE_OBJECT_AREA ON CACHE BOOL "TODO: Document")
set(OMR_GC_MINIMUM_OBJECT_SIZE ON CACHE BOOL "TODO: Document")
set(OMR_GC_MODRON_STANDARD ON CACHE BOOL "TODO: Document")
set(OMR_GC_NON_ZERO_TLH ON CACHE BOOL "TODO: Document")
set(OMR_GC_THREAD_LOCAL_HEAP ON CACHE BOOL "TODO: Document")
set(OMR_GC_COMPRESSED_POINTERS OFF CACHE BOOL "TODO: Document")
set(OMR_GC_TLH_PREFETCH_FTA OFF CACHE BOOL "TODO: Document")
set(OMR_GC_OBJECT_MAP OFF CACHE BOOL "TODO: Document")
set(OMR_GC_DYNAMIC_CLASS_UNLOADING OFF CACHE BOOL "TODO: Document")
set(OMR_GC_MODRON_COMPACTION OFF CACHE BOOL "TODO: Document")
set(OMR_GC_MODRON_CONCURRENT_MARK OFF CACHE BOOL "TODO: Document")
set(OMR_GC_MODRON_SCAVENGER OFF CACHE BOOL "TODO: Document")
set(OMR_GC_CONCURRENT_SCAVENGER OFF CACHE BOOL "TODO: Document")
set(OMR_GC_CONCURRENT_SWEEP OFF CACHE BOOL "TODO: Document")
set(OMR_GC_HYBRID_ARRAYLETS OFF CACHE BOOL "TODO: Document")
set(OMR_GC_OBJECT_ALLOCATION_NOTIFY OFF CACHE BOOL "TODO: Document")
set(OMR_GC_REALTIME OFF CACHE BOOL "TODO: Document")
set(OMR_GC_SEGREGATED_HEAP OFF CACHE BOOL "TODO: Document")
set(OMR_GC_STACCATO OFF CACHE BOOL "TODO: Document")
set(OMR_GC_VLHGC OFF CACHE BOOL "TODO: Document")

set(OMR_INTERP_HAS_SEMAPHORES ON CACHE BOOL "TODO: Document")
set(OMR_INTERP_COMPRESSED_OBJECT_HEADER OFF CACHE BOOL "TODO: Document")
set(OMR_INTERP_SMALL_MONITOR_SLOT OFF CACHE BOOL "TODO: Document")

set(OMR_RAS_TDF_TRACE ON CACHE BOOL "TODO: Document")

set(OMR_THR_ADAPTIVE_SPIN ON CACHE BOOL "TODO: Document")
set(OMR_THR_JLM_HOLD_TIMES ON CACHE BOOL "TODO: Document")
set(OMR_THR_LOCK_NURSERY ON CACHE BOOL "TODO: Document")
set(OMR_THR_FORK_SUPPORT OFF CACHE BOOL "TODO: Document")
set(OMR_THR_THREE_TIER_LOCKING OFF CACHE BOOL "TODO: Document")
set(OMR_THR_CUSTOM_SPIN_OPTIONS OFF CACHE BOOL "TODO: Document")
set(OMR_THR_SPIN_WAKE_CONTROL OFF CACHE BOOL "TODO: Document")
set(OMR_THR_YIELD_ALG OFF CACHE BOOL "TODO: Document")
#TODO set to disabled. Stuff fails to compile when its on
set(OMR_THR_TRACING OFF CACHE BOOL "TODO: Document")

#TODO this should maybe be a OMRTHREAD_LIB string variable?
set(OMRTHREAD_WIN32_DEFAULT OFF)
set(OMRTHREAD_UNIX_DEFAULT OFF)
set(OMRTHREAD_AIX_DEFAULT OFF)
set(OMRTHREAD_ZOS_DEFAULT OFF)

if(OMR_HOST_OS STREQUAL "win")
set(OMRTHREAD_WIN32_DEFAULT ON)
elseif(OMR_HOST_OS STREQUAL "aix")
set(OMRTHREAD_AIX_DEFAULT ON)
elseif(OMR_HOST_OS STREQUAL "zos")
set(OMRTHREAD_ZOS_DEFAULT ON)
else()
set(OMRTHREAD_UNIX_DEFAULT ON)
endif()

set(OMRTHREAD_LIB_AIX ${OMRTHREAD_AIX_DEFAULT} CACHE BOOL "TODO: Document")
set(OMRTHREAD_LIB_ZOS ${OMRTHREAD_ZOS_DEFAULT} CACHE BOOL "TODO: Document")
set(OMRTHREAD_LIB_WIN32 ${OMRTHREAD_WIN32_DEFAULT} CACHE BOOL "TODO: Document")
set(OMRTHREAD_LIB_UNIX ${OMRTHREAD_UNIX_DEFAULT} CACHE BOOL "TODO: Document")

set(OMR_PORT_CAN_RESERVE_SPECIFIC_ADDRESS ON CACHE BOOL "TODO: Document")
set(OMR_PORT_NUMA_SUPPORT OFF CACHE BOOL "TODO: Document")
set(OMR_PORT_ALLOCATE_TOP_DOWN OFF CACHE BOOL "TODO: Document")
set(OMR_PORT_ZOS_CEEHDLRSUPPORT OFF CACHE BOOL "TODO: Document")
set(OMR_PORT_ASYNC_HANDLER OFF CACHE BOOL "TODO: Document")


set(OMR_NOTIFY_POLICY_CONTROL OFF CACHE BOOL "TODO: Document")

set(OMR_ENV_LITTLE_ENDIAN OFF CACHE BOOL "TODO: Document")
set(OMR_ENV_GCC OFF CACHE BOOL "TODO: Document")


set(OMR_OPT_CUDA OFF CACHE BOOL "TODO: Document")
Loading