From 2a1b6b2e92edc1665eb1644f2ccf06c44e68448a Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Wed, 16 Aug 2017 14:26:19 +0200 Subject: CMake: Simplify libdevcore config --- libdevcore/CMakeLists.txt | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index c4f886a6..7cda130a 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -1,14 +1,8 @@ -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") - -aux_source_directory(. SRC_LIST) - -set(EXECUTABLE soldevcore) - -file(GLOB HEADERS "*.h") - -include_directories(..) -add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) - -eth_use(${EXECUTABLE} REQUIRED Dev::base) - -install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) +file(GLOB sources "*.cpp") +file(GLOB headers "*.h") + +add_library(devcore ${sources} ${headers}) +target_link_libraries(devcore PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_SYSTEM_LIBRARIES}) +target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS}) +target_include_directories(devcore PRIVATE ..) +add_dependencies(devcore solidity_BuildInfo.h) -- cgit From d1f4d110fb5c2ed09ef0111ecd3789f52be1200c Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Fri, 18 Aug 2017 13:31:31 +0200 Subject: CMake: Build static libs by default --- cmake/EthCompilerSettings.cmake | 20 -------------------- cmake/EthDependencies.cmake | 2 -- libevmasm/CMakeLists.txt | 2 -- liblll/CMakeLists.txt | 2 -- libsolidity/CMakeLists.txt | 2 -- test/CMakeLists.txt | 2 +- 6 files changed, 1 insertion(+), 29 deletions(-) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 4ce9d22d..9b294e27 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -63,13 +63,6 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA # Applying -fpermissive to a C command-line (ie. secp256k1) gives a build error. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") - # Build everything as shared libraries (.so files) - add_definitions(-DSHAREDLIB) - - # If supported for the target machine, emit position-independent code, suitable for dynamic - # linking and avoiding any limit on the size of the global offset table. - add_compile_options(-fPIC) - # Configuration-specific compiler settings. set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") @@ -198,7 +191,6 @@ elseif (DEFINED MSVC) add_compile_options(/wd4800) # disable forcing value to bool 'true' or 'false' (performance warning) (4800) add_compile_options(-D_WIN32_WINNT=0x0600) # declare Windows Vista API requirement add_compile_options(-DNOMINMAX) # undefine windows.h MAX && MIN macros cause it cause conflicts with std::min && std::max functions - add_compile_options(-DMINIUPNP_STATICLIB) # define miniupnp static library # Always use Release variant of C++ runtime. # We don't want to provide Debug variants of all dependencies. Some default @@ -218,12 +210,6 @@ elseif (DEFINED MSVC) # stack size 16MB set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099,4075 /STACK:16777216") - # windows likes static - if (NOT ETH_STATIC) - message("Forcing static linkage for MSVC.") - set(ETH_STATIC 1) - endif () - # If you don't have GCC, Clang or VC++ then you are on your own. Good luck! else () message(WARNING "Your compiler is not tested, if you run into any issues, we'd welcome any patches.") @@ -262,9 +248,3 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA endif () endif () endif () - -if(ETH_STATIC) - set(BUILD_SHARED_LIBS OFF) -else() - set(BUILD_SHARED_LIBS ON) -endif(ETH_STATIC) diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index a5e9b0c5..7d2a7675 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -94,8 +94,6 @@ if (STATIC_LINKING) else() set(CMAKE_FIND_LIBRARY_SUFFIXES .a) endif() - - set(ETH_STATIC ON) endif() find_package(Boost 1.54.0 QUIET REQUIRED COMPONENTS thread date_time system regex chrono filesystem unit_test_framework program_options random) diff --git a/libevmasm/CMakeLists.txt b/libevmasm/CMakeLists.txt index 9cc3e93e..9c7efb86 100644 --- a/libevmasm/CMakeLists.txt +++ b/libevmasm/CMakeLists.txt @@ -1,5 +1,3 @@ -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") - aux_source_directory(. SRC_LIST) set(EXECUTABLE solevmasm) diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index db90025a..4246e481 100644 --- a/liblll/CMakeLists.txt +++ b/liblll/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_policy(SET CMP0015 NEW) set(CMAKE_AUTOMOC OFF) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") - aux_source_directory(. SRC_LIST) set(EXECUTABLE lll) diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index 2342f0f9..e6398507 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -1,5 +1,3 @@ -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") - aux_source_directory(analysis SRC_LIST) aux_source_directory(ast SRC_LIST) aux_source_directory(codegen SRC_LIST) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8e7b8916..6b114239 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -20,7 +20,7 @@ eth_simple_add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) eth_use(${EXECUTABLE} REQUIRED Solidity::solidity Solidity::lll) include_directories(BEFORE ..) -target_link_libraries(${EXECUTABLE} soljson ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) +target_link_libraries(${EXECUTABLE} soljson devcore ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) add_executable(solfuzzer fuzzer.cpp) target_link_libraries(solfuzzer soljson ${Boost_PROGRAM_OPTIONS_LIBRARIES}) -- cgit From 63372e4a8567b26ad2cc419c6aa22919c5fcb28f Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Wed, 16 Aug 2017 13:29:46 +0200 Subject: CMake: Simplify libevmasm config --- libevmasm/CMakeLists.txt | 16 +++++----------- test/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/libevmasm/CMakeLists.txt b/libevmasm/CMakeLists.txt index 9c7efb86..914339e7 100644 --- a/libevmasm/CMakeLists.txt +++ b/libevmasm/CMakeLists.txt @@ -1,12 +1,6 @@ -aux_source_directory(. SRC_LIST) +file(GLOB sources "*.cpp") +file(GLOB headers "*.h") -set(EXECUTABLE solevmasm) - -file(GLOB HEADERS "*.h") - -include_directories(BEFORE ..) -add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -eth_use(${EXECUTABLE} REQUIRED Dev::soldevcore) -target_link_libraries(${EXECUTABLE} jsoncpp) - -install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) +add_library(evmasm ${sources} ${headers}) +target_link_libraries(evmasm PUBLIC devcore jsoncpp) +target_include_directories(evmasm PUBLIC ..) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6b114239..3578f497 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,4 +23,4 @@ include_directories(BEFORE ..) target_link_libraries(${EXECUTABLE} soljson devcore ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) add_executable(solfuzzer fuzzer.cpp) -target_link_libraries(solfuzzer soljson ${Boost_PROGRAM_OPTIONS_LIBRARIES}) +target_link_libraries(solfuzzer soljson evmasm ${Boost_PROGRAM_OPTIONS_LIBRARIES}) -- cgit From 7337054d8e4c68bc2c82b7c01b695880a86e902b Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Wed, 16 Aug 2017 13:21:18 +0200 Subject: CMake: Simplify liblll config --- liblll/CMakeLists.txt | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index 4246e481..ceaeb6cf 100644 --- a/liblll/CMakeLists.txt +++ b/liblll/CMakeLists.txt @@ -1,16 +1,6 @@ -cmake_policy(SET CMP0015 NEW) -set(CMAKE_AUTOMOC OFF) +file(GLOB sources "*.cpp") +file(GLOB headers "*.h") -aux_source_directory(. SRC_LIST) - -set(EXECUTABLE lll) - -file(GLOB HEADERS "*.h") - -include_directories(BEFORE ..) -add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) - -eth_use(${EXECUTABLE} REQUIRED Solidity::solevmasm) -#target_link_libraries(${EXECUTABLE} evmasm) - -install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) +add_library(lll ${sources} ${headers}) +target_link_libraries(lll PUBLIC evmasm) +target_include_directories(lll PUBLIC ..) -- cgit From 8404e2b6d76dd3681bf30e99e2cb21112b491d70 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Wed, 16 Aug 2017 13:29:59 +0200 Subject: CMake: Simplify libsolidity config --- libsolidity/CMakeLists.txt | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index e6398507..5e9c79f0 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -1,21 +1,7 @@ -aux_source_directory(analysis SRC_LIST) -aux_source_directory(ast SRC_LIST) -aux_source_directory(codegen SRC_LIST) -aux_source_directory(formal SRC_LIST) -aux_source_directory(interface SRC_LIST) -aux_source_directory(parsing SRC_LIST) -aux_source_directory(inlineasm SRC_LIST) # Until we have a clear separation, libjulia has to be included here -aux_source_directory(../libjulia SRC_LIST) - -set(EXECUTABLE solidity) - -file(GLOB HEADERS "*/*.h" "../libjulia/backends/evm/*") - -include_directories(BEFORE ..) -add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) - -eth_use(${EXECUTABLE} REQUIRED Dev::soldevcore Solidity::solevmasm) - -install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) +file(GLOB_RECURSE sources "*.cpp" "../libjulia/*.cpp") +file(GLOB_RECURSE headers "*.h" "../libjulia/*.h") +add_library(solidity ${sources} ${headers}) +target_link_libraries(solidity PUBLIC evmasm PRIVATE ${Boost_REGEX_LIBRARIES}) +target_include_directories(solidity PUBLIC ..) -- cgit From a874bd3f048125033250b8d7182dc30bbf36dbac Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Wed, 16 Aug 2017 13:21:12 +0200 Subject: CMake: Simplify lllc config --- lllc/CMakeLists.txt | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lllc/CMakeLists.txt b/lllc/CMakeLists.txt index 3bd11187..7bebd0b1 100644 --- a/lllc/CMakeLists.txt +++ b/lllc/CMakeLists.txt @@ -1,12 +1,3 @@ -aux_source_directory(. SRC_LIST) - -set(EXECUTABLE lllc) - -file(GLOB HEADERS "*.h") -include_directories(BEFORE ..) -eth_simple_add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) - -eth_use(${EXECUTABLE} REQUIRED Solidity::lll Dev::buildinfo Solidity::solevmasm) - -install( TARGETS ${EXECUTABLE} DESTINATION bin ) +add_executable(lllc main.cpp) +target_link_libraries(lllc PRIVATE lll) -- cgit From 6f72025ee74d6255d40905ea09fa8a8dddf49605 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Wed, 16 Aug 2017 13:30:09 +0200 Subject: CMake: Simplify solc config --- solc/CMakeLists.txt | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/solc/CMakeLists.txt b/solc/CMakeLists.txt index 18e83e75..0563fe2a 100644 --- a/solc/CMakeLists.txt +++ b/solc/CMakeLists.txt @@ -1,27 +1,19 @@ -aux_source_directory(. SRC_LIST) -list(REMOVE_ITEM SRC_LIST "./jsonCompiler.cpp") +set( + sources + CommandLineInterface.cpp CommandLineInterface.h + main.cpp +) -include_directories(BEFORE ..) +add_executable(solc ${sources}) +target_link_libraries(solc PRIVATE solidity ${Boost_PROGRAM_OPTIONS_LIBRARIES}) -set(EXECUTABLE solc) - -file(GLOB HEADERS "*.h") -eth_simple_add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) - -eth_use(${EXECUTABLE} REQUIRED Solidity::solidity) -target_link_libraries(${EXECUTABLE} ${Boost_PROGRAM_OPTIONS_LIBRARIES}) - -if (APPLE) - install(TARGETS ${EXECUTABLE} DESTINATION bin) -else() - eth_install_executable(${EXECUTABLE}) -endif() +include(GNUInstallDirs) +install(TARGETS solc DESTINATION "${CMAKE_INSTALL_BINDIR}") if (EMSCRIPTEN) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EXPORTED_FUNCTIONS='[\"_compileJSON\",\"_license\",\"_version\",\"_compileJSONMulti\",\"_compileJSONCallback\",\"_compileStandard\"]' -s RESERVED_FUNCTION_POINTERS=20") - add_executable(soljson jsonCompiler.cpp ${HEADERS}) - eth_use(soljson REQUIRED Solidity::solidity) + add_executable(soljson jsonCompiler.cpp) else() - add_library(soljson jsonCompiler.cpp ${HEADERS}) - target_link_libraries(soljson solidity) + add_library(soljson jsonCompiler.cpp) endif() +target_link_libraries(soljson PRIVATE solidity) \ No newline at end of file -- cgit From 397a72107abbe691d9e04dcb6bcc0eb2b2a583fb Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Wed, 16 Aug 2017 13:38:18 +0200 Subject: CMake: Simplify test tools config --- test/CMakeLists.txt | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3578f497..92218f1d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,26 +1,9 @@ -cmake_policy(SET CMP0015 NEW) +file(GLOB_RECURSE sources "*.cpp") +list(REMOVE_ITEM sources "${CMAKE_CURRENT_SOURCE_DIR}/fuzzer.cpp") +file(GLOB_RECURSE headers "*.h") -aux_source_directory(. SRC_LIST) -aux_source_directory(libdevcore SRC_LIST) -aux_source_directory(libevmasm SRC_LIST) -aux_source_directory(libsolidity SRC_LIST) -aux_source_directory(libjulia SRC_LIST) -aux_source_directory(contracts SRC_LIST) -aux_source_directory(liblll SRC_LIST) -aux_source_directory(libjulia SRC_LIST) - -list(REMOVE_ITEM SRC_LIST "./fuzzer.cpp") - -get_filename_component(TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE) - -file(GLOB HEADERS "*.h" "*/*.h") -set(EXECUTABLE soltest) -eth_simple_add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) - -eth_use(${EXECUTABLE} REQUIRED Solidity::solidity Solidity::lll) - -include_directories(BEFORE ..) -target_link_libraries(${EXECUTABLE} soljson devcore ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) +add_executable(soltest ${sources} ${headers}) +target_link_libraries(soltest PRIVATE soljson solidity lll ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) add_executable(solfuzzer fuzzer.cpp) target_link_libraries(solfuzzer soljson evmasm ${Boost_PROGRAM_OPTIONS_LIBRARIES}) -- cgit From 0712e6302e728bba281f41afa74e6c74638a75c7 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Thu, 17 Aug 2017 11:56:49 +0200 Subject: Boost: Use static libs --- cmake/EthDependencies.cmake | 55 ++------------------------------------------- libdevcore/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 54 deletions(-) diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 7d2a7675..14037307 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -43,60 +43,9 @@ find_program(CTEST_COMMAND ctest) ## use multithreaded boost libraries, with -mt suffix set(Boost_USE_MULTITHREADED ON) +set(Boost_USE_STATIC_LIBS ON) -if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - -# use static boost libraries *.lib - set(Boost_USE_STATIC_LIBS ON) - -elseif (APPLE) - -# use static boost libraries *.a - set(Boost_USE_STATIC_LIBS ON) - -elseif (UNIX) -# use dynamic boost libraries *.dll - set(Boost_USE_STATIC_LIBS OFF) - -endif() - -set(STATIC_LINKING FALSE CACHE BOOL "Build static binaries") - -if (STATIC_LINKING) - - set(Boost_USE_STATIC_LIBS ON) - set(Boost_USE_STATIC_RUNTIME ON) - - set(OpenSSL_USE_STATIC_LIBS ON) - - if (MSVC) - # TODO - Why would we need .a on Windows? Maybe some Cygwin-ism. - # When I work through Windows static linkage, I will remove this, - # if that is possible. - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - elseif (APPLE) - # At the time of writing, we are still only PARTIALLY statically linked - # on OS X, with a mixture of statically linked external libraries where - # those are available, and dynamically linked where that is the only - # option we have. Ultimately, the aim would be for everything except - # the runtime libraries to be statically linked. - # - # Still TODO: - # - jsoncpp - # - json-rpc-cpp - # - leveldb (which pulls in snappy, for the dylib at ;east) - # - miniupnp - # - gmp - # - # Two further libraries (curl and zlib) ship as dylibs with the platform - # but again we could build from source and statically link these too. - set(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) - endif() -endif() - -find_package(Boost 1.54.0 QUIET REQUIRED COMPONENTS thread date_time system regex chrono filesystem unit_test_framework program_options random) +find_package(Boost 1.54.0 QUIET REQUIRED COMPONENTS regex filesystem unit_test_framework program_options) eth_show_dependency(Boost boost) diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index 7cda130a..4b15427f 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -2,7 +2,7 @@ file(GLOB sources "*.cpp") file(GLOB headers "*.h") add_library(devcore ${sources} ${headers}) -target_link_libraries(devcore PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_SYSTEM_LIBRARIES}) +target_link_libraries(devcore PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${Boost_SYSTEM_LIBRARIES}) target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS}) target_include_directories(devcore PRIVATE ..) add_dependencies(devcore solidity_BuildInfo.h) -- cgit From 99d198ffb034839e82649f10814210c0374d40d4 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Thu, 17 Aug 2017 15:48:39 +0200 Subject: CMake: Make libs dependencies explicit --- liblll/CMakeLists.txt | 2 +- libsolidity/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index ceaeb6cf..1cc37da3 100644 --- a/liblll/CMakeLists.txt +++ b/liblll/CMakeLists.txt @@ -2,5 +2,5 @@ file(GLOB sources "*.cpp") file(GLOB headers "*.h") add_library(lll ${sources} ${headers}) -target_link_libraries(lll PUBLIC evmasm) +target_link_libraries(lll PUBLIC evmasm devcore) target_include_directories(lll PUBLIC ..) diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index 5e9c79f0..ebd09c5f 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -3,5 +3,5 @@ file(GLOB_RECURSE sources "*.cpp" "../libjulia/*.cpp") file(GLOB_RECURSE headers "*.h" "../libjulia/*.h") add_library(solidity ${sources} ${headers}) -target_link_libraries(solidity PUBLIC evmasm PRIVATE ${Boost_REGEX_LIBRARIES}) +target_link_libraries(solidity PUBLIC evmasm devcore PRIVATE ${Boost_REGEX_LIBRARIES}) target_include_directories(solidity PUBLIC ..) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 92218f1d..6a8a4399 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,7 @@ list(REMOVE_ITEM sources "${CMAKE_CURRENT_SOURCE_DIR}/fuzzer.cpp") file(GLOB_RECURSE headers "*.h") add_executable(soltest ${sources} ${headers}) -target_link_libraries(soltest PRIVATE soljson solidity lll ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) +target_link_libraries(soltest PRIVATE soljson solidity lll evmasm devcore ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) add_executable(solfuzzer fuzzer.cpp) target_link_libraries(solfuzzer soljson evmasm ${Boost_PROGRAM_OPTIONS_LIBRARIES}) -- cgit From fa534946262ca4a13c94a9ef012c0af014827871 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Mon, 21 Aug 2017 12:37:55 +0200 Subject: CMake: Remove libsolidity <- boost::regex dependency --- libsolidity/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index ebd09c5f..fd27a492 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -3,5 +3,5 @@ file(GLOB_RECURSE sources "*.cpp" "../libjulia/*.cpp") file(GLOB_RECURSE headers "*.h" "../libjulia/*.h") add_library(solidity ${sources} ${headers}) -target_link_libraries(solidity PUBLIC evmasm devcore PRIVATE ${Boost_REGEX_LIBRARIES}) +target_link_libraries(solidity PUBLIC evmasm devcore) target_include_directories(solidity PUBLIC ..) -- cgit From 0dc73913e1b72e89ffdbf05592798d4bbfbf1714 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Mon, 21 Aug 2017 20:42:06 +0200 Subject: CMake: Allow linking Boost dynamically Make Boost_USE_STATIC_LIBS an CMake option, ON by default. --- cmake/EthDependencies.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 14037307..39ce060e 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -43,7 +43,7 @@ find_program(CTEST_COMMAND ctest) ## use multithreaded boost libraries, with -mt suffix set(Boost_USE_MULTITHREADED ON) -set(Boost_USE_STATIC_LIBS ON) +option(Boost_USE_STATIC_LIBS "Link Boost statically" ON) find_package(Boost 1.54.0 QUIET REQUIRED COMPONENTS regex filesystem unit_test_framework program_options) -- cgit From 15fd43f0357e1f3c6ec1262df6ee39b06a6fe3f9 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Tue, 22 Aug 2017 16:37:27 +0200 Subject: CMake: Fix linking with pthread --- CMakeLists.txt | 2 ++ libdevcore/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a11c56ee..d204ffec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,8 @@ project(solidity VERSION ${PROJECT_VERSION}) include(EthDependencies) include(deps/jsoncpp.cmake) +find_package(Threads) + # Figure out what compiler and system are we using include(EthCompilerSettings) diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index 4b15427f..016d7ea3 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -2,7 +2,7 @@ file(GLOB sources "*.cpp") file(GLOB headers "*.h") add_library(devcore ${sources} ${headers}) -target_link_libraries(devcore PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${Boost_SYSTEM_LIBRARIES}) +target_link_libraries(devcore PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${Boost_SYSTEM_LIBRARIES} Threads::Threads) target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS}) target_include_directories(devcore PRIVATE ..) add_dependencies(devcore solidity_BuildInfo.h) -- cgit From 4974ff3962759a19150877b0e59e64319190ba1d Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Tue, 22 Aug 2017 22:50:03 +0200 Subject: CMake: Add option to static link solc --- CMakeLists.txt | 2 ++ scripts/Dockerfile | 2 +- solc/CMakeLists.txt | 14 +++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d204ffec..da14ddb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ eth_policy() set(PROJECT_VERSION "0.4.16") project(solidity VERSION ${PROJECT_VERSION}) +option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF) + # Let's find our dependencies include(EthDependencies) include(deps/jsoncpp.cmake) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index c984ce99..654a9f29 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -9,7 +9,7 @@ COPY / $WORKDIR #Install dependencies, eliminate annoying warnings, and build release, delete all remaining points and statically link. RUN ./scripts/install_deps.sh && sed -i -E -e 's/include /include /' /usr/include/boost/asio/detail/socket_types.hpp &&\ -cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=0 -DSTATIC_LINKING=1 &&\ +cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=0 -DSOLC_LINK_STATIC=1 &&\ make solc && install -s solc/solc /usr/bin &&\ cd / && rm -rf solidity &&\ apk del sed build-base git make cmake gcc g++ musl-dev curl-dev boost-dev &&\ diff --git a/solc/CMakeLists.txt b/solc/CMakeLists.txt index 0563fe2a..656b27c3 100644 --- a/solc/CMakeLists.txt +++ b/solc/CMakeLists.txt @@ -16,4 +16,16 @@ if (EMSCRIPTEN) else() add_library(soljson jsonCompiler.cpp) endif() -target_link_libraries(soljson PRIVATE solidity) \ No newline at end of file +target_link_libraries(soljson PRIVATE solidity) + +if(SOLC_LINK_STATIC AND UNIX AND NOT APPLE) + # Produce solc as statically linked binary (includes C/C++ standard libraries) + # This is not supported on macOS, see + # https://developer.apple.com/library/content/qa/qa1118/_index.html. + set_target_properties( + solc PROPERTIES + LINK_FLAGS -static + LINK_SEARCH_START_STATIC ON + LINK_SEARCH_END_STATIC ON + ) +endif() \ No newline at end of file -- cgit From 388fc983fa5480ec8498c399cf598991c63cfa22 Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Tue, 22 Aug 2017 16:43:30 +0200 Subject: CMake: Cleanup "local" include path --- libdevcore/CMakeLists.txt | 2 +- libevmasm/CMakeLists.txt | 1 - liblll/CMakeLists.txt | 1 - libsolidity/CMakeLists.txt | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index 016d7ea3..b97866f4 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -4,5 +4,5 @@ file(GLOB headers "*.h") add_library(devcore ${sources} ${headers}) target_link_libraries(devcore PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${Boost_SYSTEM_LIBRARIES} Threads::Threads) target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS}) -target_include_directories(devcore PRIVATE ..) +target_include_directories(devcore PUBLIC "${CMAKE_SOURCE_DIR}") add_dependencies(devcore solidity_BuildInfo.h) diff --git a/libevmasm/CMakeLists.txt b/libevmasm/CMakeLists.txt index 914339e7..5c945c7d 100644 --- a/libevmasm/CMakeLists.txt +++ b/libevmasm/CMakeLists.txt @@ -3,4 +3,3 @@ file(GLOB headers "*.h") add_library(evmasm ${sources} ${headers}) target_link_libraries(evmasm PUBLIC devcore jsoncpp) -target_include_directories(evmasm PUBLIC ..) diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index 1cc37da3..4cdc073a 100644 --- a/liblll/CMakeLists.txt +++ b/liblll/CMakeLists.txt @@ -3,4 +3,3 @@ file(GLOB headers "*.h") add_library(lll ${sources} ${headers}) target_link_libraries(lll PUBLIC evmasm devcore) -target_include_directories(lll PUBLIC ..) diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index fd27a492..11fd6fe2 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -4,4 +4,3 @@ file(GLOB_RECURSE headers "*.h" "../libjulia/*.h") add_library(solidity ${sources} ${headers}) target_link_libraries(solidity PUBLIC evmasm devcore) -target_include_directories(solidity PUBLIC ..) -- cgit From 09628dee8c86e71119884204eb729fe439fb3bad Mon Sep 17 00:00:00 2001 From: Paweł Bylica Date: Tue, 22 Aug 2017 16:55:54 +0200 Subject: docs: Add a note about CMake options --- docs/installing-solidity.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst index ddc5c850..782bb606 100644 --- a/docs/installing-solidity.rst +++ b/docs/installing-solidity.rst @@ -230,6 +230,7 @@ Or, on Windows: Command-Line Build ------------------ +Solidity project uses CMake to configure the build. Building Solidity is quite similar on Linux, macOS and other Unices: .. code:: bash @@ -264,6 +265,11 @@ Alternatively, you can build for Windows on the command-line, like so: cmake --build . --config RelWithDebInfo +CMake options +============= + +If you are interested what CMake options are available run ``cmake .. -LH``. + The version string in detail ============================ -- cgit