Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Getting Started

Ahmed Castro edited this page Sep 30, 2017 · 38 revisions

This page explains how to setup mod.works SDK into your game. Visual C++ and MinGW are supported for Windows, GCC for Linux and Clang for OS X.

Step 1: Download the SDK

Download the latest version of the SDK from the github releases page or from the mod.works website, it provides all the files needed to integrate mod.works into your game or modding tool.

Step 2: Link the Libraries

Windows Visual C++

Link the provided import library modworks.lib and place all the provided DLL files next to your executable. The import library is located at lib/visualc++/ and the DLLs at bin/visualc++/.

Windows MinGW

Link the provided import library modworks.a and place all the provided DLL files next to your executable. The import library is located at lib/mingw/ and the DLLs at bin/mingw/.

Note: Mod.works is compiled using C++11 so you will need to add the -std=c++11 compiler flag.

Linux GCC

mod.works SDK uses LibCurl, Zlib, Minizip and Pthread. Usually, they are already present on your Linux distribution. If it's not the case, install them using your package manager:

apt-get install libcurl4-openssl-dev zlib1g-dev libpthread-stubs0-dev

Link the the provided shared library modworks.so located in the lib/linux/ directory.

Note: Mod.works SDK is built using C++11 so you will need to add the -std=c++11 compiler flag.

OS X

Install Clang shipped with the XCode build essentials. This will install all mod.works SDK dependencies so no additional setup is required.

Link the the provided shared library modworks.dylib located in the lib/osx/ directory.

Note: Mod.works SDK is built using C++11 so you will need to add the -std=c++11 compiler flag.

Step 3: Include the Headers

Add the provided include/ directory to your compiler's include path.

Step 4: Initialize mod.works SDK

That's it! You should be able to use the mod.works SDK on your project.

#include <ModworksSDK.h>
int main()
{
  modworks::init(/*your game id*/7, "YOUR-API-KEY");
  return 0;
}

Compliation Examples

The following are complete Makefile examples that shows how to link and import mod.works SDK into your project.

Visual C++

#Makefile
#run with the 'nmake' command

CC = cl.exe
CFLAGS = /EHsc /MD
SOURCES = Example.cpp
LIBRARIES = modworks.lib

build:
 $(CC) $(CFLAGS) $(SOURCES) /I ModworksSDK/include /link $(LIBRARIES) /SUBSYSTEM:CONSOLE

MinGW

#Makefile
#run with the 'MinGW32-make.exe' command

CC=g++
CFLAGS=-c -Wall -std=c++11
SOURCES=Example.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=Example
LIBRARIES=modworks.a

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(OBJECTS) $(LIBRARIES) -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@ -I ModworksSDK/include

GCC

#Makefile
#run with the 'make' command

CC=g++
CFLAGS=-c -Wall -std=c++11
LDFLAGS=-lcurl -pthread -lz
SOURCES=Example.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=Example
LIBRARIES=modworks.so

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) $(LIBRARIES) -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@ -I ModworksSDK/include

Clang

#Makefile
#run with the 'make' command

CC=clang++
CFLAGS=-c -Wall -std=c++11
LDFLAGS=-lcurl -lz
SOURCES=Example.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=Example
LIBRARIES=modworks.dylib

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) $(LIBRARIES) -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@ -I ../include

Contents

Clone this wiki locally