diff --git a/crypto777/bitcoind_RPC.c b/crypto777/bitcoind_RPC.c index 4f0a9cdd4..98c7e7eb0 100755 --- a/crypto777/bitcoind_RPC.c +++ b/crypto777/bitcoind_RPC.c @@ -56,7 +56,7 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char * char *retstr = 0; cJSON *json,*result,*error; #ifdef FROM_MARKETMAKER - usleep(5000); + usleep(3000); #endif //printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr); if ( command == 0 || rpcstr == 0 || rpcstr[0] == 0 ) diff --git a/crypto777/cJSON.c b/crypto777/cJSON.c index 8bce48b19..93438fe79 100755 --- a/crypto777/cJSON.c +++ b/crypto777/cJSON.c @@ -578,8 +578,6 @@ cJSON *cJSON_CreateFalse(void) {cJSON *item=cJSON_New_Item();if(item)item->t cJSON *cJSON_CreateBool(int32_t b) {cJSON *item=cJSON_New_Item();if(item)item->type=b?cJSON_True:cJSON_False;return item;} cJSON *cJSON_CreateNumber(double num) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_Number;item->valuedouble=num;item->valueint=(int64_t)num;}return item;} cJSON *cJSON_CreateString(const char *string) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_String;item->valuestring=cJSON_strdup(string);}return item;} -cJSON *cJSON_CreateArray(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Array;return item;} -cJSON *cJSON_CreateObject(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Object;return item;} /* Create Arrays: */ cJSON *cJSON_CreateIntArray(int64_t *numbers,int32_t count) {int32_t i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && ichild=n;else suffix_object(p,n);p=n;}return a;} @@ -1129,4 +1127,33 @@ cJSON *addrs_jsonarray(uint64_t *addrs,int32_t num) return(array); } -void free_json(cJSON *json) { if ( json != 0 ) cJSON_Delete(json); } +cJSON *cJSON_CreateArray(void) +{ + cJSON *item = cJSON_New_Item(); + if ( item ) + item->type = cJSON_Array; +//#ifdef CJSON_GARBAGECOLLECTION +// cJSON_register(item); +//#endif + return(item); +} + +cJSON *cJSON_CreateObject(void) +{ + cJSON *item = cJSON_New_Item(); + if ( item ) + item->type = cJSON_Object; +//#ifdef CJSON_GARBAGECOLLECTION +// cJSON_register(item); +//#endif + return item; +} + +void free_json(cJSON *item) +{ +//#ifdef CJSON_GARBAGECOLLECTION +// cJSON_unregister(item); +//#endif + if ( item != 0 ) + cJSON_Delete(item); +} diff --git a/iguana/dexscripts.win32/bot_buy.cmd b/iguana/dexscripts.win32/bot_buy.cmd new file mode 100644 index 000000000..641ef1d7b --- /dev/null +++ b/iguana/dexscripts.win32/bot_buy.cmd @@ -0,0 +1,7 @@ +@echo off +set /p TMPUSERPASS= UTXO PAIRS to understand the basics. This script is just for example how you can split your coins in (X, X/777) to start trading them. + ## F.A.Q. ## **Q.** Is any simple way how i can display JSON results returned by all scripts, like orderbook and others, in human readable form? + **A.** Yes, you can use this service [JSON Editor Online](http://jsoneditoronline.org/), just copy and paste output of script in left column and see structured output in right. **Q.** I see an output like this when i'm start `1-client.cmd` : @@ -42,3 +74,27 @@ And nothing works. **A.** Before run `1-client.cmd` make sure in Task Manager that you haven't already running `marketmaker.exe`. If have - kill this process via Task Manager or via command line command `taskkill /f /im taskkill.exe` . +**Q.** How can i pretty print JSON answers of marketmaker? + +**A.** You can get best results with 2 tools - [conemu](https://conemu.github.io/) and [jq](https://stedolan.github.io/jq/), conemu supports ANSI X3.64 and Xterm 256 colors and jq allow you to pretty-print json output with colors, like this: + +![](./images/conemu_jq.png) + +Also i'm always recommend to install [Far Manager](https://www.farmanager.com/index.php?l=en) - this is powerful console file manager for Windows, like Midnight Commander in *nix. + +**Q.** What additional dependencies required by marketmaker? + +**A.** Currently marketmaker (Windows) used the following DLLs: + +*32 bit:* +- libcrypto-1_1.dll +- libcurl.dll +- libssl-1_1.dll +- nanomsg.dll +- pthreadvc2.dll + +*64-bit:* +- libcurl.dll +- nanomsg.dll + +It already included in repo and in archive with release. \ No newline at end of file diff --git a/iguana/dexscripts.win32/images/conemu_jq.png b/iguana/dexscripts.win32/images/conemu_jq.png new file mode 100644 index 000000000..e8eeaf523 Binary files /dev/null and b/iguana/dexscripts.win32/images/conemu_jq.png differ diff --git a/iguana/dexscripts.win32/sendrawtransaction.cmd b/iguana/dexscripts.win32/sendrawtransaction.cmd new file mode 100644 index 000000000..a19d77355 --- /dev/null +++ b/iguana/dexscripts.win32/sendrawtransaction.cmd @@ -0,0 +1,5 @@ +@echo off +set /p TMPUSERPASS= withdraw.txt +type withdraw.txt diff --git a/iguana/dexscripts.win32/withdraw_10_send.cmd b/iguana/dexscripts.win32/withdraw_10_send.cmd new file mode 100644 index 000000000..44a947787 --- /dev/null +++ b/iguana/dexscripts.win32/withdraw_10_send.cmd @@ -0,0 +1,14 @@ +@echo off +set /p TMPUSERPASS= withdraw.txt +type withdraw.txt +timeout /t 5 /nobreak +for /f "tokens=4 delims=:," %%a in (' find "hex" "withdraw.txt" ') do ( +rem echo [%%~a] +curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"sendrawtransaction\",\"coin\":\"%COIN%\",\"signedtx\":\"%%~a\"}" +) diff --git a/iguana/dexscripts.win32/withdraw_send.cmd b/iguana/dexscripts.win32/withdraw_send.cmd new file mode 100644 index 000000000..a26b9bf56 --- /dev/null +++ b/iguana/dexscripts.win32/withdraw_send.cmd @@ -0,0 +1,14 @@ +@echo off +set /p TMPUSERPASS= withdraw.txt +type withdraw.txt +timeout /t 5 /nobreak +for /f "tokens=4 delims=:," %%a in (' find "hex" "withdraw.txt" ') do ( +rem echo [%%~a] +curl -s --url "http://127.0.0.1:7783" --data "{\"userpass\":\"%USERPASS%\",\"method\":\"sendrawtransaction\",\"coin\":\"%COIN%\",\"signedtx\":\"%%~a\"}" +) + diff --git a/iguana/exchanges/LP_cache.c b/iguana/exchanges/LP_cache.c index a08828966..fdc734fe9 100644 --- a/iguana/exchanges/LP_cache.c +++ b/iguana/exchanges/LP_cache.c @@ -45,10 +45,10 @@ struct LP_transaction *LP_create_transaction(struct iguana_info *coin,bits256 tx vins = jarray(&numvins,txobj,"vin"); vouts = jarray(&numvouts,txobj,"vout"); tx = LP_transactionadd(coin,txid,height,numvouts,numvins); - tx->serialized = serialized; - //free(serialized); + tx->serialized = 0;//serialized; + free(serialized); tx->fpos = fpos; - tx->len = tx->len; + tx->len = 0;//tx->len; tx->SPV = tx->height = height; //printf("tx.%s numvins.%d numvouts.%d\n",bits256_str(str,txid),numvins,numvouts); for (i=0; i= 1000 ) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index b7dd79e03..b6c24be52 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -23,7 +23,7 @@ #define LP_MAJOR_VERSION "0" #define LP_MINOR_VERSION "1" -#define LP_BUILD_NUMBER "14414" +#define LP_BUILD_NUMBER "15000" #ifdef FROM_JS #include @@ -53,8 +53,8 @@ void emscripten_usleep(int32_t x); // returns immediate, no sense for sleeping #define LP_MIN_PEERS 8 #define LP_MAX_PEERS 32 -#define LP_MAXDESIRED_UTXOS 128 -#define LP_MINDESIRED_UTXOS 32 +#define LP_MAXDESIRED_UTXOS (IAMLP != 0 ? 128 : 64) +#define LP_MINDESIRED_UTXOS (IAMLP != 0 ? 32 : 16) #define LP_DUSTCOMBINE_THRESHOLD 1000000 // RTmetrics diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 6232d159b..6f90ed93c 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -17,16 +17,14 @@ // LP_nativeDEX.c // marketmaker // -// single utxo allocations alice -// gc cJSON -// more retries for swap sendrawtransaction +// more retries for swap sendrawtransaction? // pbca26 unfinished swaps -// alice waiting for bestprice -//if ( G.LP_pendingswaps != 0 ) -//return(-1); +// if ( G.LP_pendingswaps != 0 ) return(-1); // bot safe to exit? // // BCH signing +// single utxo allocations alice +// alice waiting for bestprice // previously, it used to show amount, kmd equiv, perc // dPoW security -> 4: KMD notarized, 5: BTC notarized, after next notary elections // bigendian architectures need to use little endian for sighash calcs @@ -83,7 +81,7 @@ void LP_millistats_update(struct LP_millistats *mp) } #include "LP_include.h" -portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex,LP_nanorecvsmutex,LP_tradebotsmutex,LP_gcmutex,LP_inusemutex; +portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex,LP_nanorecvsmutex,LP_tradebotsmutex,LP_gcmutex,LP_inusemutex,LP_cJSONmutex; int32_t LP_canbind; char *Broadcaststr,*Reserved_msgs[2][1000]; int32_t num_Reserved_msgs[2],max_Reserved_msgs[2]; @@ -328,7 +326,7 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock, int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int32_t sock,char *remoteaddr,int32_t maxdepth) { - int32_t recvlen=1,nonz = 0; cJSON *argjson; void *ptr; char methodstr[64],*retstr,*str; struct nn_pollfd pfd; + int32_t recvlen=1,nonz = 0; cJSON *argjson; void *ptr,*buf; char methodstr[64],*retstr,*str; struct nn_pollfd pfd; if ( sock >= 0 ) { while ( nonz < maxdepth && recvlen > 0 ) @@ -340,8 +338,11 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int if ( nn_poll(&pfd,1,1) != 1 ) break; ptr = 0; - if ( (recvlen= nn_recv(sock,&ptr,NN_MSG,0)) > 0 ) + buf = malloc(1000000); + if ( (recvlen= nn_recv(sock,buf,1000000,0)) > 0 ) + //if ( (recvlen= nn_recv(sock,&ptr,NN_MSG,0)) > 0 ) { + ptr = buf; methodstr[0] = 0; //printf("%s.(%s)\n",typestr,(char *)ptr); if ( 0 ) @@ -391,7 +392,10 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int } } if ( ptr != 0 ) - nn_freemsg(ptr), ptr = 0; + { + //nn_freemsg(ptr), ptr = 0; + free(buf); + } } } return(nonz); @@ -939,6 +943,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu portable_mutex_init(&LP_reservedmutex); portable_mutex_init(&LP_nanorecvsmutex); portable_mutex_init(&LP_tradebotsmutex); + portable_mutex_init(&LP_cJSONmutex); myipaddr = clonestr("127.0.0.1"); #ifndef _WIN32 #ifndef FROM_JS diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 0ab6faca0..7d60f336d 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -449,6 +449,11 @@ int32_t LP_connectstartbob(void *ctx,int32_t pubsock,cJSON *argjson,char *base,c if ( bits256_nonz(privkey) != 0 && bits256_cmp(G.LP_mypub25519,qp->srchash) == 0 ) { LP_requestinit(&qp->R,qp->srchash,qp->desthash,base,qp->satoshis-qp->txfee,rel,qp->destsatoshis-qp->desttxfee,qp->timestamp,qp->quotetime,DEXselector); + if ( LP_pendingswap(qp->R.requestid,qp->R.quoteid) > 0 ) + { + printf("requestid.%u quoteid.%u is already in progres\n",qp->R.requestid,qp->R.quoteid); + return(-1); + } if ( (swap= LP_swapinit(1,0,privkey,&qp->R,qp)) == 0 ) { printf("cant initialize swap\n"); @@ -611,6 +616,12 @@ char *LP_connectedalice(cJSON *argjson) // alice { retjson = cJSON_CreateObject(); LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-Q.txfee,Q.destcoin,Q.destsatoshis-Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector); + if ( LP_pendingswap(Q.R.requestid,Q.R.quoteid) > 0 ) + { + printf("requestid.%u quoteid.%u is already in progres\n",Q.R.requestid,Q.R.quoteid); + jaddstr(retjson,"error","swap already in progress"); + return(jprint(retjson,1)); + } if ( (swap= LP_swapinit(0,0,Q.privkey,&Q.R,&Q)) == 0 ) { jaddstr(retjson,"error","couldnt swapinit"); diff --git a/iguana/exchanges/LP_remember.c b/iguana/exchanges/LP_remember.c index d8b264e7c..c0ef0efd7 100644 --- a/iguana/exchanges/LP_remember.c +++ b/iguana/exchanges/LP_remember.c @@ -1441,3 +1441,40 @@ char *basilisk_swapentries(char *refbase,char *refrel,int32_t limit) return(jprint(retarray,1)); } +int32_t LP_pendingswap(uint32_t requestid,uint32_t quoteid) +{ + cJSON *retjson,*array,*pending,*item; uint32_t r,q; char *retstr; int32_t i,n,retval = 0; + if ( (retstr= LP_recent_swaps(1000)) != 0 ) + { + if ( (retjson= cJSON_Parse(retstr)) != 0 ) + { + if ( (array= jarray(&n,retjson,"swaps")) != 0 ) + { + for (i=0; iI.req.requestid),&swap->I.req.requestid); + datalen += iguana_rwnum(1,&data[datalen],sizeof(swap->I.req.quoteid),&swap->I.req.quoteid); data[datalen++] = swap->I.aliceconfirms; data[datalen++] = swap->I.bobconfirms; data[datalen++] = swap->I.alicemaxconfirms; @@ -196,14 +198,22 @@ int32_t LP_pubkeys_data(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen) data[datalen++] = swap->persistent_pubkey33[i]; for (i=0; ideck)/sizeof(swap->deck[0][0]); i++) datalen += iguana_rwnum(1,&data[datalen],sizeof(swap->deck[i>>1][i&1]),&swap->deck[i>>1][i&1]); + printf("send >>>>>>>>> r.%u q.%u datalen.%d\n",swap->I.req.requestid,swap->I.req.quoteid,datalen); return(datalen); } int32_t LP_pubkeys_verify(struct basilisk_swap *swap,uint8_t *data,int32_t datalen) { - int32_t i,nonz=0,alicemaxconfirms,bobmaxconfirms,aliceconfirms,bobconfirms,len = 0; uint8_t other33[33]; - if ( datalen == sizeof(swap->otherdeck)+38 ) + uint32_t requestid,quoteid; int32_t i,nonz=0,alicemaxconfirms,bobmaxconfirms,aliceconfirms,bobconfirms,len = 0; uint8_t other33[33]; + if ( datalen == sizeof(swap->otherdeck)+38+sizeof(uint32_t)*2 ) { + len += iguana_rwnum(0,&data[len],sizeof(requestid),&requestid); + len += iguana_rwnum(0,&data[len],sizeof(quoteid),"eid); + if ( requestid != swap->I.req.requestid || quoteid != swap->I.req.quoteid ) + { + printf("SWAP requestid.%u quoteid.%u mismatch received r.%u q.%u\n",swap->I.req.requestid,swap->I.req.quoteid,requestid,quoteid); + return(-1); + } aliceconfirms = data[len++]; bobconfirms = data[len++]; alicemaxconfirms = data[len++]; @@ -243,7 +253,7 @@ int32_t LP_pubkeys_verify(struct basilisk_swap *swap,uint8_t *data,int32_t datal len += iguana_rwnum(0,&data[len],sizeof(swap->otherdeck[i>>1][i&1]),&swap->otherdeck[i>>1][i&1]); return(0); } - printf("pubkeys verify size mismatch %d != %d\n",datalen,(int32_t)sizeof(swap->otherdeck)+36); + printf("pubkeys verify size mismatch %d != %d\n",datalen,(int32_t)(sizeof(swap->otherdeck)+38+sizeof(uint32_t)*2)); return(-1); } @@ -895,7 +905,7 @@ void LP_aliceloop(void *_swap) } basilisk_swap_finished(swap); printf("finish swap.%p\n",swap); - //free(swap); + free(swap); G.LP_pendingswaps--; } diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 6e49013b0..da6f97cc1 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -27,6 +27,73 @@ struct LP_inuse_info } LP_inuse[1024]; int32_t LP_numinuse; +struct cJSON_list +{ + struct cJSON_list *next,*prev; + cJSON *item; + uint32_t timestamp,cjsonid; +} *LP_cJSONlist; + +void cJSON_register(cJSON *item) +{ + struct cJSON_list *ptr; + ptr = calloc(1,sizeof(*ptr)); + ptr->timestamp = (uint32_t)time(NULL); + ptr->item = item; + item->cjsonid = rand(); + ptr->cjsonid = item->cjsonid; + portable_mutex_lock(&LP_cJSONmutex); + DL_APPEND(LP_cJSONlist,ptr); + portable_mutex_unlock(&LP_cJSONmutex); +} + +char *mbstr(char *str,double n); +void cJSON_unregister(cJSON *item) +{ + static uint32_t lasttime; + int32_t n; char *tmpstr; uint64_t total = 0; struct cJSON_list *ptr,*tmp; uint32_t now; + if ( (now= (uint32_t)time(NULL)) > lasttime+6 ) + { + n = 0; + DL_FOREACH_SAFE(LP_cJSONlist,ptr,tmp) + { + if ( ptr->item != 0 && ptr->item->child != 0 && ptr->cjsonid != 0 ) + { + if ( (tmpstr= jprint(ptr->item,0)) != 0 ) + { + total += strlen(tmpstr); + free(tmpstr); + } + } + n++; + } + printf("total %d cJSON pending\n",n); + lasttime = (uint32_t)time(NULL); + } + DL_FOREACH_SAFE(LP_cJSONlist,ptr,tmp) + { + if ( ptr->cjsonid == item->cjsonid ) + break; + else if ( now > ptr->timestamp+60 && item->cjsonid != 0 ) + { + portable_mutex_lock(&LP_cJSONmutex); + DL_DELETE(LP_cJSONlist,ptr); + portable_mutex_unlock(&LP_cJSONmutex); + printf("free expired\n"); + cJSON_Delete(ptr->item); + free(ptr); + } + ptr = 0; + } + if ( ptr != 0 ) + { + portable_mutex_lock(&LP_cJSONmutex); + DL_DELETE(LP_cJSONlist,ptr); + free(ptr); + portable_mutex_unlock(&LP_cJSONmutex); + } //else printf("cJSON_unregister of unknown %p %u\n",item,item->cjsonid); +} + struct LP_inuse_info *_LP_inuse_find(bits256 txid,int32_t vout) { int32_t i; diff --git a/iguana/exchanges/invreset b/iguana/exchanges/invreset index f0b1c79e3..0304c7503 100755 --- a/iguana/exchanges/invreset +++ b/iguana/exchanges/invreset @@ -1,3 +1,4 @@ +#!/bin/bash source userpass source passphrase curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"inventory\",\"coin\":\"KMD\",\"reset\":1,\"passphrase\":\"$passphrase\"}" diff --git a/iguana/exchanges/mm.c b/iguana/exchanges/mm.c index 1d2a1bd5e..f906390b8 100644 --- a/iguana/exchanges/mm.c +++ b/iguana/exchanges/mm.c @@ -19,11 +19,21 @@ // Copyright © 2017 SuperNET. All rights reserved. // +/* +#define malloc(n) LP_alloc(n) +#define calloc(a,b) LP_alloc((uint64_t)(a) * (b)) +#define free(ptr) LP_free(ptr)*/ + void PNACL_message(char *arg,...) { } #define FROM_MARKETMAKER + +#ifndef CJSON_GARBAGECOLLECTION +#define CJSON_GARBAGECOLLECTION +#endif + #include #include #ifndef NATIVE_WINDOWS diff --git a/iguana/m_mm b/iguana/m_mm index b5ba405ca..36a0acad1 100755 --- a/iguana/m_mm +++ b/iguana/m_mm @@ -1,3 +1,3 @@ cd secp256k1; ./m_unix; cd .. cd ../crypto777; ./m_LP; cd ../iguana -gcc -g -o marketmaker -I../crypto777 exchanges/mm.c mini-gmp.c secp256k1.o ../agents/libcrypto777.a -lnanomsg -lcurl -lpthread -lm +gcc -g -o marketmaker -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c secp256k1.o ../agents/libcrypto777.a -lnanomsg -lcurl -lpthread -lm diff --git a/includes/cJSON.h b/includes/cJSON.h index 77e0752e6..3ecdadc69 100755 --- a/includes/cJSON.h +++ b/includes/cJSON.h @@ -73,6 +73,7 @@ extern "C" double valuedouble; /* The item's number, if type==cJSON_Number */ char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */ + uint32_t cjsonid; } cJSON; typedef struct cJSON_Hooks { @@ -218,6 +219,8 @@ extern "C" char *nxt64str2(uint64_t nxt64bits); cJSON *addrs_jsonarray(uint64_t *addrs,int32_t num); int32_t myatoi(char *str,int32_t range); + void cJSON_register(cJSON *item); + void cJSON_unregister(cJSON *item); char *stringifyM(char *str); #define replace_backslashquotes unstringify diff --git a/marketmaker_build_32_64.cmd b/marketmaker_build_32_64.cmd new file mode 100644 index 000000000..bac8df5e0 --- /dev/null +++ b/marketmaker_build_32_64.cmd @@ -0,0 +1,47 @@ +@echo off + +@REM Check for Visual Studio +call set "VSPATH=" +if defined VS140COMNTOOLS ( if not defined VSPATH ( + call set "VSPATH=%%VS140COMNTOOLS%%" +) ) + +@REM check if we already have the tools in the environment +if exist "%VCINSTALLDIR%" ( + goto compile +) + +if not defined VSPATH ( + echo You need Microsoft Visual Studio 15 installed + pause + exit +) + +@REM set up the environment +if exist "%VSPATH%..\..\vc\vcvarsall.bat" ( + call "%%VSPATH%%..\..\vc\vcvarsall.bat" amd64 + goto compile +) + +echo Unable to set up the environment +pause +exit + +:compile +rem MSBuild /help +MSBuild marketmaker.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64 +MSBuild marketmaker.sln /t:Rebuild /p:Configuration=Release /p:Platform=x86 + +rem Using to add in marketmaker_release.7z +set host=%COMPUTERNAME% +IF "%host%"=="VM-81" ( + mkdir package_content\win32 + mkdir package_content\win64 + copy /y Release\marketmaker.exe package_content\win32 + copy /y x64\Release\marketmaker.exe package_content\win64 + cd package_content + "C:\Program Files\7-Zip\7z.exe" a C:\komodo\marketmaker_release\marketmaker_release.7z win32\marketmaker.exe + "C:\Program Files\7-Zip\7z.exe" a C:\komodo\marketmaker_release\marketmaker_release.7z win64\marketmaker.exe + cd .. + rd package_content /s /q + )