@ -4,21 +4,18 @@ project(wowlet)
message ( STATUS "Initiating compile using CMake ${CMAKE_VERSION}" )
set ( THREADS_PREFER_PTHREAD_FLAG ON )
set ( VERSION_MAJOR " 2 ")
set ( VERSION_MINOR " 0 ")
set ( VERSION_REVISION " 0 ")
set ( VERSION "beta- 2 ")
set ( VERSION_MAJOR " 4 ")
set ( VERSION_MINOR " 1 ")
set ( VERSION_REVISION " 1 ")
set ( VERSION "beta- 8 ")
option ( FETCH_DEPS "Download dependencies if they are not found" ON )
option ( XMRIG "Include XMRig module" ON )
option ( OPENVR "Include OpenVR support" )
option ( QML "Include QtQuick (QML)" )
option ( ANDROID "Android deployment" )
option ( ANDROID_DEBUG "View the Android app on desktop" )
option ( TOR_BIN "Path to Tor binary to embed inside WOWlet" )
option ( STATIC "Link libraries statically, requires static Qt" )
option ( USE_DEVICE_TREZOR "Trezor support compilation" )
option ( DONATE_BEG "Prompt donation window every once in a while" ON )
list ( INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake" )
include ( CheckCCompilerFlag )
include ( CheckCXXCompilerFlag )
@ -28,14 +25,11 @@ include(FindCcache)
include ( CheckIncludeFile )
include ( CheckSymbolExists )
set ( WOWNERO_HEAD " f611d5c9e32bc62f1735f6571b0bdb95cc020531 ")
set ( WOWNERO_HEAD " a21819cc22587e16af00e2c3d8f70156c11310a0 ")
set ( BUILD_GUI_DEPS ON )
set ( BUILD_64 ON CACHE BOOL "Build 64-bit binaries" )
set ( INSTALL_VENDORED_LIBUNBOUND ${ STATIC } )
set ( USE_SINGLE_BUILDDIR ON )
if ( OPENVR OR ANDROID_DEBUG )
set ( QML ON )
endif ( )
# A r e w e i n d e b u g m o d e ?
set ( _CMAKE_BUILD_TYPE "" )
@ -57,7 +51,7 @@ if(STATIC)
# m a n u a l l y s e t t h e u n b o u n d s u b m o d u l e t h e r i g h t c o m m i t t h a t h a s t h e f i x .
# T h i s o n l y w o r k s w i t h - D M A N U A L _ S U B M O D U L E S = 1
message ( STATUS "applying unbound static build fix contrib/unbound_static.patch" )
execute_process ( COMMAND bash -c "git -C ${CMAKE_SOURCE_DIR}/ mo nero/external/unbound apply ${CMAKE_SOURCE_DIR}/contrib/unbound_static.patch")
execute_process ( COMMAND bash -c "git -C ${CMAKE_SOURCE_DIR}/ wow nero/external/unbound apply ${CMAKE_SOURCE_DIR}/contrib/unbound_static.patch")
set ( Boost_USE_STATIC_LIBS ON )
set ( Boost_USE_STATIC_RUNTIME ON )
@ -90,21 +84,9 @@ function (add_linker_flag_if_supported flag var)
endfunction ( )
find_package ( Git )
if ( GIT_FOUND )
message ( STATUS "Initializing submodules" )
execute_process ( COMMAND git "submodule" "update" "--init" "--recursive" )
execute_process ( COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${ CMAKE_SOURCE_DIR } /monero OUTPUT_VARIABLE _WOWNERO_HEAD OUTPUT_STRIP_TRAILING_WHITESPACE )
if ( NOT _WOWNERO_HEAD STREQUAL WOWNERO_HEAD )
message ( FATAL_ERROR "[submodule] Monero HEAD was at ${_WOWNERO_HEAD} but should be at ${WOWNERO_HEAD}" )
else ( )
message ( STATUS "[submodule] Wownero HEAD @ ${WOWNERO_HEAD}" )
endif ( )
endif ( )
add_subdirectory ( monero )
set_property ( TARGET wallet_merged PROPERTY FOLDER "monero" )
get_directory_property ( ARCH_WIDTH DIRECTORY "monero" DEFINITION ARCH_WIDTH )
get_directory_property ( UNBOUND_LIBRARY DIRECTORY "monero" DEFINITION UNBOUND_LIBRARY )
add_subdirectory ( wownero )
get_directory_property ( ARCH_WIDTH DIRECTORY "wownero" DEFINITION ARCH_WIDTH )
include ( CMakePackageConfigHelpers )
include ( VersionMonero )
@ -114,9 +96,6 @@ include_directories(${EASYLOGGING_INCLUDE})
link_directories ( ${ EASYLOGGING_LIBRARY_DIRS } )
# O p e n S S L
if ( APPLE AND NOT OPENSSL_ROOT_DIR )
execute_process ( COMMAND brew --prefix openssl OUTPUT_VARIABLE OPENSSL_ROOT_DIR OUTPUT_STRIP_TRAILING_WHITESPACE )
endif ( )
find_package ( OpenSSL REQUIRED )
message ( STATUS "OpenSSL: Version ${OPENSSL_VERSION}" )
message ( STATUS "OpenSSL: include dir at ${OPENSSL_INCLUDE_DIR}" )
@ -129,49 +108,28 @@ message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}")
# H I D A p i
set ( HIDAPI_FOUND OFF )
# U n b o u n d
find_package ( Unbound REQUIRED )
# Q r E n c o d e
find_package ( QREncode REQUIRED )
# T e v a d o r 1 4 w o r d M o n e r o s e e d
find_package ( monero-seed CONFIG )
if ( NOT monero-seed_FOUND )
if ( FETCH_DEPS )
FetchContent_Declare ( monero-seed
G I T _ R E P O S I T O R Y h t t p s : / / g i t . w o w n e r o . c o m / w o w l e t / m o n e r o - s e e d . g i t )
FetchContent_GetProperties ( monero-seed )
if ( NOT monero-seed_POPULATED )
message ( STATUS "Fetching monero-seed" )
FetchContent_Populate ( monero-seed )
add_subdirectory ( ${ monero-seed_SOURCE_DIR } ${ monero-seed_BINARY_DIR } )
endif ( )
add_library ( monero-seed::monero-seed ALIAS monero-seed )
else ( )
message ( FATAL_ERROR "monero-seed was not installed and fetching deps is disabled" )
endif ( )
endif ( )
# T e v a d o r 1 4 w o r d seed ( https://git.wownero.com/wowlet/wownero-seed )
find_package ( wownero-seed CONFIG REQUIRED )
# B o o s t
if ( DEBUG )
set ( Boost_DEBUG ON )
endif ( )
if ( APPLE AND NOT BOOST_ROOT )
execute_process ( COMMAND brew --prefix boost OUTPUT_VARIABLE BOOST_ROOT OUTPUT_STRIP_TRAILING_WHITESPACE )
endif ( )
if ( MINGW )
set ( Boost_THREADAPI win32 )
endif ( )
find_package ( Boost 1.58 REQUIRED COMPONENTS
s y s t e m
f i l e s y s t e m
t h r e a d
d a t e _ t i m e
c h r o n o
r e g e x
s e r i a l i z a t i o n
p r o g r a m _ o p t i o n s
l o c a l e )
if ( UNIX AND NOT APPLE AND NOT ANDROID )
set ( _BOOST_COMPONENTS system filesystem thread date_time chrono regex serialization program_options locale )
find_package ( Boost 1.58 REQUIRED COMPONENTS ${ _BOOST_COMPONENTS } )
if ( UNIX AND NOT ANDROID )
if ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
# h t t p s : / / g i t h u b . c o m / m o n e r o - p r o j e c t / m o n e r o - g u i / i s s u e s / 3 1 4 2 # i s s u e c o m m e n t - 7 0 5 9 4 0 4 4 6
set ( CMAKE_SKIP_RPATH ON )
@ -204,40 +162,46 @@ if(UNIX)
endif ( )
endif ( )
# T o b u i l d W O W l e t w i t h embedded ( and static ) T o r , p a s s C M a k e - D T O R _ B I N = / p a t h / t o / t o r
if ( TOR_BIN )
if ( APPLE )
execute_process ( COMMAND bash -c "touch ${CMAKE_CURRENT_SOURCE_DIR}/src/tor/libevent-2.1.7.dylib" )
endif ( )
execute_process ( COMMAND bash -c "${TOR_BIN} --version --quiet" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE out RESULT_VARIABLE ret )
if ( ret EQUAL "0" )
set ( TOR_VERSION "${out}" )
endif ( )
message ( STATUS "${TOR_VERSION}" )
configure_file ( "cmake/config-wowlet.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-wowlet.h" )
# o n t h e b u i l d b o t T o r i s b a k e d i n t o t h e i m a g e
# T o b u i l d W O W l e t w i t h e m b e d d e d & s t a t i c T o r , p a s s C M a k e - D T O R _ B I N = / p a t h / t o / t o r _ e x e c u t a b l e
# T h e C M a k e b e l o w w i l l c o p y t h e T o r b i n a r y i n t o s r c / a s s e t s / e x e c
#
# F o r r e l e a s e :
# # # L i n u x / W i n d o w
# o n t h e buildbot ( s ) T o r i s b a k e d i n t o t h e i m a g e
# - l i n u x : S e e ` D o c k e r f i l e `
# - w i n d o w s : S e e ` D o c k e r f i l e . w i n d o w s `
# - m a c o s : t a k e n f r o m T o r B r o w s e r o f f i c i a l r e l e a s e
if ( REPRODUCIBLE ) # A l w a y s c o p y T o r w h e n d o i n g a r e p r o d u c i b l e b u i l d t o p r e v e n t o l d v e r s i o n s f r o m g e t t i n g i n c l u d e d
set ( TOR_COPY_CMD "cp ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor" )
else ( )
set ( TOR_COPY_CMD "cp -u ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor" )
if ( NOT EXISTS "${TOR_BIN}" )
message ( FATAL_ERROR "TOR_BIN is set, but file does not exist: '${TOR_BIN}'" )
endif ( )
message ( STATUS "${TOR_COPY_CMD}" )
# c o p y t h e T o r e x e c u t a b l e o v e r
set ( TOR_COPY_CMD "cp ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor" )
message ( STATUS "Tor cmd: ${TOR_COPY_CMD}" )
execute_process ( COMMAND bash -c "${TOR_COPY_CMD}" RESULT_VARIABLE ret )
if ( ret EQUAL "1" )
message ( FATAL_ERROR "Tor copy failure: ${TOR_COPY_CMD}" )
endif ( )
# g e t T o r v e r s i o n w h i l e w e ' r e a t i t
if ( NOT TOR_VERSION )
execute_process ( COMMAND bash -c "${TOR_BIN} --version --quiet | head -n1" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE out RESULT_VARIABLE ret )
if ( ret EQUAL "0" )
set ( TOR_VERSION "${out}" )
endif ( )
endif ( )
message ( STATUS "Tor version: ${TOR_VERSION}" )
configure_file ( "cmake/config-wowlet.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-wowlet.h" )
message ( STATUS "Embedding Tor binary at ${TOR_BIN}" )
else ( )
message ( STATUS "Skipping Tor inclusion because -DTOR_BIN=Off" )
endif ( )
if ( MINGW )
find_package ( Iconv REQUIRED )
string ( REGEX MATCH "^[^/]:/[^/]*" msys2_install_path "${CMAKE_C_COMPILER}" )
message ( STATUS "MSYS location: ${msys2_install_path}" )
set ( CMAKE_INCLUDE_PATH "${msys2_install_path}/mingw${ARCH_WIDTH}/include" )
@ -262,8 +226,6 @@ if(MINGW)
else ( )
set ( ICU_LIBRARIES icuio icuin icuuc icudt icutu iconv )
endif ( )
elseif ( APPLE )
set ( EXTRA_LIBRARIES "-framework AppKit" )
elseif ( OPENBSD )
set ( EXTRA_LIBRARIES "" )
elseif ( FREEBSD )
@ -280,23 +242,6 @@ endif()
list ( APPEND EXTRA_LIBRARIES ${ CMAKE_DL_LIBS } )
if ( APPLE )
include_directories ( SYSTEM /usr/include/malloc )
if ( POLICY CMP0042 )
cmake_policy ( SET CMP0042 NEW )
endif ( )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0" )
endif ( )
if ( APPLE AND NOT IOS )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11" )
endif ( )
if ( APPLE )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0" )
endif ( )
# w a r n i n g s
# @ T O D O : e n a b l e t h e s e 2 f o r m i g r a t i o n t o Q t 6
# add_c_flag_if_supported ( -Werror C_SECURITY_FLAGS )
@ -331,12 +276,7 @@ if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VER
endif ( )
# l i n k e r
if ( APPLE )
add_linker_flag_if_supported ( -Wl,-bind_at_load LD_SECURITY_FLAGS )
add_linker_flag_if_supported ( -Wl,-dead_strip LD_SECURITY_FLAGS )
add_linker_flag_if_supported ( -Wl,-dead_strip_dylibs LD_SECURITY_FLAGS )
endif ( )
if ( NOT APPLE AND NOT ( WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU" ) )
if ( NOT ( WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU" ) )
# W i n d o w s b i n a r i e s d i e o n s t a r t u p w i t h P I E w h e n c o m p i l e d w i t h G C C
add_linker_flag_if_supported ( -pie LD_SECURITY_FLAGS )
endif ( )
@ -366,6 +306,11 @@ if(STATIC)
endif ( )
endif ( )
if ( LINUX_ACTIVATION )
find_package ( Cairo REQUIRED )
find_package ( Xfixes REQUIRED )
endif ( )
# W i t h G C C 6 . 1 . 1 t h e c o m p i l e d b i n a r y m a l f u n c t i o n s d u e t o a l i a s i n g . U n t i l t h a t
# i s f i x e d i n t h e code ( Issue # 847 ) , f o r c e c o m p i l e r t o b e c o n s e r v a t i v e .
add_c_flag_if_supported ( -fno-strict-aliasing C_SECURITY_FLAGS )
@ -382,10 +327,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${C_SECURITY_FLAGS}")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CXX_SECURITY_FLAGS}" )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${STATIC_FLAGS}" )
if ( APPLE )
add_subdirectory ( "${CMAKE_CURRENT_SOURCE_DIR}/contrib/KDMacTouchBar" )
endif ( )
if ( OPENVR )
# A d d c o n t r i b / o p e n v r a s l i b r a r y
add_definitions ( -DVR_API_PUBLIC )