Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: macos build #55

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ build-release
CMakeLists.txt.user*

# RME
remeres
rme
rme.cfg
data/user
world

# Visual Studio
*.MAP
Expand Down
238 changes: 138 additions & 100 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,102 +1,140 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 22,
"patch": 0
},
"configurePresets": [
{
"name": "windows-release",
"displayName": "Windows - Release",
"description": "Sets Ninja generator, compilers, build and install directory and set build type as release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"VCPKG_TARGET_TRIPLET": "x64-windows-static",
"CMAKE_BUILD_TYPE": "Release",
"OPTIONS_ENABLE_SCCACHE": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "Windows" ]
}
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "linux-release",
"displayName": "Linux - Release",
"description": "Sets Ninja generator, compilers, build and install directory and set build type as release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"CMAKE_BUILD_TYPE": "Release",
"OPTIONS_ENABLE_CCACHE": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "windows-debug",
"inherits": "windows-release",
"displayName": "Windows - Debug",
"description": "Build Debug Mode",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"DEBUG_LOG": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
}
},
{
"name": "linux-debug",
"inherits": "linux-release",
"displayName": "Linux - Debug Build",
"description": "Build Debug Mode",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"DEBUG_LOG": "ON"
}
}
],
"buildPresets": [
{
"name": "linux-release",
"configurePreset": "linux-release"
},
{
"name": "linux-debug",
"configurePreset": "linux-debug"
},
{
"name": "windows-release",
"configurePreset": "windows-release"
},
{
"name": "windows-Xdebug",
"configurePreset": "windows-debug"
}
]
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 22,
"patch": 0
},
"configurePresets": [
{
"name": "windows-release",
"displayName": "Windows - Release",
"description": "Sets Ninja generator, compilers, build and install directory and set build type as release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"VCPKG_TARGET_TRIPLET": "x64-windows-static",
"CMAKE_BUILD_TYPE": "Release",
"OPTIONS_ENABLE_SCCACHE": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": ["Windows"]
}
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "linux-release",
"displayName": "Linux - Release",
"description": "Sets Ninja generator, compilers, build and install directory and set build type as release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"CMAKE_BUILD_TYPE": "Release",
"OPTIONS_ENABLE_CCACHE": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "macos-release",
"displayName": "macOS - Release",
"description": "Sets Ninja generator, compilers, build and install directory and set build type as release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"CMAKE_BUILD_TYPE": "Release",
"OPTIONS_ENABLE_CCACHE": "ON"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "windows-debug",
"inherits": "windows-release",
"displayName": "Windows - Debug",
"description": "Build Debug Mode",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"DEBUG_LOG": "ON"
},
"architecture": {
"value": "x64",
"strategy": "external"
}
},
{
"name": "linux-debug",
"inherits": "linux-release",
"displayName": "Linux - Debug Build",
"description": "Build Debug Mode",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"DEBUG_LOG": "ON"
}
},
{
"name": "macos-debug",
"inherits": "macos-release",
"displayName": "macOS - Debug Build",
"description": "Build Debug Mode",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"DEBUG_LOG": "ON"
}
}
],
"buildPresets": [
{
"name": "linux-release",
"configurePreset": "linux-release"
},
{
"name": "linux-debug",
"configurePreset": "linux-debug"
},
{
"name": "windows-release",
"configurePreset": "windows-release"
},
{
"name": "windows-Xdebug",
"configurePreset": "windows-debug"
},
{
"name": "macos-release",
"configurePreset": "macos-release"
},
{
"name": "macos-debug",
"configurePreset": "macos-debug"
}
]
}
18 changes: 9 additions & 9 deletions source/complexitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ class Container : public Item {
size_t getVolume() const noexcept {
return getItemType().volume;
}
double getWeight() noexcept {
double getWeight() noexcept override {
return getItemType().weight;
}

virtual bool unserializeItemNode_OTBM(const IOMap &maphandle, BinaryNode* node);
virtual bool serializeItemNode_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const;
virtual bool unserializeItemNode_OTBM(const IOMap &maphandle, BinaryNode* node) override;
virtual bool serializeItemNode_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const override;
// virtual bool unserializeItemNode_OTMM(const IOMap& maphandle, BinaryNode* node);
// virtual bool serializeItemNode_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const;

Expand All @@ -74,8 +74,8 @@ class Teleport : public Item {
return this;
}

virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const;
virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node);
virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const override;
virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node) override;
// virtual void serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const;
// virtual bool readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* node);

Expand Down Expand Up @@ -118,8 +118,8 @@ class Door : public Item {
doorId = id;
}

virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const;
virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node);
virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const override;
virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node) override;
// virtual void serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const;
// virtual bool readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* node);

Expand All @@ -143,8 +143,8 @@ class Depot : public Item {
depotId = id;
}

virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const;
virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node);
virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const override;
virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node) override;
// virtual void serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const;
// virtual bool readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* node);

Expand Down
1 change: 1 addition & 0 deletions source/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct SpriteLight {
class Sprite {
public:
Sprite() { }
virtual ~Sprite() { }

virtual void DrawTo(wxDC* dc, SpriteSize sz, int start_x, int start_y, int width = -1, int height = -1) = 0;
virtual void unloadDC() = 0;
Expand Down
6 changes: 3 additions & 3 deletions source/map_drawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

#include "main.h"

#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#if defined(__LINUX__) || defined(__WINDOWS__)
#include <GL/glut.h>
#endif

Expand Down Expand Up @@ -1788,6 +1786,7 @@ void MapDrawer::DrawPositionIndicator(int z) {
}

void MapDrawer::DrawTooltips() {
#if defined(__LINUX__) || defined(__WINDOWS__)
if (!options.show_tooltips || tooltips.empty()) {
return;
}
Expand Down Expand Up @@ -1898,6 +1897,7 @@ void MapDrawer::DrawTooltips() {
}

glEnable(GL_TEXTURE_2D);
#endif
}

void MapDrawer::MakeTooltip(int screenx, int screeny, const std::string &text, uint8_t r, uint8_t g, uint8_t b) {
Expand Down
2 changes: 1 addition & 1 deletion source/npcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ bool NpcDatabase::importXMLFromOT(const FileName &filename, wxString &error, wxA
}

pugi::xml_node node;
if (node = doc.child("npc")) {
if ((node = doc.child("npc"))) {
NpcType* npcType = NpcType::loadFromOTXML(filename, doc, warnings);
if (npcType) {
NpcType* current = (*this)[npcType->name];
Expand Down
Loading