mirror of
https://github.com/arabine/open-story-teller.git
synced 2025-12-06 17:09:06 +01:00
Add MacOS bundle generation (WIP) + Macos build fixes
This commit is contained in:
parent
d290affe17
commit
7c9f56cd3b
10 changed files with 115 additions and 7 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -69,3 +69,11 @@ docs/.vitepress/cache/
|
|||
docs/.vitepress/dist/
|
||||
|
||||
software/.cache/
|
||||
|
||||
.DS_Store
|
||||
|
||||
story-editor/.idea/
|
||||
|
||||
story-editor/buildxcode/
|
||||
|
||||
story-editor/cmake-build-debug/
|
||||
|
|
|
|||
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
|
|
@ -14,7 +14,15 @@
|
|||
"cwd": "${workspaceFolder}/story-editor",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"linux": {
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "/usr/bin/gdb"
|
||||
},
|
||||
"osx": {
|
||||
"MIMode": "lldb",
|
||||
"miDebuggerPath": "/Users/user936511/.vscode/extensions/ms-vscode.cpptools-1.18.5-darwin-arm64/debugAdapters/lldb-mi/bin/lldb-mi"
|
||||
},
|
||||
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
|
|
|
|||
|
|
@ -203,6 +203,27 @@ target_include_directories(${STORY_EDITOR_PROJECT} PUBLIC
|
|||
add_definitions(-DIMGUI_USE_WCHAR32 -DVERSION_MAJOR=${PROJECT_VERSION_MAJOR} -DVERSION_MINOR=${PROJECT_VERSION_MINOR} -DVERSION_PATCH=${PROJECT_VERSION_PATCH})
|
||||
add_link_options(-static-libgcc -static-libstdc++)
|
||||
|
||||
if (APPLE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
LINK_FLAGS "-Wl,-rpath,@executable_path"
|
||||
MACOSX_RPATH TRUE
|
||||
SKIP_BUILD_RPATH FALSE
|
||||
BUILD_WITH_INSTALL_RPATH TRUE
|
||||
INSTALL_RPATH_USE_LINK_PATH TRUE
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
BUNDLE True
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER eu.d8s.OpenStoryTeller.StoryEditor.${CUR_TARGET}
|
||||
MACOSX_BUNDLE_BUNDLE_NAME ${CUR_TARGET}
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION "0.1"
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.1"
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/bundle.plist.in
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${STORY_EDITOR_PROJECT} PUBLIC cimg_display=0)
|
||||
|
||||
target_compile_definitions(${STORY_EDITOR_PROJECT} PUBLIC "$<$<CONFIG:DEBUG>:DEBUG>")
|
||||
|
|
@ -255,4 +276,8 @@ if(WIN32)
|
|||
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/story-editor-logo.ico")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
install_files("." FILES "${SDL2_BIN_DIR}/libSDL2-2.0.0.dylib")
|
||||
endif()
|
||||
|
||||
include(CPack)
|
||||
|
|
|
|||
34
story-editor/bundle.plist.in
Normal file
34
story-editor/bundle.plist.in
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -8,7 +8,7 @@ your use of the corresponding standard functions.
|
|||
#include "gui.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "imgui_impl_sdl2.h"
|
||||
#include "imgui_impl_sdlrenderer2.h"
|
||||
|
|
@ -24,6 +24,9 @@ your use of the corresponding standard functions.
|
|||
#include "IconsFontAwesome5_c.h"
|
||||
#include "qoi.h"
|
||||
|
||||
|
||||
#include "platform_folders.h"
|
||||
|
||||
static void glfw_error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "GLFW Error %d: %s\n", error, description);
|
||||
|
|
@ -110,9 +113,16 @@ bool LoadTextureFromFile(const char* filename, Gui::Image &img)
|
|||
|
||||
#define MANOLAB_VERSION "1.0"
|
||||
|
||||
std::string GetDirectory (const std::string& path)
|
||||
{
|
||||
size_t found = path.find_last_of("/\\");
|
||||
return(path.substr(0, found));
|
||||
}
|
||||
|
||||
Gui::Gui()
|
||||
{
|
||||
|
||||
m_executablePath = GetDirectory(pf::getExecutablePath());
|
||||
std::cout << "PATH: " << m_executablePath << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -161,7 +171,7 @@ bool Gui::Initialize()
|
|||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||
|
||||
|
||||
io.Fonts->AddFontFromFileTTF( "fonts/roboto.ttf", 20);
|
||||
io.Fonts->AddFontFromFileTTF( std::string(m_executablePath + "/fonts/roboto.ttf").c_str(), 20);
|
||||
|
||||
{
|
||||
ImFontConfig config;
|
||||
|
|
@ -169,7 +179,7 @@ bool Gui::Initialize()
|
|||
// config.GlyphMinAdvanceX = 20.0f; // Use if you want to make the icon monospaced
|
||||
// config.GlyphOffset.y += 1.0;
|
||||
static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
|
||||
io.Fonts->AddFontFromFileTTF("fonts/fa-solid-900.ttf", 16.0f, &config, icon_ranges);
|
||||
io.Fonts->AddFontFromFileTTF(std::string(m_executablePath + "/fonts/fa-solid-900.ttf").c_str(), 16.0f, &config, icon_ranges);
|
||||
|
||||
io.Fonts->Build();
|
||||
}
|
||||
|
|
@ -179,7 +189,7 @@ bool Gui::Initialize()
|
|||
config.MergeMode = true; // ATTENTION, MERGE AVEC LA FONT PRECEDENTE !!
|
||||
|
||||
static const ImWchar icon_ranges_mdi[] = { ICON_MIN_MDI, ICON_MAX_MDI, 0 };
|
||||
io.Fonts->AddFontFromFileTTF("fonts/materialdesignicons-webfont.ttf", 16.0f, &config, icon_ranges_mdi);
|
||||
io.Fonts->AddFontFromFileTTF(std::string(m_executablePath + "/fonts/materialdesignicons-webfont.ttf").c_str(), 16.0f, &config, icon_ranges_mdi);
|
||||
|
||||
io.Fonts->Build();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public:
|
|||
static Size GetWindowSize();
|
||||
|
||||
private:
|
||||
|
||||
std::string m_executablePath;
|
||||
};
|
||||
|
||||
namespace ImGui {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
#include <sstream>
|
||||
#include "media_node.h"
|
||||
|
||||
namespace ed = ax::NodeEditor;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <iostream>
|
||||
#include <cstdint>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include "IconsFontAwesome5_c.h"
|
||||
|
||||
#include "media_node.h"
|
||||
|
|
|
|||
|
|
@ -164,6 +164,24 @@ static std::string GetAppDataLocal()
|
|||
return GetKnownWindowsFolder(FOLDERID_LocalAppData, "LocalAppData could not be found");
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
|
||||
#include <mach-o/dyld.h>
|
||||
#include <limits.h>
|
||||
|
||||
namespace pf {
|
||||
std::string getExecutablePath()
|
||||
{
|
||||
std::string path;
|
||||
char buf [PATH_MAX];
|
||||
uint32_t bufsize = PATH_MAX;
|
||||
if(!_NSGetExecutablePath(buf, &bufsize))
|
||||
path.assign(buf);
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ std::string win32_utf16_to_utf8(const wchar_t* wstr);
|
|||
std::string getDataHome();
|
||||
|
||||
|
||||
std::string getExecutablePath();
|
||||
|
||||
std::string getUserHome();
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue