@@ -49,9 +49,6 @@ if (MSVC)
4949 set (CMAKE_PREFIX_PATH ${ETH_DEPENDENCY_INSTALL_DIR} ${CMAKE_PREFIX_PATH} )
5050endif ()
5151
52- # boilerplate macros for some code editors
53- add_definitions (-DETH_TRUE)
54-
5552# custom cmake scripts
5653set (ETH_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR} )
5754set (ETH_SCRIPTS_DIR ${ETH_CMAKE_DIR} /scripts)
@@ -88,105 +85,13 @@ else()
8885 set (Boost_USE_STATIC_LIBS ON )
8986endif ()
9087
91- # We have work-in-progress here to support building cpp-ethereum with static-linkage, which
92- # provides a fantastic end-user experience. You have entirely standalone executables
93- # which are entirely atomic and "just work". They contain everything you need and talk directly
94- # to the operating system kernel. Such linkage also allow best-possible dead-code removal and
95- # global optimizations. That is the model which is used by default for all golang apps.
96- #
97- # "Enable static build of binaries"
98- # https://github.com/ethereum/webthree-umbrella/issues/495
99- #
100- # So we just have `geth` and `geth.exe`. This mode lets you have an `eth` which works just
101- # the same. This approach is a particular benefit on Linux where there is huge fragmentation
102- # of packaging systems and .so versioning across distros. Building a standalone executable
103- # for Linux which "just works" on all distros would be a huge win. This mode allows just
104- # that to happen already on Alpine Linux using the musl standard library, and I hope we can
105- # extend that support to further distros in the near future.
106- #
107- # We also have partial support for static linkage on macOS, though we would only be able to
108- # statically link the external dependencies above the kernel. Anything which is part of the
109- # operating system itself can only be used via dylibs. Still, we can improve things a lot.
110- #
111- # This is a macOS operating system constraint.
112- #
113- # See https://developer.apple.com/library/mac/qa/qa1118/_index.html
114- #
115- # "Apple does not support statically linked binaries on Mac OS X. A statically linked binary
116- # assumes binary compatibility at the kernel system call interface, and we do not make any
117- # guarantees on that front. Rather, we strive to ensure binary compatibility in each
118- # dynamically linked system library and framework."
119-
120- set (STATIC_LINKING FALSE CACHE BOOL "Build static binaries" )
121-
122- if (STATIC_LINKING)
123-
124- set (Boost_USE_STATIC_RUNTIME ON )
125- set (OpenSSL_USE_STATIC_LIBS ON )
126-
127- if (MSVC )
128- # TODO - Why would we need .a on Windows? Maybe some Cygwin-ism.
129- # When I work through Windows static linkage, I will remove this,
130- # if that is possible.
131- set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES} )
132- elseif (APPLE )
133- # At the time of writing, we are still only PARTIALLY statically linked
134- # on OS X, with a mixture of statically linked external libraries where
135- # those are available, and dynamically linked where that is the only
136- # option we have. Ultimately, the aim would be for everything except
137- # the runtime libraries to be statically linked.
138- #
139- # Still TODO:
140- # - json-rpc-cpp
141- # - leveldb (which pulls in snappy, for the dylib at ;east)
142- # - miniupnp
143- # - gmp
144- #
145- # Two further libraries (curl and zlib) ship as dylibs with the platform
146- # but again we could build from source and statically link these too.
147- set (CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib)
148- else ()
149- set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
150- endif ()
151-
152- set (ETH_STATIC ON )
153- endif ()
154-
155- # Add Homebrew include paths and library paths for macOS clients.
156- #
157- # Homebrew (http://brew.sh/) is the de-facto standard package manager for Mac.
158- # It is a rolling-release manager, which brings its own problems, because it
159- # means that we are building on top of an unstable platform, where the build
160- # can work for me today and be broken for you tomorrow, even though we didn't
161- # change anything ourselves. Qt was particularly problematic for this, but
162- # thankfully is no longer an issue for us anymore, after we removed the GUI
163- # applications in cpp-ethereum-v1.3.0.
164- #
165- # There is an alternative (minority) packaging system called MacPorts, but it isn't
166- # possible to run both on a single computer, so we dropped support for
167- # MacPorts in early 2016 to simplify our problem space.
168- #
169- # Again, as per the Windows notes above, building dependencies from source
170- # would sidestep these issues entirely.
171- #
172- # "Both Homebrew and MacPorts are 'rolling release' package managers"
173- # https://github.com/ethereum/webthree-umbrella/issues/118
174- if (APPLE )
175- link_directories (/usr/local/lib)
176- include_directories (/usr/local/include )
177- endif ()
178-
17988include_directories (BEFORE "${PROJECT_BINARY_DIR} /include" )
18089
18190function (eth_use TARGET REQUIRED)
18291 if (NOT TARGET ${TARGET} )
18392 message (FATAL_ERROR "eth_use called for non existing target ${TARGET} " )
18493 endif ()
18594
186- if (TARGET ${PROJECT_NAME} _BuildInfo.h)
187- add_dependencies (${TARGET} ${PROJECT_NAME} _BuildInfo.h)
188- endif ()
189-
19095 foreach (MODULE ${ARGN} )
19196 string (REPLACE "::" ";" MODULE_PARTS "${MODULE} " )
19297 list (GET MODULE_PARTS 0 MODULE_MAIN)
0 commit comments