Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed windows build #1

Merged
merged 67 commits into from
Oct 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
3894ebb
Playing around with appveyor build
Bendr0id Oct 23, 2017
ae0c2ea
trying to add curl
Bendr0id Oct 23, 2017
48b2648
Fixed typo
Bendr0id Oct 23, 2017
1346152
Fixed windows compile issues
Bendr0id Oct 23, 2017
2154ffd
Merged branch master into winbuild
Bendr0id Oct 23, 2017
b6d023a
Fixed more windows compile issues
Bendr0id Oct 23, 2017
e52683f
Debugging of xmrigd
Bendr0id Oct 23, 2017
22584a5
Temp disabled curl
Bendr0id Oct 23, 2017
692fc42
Removed libuc
Bendr0id Oct 23, 2017
8935eea
Added xmrig deps again
Bendr0id Oct 23, 2017
983796b
fixed wchar unicode
Bendr0id Oct 23, 2017
a8f50d3
Added libcurl again
Bendr0id Oct 23, 2017
0ebc50a
fixed Typo
Bendr0id Oct 23, 2017
02797f0
Windows strings :/
Bendr0id Oct 23, 2017
47bf22b
windows!
Bendr0id Oct 23, 2017
a091475
Added artifacts
Bendr0id Oct 24, 2017
2b6b154
Test with artifacts
Bendr0id Oct 24, 2017
c8cdbf9
Test
Bendr0id Oct 24, 2017
fc9bb13
Removed unused import
Bendr0id Oct 24, 2017
0e60ab4
Cleanup
Bendr0id Oct 24, 2017
6594276
Temp disabled CC
Bendr0id Oct 24, 2017
f124f4f
in ccclient XMRIG_NO_CC
Bendr0id Oct 24, 2017
9917af8
remioved zconf dep
Bendr0id Oct 24, 2017
d1c6660
updated artifact name
Bendr0id Oct 24, 2017
fd058f4
testing with artifacts
Bendr0id Oct 24, 2017
da37d77
test
Bendr0id Oct 24, 2017
a096dde
Update appveyor.yml
Bendr0id Oct 24, 2017
ad411e3
Update appveyor.yml
Bendr0id Oct 24, 2017
bdec17b
Update appveyor.yml
Bendr0id Oct 24, 2017
31c09d0
Update appveyor.yml
Bendr0id Oct 24, 2017
4a767a3
Update xmrigd.cpp
Bendr0id Oct 24, 2017
0e01ec5
Update CMakeLists.txt
Bendr0id Oct 24, 2017
7c99b32
Update CMakeLists.txt
Bendr0id Oct 24, 2017
9b15405
Update xmrigd.cpp
Bendr0id Oct 24, 2017
133c606
Update xmrigd.cpp
Bendr0id Oct 24, 2017
edd5180
Update xmrigd.cpp
Bendr0id Oct 24, 2017
0849aff
Update CMakeLists.txt
Bendr0id Oct 24, 2017
eb7a17d
Update appveyor.yml
Bendr0id Oct 24, 2017
5f6f8ae
Update appveyor.yml
Bendr0id Oct 24, 2017
34331f7
Update appveyor.yml
Bendr0id Oct 24, 2017
a59086d
Update appveyor.yml
Bendr0id Oct 24, 2017
60f5720
Update appveyor.yml
Bendr0id Oct 24, 2017
f14d1b8
Update appveyor.yml
Bendr0id Oct 24, 2017
3ec7d0d
Update appveyor.yml
Bendr0id Oct 24, 2017
7d15769
Update CMakeLists.txt
Bendr0id Oct 24, 2017
0d449c2
Update appveyor.yml
Bendr0id Oct 24, 2017
3828443
Update appveyor.yml
Bendr0id Oct 24, 2017
d2cb629
Update appveyor.yml
Bendr0id Oct 24, 2017
4932ba3
Update appveyor.yml
Bendr0id Oct 24, 2017
413cfe0
Update appveyor.yml
Bendr0id Oct 24, 2017
81fd3b2
Update appveyor.yml
Bendr0id Oct 24, 2017
7c3f2f2
Update CMakeLists.txt
Bendr0id Oct 24, 2017
4e88491
Update appveyor.yml
Bendr0id Oct 24, 2017
3c39e8b
Update appveyor.yml
Bendr0id Oct 24, 2017
166ef7a
Update appveyor.yml
Bendr0id Oct 24, 2017
5720f46
Update appveyor.yml
Bendr0id Oct 24, 2017
8a16307
Updated to 2017
Bendr0id Oct 24, 2017
8357c3e
Update CCClient.cpp
Bendr0id Oct 24, 2017
5744439
Update CCClient.cpp
Bendr0id Oct 24, 2017
870bdde
fixed cmake
Bendr0id Oct 24, 2017
ffcc96f
Merged branch master into winbuild
Bendr0id Oct 24, 2017
03c2e4d
Removed path in log
Bendr0id Oct 24, 2017
e8ae6cb
Fixed crash in startup when no cc-url is set
Bendr0id Oct 24, 2017
d993067
Debugging
Bendr0id Oct 24, 2017
e91d6f2
more debugging
Bendr0id Oct 24, 2017
fee2946
Added missing mutex init
Bendr0id Oct 24, 2017
65d750a
Removed debug log
Bendr0id Oct 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ if (WITH_CC)
if (CURL_FOUND)
include_directories(${CURL_INCLUDE_DIRS})
else()
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_CC=OFF` to build without CC Server support")
message(FATAL_ERROR "curl NOT found: use `-DWITH_CC=OFF` to build without CC Server support")
endif()

set(HEADERS_CC_COMMON
Expand Down Expand Up @@ -295,7 +295,7 @@ include_directories(${UV_INCLUDE_DIR})
add_executable(xmrigMiner ${HEADERS} ${SOURCES} ${HEADERS_COMMON} ${SOURCES_COMMON} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES} ${SOURCES_CC_COMMON} ${HEADERS_CC_COMMON} ${SOURCES_CC_CLIENT} ${HEADERS_CC_CLIENT})
target_link_libraries(xmrigMiner ${UV_LIBRARIES} ${MHD_LIBRARY} ${CURL_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})

add_executable(xmrigDaemon src/xmrigd.cpp)
add_executable(xmrigDaemon src/xmrigd.cpp res/app.rc)

if (WITH_CC AND MHD_FOUND AND CURL_FOUND)
add_executable(xmrigCCServer ${HEADERS_COMMON} ${SOURCES_COMMON} ${SOURCES_OS} ${SOURCES_CPUID} ${SOURCES_SYSLOG} ${SOURCES_CC_COMMON} ${HEADERS_CC_COMMON} ${SOURCES_CC_SERVER} ${HEADERS_CC_SERVER})
Expand Down
32 changes: 32 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# image
image: Visual Studio 2017

# build platform
platform: x64
configuration: Release

# clone directory
clone_folder: c:\xmrigCC

install:
- mkdir c:\xmrigCC-deps
- curl -sL https://github.com/xmrig/xmrig-deps/releases/download/v2/xmrig-deps-v2.zip -o xmrigCC-deps-v2.zip
- 7z x xmrigCC-deps-v2.zip -o"c:\xmrigCC-deps" -y > nul
- vcpkg install curl:x64-windows

build_script:
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsMSBuildCmd.bat"
- cd c:\xmrigCC
- mkdir build
- cd build
- set CMAKE_PREFIX_PATH=c:\xmrigCC-deps\msvc2017\libuv\x64\;c:\xmrigCC-deps\msvc2017\libmicrohttpd\x64\;C:\Tools\vcpkg\installed\x64-windows\
- cmake -G "Visual Studio 15 2017 Win64" -T v141,host=x64 ..
- msbuild xmrig.sln /p:Configuration=Release

after_build:
- cd c:\xmrigCC
- cmd: 7z a xmrigCC.zip "c:\xmrigCC\build\Release\*.*" "c:\xmrigCC\src\*config*" "C:\Tools\vcpkg\installed\x64-windows\lib\*.dll" "c:\xmrigCC\index.html"
- cmd: dir

artifacts:
- path: xmrigCC.zip
13 changes: 9 additions & 4 deletions src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include <stdlib.h>
#include <uv.h>
#include <zconf.h>

#include "api/Api.h"
#include "App.h"
Expand Down Expand Up @@ -111,7 +110,9 @@ App::~App()
# endif

# ifndef XMRIG_NO_CC
delete m_ccclient;
if (m_ccclient) {
delete m_ccclient;
}
# endif
}

Expand Down Expand Up @@ -146,7 +147,11 @@ int App::start()
# endif

# ifndef XMRIG_NO_CC
m_ccclient = new CCClient(m_options);
if (m_options->ccUrl()) {
m_ccclient = new CCClient(m_options);
} else {
LOG_WARN("Please configure CC-Url and restart. CC feature is now deactivated.");
}
# endif

Workers::start(m_options->affinity(), m_options->priority());
Expand All @@ -156,7 +161,7 @@ int App::start()
const int r = uv_run(uv_default_loop(), UV_RUN_DEFAULT);
uv_loop_close(uv_default_loop());

return m_restart ? ERESTART : r;
return m_restart ? EINTR : r;
}

void App::onConsoleCommand(char command)
Expand Down
1 change: 0 additions & 1 deletion src/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/


#include <zconf.h>
#include "Console.h"
#include "interfaces/IConsoleListener.h"

Expand Down
1 change: 0 additions & 1 deletion src/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ Options::Options(int argc, char **argv) :
return;
}
#else

#ifndef XMRIG_NO_CC
if (!m_daemonized) {
fprintf(stderr, "\"" APP_ID "\" is compiled with CC support, please start the daemon instead.\n");
Expand Down
39 changes: 25 additions & 14 deletions src/cc/CCClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <zconf.h>
#include <fstream>
#include <3rdparty/rapidjson/stringbuffer.h>
#include <3rdparty/rapidjson/prettywriter.h>

#if _WIN32
# include "winsock2.h"
#else
# include "unistd.h"
#endif

#include "CCClient.h"
#include "App.h"
#include "ControlCommand.h"
Expand All @@ -42,6 +47,8 @@ uv_mutex_t CCClient::m_mutex;
CCClient::CCClient(const Options *options)
: m_options(options)
{
uv_mutex_init(&m_mutex);

m_self = this;

std::string clientId;
Expand Down Expand Up @@ -75,10 +82,12 @@ void CCClient::updateHashrate(const Hashrate *hashrate)
{
uv_mutex_lock(&m_mutex);

m_self->m_clientStatus.setHashrateShort(hashrate->calc(Hashrate::ShortInterval));
m_self->m_clientStatus.setHashrateMedium(hashrate->calc(Hashrate::MediumInterval));
m_self->m_clientStatus.setHashrateLong(hashrate->calc(Hashrate::LargeInterval));
m_self->m_clientStatus.setHashrateHighest(hashrate->highest());
if (m_self) {
m_self->m_clientStatus.setHashrateShort(hashrate->calc(Hashrate::ShortInterval));
m_self->m_clientStatus.setHashrateMedium(hashrate->calc(Hashrate::MediumInterval));
m_self->m_clientStatus.setHashrateLong(hashrate->calc(Hashrate::LargeInterval));
m_self->m_clientStatus.setHashrateHighest(hashrate->highest());
}

uv_mutex_unlock(&m_mutex);
}
Expand All @@ -88,13 +97,14 @@ void CCClient::updateNetworkState(const NetworkState &network)
{
uv_mutex_lock(&m_mutex);

m_self->m_clientStatus.setCurrentStatus(Workers::isEnabled() ? ClientStatus::RUNNING : ClientStatus::PAUSED);
m_self->m_clientStatus.setCurrentPool(network.pool);
m_self->m_clientStatus.setSharesGood(network.accepted);
m_self->m_clientStatus.setSharesTotal(network.accepted + network.rejected);
m_self->m_clientStatus.setHashesTotal(network.total);
m_self->m_clientStatus.setAvgTime(network.avgTime());

if (m_self) {
m_self->m_clientStatus.setCurrentStatus(Workers::isEnabled() ? ClientStatus::RUNNING : ClientStatus::PAUSED);
m_self->m_clientStatus.setCurrentPool(network.pool);
m_self->m_clientStatus.setSharesGood(network.accepted);
m_self->m_clientStatus.setSharesTotal(network.accepted + network.rejected);
m_self->m_clientStatus.setHashesTotal(network.total);
m_self->m_clientStatus.setAvgTime(network.avgTime());
}
uv_mutex_unlock(&m_mutex);
}

Expand Down Expand Up @@ -210,7 +220,9 @@ CURLcode CCClient::performCurl(const std::string& requestUrl, const std::string&

void CCClient::onReport(uv_timer_t *handle)
{
m_self->publishClientStatusReport();
if (m_self) {
m_self->publishClientStatusReport();
}
}

int CCClient::onResponse(char* data, size_t size, size_t nmemb, std::string* responseBuffer)
Expand All @@ -224,4 +236,3 @@ int CCClient::onResponse(char* data, size_t size, size_t nmemb, std::string* res

return result;
}

2 changes: 2 additions & 0 deletions src/cc/CCClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#ifndef __CC_CLIENT_H__
#define __CC_CLIENT_H__

#ifndef XMRIG_NO_CC

#include <uv.h>
#include <curl/curl.h>
Expand Down Expand Up @@ -68,4 +69,5 @@ class CCClient

};

#endif
#endif /* __CC_CLIENT_H__ */
1 change: 0 additions & 1 deletion src/cc/ControlCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#define __CONTROL_COMMAND_H__

#include <string>
#include <vector>
#include "rapidjson/document.h"

class ControlCommand
Expand Down
19 changes: 14 additions & 5 deletions src/xmrigd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@

#include <stdlib.h>
#include <string>
#include <regex>


#ifdef WIN32
#define WIN32_LEAN_AND_MEAN /* avoid including junk */
#include <windows.h>
#include <signal.h>
#endif
int main(int argc, char **argv) {

std::string ownPath(argv[0]);
std::string xmrigMinerPath = std::regex_replace(ownPath, std::regex(program_invocation_short_name), "xmrigMiner");
std::string xmrigDaemon("xmrigDaemon");
std::string xmrigMiner("xmrigMiner");

std::string xmrigMinerPath = ownPath.replace(ownPath.rfind(xmrigDaemon),xmrigDaemon.size(), xmrigMiner);

for (int i=1; i < argc; i++){
xmrigMinerPath += " ";
Expand All @@ -40,7 +47,9 @@ int main(int argc, char **argv) {

int status = 0;

do {
//do {
status = system(xmrigMinerPath.c_str());
} while (WEXITSTATUS(status) == ERESTART);

printf("Status: %d", status);
//} while (WEXITSTATUS(status) == EINTR);
}