diff --git a/CMakeLists.txt b/CMakeLists.txt index 95a57fb4..2b01b0e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,12 @@ else (APPLE) set (PLATFORM_LINK_FLAGS "") endif (APPLE) +if (WIN32) + set (PLATFORM_QT_PACKAGES WinExtras) +else (WIN32) + set (PLATFORM_QT_PACKAGES) +endif (WIN32) + include_directories (${CMAKE_SOURCE_DIR}) find_package (Boost REQUIRED COMPONENTS filesystem system log log_setup thread program_options) @@ -30,7 +36,7 @@ include_directories (${GTEST_INCLUDE_DIR}) find_package (CryptoPP REQUIRED) include_directories (${CRYPTOPP_INCLUDE_DIR}) -find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets Test) +find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets Test ${PLATFORM_QT_PACKAGES}) include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Test_INCLUDE_DIRS}) include_directories (${CPPNETLIB_INCLUDE_DIRS}) @@ -64,15 +70,15 @@ add_library (blake2 ${BLAKE2_IMPLEMENTATION}) if (APPLE) - set (PLATFORM_NODE_SOURCE rai/plat/osx/working.mm) + set (PLATFORM_SECURE_SOURCE rai/plat/osx/working.mm) elseif (WIN32) - set (PLATFORM_NODE_SOURCE rai/plat/windows/working.cpp) + set (PLATFORM_SECURE_SOURCE rai/plat/windows/working.cpp) elseif (UNIX) - set (PLATFORM_NODE_SOURCE rai/plat/posix/working.cpp) + set (PLATFORM_SECURE_SOURCE rai/plat/posix/working.cpp) endif (APPLE) add_library (secure - ${PLATFORM_NODE_SOURCE} + ${PLATFORM_SECURE_SOURCE} rai/config.hpp rai/secure.cpp rai/secure.hpp @@ -124,7 +130,14 @@ add_library (qt add_executable (landing rai/landing/entry.cpp) +if (WIN32) + set (PLATFORM_WALLET_SOURCE rai/plat/windows/icon.cpp RaiBlocks.rc) +else (WIN32) + set (PLATFORM_WALLET_SOURCE rai/plat/unknown/icon.cpp) +endif (WIN32) + add_executable (qt_wallet ${PLATFORM_GUI_TARGET_PROPERTIES} + ${PLATFORM_WALLET_SOURCE} rai/qt_wallet/entry.cpp) add_executable (qt_system @@ -149,6 +162,12 @@ else (WIN32) set (PLATFORM_LIBS) endif (WIN32) +if (WIN32) + set (PLATFORM_WALLET_LIBS Qt5::WinExtras) +else (WIN32) + set (PLATFORM_WALLET_LIBS) +endif (WIN32) + target_link_libraries (core_test node secure lmdb xxhash ed25519 blake2 ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_LOG_LIBRARY} ${Boost_LOG_SETUP_LIBRARY} ${Boost_THREAD_LIBRARY} ${GTEST_MAIN_LIBRARY} ${GTEST_LIBRARY} ${CRYPTOPP_LIBRARY} ${CPPNETLIB_LIBRARIES} pthread ${PLATFORM_LIBS}) target_link_libraries (slow_test node secure lmdb xxhash ed25519 blake2 ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_LOG_LIBRARY} ${Boost_LOG_SETUP_LIBRARY} ${Boost_THREAD_LIBRARY} ${CRYPTOPP_LIBRARY} ${GTEST_MAIN_LIBRARY} ${GTEST_LIBRARY} ${CPPNETLIB_LIBRARIES} pthread ${PLATFORM_LIBS}) @@ -159,7 +178,7 @@ target_link_libraries (landing node secure lmdb xxhash ed25519 blake2 ${Boost_FI target_link_libraries (qt_test node secure lmdb xxhash ed25519 qt blake2 ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_LOG_LIBRARY} ${Boost_LOG_SETUP_LIBRARY} ${Boost_THREAD_LIBRARY} ${GTEST_LIBRARY} ${CRYPTOPP_LIBRARY} ${CPPNETLIB_LIBRARIES} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test ${QT_QTGUI_LIBRARY} pthread ${PLATFORM_LIBS}) -target_link_libraries (qt_wallet node secure lmdb xxhash ed25519 qt blake2 ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_LOG_LIBRARY} ${Boost_LOG_SETUP_LIBRARY} ${Boost_THREAD_LIBRARY} ${CRYPTOPP_LIBRARY} ${CPPNETLIB_LIBRARIES} Qt5::Core Qt5::Gui Qt5::Widgets ${QT_QTGUI_LIBRARY} pthread ${PLATFORM_LIBS}) +target_link_libraries (qt_wallet node secure lmdb xxhash ed25519 qt blake2 ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_LOG_LIBRARY} ${Boost_LOG_SETUP_LIBRARY} ${Boost_THREAD_LIBRARY} ${CRYPTOPP_LIBRARY} ${CPPNETLIB_LIBRARIES} Qt5::Core Qt5::Gui Qt5::Widgets ${QT_QTGUI_LIBRARY} pthread ${PLATFORM_LIBS} ${PLATFORM_WALLET_LIBS}) target_link_libraries (qt_system node secure lmdb xxhash ed25519 qt blake2 ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_LOG_LIBRARY} ${Boost_LOG_SETUP_LIBRARY} ${Boost_THREAD_LIBRARY} ${GTEST_LIBRARY} ${CRYPTOPP_LIBRARY} ${CPPNETLIB_LIBRARIES} Qt5::Core Qt5::Gui Qt5::Widgets ${QT_QTGUI_LIBRARY} pthread ${PLATFORM_LIBS}) diff --git a/RaiBlocks.ico b/RaiBlocks.ico new file mode 100644 index 00000000..a7fe4d33 Binary files /dev/null and b/RaiBlocks.ico differ diff --git a/RaiBlocks.rc b/RaiBlocks.rc new file mode 100644 index 00000000..f513adb6 --- /dev/null +++ b/RaiBlocks.rc @@ -0,0 +1 @@ +1 ICON "RaiBlocks.ico" \ No newline at end of file diff --git a/rai/icon.hpp b/rai/icon.hpp new file mode 100644 index 00000000..c6c06332 --- /dev/null +++ b/rai/icon.hpp @@ -0,0 +1,7 @@ +#pragma once + +class QApplication; +namespace rai +{ +void set_application_icon (QApplication &); +} \ No newline at end of file diff --git a/rai/plat/unknown/icon.cpp b/rai/plat/unknown/icon.cpp new file mode 100644 index 00000000..e22c77ae --- /dev/null +++ b/rai/plat/unknown/icon.cpp @@ -0,0 +1,5 @@ +#include + +void rai::set_application_icon (QApplication &) +{ +} \ No newline at end of file diff --git a/rai/plat/windows/icon.cpp b/rai/plat/windows/icon.cpp new file mode 100644 index 00000000..36262559 --- /dev/null +++ b/rai/plat/windows/icon.cpp @@ -0,0 +1,12 @@ +#include + +#include +#include +#include + +void rai::set_application_icon (QApplication & application_a) +{ + HICON hIcon = static_cast (LoadImage (GetModuleHandle (nullptr), MAKEINTRESOURCE (1), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADTRANSPARENT)); + application_a.setWindowIcon (QIcon (QtWin::fromHICON (hIcon))); + DestroyIcon (hIcon); +} \ No newline at end of file diff --git a/rai/qt_wallet/entry.cpp b/rai/qt_wallet/entry.cpp index 3621dc53..f72ae4b9 100644 --- a/rai/qt_wallet/entry.cpp +++ b/rai/qt_wallet/entry.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include @@ -100,6 +101,7 @@ int main (int argc, char * const * argv) if (!config_error) { QApplication application (argc, const_cast (argv)); + rai::set_application_icon (application); auto service (boost::make_shared ()); rai::processor_service processor; rai::node_init init;