actorid
Nicolay Korslund 14 years ago
commit 2ec96ed7de

2
.gitignore vendored

@ -9,7 +9,7 @@ Makefile
cmake*.cmake
Ogre.log
ogre.cfg
build
build*
plugins.cfg
openmw.cfg
Doxygen

@ -231,6 +231,16 @@ endif (CMAKE_COMPILER_IS_GNUCC)
# Main executable
add_executable(openmw
${BSA} ${BSA_HEADER}
${TOOLS} ${TOOLS_HEADER}
${OGRE} ${OGRE_HEADER}
${INPUT} ${INPUT_HEADER}
${NIF} ${NIF_HEADER}
${NIFOGRE} ${NIFOGRE_HEADER}
${MANGLE_VFS}
${GAME}
${ESM_STORE} ${ESM_STORE_HEADER}
${GAMEREND} ${GAMEREND_HEADER}
MACOSX_BUNDLE
${COMPONENTS} ${COMPONENTS_HEADER}
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
@ -255,17 +265,29 @@ add_subdirectory( apps/clientconsole )
# Apple bundling
if (APPLE)
set_source_files_properties(
${CMAKE_SOURCE_DIR}/files/openmw.cfg
${CMAKE_SOURCE_DIR}/files/mac/plugins.cfg
PROPERTIES
MACOSX_PACKAGE_LOCATION MacOS
)
set_target_properties(
openmw
PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "OpenMW"
)
set(MISC_FILES
${CMAKE_SOURCE_DIR}/files/openmw.cfg
${CMAKE_SOURCE_DIR}/files/mac/plugins.cfg
${CMAKE_SOURCE_DIR}/files/mac/ogre.cfg)
install(TARGETS openmw
BUNDLE DESTINATION .
RUNTIME DESTINATION ../MacOS
COMPONENT Runtime)
install(FILES ${MISC_FILES} DESTINATION ../MacOS)
set(CPACK_GENERATOR "Bundle")
set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/files/mac/Info.plist")
set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw.icns")
set(CPACK_BUNDLE_NAME "OpenMW")
set(CPACK_PACKAGE_VERSION "0.07")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "07")
set(CPACK_PACKAGE_VERSION_PATCH "")
include(CPack)
set(CMAKE_EXE_LINKER_FLAGS "-arch i386")
set(CMAKE_CXX_FLAGS "-arch i386")
endif (APPLE)
# Tools

@ -5,6 +5,7 @@
#include <boost/program_options.hpp>
#include "tools/fileops.hpp"
#include "engine.hpp"
using namespace std;
@ -37,10 +38,17 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
bpo::variables_map variables;
std::ifstream configFile ("openmw.cfg");
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
std::string configFilePath(macBundlePath() + "/Contents/MacOS/openmw.cfg");
std::ifstream configFile (configFilePath.c_str());
#else
std::ifstream configFile ("openmw.cfg");
#endif
bpo::store ( bpo::parse_command_line (argc, argv, desc), variables );
bpo::notify (variables);
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv).options(desc).allow_unregistered().run();
bpo::store(valid_opts, variables);
bpo::notify(variables);
if (configFile.is_open())
bpo::store ( bpo::parse_config_file (configFile, desc), variables);

@ -1,8 +1,34 @@
#include "fileops.hpp"
#include <boost/filesystem.hpp>
#include <string>
bool isFile(const char *name)
{
boost::filesystem::path cfg_file_path(name);
return boost::filesystem::exists(cfg_file_path);
}
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
#include <CoreFoundation/CoreFoundation.h>
std::string macBundlePath()
{
char path[1024];
CFBundleRef mainBundle = CFBundleGetMainBundle();
assert(mainBundle);
CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
assert(mainBundleURL);
CFStringRef cfStringRef = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
assert(cfStringRef);
CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
CFRelease(mainBundleURL);
CFRelease(cfStringRef);
return std::string(path);
}
#endif

@ -1,7 +1,13 @@
#ifndef __FILEOPS_H_
#define __FILEOPS_H_
#include <string>
/// Check if a given path is an existing file (not a directory)
bool isFile(const char *name);
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
std::string macBundlePath();
#endif
#endif

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIconFile</key>
<string>OpenMW.icns</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>openmw</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>OpenMW</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.07</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
</dict>
</plist>

Binary file not shown.
Loading…
Cancel
Save