First you will need to download the repository and unpack it into a project folder. After that you will need to download and unpack the Steamworks SDK and copy the following into your unpacked repo folder:
- Steam header (steam) folder from the /sdk/public folder
- Steam API lib file from the /sdk/redistributable_bin folder
Depending on your operating system, you will need to acquire different files from /sdk/redistributable_bin and follow a different set of instructions. We will address each below.
Linux
Look in either the linux32 or linux64 folder, depending on your installation, and copy the libsteam_api.so over to your project folder.
At this point you can either run the makefile that is included in the repository or you can just run the following in terminal:
g++ -std=c++11 -o SteamworksPy.so -shared -fPIC SteamworksPy.cpp -l steam_api -L.
This should result in the SteamworksPy.so file you need to use with the module.
Windows
Look in either the base of the /sdk/redistributable_bin or the win64 folder, depending on your installation, and copy the steam_api.dll and steam_api.lib or the steam_api64.dll and steam_api64.lib files to your project folder.
If you have Native Tools Command Prompt installed for Visual Studio (or compiling tools for console), then you can use these handy commands to compile your DLL file. For 64-bit use:
cl /D_USRDLL /D_WINDLL SteamworksPy.cpp steam_api64.lib /link /DLL /OUT:SteamworksPy64.dll
If you are using 32-bit then use:
cl /D_USRDLL /D_WINDLL SteamworksPy.cpp steam_api.lib /link /DLL /OUT:SteamworksPy.dll
Alternatively you can create a new project in Visual Studio to create the DLL file using these steps:
- Create a new DLL project in Visual Studio.
- New > Project.
- Templates > Visual C++ > Win32 > Win32 Project.
- Follow the wizard and pick the DLL Application Type.
- Add SteamworksPy.cpp to Source Files and steam_api.h from /steam/ folder to Header Files.
- Go to Project > Properties in the toolbar.
- Under C/C++ > Precompiled Headers, turn off Precompiled Header option.
- Under Linker > Input, add steam_api.lib or steam_api64.lib to Additional Dependenices.
- You may also want to add _CRT_SECURE_NO_WARNINGS under C/C++ > Preprocessor > Preprocessor Definitions.
- Clean and build.
This will proce the SteamworksPy.dll somewhere deep in your Visual Studio output folders.
MacOS
Follow these steps to create your SteamworksPy.dylib file:
- Create a new library project in Xcode.
- New > Project > Library
- When configuring options, set Framework to "None (Plain C/C++ Library)" and Type to "Dynamic".
- Move libsteam_api.dylib to the project directory created by Xcode.
- In the Build Phases tab:
- Add SteamworksPy.cpp to Compile Sources.
- Add steam_api.h from /steam/ folder to the public section of Headers.
- Add libsteam_api.dylib to Link Binary with Libraries.
- Build.
- Find the resultant library and rename it SteamworksPy.dylib.