s2client-api icon indicating copy to clipboard operation
s2client-api copied to clipboard

Precompiled libs outdated

Open RaphaelRoyerRivard opened this issue 6 years ago • 8 comments

HI, I want to use the Connect() method of the Coordinator class but it does not exist in the version of the precompiled libs. Could it be updated please?

Thanks

RaphaelRoyerRivard avatar Mar 13 '18 14:03 RaphaelRoyerRivard

A much better option is to add s2client-api as a submodule of your project.

Considering you have a src folder in your project, you'll need a CMakeLists.txt file like this in your project root folder:

cmake_minimum_required(VERSION 3.1)

project(your_binary_name)

# Specify output directories.
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

# Build with c++14 support, required by sc2api.
set(CMAKE_CXX_STANDARD 14)

# Allow creating filters for projects in visual studio.
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# Disable building of examples in the sc2api submodule.
set(BUILD_API_EXAMPLES OFF CACHE INTERNAL "" FORCE)

# Disable building of tests in the sc2api submodule.
set(BUILD_API_TESTS OFF CACHE INTERNAL "" FORCE)

add_subdirectory("s2client-api")
add_subdirectory("src")

Now, install Visual Community and cmake. Then, do the following steps:

cd <path-to-your-project>
git submodule add https://github.com/Blizzard/s2client-api.git s2client-api
git submodule update --init --recursive
mkdir build 
cd build
cmake ../ -G "Visual Studio 15 2017 Win64"
start your_solution.sln

If you're not sure how to do that, check out @alkurbatov's project: https://github.com/alkurbatov/suvorov-bot

herodrigues avatar Apr 11 '18 13:04 herodrigues

@RaphaelRoyerRivard were you able to do the steps above?

herodrigues avatar Apr 17 '18 18:04 herodrigues

Sorry, I did not try to follow these steps since I compiled the lib myself a few hours after posting this issue. I just think people that want to use the lib should be forced to compile it themselves (the precompiled version is starting to be outdated). As I recall, it was not trivial to do so but I managed.

RaphaelRoyerRivard avatar Apr 17 '18 19:04 RaphaelRoyerRivard

It was not trivial for me too. I think that's can be included in the docs.

herodrigues avatar Apr 17 '18 19:04 herodrigues

The building instructions are in the docs: docs/building.md.

Archiatrus avatar Apr 17 '18 20:04 Archiatrus

@Archiatrus

TL;DR: One cmake command to build s2client-api + personal project (bot)

I was talking about integrating the API into a personal project that uses s2client-api as a dependency. This way it's possible to add s2client-api as a git submodule and compile both the API and a personal project (bot).

Also, the developer can use the latest API modifications without needing to compile it in a separate way each time a new PR is merged.

herodrigues avatar Apr 17 '18 20:04 herodrigues

Yeah, I should do that for my CommandCenter project, but I guess I'll do it only the next time I need new changes.

RaphaelRoyerRivard avatar Apr 17 '18 20:04 RaphaelRoyerRivard

I believe the best solution would be to fully move CommandCenter to cmake (currently it uses cmake for linux+osx and presaved visual studio solution) and s2client-api as a submodule. Since CommandCenter is usually the default ‘starting’ bot that will help much more then any documentation anywhere. Also we can throw out all these complex instructions regarding installation process :)

alkurbatov avatar Apr 17 '18 20:04 alkurbatov