@@ -42,40 +42,21 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
4242 # TODO - Track down what breaks if we do NOT do this.
4343 add_compile_options (-Wno-unknown-pragmas)
4444
45- # To get the code building on FreeBSD and Arch Linux we seem to need the following
46- # warning suppression to work around some issues in Boost headers.
47- #
48- # See the following reports:
49- # https://github.com/ethereum/webthree-umbrella/issues/384
50- # https://github.com/ethereum/webthree-helpers/pull/170
51- #
52- # The issue manifest as warnings-as-errors like the following:
53- #
54- # /usr/local/include/boost/multiprecision/cpp_int.hpp:181:4: error:
55- # right operand of shift expression '(1u << 63u)' is >= than the precision of the left operand
56- #
57- # -fpermissive is a pretty nasty way to address this. It is described as follows:
58- #
59- # Downgrade some diagnostics about nonconformant code from errors to warnings.
60- # Thus, using -fpermissive will allow some nonconforming code to compile.
61- #
62- # NB: Have to use this form for the setting, so that it only applies to C++ builds.
63- # Applying -fpermissive to a C command-line (ie. secp256k1) gives a build error.
64- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive" )
65-
66- # Build everything as shared libraries (.so files)
67- add_definitions (-DSHAREDLIB)
68-
69- # If supported for the target machine, emit position-independent code, suitable for dynamic
70- # linking and avoiding any limit on the size of the global offset table.
71- add_compile_options (-fPIC)
72-
7345 # Configuration-specific compiler settings.
7446 set (CMAKE_CXX_FLAGS_DEBUG "-Og -g -DETH_DEBUG" )
7547 set (CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE" )
7648 set (CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DETH_RELEASE" )
7749 set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_RELEASE" )
7850
51+ option (USE_LD_GOLD "Use GNU gold linker" ON )
52+ if (USE_LD_GOLD)
53+ execute_process (COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
54+ if ("${LD_VERSION} " MATCHES "GNU gold" )
55+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold" )
56+ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold" )
57+ endif ()
58+ endif ()
59+
7960 # Additional GCC-specific compiler settings.
8061 if ("${CMAKE_CXX_COMPILER_ID} " MATCHES "GNU" )
8162
@@ -122,40 +103,14 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
122103 message (WARNING "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION} " )
123104 endif ()
124105
125- # A couple of extra warnings suppressions which we seemingly
126- # need when building with Clang.
127- #
128- # TODO - Nail down exactly where these warnings are manifesting and
129- # try to suppress them in a more localized way. Notes in this file
130- # indicate that the first is needed for sepc256k1 and that the
131- # second is needed for the (clog, cwarn) macros. These will need
132- # testing on at least OS X and Ubuntu.
133- add_compile_options (-Wno-unused-function)
134- add_compile_options (-Wno-dangling-else)
135-
136106 # Some Linux-specific Clang settings. We don't want these for OS X.
137107 if ("${CMAKE_SYSTEM_NAME} " MATCHES "Linux" )
138108
139- # TODO - Is this even necessary? Why?
140- # See http://stackoverflow.com/questions/19774778/when-is-it-necessary-to-use-use-the-flag-stdlib-libstdc.
141- add_compile_options (-stdlib=libstdc++)
142-
143109 # Tell Boost that we're using Clang's libc++. Not sure exactly why we need to do.
144110 add_definitions (-DBOOST_ASIO_HAS_CLANG_LIBCXX)
145111
146112 # Use fancy colors in the compiler diagnostics
147113 add_compile_options (-fcolor-diagnostics)
148-
149- # See "How to silence unused command line argument error with clang without disabling it?"
150- # When using -Werror with clang, it transforms "warning: argument unused during compilation" messages
151- # into errors, which makes sense.
152- # http://stackoverflow.com/questions/21617158/how-to-silence-unused-command-line-argument-error-with-clang-without-disabling-i
153- add_compile_options (-Qunused-arguments)
154- endif ()
155-
156- if (EMSCRIPTEN)
157- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --memory-init-file 0 -O3 -s LINKABLE=1 -s DISABLE_EXCEPTION_CATCHING=0 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_DYNAMIC_EXECUTION=1" )
158- add_definitions (-DETH_EMSCRIPTEN=1)
159114 endif ()
160115 endif ()
161116
@@ -223,14 +178,3 @@ if (PROFILING AND (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")))
223178 set (CMAKE_SHARED_LINKER_FLAGS "--coverage ${CMAKE_SHARED_LINKER_FLAGS} -lprofiler" )
224179 set (CMAKE_EXE_LINKER_FLAGS "--coverage ${CMAKE_EXE_LINKER_FLAGS} -lprofiler" )
225180endif ()
226-
227- if (("${CMAKE_CXX_COMPILER_ID} " MATCHES "GNU" ) OR ("${CMAKE_CXX_COMPILER_ID} " MATCHES "Clang" ))
228- option (USE_LD_GOLD "Use GNU gold linker" ON )
229- if (USE_LD_GOLD)
230- execute_process (COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
231- if ("${LD_VERSION} " MATCHES "GNU gold" )
232- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold" )
233- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold" )
234- endif ()
235- endif ()
236- endif ()
0 commit comments