aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--CMakeLists.txt50
-rw-r--r--libsolidity/AST.cpp2
-rw-r--r--libsolidity/CMakeLists.txt10
-rw-r--r--solc/CMakeLists.txt8
-rw-r--r--test/CMakeLists.txt17
6 files changed, 28 insertions, 64 deletions
diff --git a/.gitignore b/.gitignore
index 675407ee..ebd0881e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,7 @@
*.app
# Build directory
-build/ \ No newline at end of file
+build/
+
+# vim stuff
+*.swp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5198adb4..49de37e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,35 +1,15 @@
-cmake_minimum_required(VERSION 2.8.12)
-
-cmake_policy(SET CMP0015 NEW)
-# let cmake autolink dependencies on windows
-cmake_policy(SET CMP0020 NEW)
-# this policy was introduced in cmake 3.0
-# remove if, once 3.0 will be used on unix
-if (${CMAKE_MAJOR_VERSION} GREATER 2)
- cmake_policy(SET CMP0043 OLD)
-endif()
-
-# TODO use version from Version.h
-set(PROJECT_VERSION "0.9.42")
-if (${CMAKE_VERSION} VERSION_GREATER 3.0)
- cmake_policy(SET CMP0042 OLD) # fix MACOSX_RPATH
- cmake_policy(SET CMP0048 NEW) # allow VERSION argument in project()
- project(solidity VERSION ${PROJECT_VERSION})
-else()
- project(solidity)
-endif()
-
-# Figure out environment.
-set(ETH_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/../cpp-ethereum-cmake" CACHE PATH "The the path to the cmake directory")
-set(ETH_DIR "${CMAKE_CURRENT_LIST_DIR}/../cpp-ethereum" CACHE PATH "The path to the cpp-ethereum directory")
-set(BUILD_DIR_NAME "build" CACHE STRING "The name of the build directory in cpp-ethereum")
-set(ETH_BUILD_DIR "${ETH_DIR}/${BUILD_DIR_NAME}")
+cmake_minimum_required(VERSION 3.0.0)
-# A place where should we look for *.cmake files
+set(ETH_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/../cpp-ethereum-cmake" CACHE PATH "The the path to the cmake directory")
list(APPEND CMAKE_MODULE_PATH ${ETH_CMAKE_DIR})
-# A place where we should look for ethereum libraries
-set(CMAKE_LIBRARY_PATH ${ETH_BUILD_DIR})
+# Set cmake_policies
+include(EthPolicy)
+eth_policy()
+
+# project name and version should be set after cmake_policy CMP0048
+set(PROJECT_VERSION "0.1.0")
+project(solidity VERSION ${PROJECT_VERSION})
# Let's find our dependencies
include(EthDependencies)
@@ -40,16 +20,8 @@ include(EthCompilerSettings)
# Include helper macros
include(EthExecutableHelper)
-# Include a directory with BuildInfo.h
-include_directories(${ETH_BUILD_DIR})
-
-find_package(Eth)
-
-include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS})
-include_directories(BEFORE .)
-include_directories(${Boost_INCLUDE_DIRS})
-include_directories(${ETH_DIR})
-include_directories(${CPPETHEREUM_BUILD})
+# Include utils
+include(EthUtils)
add_subdirectory(libsolidity)
add_subdirectory(solc)
diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp
index f7c84ccb..a849535a 100644
--- a/libsolidity/AST.cpp
+++ b/libsolidity/AST.cpp
@@ -556,7 +556,7 @@ void VariableDeclaration::checkTypeRequirements()
BOOST_THROW_EXCEPTION(createTypeError("Illegal use of \"constant\" specifier."));
if (!m_value)
BOOST_THROW_EXCEPTION(createTypeError("Uninitialized \"constant\" variable."));
- else if (!m_type->isValueType())
+ else if (m_type && !m_type->isValueType())
// TODO: const is implemented only for uint, bytesXX and enums types.
BOOST_THROW_EXCEPTION(createTypeError("Illegal use of \"constant\" specifier. \"constant\" is not implemented for this type yet."));
}
diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt
index 159405a2..6e1d70af 100644
--- a/libsolidity/CMakeLists.txt
+++ b/libsolidity/CMakeLists.txt
@@ -11,14 +11,8 @@ file(GLOB HEADERS "*.h")
include_directories(BEFORE ..)
add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
-add_dependencies(${EXECUTABLE} BuildInfo.h)
-
-target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES})
-target_link_libraries(${EXECUTABLE} ${Boost_LIBRARIES})
-target_link_libraries(${EXECUTABLE} ${ETH_DEVCORE_LIBRARY})
-target_link_libraries(${EXECUTABLE} ${ETH_EVMCORE_LIBRARY})
-target_link_libraries(${EXECUTABLE} ${ETH_EVMASM_LIBRARY})
-target_link_libraries(${EXECUTABLE} ${ETH_DEVCRYPTO_LIBRARY})
+
+eth_use(${EXECUTABLE} REQUIRED Eth::devcore Eth::evmasm)
install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} )
diff --git a/solc/CMakeLists.txt b/solc/CMakeLists.txt
index df72f52d..e9a3446b 100644
--- a/solc/CMakeLists.txt
+++ b/solc/CMakeLists.txt
@@ -1,23 +1,17 @@
-cmake_policy(SET CMP0015 NEW)
set(CMAKE_AUTOMOC OFF)
aux_source_directory(. SRC_LIST)
list(REMOVE_ITEM SRC_LIST "./jsonCompiler.cpp")
-include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS})
include_directories(BEFORE ..)
-include_directories(${Boost_INCLUDE_DIRS})
set(EXECUTABLE solc)
file(GLOB HEADERS "*.h")
add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
-add_dependencies(${EXECUTABLE} BuildInfo.h)
-
-target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES})
+eth_use(${EXECUTABLE} REQUIRED Solidity)
target_link_libraries(${EXECUTABLE} ${Boost_PROGRAM_OPTIONS_LIBRARIES})
-target_link_libraries(${EXECUTABLE} solidity)
if (APPLE)
install(TARGETS ${EXECUTABLE} DESTINATION bin)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 81053d82..9c6e2944 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -2,8 +2,10 @@ cmake_policy(SET CMP0015 NEW)
aux_source_directory(. SRC_LIST)
+get_filename_component(TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
+
macro (add_sources)
- file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}/test" "${CMAKE_CURRENT_SOURCE_DIR}")
+ file (RELATIVE_PATH _relPath ${TESTS_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
foreach (_src ${ARGN})
if (_relPath)
list (APPEND SRC "${_relPath}/${_src}")
@@ -39,14 +41,13 @@ foreach(file ${SRC_LIST})
endforeach(file)
file(GLOB HEADERS "*.h")
-add_executable(test ${SRC_LIST} ${HEADERS})
+set(EXECUTABLE soltest)
+add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
+
+eth_use(${EXECUTABLE} REQUIRED Solidity Eth::ethereum)
-target_link_libraries(test ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
-target_link_libraries(test ${ETH_ETHEREUM_LIBRARY})
-target_link_libraries(test ${ETH_ETHCORE_LIBRARY})
-target_link_libraries(test solidity)
+include_directories(BEFORE ..)
+target_link_libraries(${EXECUTABLE} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
enable_testing()
set(CTEST_OUTPUT_ON_FAILURE TRUE)
-
-include(EthUtils)