aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-13 02:01:07 +0800
committerGitHub <noreply@github.com>2018-09-13 02:01:07 +0800
commiteb1fbaaac8a7a87684a83d7e5a83baa16d1680d3 (patch)
treea2f4c573cd49babd0214249c2270ab764ee4fbc5
parent7cda8456d86a0f17e09efd067e6e941f0266f18f (diff)
parent84d92450767480dcd0748c781e3cbda8e4a82ebd (diff)
downloaddexon-solidity-eb1fbaaac8a7a87684a83d7e5a83baa16d1680d3.tar.gz
dexon-solidity-eb1fbaaac8a7a87684a83d7e5a83baa16d1680d3.tar.zst
dexon-solidity-eb1fbaaac8a7a87684a83d7e5a83baa16d1680d3.zip
Merge pull request #4956 from ethereum/backport_json_build_fix
Backport json build fixes
-rw-r--r--.gitignore3
-rw-r--r--cmake/EthCompilerSettings.cmake11
-rw-r--r--cmake/jsoncpp.cmake22
3 files changed, 17 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index 14c227d0..87a3e593 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ build/
docs/_build
docs/utils/__pycache__
docs/utils/*.pyc
+/deps/downloads/
# vim stuff
*.swp
@@ -43,3 +44,5 @@ docs/utils/*.pyc
.idea
browse.VC.db
CMakeLists.txt.user
+/CMakeSettings.json
+/.vs
diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake
index 683d1d2e..3ae5bf2a 100644
--- a/cmake/EthCompilerSettings.cmake
+++ b/cmake/EthCompilerSettings.cmake
@@ -132,17 +132,6 @@ elseif (DEFINED MSVC)
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
- # Always use Release variant of C++ runtime.
- # We don't want to provide Debug variants of all dependencies. Some default
- # flags set by CMake must be tweaked.
- string(REPLACE "/MDd" "/MD" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
- string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
- string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
- string(REPLACE "/MDd" "/MD" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
- string(REPLACE "/D_DEBUG" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
- string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
- set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS OFF)
-
# disable empty object file warning
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
# warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification
diff --git a/cmake/jsoncpp.cmake b/cmake/jsoncpp.cmake
index 3d6b37ed..ea3218ef 100644
--- a/cmake/jsoncpp.cmake
+++ b/cmake/jsoncpp.cmake
@@ -6,13 +6,20 @@ else()
set(JSONCPP_CMAKE_COMMAND ${CMAKE_COMMAND})
endif()
-include(GNUInstallDirs)
set(prefix "${CMAKE_BINARY_DIR}/deps")
-set(JSONCPP_LIBRARY "${prefix}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}jsoncpp${CMAKE_STATIC_LIBRARY_SUFFIX}")
+set(JSONCPP_LIBRARY "${prefix}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}jsoncpp${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(JSONCPP_INCLUDE_DIR "${prefix}/include")
-if(NOT MSVC)
- set(JSONCPP_EXTRA_FLAGS "-std=c++11")
+# TODO: Investigate why this breaks some emscripten builds and
+# check whether this can be removed after updating the emscripten
+# versions used in the CI runs.
+if(EMSCRIPTEN)
+ # Do not include all flags in CMAKE_CXX_FLAGS for emscripten,
+ # but only use -std=c++11. Using all flags causes build failures
+ # at the moment.
+ set(JSONCPP_CXX_FLAGS -std=c++11)
+else()
+ set(JSONCPP_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()
set(byproducts "")
@@ -30,14 +37,13 @@ ExternalProject_Add(jsoncpp-project
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+ -DCMAKE_INSTALL_LIBDIR=lib
# Build static lib but suitable to be included in a shared lib.
-DCMAKE_POSITION_INDEPENDENT_CODE=${BUILD_SHARED_LIBS}
-DJSONCPP_WITH_TESTS=OFF
-DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF
- -DCMAKE_CXX_FLAGS=${JSONCPP_EXTRA_FLAGS}
- # Overwrite build and install commands to force Release build on MSVC.
- BUILD_COMMAND cmake --build <BINARY_DIR> --config Release
- INSTALL_COMMAND cmake --build <BINARY_DIR> --config Release --target install
+ -DCMAKE_CXX_FLAGS=${JSONCPP_CXX_FLAGS}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
${byproducts}
)