Sync changes.

This commit is contained in:
XMRig 2018-11-11 03:18:56 +07:00
parent a76243a65e
commit 9f6f599d78
8 changed files with 32 additions and 8 deletions

View file

@ -257,5 +257,5 @@ if (WITH_DEBUG_LOG)
add_definitions(/DAPP_DEBUG)
endif()
add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
target_link_libraries(${PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})

View file

@ -20,4 +20,6 @@ else()
set(TLS_SOURCES "")
set(OPENSSL_LIBRARIES "")
add_definitions(/DXMRIG_NO_TLS)
set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls")
endif()

View file

@ -87,6 +87,10 @@ App::~App()
int App::exec()
{
if (m_controller->isDone()) {
return 0;
}
if (!m_controller->isReady()) {
return 2;
}

View file

@ -174,8 +174,11 @@ void xmrig::CommonConfig::printVersions()
int length = snprintf(buf, sizeof buf, "CUDA/%d.%d ", cudaVersion / 1000, cudaVersion % 100);
# else
memset(buf, 0, 16);
# if !defined(XMRIG_NO_HTTPD) || !defined(XMRIG_NO_TLS)
int length = 0;
# endif
# endif
# if !defined(XMRIG_NO_TLS) && defined(OPENSSL_VERSION_TEXT)
{

View file

@ -50,6 +50,7 @@
#include "rapidjson/filereadstream.h"
bool xmrig::ConfigLoader::m_done = false;
xmrig::ConfigWatcher *xmrig::ConfigLoader::m_watcher = nullptr;
xmrig::IConfigCreator *xmrig::ConfigLoader::m_creator = nullptr;
xmrig::IWatcherListener *xmrig::ConfigLoader::m_listener = nullptr;
@ -283,12 +284,16 @@ void xmrig::ConfigLoader::parseJSON(xmrig::IConfig *config, const struct option
void xmrig::ConfigLoader::showUsage()
{
m_done = true;
printf(usage);
}
void xmrig::ConfigLoader::showVersion()
{
m_done = true;
printf(APP_NAME " " APP_VERSION "\n built on " __DATE__
# if defined(__clang__)

View file

@ -21,8 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CONFIGLOADER_H__
#define __CONFIGLOADER_H__
#ifndef XMRIG_CONFIGLOADER_H
#define XMRIG_CONFIGLOADER_H
#include <stdint.h>
@ -53,6 +53,8 @@ public:
static IConfig *load(int argc, char **argv, IConfigCreator *creator, IWatcherListener *listener);
static void release();
static inline bool isDone() { return m_done; }
private:
static bool getJSON(const char *fileName, rapidjson::Document &doc);
static bool parseArg(IConfig *config, int key, const char *arg);
@ -60,6 +62,7 @@ private:
static void showUsage();
static void showVersion();
static bool m_done;
static ConfigWatcher *m_watcher;
static IConfigCreator *m_creator;
static IWatcherListener *m_listener;
@ -68,4 +71,4 @@ private:
} /* namespace xmrig */
#endif /* __CONFIGLOADER_H__ */
#endif /* XMRIG_CONFIGLOADER_H */

View file

@ -78,6 +78,12 @@ xmrig::Controller::~Controller()
}
bool xmrig::Controller::isDone() const
{
return ConfigLoader::isDone();
}
bool xmrig::Controller::isReady() const
{
return d_ptr->config && d_ptr->network;

View file

@ -21,8 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CONTROLLER_H__
#define __CONTROLLER_H__
#ifndef XMRIG_CONTROLLER_H
#define XMRIG_CONTROLLER_H
#include "common/interfaces/IWatcherListener.h"
@ -46,6 +46,7 @@ public:
Controller();
~Controller();
bool isDone() const;
bool isReady() const;
Config *config() const;
int init(int argc, char **argv);
@ -61,4 +62,4 @@ private:
} /* namespace xmrig */
#endif /* __CONTROLLER_H__ */
#endif /* XMRIG_CONTROLLER_H */