From 83c048d1295b9df59d90a7513953c99a267eb1f5 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joel.grunbaum@imc.com>
Date: Tue, 11 Jan 2022 07:26:39 +0000
Subject: [PATCH] CYA Cmake, compiling on remote box

---
 /dev/null    |   26 --------------------------
 .gitignore   |    3 ++-
 Makefile     |   26 ++++++++++++++++++++++++++
 protocol.cpp |    2 +-
 click        |    0 
 5 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8c4231d..caa630c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,5 @@
 bid
 ask
 oneshot
-build
\ No newline at end of file
+build
+test
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index d607e47..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-cmake_minimum_required(VERSION 3.10)
-
-project(bomex)
-
-set(CMAKE_CXX_STANDARD 20)
-set(CMAKE_CXX_STANDARD_REQUIRED True)
-
-add_compile_options(-g -Wall)
-
-add_subdirectory(date)
-# add_subdirectory(rapidjson)
-
-add_library(WS easywsclient/easywsclient.cpp)
-
-add_library(JSON json.cpp)
-
-add_library(MAIN date protocol.cpp book.cpp)
-target_link_libraries(MAIN PUBLIC JSON WS)
-
-add_executable(test test.cpp strat.cpp)
-add_executable(bot bot.cpp strat.cpp)
-add_executable(click click.cpp)
-
-target_link_libraries(test PUBLIC MAIN)
-target_link_libraries(bot PUBLIC MAIN)
-target_link_libraries(click PUBLIC MAIN)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bcc17bc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+CXX=g++
+CXXFLAGS=-g -Wall -static
+#LDFLAGS=-rpath=/lib64/libstdc++.so.6
+
+
+json=json.o
+ws=easywsclient/easywsclient.o
+main=${json} ${ws} protocol.o book.o
+
+default: test click bot
+
+test: test.o strat.o ${main}
+	${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ $^
+
+click: click.o ${main}
+	${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ $^
+
+bot: bot.o strat.o ${main}
+	${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ $^
+
+%.o: %.cpp
+	${CXX} ${CXXFLAGS} -c -o $@ $^
+
+.PHONY: clean
+clean:
+	rm -f ${main} test click bot
diff --git a/click b/click
new file mode 100755
index 0000000..9b621ad
--- /dev/null
+++ b/click
Binary files differ
diff --git a/protocol.cpp b/protocol.cpp
index e21a2df..0396038 100644
--- a/protocol.cpp
+++ b/protocol.cpp
@@ -170,7 +170,7 @@
 void tradeOrder(std::unordered_map<std::string, book::Book>& bs,
                 json::TradeMessage* message)
 {
-	if (bs.contains(message->passiveOrder)) {
+	if (bs.find(message->passiveOrder) != bs.end()) {
 		if (message->tradeType == json::BUY_AGGRESSOR) {
 			if (message->passiveOrderRemaining > 0) {
 				bs[message->product].askSide.at(message->passiveOrder).volume =

--
Gitblit v1.9.3