From 1690f1c947b1b1bfaf84d0a586d2a56ffed11f37 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Wed, 19 Aug 2015 14:57:25 +0200 Subject: [PATCH] Add CMakeLists.txt for libsolidity --- CMakeLists.txt | 50 +++++++++++++++++++ {src => libsolidity}/AST.cpp | 0 {src => libsolidity}/AST.h | 0 {src => libsolidity}/ASTForward.h | 0 {src => libsolidity}/ASTJsonConverter.cpp | 0 {src => libsolidity}/ASTJsonConverter.h | 0 {src => libsolidity}/ASTPrinter.cpp | 0 {src => libsolidity}/ASTPrinter.h | 0 {src => libsolidity}/ASTUtils.cpp | 0 {src => libsolidity}/ASTUtils.h | 0 {src => libsolidity}/ASTVisitor.h | 0 {src => libsolidity}/AST_accept.h | 0 {src => libsolidity}/ArrayUtils.cpp | 0 {src => libsolidity}/ArrayUtils.h | 0 {src => libsolidity}/CMakeLists.txt | 0 {src => libsolidity}/Compiler.cpp | 0 {src => libsolidity}/Compiler.h | 0 {src => libsolidity}/CompilerContext.cpp | 0 {src => libsolidity}/CompilerContext.h | 0 {src => libsolidity}/CompilerStack.cpp | 0 {src => libsolidity}/CompilerStack.h | 0 {src => libsolidity}/CompilerUtils.cpp | 0 {src => libsolidity}/CompilerUtils.h | 0 {src => libsolidity}/DeclarationContainer.cpp | 0 {src => libsolidity}/DeclarationContainer.h | 0 {src => libsolidity}/Exceptions.h | 0 {src => libsolidity}/ExpressionCompiler.cpp | 0 {src => libsolidity}/ExpressionCompiler.h | 0 {src => libsolidity}/GasEstimator.cpp | 0 {src => libsolidity}/GasEstimator.h | 0 {src => libsolidity}/GlobalContext.cpp | 0 {src => libsolidity}/GlobalContext.h | 0 {src => libsolidity}/InterfaceHandler.cpp | 0 {src => libsolidity}/InterfaceHandler.h | 0 {src => libsolidity}/LValue.cpp | 0 {src => libsolidity}/LValue.h | 0 {src => libsolidity}/NameAndTypeResolver.cpp | 0 {src => libsolidity}/NameAndTypeResolver.h | 0 {src => libsolidity}/Parser.cpp | 0 {src => libsolidity}/Parser.h | 0 {src => libsolidity}/Scanner.cpp | 0 {src => libsolidity}/Scanner.h | 0 .../SourceReferenceFormatter.cpp | 0 .../SourceReferenceFormatter.h | 0 {src => libsolidity}/Token.cpp | 0 {src => libsolidity}/Token.h | 0 {src => libsolidity}/Types.cpp | 0 {src => libsolidity}/Types.h | 0 {src => libsolidity}/Utils.h | 0 {src => libsolidity}/Version.cpp | 2 +- {src => libsolidity}/Version.h | 0 {src => libsolidity}/grammar.txt | 0 52 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt rename {src => libsolidity}/AST.cpp (100%) rename {src => libsolidity}/AST.h (100%) rename {src => libsolidity}/ASTForward.h (100%) rename {src => libsolidity}/ASTJsonConverter.cpp (100%) rename {src => libsolidity}/ASTJsonConverter.h (100%) rename {src => libsolidity}/ASTPrinter.cpp (100%) rename {src => libsolidity}/ASTPrinter.h (100%) rename {src => libsolidity}/ASTUtils.cpp (100%) rename {src => libsolidity}/ASTUtils.h (100%) rename {src => libsolidity}/ASTVisitor.h (100%) rename {src => libsolidity}/AST_accept.h (100%) rename {src => libsolidity}/ArrayUtils.cpp (100%) rename {src => libsolidity}/ArrayUtils.h (100%) rename {src => libsolidity}/CMakeLists.txt (100%) rename {src => libsolidity}/Compiler.cpp (100%) rename {src => libsolidity}/Compiler.h (100%) rename {src => libsolidity}/CompilerContext.cpp (100%) rename {src => libsolidity}/CompilerContext.h (100%) rename {src => libsolidity}/CompilerStack.cpp (100%) rename {src => libsolidity}/CompilerStack.h (100%) rename {src => libsolidity}/CompilerUtils.cpp (100%) rename {src => libsolidity}/CompilerUtils.h (100%) rename {src => libsolidity}/DeclarationContainer.cpp (100%) rename {src => libsolidity}/DeclarationContainer.h (100%) rename {src => libsolidity}/Exceptions.h (100%) rename {src => libsolidity}/ExpressionCompiler.cpp (100%) rename {src => libsolidity}/ExpressionCompiler.h (100%) rename {src => libsolidity}/GasEstimator.cpp (100%) rename {src => libsolidity}/GasEstimator.h (100%) rename {src => libsolidity}/GlobalContext.cpp (100%) rename {src => libsolidity}/GlobalContext.h (100%) rename {src => libsolidity}/InterfaceHandler.cpp (100%) rename {src => libsolidity}/InterfaceHandler.h (100%) rename {src => libsolidity}/LValue.cpp (100%) rename {src => libsolidity}/LValue.h (100%) rename {src => libsolidity}/NameAndTypeResolver.cpp (100%) rename {src => libsolidity}/NameAndTypeResolver.h (100%) rename {src => libsolidity}/Parser.cpp (100%) rename {src => libsolidity}/Parser.h (100%) rename {src => libsolidity}/Scanner.cpp (100%) rename {src => libsolidity}/Scanner.h (100%) rename {src => libsolidity}/SourceReferenceFormatter.cpp (100%) rename {src => libsolidity}/SourceReferenceFormatter.h (100%) rename {src => libsolidity}/Token.cpp (100%) rename {src => libsolidity}/Token.h (100%) rename {src => libsolidity}/Types.cpp (100%) rename {src => libsolidity}/Types.h (100%) rename {src => libsolidity}/Utils.h (100%) rename {src => libsolidity}/Version.cpp (97%) rename {src => libsolidity}/Version.h (100%) rename {src => libsolidity}/grammar.txt (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..e3c48341a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,50 @@ +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(CPPETHEREUM_BUILD "${CMAKE_CURRENT_SOURCE_DIR}/../cpp-ethereum/${BUILD_DIR_NAME}" CACHE STRING "The absolute build directory of cpp-ethereum.") +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}") + +list(APPEND CMAKE_MODULE_PATH ${ETH_CMAKE_DIR}) + +include(EthDependencies) +include(EthExecutableHelper) +include(EthCompilerSettings) + +include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) +include_directories(BEFORE ..) +include_directories(${Boost_INCLUDE_DIRS}) +include_directories(libsolidity) +# Include a directory with BuildInfo.h +include_directories(${ETH_BUILD_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../cpp-ethereum) +include_directories(${CPPETHEREUM_BUILD}) + +file(GLOB_RECURSE SRC_LIST "libsolidity/*.cpp") +file(GLOB_RECURSE HEADERS "libsolidity/*.h") + +set(EXECUTABLE solidity) +add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) + +# TODO installation and packaging rules diff --git a/src/AST.cpp b/libsolidity/AST.cpp similarity index 100% rename from src/AST.cpp rename to libsolidity/AST.cpp diff --git a/src/AST.h b/libsolidity/AST.h similarity index 100% rename from src/AST.h rename to libsolidity/AST.h diff --git a/src/ASTForward.h b/libsolidity/ASTForward.h similarity index 100% rename from src/ASTForward.h rename to libsolidity/ASTForward.h diff --git a/src/ASTJsonConverter.cpp b/libsolidity/ASTJsonConverter.cpp similarity index 100% rename from src/ASTJsonConverter.cpp rename to libsolidity/ASTJsonConverter.cpp diff --git a/src/ASTJsonConverter.h b/libsolidity/ASTJsonConverter.h similarity index 100% rename from src/ASTJsonConverter.h rename to libsolidity/ASTJsonConverter.h diff --git a/src/ASTPrinter.cpp b/libsolidity/ASTPrinter.cpp similarity index 100% rename from src/ASTPrinter.cpp rename to libsolidity/ASTPrinter.cpp diff --git a/src/ASTPrinter.h b/libsolidity/ASTPrinter.h similarity index 100% rename from src/ASTPrinter.h rename to libsolidity/ASTPrinter.h diff --git a/src/ASTUtils.cpp b/libsolidity/ASTUtils.cpp similarity index 100% rename from src/ASTUtils.cpp rename to libsolidity/ASTUtils.cpp diff --git a/src/ASTUtils.h b/libsolidity/ASTUtils.h similarity index 100% rename from src/ASTUtils.h rename to libsolidity/ASTUtils.h diff --git a/src/ASTVisitor.h b/libsolidity/ASTVisitor.h similarity index 100% rename from src/ASTVisitor.h rename to libsolidity/ASTVisitor.h diff --git a/src/AST_accept.h b/libsolidity/AST_accept.h similarity index 100% rename from src/AST_accept.h rename to libsolidity/AST_accept.h diff --git a/src/ArrayUtils.cpp b/libsolidity/ArrayUtils.cpp similarity index 100% rename from src/ArrayUtils.cpp rename to libsolidity/ArrayUtils.cpp diff --git a/src/ArrayUtils.h b/libsolidity/ArrayUtils.h similarity index 100% rename from src/ArrayUtils.h rename to libsolidity/ArrayUtils.h diff --git a/src/CMakeLists.txt b/libsolidity/CMakeLists.txt similarity index 100% rename from src/CMakeLists.txt rename to libsolidity/CMakeLists.txt diff --git a/src/Compiler.cpp b/libsolidity/Compiler.cpp similarity index 100% rename from src/Compiler.cpp rename to libsolidity/Compiler.cpp diff --git a/src/Compiler.h b/libsolidity/Compiler.h similarity index 100% rename from src/Compiler.h rename to libsolidity/Compiler.h diff --git a/src/CompilerContext.cpp b/libsolidity/CompilerContext.cpp similarity index 100% rename from src/CompilerContext.cpp rename to libsolidity/CompilerContext.cpp diff --git a/src/CompilerContext.h b/libsolidity/CompilerContext.h similarity index 100% rename from src/CompilerContext.h rename to libsolidity/CompilerContext.h diff --git a/src/CompilerStack.cpp b/libsolidity/CompilerStack.cpp similarity index 100% rename from src/CompilerStack.cpp rename to libsolidity/CompilerStack.cpp diff --git a/src/CompilerStack.h b/libsolidity/CompilerStack.h similarity index 100% rename from src/CompilerStack.h rename to libsolidity/CompilerStack.h diff --git a/src/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp similarity index 100% rename from src/CompilerUtils.cpp rename to libsolidity/CompilerUtils.cpp diff --git a/src/CompilerUtils.h b/libsolidity/CompilerUtils.h similarity index 100% rename from src/CompilerUtils.h rename to libsolidity/CompilerUtils.h diff --git a/src/DeclarationContainer.cpp b/libsolidity/DeclarationContainer.cpp similarity index 100% rename from src/DeclarationContainer.cpp rename to libsolidity/DeclarationContainer.cpp diff --git a/src/DeclarationContainer.h b/libsolidity/DeclarationContainer.h similarity index 100% rename from src/DeclarationContainer.h rename to libsolidity/DeclarationContainer.h diff --git a/src/Exceptions.h b/libsolidity/Exceptions.h similarity index 100% rename from src/Exceptions.h rename to libsolidity/Exceptions.h diff --git a/src/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp similarity index 100% rename from src/ExpressionCompiler.cpp rename to libsolidity/ExpressionCompiler.cpp diff --git a/src/ExpressionCompiler.h b/libsolidity/ExpressionCompiler.h similarity index 100% rename from src/ExpressionCompiler.h rename to libsolidity/ExpressionCompiler.h diff --git a/src/GasEstimator.cpp b/libsolidity/GasEstimator.cpp similarity index 100% rename from src/GasEstimator.cpp rename to libsolidity/GasEstimator.cpp diff --git a/src/GasEstimator.h b/libsolidity/GasEstimator.h similarity index 100% rename from src/GasEstimator.h rename to libsolidity/GasEstimator.h diff --git a/src/GlobalContext.cpp b/libsolidity/GlobalContext.cpp similarity index 100% rename from src/GlobalContext.cpp rename to libsolidity/GlobalContext.cpp diff --git a/src/GlobalContext.h b/libsolidity/GlobalContext.h similarity index 100% rename from src/GlobalContext.h rename to libsolidity/GlobalContext.h diff --git a/src/InterfaceHandler.cpp b/libsolidity/InterfaceHandler.cpp similarity index 100% rename from src/InterfaceHandler.cpp rename to libsolidity/InterfaceHandler.cpp diff --git a/src/InterfaceHandler.h b/libsolidity/InterfaceHandler.h similarity index 100% rename from src/InterfaceHandler.h rename to libsolidity/InterfaceHandler.h diff --git a/src/LValue.cpp b/libsolidity/LValue.cpp similarity index 100% rename from src/LValue.cpp rename to libsolidity/LValue.cpp diff --git a/src/LValue.h b/libsolidity/LValue.h similarity index 100% rename from src/LValue.h rename to libsolidity/LValue.h diff --git a/src/NameAndTypeResolver.cpp b/libsolidity/NameAndTypeResolver.cpp similarity index 100% rename from src/NameAndTypeResolver.cpp rename to libsolidity/NameAndTypeResolver.cpp diff --git a/src/NameAndTypeResolver.h b/libsolidity/NameAndTypeResolver.h similarity index 100% rename from src/NameAndTypeResolver.h rename to libsolidity/NameAndTypeResolver.h diff --git a/src/Parser.cpp b/libsolidity/Parser.cpp similarity index 100% rename from src/Parser.cpp rename to libsolidity/Parser.cpp diff --git a/src/Parser.h b/libsolidity/Parser.h similarity index 100% rename from src/Parser.h rename to libsolidity/Parser.h diff --git a/src/Scanner.cpp b/libsolidity/Scanner.cpp similarity index 100% rename from src/Scanner.cpp rename to libsolidity/Scanner.cpp diff --git a/src/Scanner.h b/libsolidity/Scanner.h similarity index 100% rename from src/Scanner.h rename to libsolidity/Scanner.h diff --git a/src/SourceReferenceFormatter.cpp b/libsolidity/SourceReferenceFormatter.cpp similarity index 100% rename from src/SourceReferenceFormatter.cpp rename to libsolidity/SourceReferenceFormatter.cpp diff --git a/src/SourceReferenceFormatter.h b/libsolidity/SourceReferenceFormatter.h similarity index 100% rename from src/SourceReferenceFormatter.h rename to libsolidity/SourceReferenceFormatter.h diff --git a/src/Token.cpp b/libsolidity/Token.cpp similarity index 100% rename from src/Token.cpp rename to libsolidity/Token.cpp diff --git a/src/Token.h b/libsolidity/Token.h similarity index 100% rename from src/Token.h rename to libsolidity/Token.h diff --git a/src/Types.cpp b/libsolidity/Types.cpp similarity index 100% rename from src/Types.cpp rename to libsolidity/Types.cpp diff --git a/src/Types.h b/libsolidity/Types.h similarity index 100% rename from src/Types.h rename to libsolidity/Types.h diff --git a/src/Utils.h b/libsolidity/Utils.h similarity index 100% rename from src/Utils.h rename to libsolidity/Utils.h diff --git a/src/Version.cpp b/libsolidity/Version.cpp similarity index 97% rename from src/Version.cpp rename to libsolidity/Version.cpp index 75a0dd256..3fb8e728c 100644 --- a/src/Version.cpp +++ b/libsolidity/Version.cpp @@ -20,7 +20,7 @@ * Versioning. */ -#include +#include #include #include #include diff --git a/src/Version.h b/libsolidity/Version.h similarity index 100% rename from src/Version.h rename to libsolidity/Version.h diff --git a/src/grammar.txt b/libsolidity/grammar.txt similarity index 100% rename from src/grammar.txt rename to libsolidity/grammar.txt