Skip to content

Commit

Permalink
fix building stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
TechStudent10 committed Sep 27, 2024
1 parent 0c7cbbd commit 70b925a
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 84 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ext/cereal"]
path = ext/cereal
url = https://github.com/USCiLab/cereal
51 changes: 1 addition & 50 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,62 +23,13 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_compile_definitions(WIN32_LEAN_AND_MEAN=1)
endif()

CPMAddPackage("gh:socketio/socket.io-client-cpp#0dc2f7a")

# CPMAddPackage(
# NAME Boost
# VERSION 1.84.0
# URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
# URL_HASH SHA256=2e64e5d79a738d0fa6fb546c6e5c2bd28f88d268a2a080546f74e5ff98f29d0e
# OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_INCLUDE_LIBRARIES describe" # escape with \\\;
# )
# find_package(Boost REQUIRED COMPONENTS filesystem system thread regex)

# CPMAddPackage("gh:zaphoyd/websocketpp#1b11fd3")

# target_include_directories(${PROJECT_NAME} PRIVATE ${websocketpp_SOURCE_DIR})


# Add ZLIB
# set(ZLIB_REPO "https://github.com/madler/zlib.git"
# CACHE STRING "ZLIB repository location."
# )
# CPMAddPackage(
# NAME zlib
# GIT_REPOSITORY ${ZLIB_REPO}
# GIT_TAG "v1.2.13"
# OPTIONS
# "CMAKE_POSITION_INDEPENDENT_CODE True"
# )
# if(zlib_ADDED)
# target_include_directories(zlib
# PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}>
# PUBLIC $<INSTALL_INTERFACE:include>)
# target_include_directories(zlibstatic
# PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}>
# PUBLIC $<INSTALL_INTERFACE:include>)

# set(ZLIB_LIBRARY ${zlib_BINARY_DIR})
# set(ZLIB_INCLUDE_DIR ${zlib_SOURCE_DIR})
# message(STATUS "Cmake added local zlib: ${zlib_SOURCE_DIR}")
# else()
# message(FATAL_ERROR "Cmake failed to add local zlib")
# endif()

# set(ZLIB_LIBRARY "${CMAKE_SOURCE_DIR}/ext/zlib")
# set(ZLIB_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/ext/zlib")
# set(RENAME_ZCONF OFF)

set(USE_ZLIB OFF)

CPMAddPackage("gh:machinezone/IXWebSocket#9884c32")

target_include_directories(${PROJECT_NAME} PRIVATE ${ixwebsocket_SOURCE_DIR})
# target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/ext/zlib")
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/ext/cereal/include")

# add_subdirectory("ext/zlib")

target_link_libraries(${PROJECT_NAME} ixwebsocket sioclient)
target_link_libraries(${PROJECT_NAME} ixwebsocket)

setup_geode_mod(${PROJECT_NAME})
1 change: 0 additions & 1 deletion ext/zlib
Submodule zlib deleted from d47682
1 change: 0 additions & 1 deletion src/managers/SwapManager.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include <Geode/Geode.hpp>
#include <sio_client.h>

#include <types/lobby.hpp>

Expand Down
28 changes: 0 additions & 28 deletions src/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,5 @@
#include "utils.hpp"

std::vector<Account> cr::utils::getAccountsFromMsgVector(std::vector<sio::message::ptr> vec) {
std::vector<Account> accounts;
for (auto _msg : vec) {
auto msg = _msg->get_map();
#define GETKEY(key) msg.at(key)->get_string()
Account acc = {
.name = GETKEY("name"),
.userID = GETKEY("userID"),
.iconID = GETKEY("iconID"),
.color1 = GETKEY("color1"),
.color2 = GETKEY("color2"),
.color3 = GETKEY("color3")
};
accounts.push_back(acc);
}
return accounts;
}

LobbySettings cr::utils::getSettingsFromMsgMap(std::map<std::string, sio::message::ptr> settingsMap) {
LobbySettings settings;

settings.name = settingsMap["name"]->get_string();
settings.turns = settingsMap["turns"]->get_int();
settings.owner = settingsMap["owner"]->get_int();

return settings;
}

void cr::utils::goToScene(CCScene *scene) {
CCDirector::sharedDirector()->pushScene(CCTransitionFade::create(0.5f, scene));
}
Expand Down
4 changes: 0 additions & 4 deletions src/utils.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#pragma once
#include <Geode/Geode.hpp>
#include <types/lobby.hpp>
#include <sio_client.h>

using namespace geode::prelude;

namespace cr::utils {
std::vector<Account> getAccountsFromMsgVector(std::vector<sio::message::ptr> msgVector);
LobbySettings getSettingsFromMsgMap(std::map<std::string, sio::message::ptr> msgMap);

void goToScene(CCScene* scene);
void replaceScene(CCScene* scene);
void popScene();
Expand Down

0 comments on commit 70b925a

Please sign in to comment.