frmUpdate.cpp
frmUpdate.h)
-if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+if(APPLE)
list(APPEND FILE_LIST frmEditAccount.mm
- frmNewAccount.mm)
+ frmNewAccount.mm
+ frmMain.mm
+ os/osx/XestiaAddressBook.icns)
endif()
-if (MSVC)
- list(APPEND FILE_LIST os/msw/xestiaab.rc)
- add_executable(xestiaab WIN32
- ${FILE_LIST})
-else()
- add_executable(xestiaab
- ${FILE_LIST})
-endif()
-
-
-message("${RUNTIME_OUTPUT_NAME_bitmapcode}")
-
-target_include_directories(xestiaab
- PUBLIC
- ".")
-
-add_dependencies(xestiaab bitmapcode)
-
list(APPEND LIBRARIES ${wxWidgets_LIBRARIES}
${LIBXML2_LIBRARY}
sfml-audio
crypt32)
endif()
-target_link_libraries(xestiaab
- LINK_PUBLIC
- ${LIBRARIES}
-)
+if (MSVC)
+ list(APPEND FILE_LIST os/msw/xestiaab.rc)
+ add_executable(xestiaab WIN32
+ ${FILE_LIST})
+elseif(APPLE)
+ # Main icons
+ set_source_files_properties(os/osx/XestiaAddressBook.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
+ set(MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/os/osx/Info.plist")
+ set(CMAKE_BUILD_PATH_USE_ORIGIN TRUE)
+ set(APPS "\${CMAKE_INSTALL_PREFIX}/xestiaab.app")
+ set(DIR ${CMAKE_BINARY_DIR})
+
+ install(CODE "include(BundleUtilities)
+ fixup_bundle(\"${APPS}\" \"\" \"\")")
+
+ # Documentation
+ file(GLOB DocumentationFiles ${CMAKE_SOURCE_DIR}/../docs/*.fodt)
+ set_source_files_properties(${DocumentationFiles}
+ PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+
+ add_executable(xestiaab MACOSX_BUNDLE
+ ${FILE_LIST}
+ ${DocumentationFiles}
+ ${FrameworkFiles})
+
+ install(TARGETS xestiaab
+ BUNDLE DESTINATION . COMPONENT Runtime
+ RUNTIME DESTINATION bin COMPONENT Runtime)
+
+ target_link_libraries(xestiaab LINK_PUBLIC
+ stdc++
+ objc
+ ${COREFOUNDATION_FRAMEWORK}
+ ${SECURITY_FRAMEWORK}
+ ${SECURITYINTERFACE_FRAMEWORK}
+ ${LIBRARIES})
+
+ set_target_properties(xestiaab PROPERTIES
+ MACOSX_BUNDLE TRUE
+ MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/os/osx/Info.plist)
+
+ add_custom_command(
+ TARGET xestiaab
+ COMMAND ${CMAKE_COMMAND} -D SRC=$<TARGET_BUNDLE_DIR:xestiaab>/Contents/MacOS/xestiaab
+ -D DST=$<TARGET_BUNDLE_DIR:xestiaab>/Contents/Frameworks
+ -D SFML_FRAMEWORKS_LOCATION=${SFML_FRAMEWORKS_LOCATION}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/CMakeFunctions/CopyLibraries.cmake
+ POST_BUILD
+ )
+else()
+ add_executable(xestiaab
+ ${FILE_LIST})
+endif()
+
+
+message("${RUNTIME_OUTPUT_NAME_bitmapcode}")
+
+target_include_directories(xestiaab
+ PUBLIC
+ ".")
+
+add_dependencies(xestiaab bitmapcode)
file(GLOB DOCUMENTATION_INSTALL_FILES "${CMAKE_SOURCE_DIR}/../docs/*")
foreach(ITEM ${DOCUMENTATION_INSTALL_FILES})
list(APPEND DOCUMENTATION_DEPLOY_DIRECTORIES "${ITEM}")
endif()
endforeach()
-
-install(TARGETS xestiaab RUNTIME DESTINATION bin)
-install(TARGETS odthelpbrowser RUNTIME DESTINATION bin)
-install(FILES ${CMAKE_SOURCE_DIR}/xestiaab.1 DESTINATION share/man/man1)
-install(FILES ${DOCUMENTATION_DEPLOY_FILES} DESTINATION share/doc/xestiaab)
-install(FILES ${DOCUMENTATION_DEPLOY_DIRECTORIES} DESTINATION share/doc/xestiaab)
\ No newline at end of file
--- /dev/null
+# list command no longer ignores empty elements
+cmake_policy(SET CMP0007 NEW)
+
+function(Execute)
+ list(POP_FRONT ARGV outlist)
+
+ execute_process(
+ COMMAND ${ARGV}
+ OUTPUT_VARIABLE cmd_out
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ string(REPLACE "\n" ";" cmd_out "${cmd_out}")
+ list(TRANSFORM cmd_out STRIP)
+ set(${outlist} ${cmd_out} PARENT_SCOPE)
+endfunction()
+
+function(GatherRuntimePaths source)
+ Execute(output otool -l ${source})
+
+ set (line_index 0)
+ foreach (line ${output})
+ if(line MATCHES "^.*cmd LC_RPATH")
+ set(line_index 1)
+ continue()
+ endif()
+
+ if (line_index EQUAL 1)
+ set(line_index 2)
+ continue()
+ endif()
+
+ if (line_index EQUAL 2)
+ string(REGEX REPLACE "^.*path" "" extracted_path ${line})
+ string(REGEX REPLACE "\\(offset .*\\)$" "" extracted_path ${extracted_path})
+ string(STRIP ${extracted_path} extracted_path)
+ list(APPEND runpaths ${extracted_path})
+ set(line_index 0)
+ continue()
+ endif()
+ endforeach()
+
+ set(runpaths ${runpaths} PARENT_SCOPE)
+endfunction()
+
+function(GatherSFMLLibrariesForCopying libraries postcmds)
+ foreach(library ${libraries})
+ Execute(output otool -L ${library})
+
+ foreach(line ${output})
+ if(line MATCHES "^.*libsfml.*.[^0-9].[^0-9].[^0-9].*\\.dylib ")
+ string(REGEX REPLACE "dylib .*" "dylib" line "${line}")
+
+ if(line MATCHES "^@rpath/")
+ get_filename_component(refname "${line}" NAME)
+ list(APPEND postcmds "sh -c 'install_name_tool -change ${line} @executable_path/../Frameworks/${refname} ${library}'")
+ list(APPEND libs ${dylib_location})
+ endif()
+ elseif(line MATCHES "^@rpath/../Frameworks/.*.framework/Versions/.*/.*")
+ string(REGEX MATCH "^@rpath/../Frameworks/(.*)/Versions/.*$" _ ${line})
+ list(APPEND frameworksToCopy ${CMAKE_MATCH_1})
+ endif()
+ endforeach()
+ endforeach()
+
+ set(postcmds ${postcmds} PARENT_SCOPE)
+ set(frameworksToCopy ${frameworksToCopy} PARENT_SCOPE)
+endfunction()
+
+function (InstallSFMLDependencies frameworks postcmds destination)
+ foreach (framework ${frameworks})
+ unset(frameworkLocation)
+ string(REGEX MATCH "(.*).framework" _ ${framework})
+ string(APPEND frameworkLocation ${SFML_FRAMEWORKS_LOCATION} "/" ${framework})
+ file(INSTALL ${frameworkLocation} DESTINATION ${destination})
+ endforeach()
+endfunction()
+
+function(AdjustSFMLDependencies libraries destination)
+ foreach (libraryFilename ${libraries})
+ string(REGEX MATCH "(.*).framework" _ ${libraryFilename})
+ string(CONCAT libraryName ${CMAKE_MATCH_1})
+ string(CONCAT frameworkLocation ${destination} "/" ${libraryFilename} "/" ${libraryName})
+ Execute(output otool -L ${frameworkLocation})
+
+ foreach (oldLocation ${output})
+ string(REGEX REPLACE " \\\(compatibility .*" "" oldLocation ${oldLocation})
+ if(oldLocation MATCHES "^@rpath")
+ string(REPLACE "@rpath/" "@executable_path/" newLocation ${oldLocation})
+ execute_process(
+ COMMAND sh -c "install_name_tool -change ${oldLocation} ${newLocation} ${frameworkLocation}"
+ COMMAND_ECHO STDOUT
+ )
+ endif()
+ endforeach()
+ endforeach()
+endfunction()
+
+function(AdjustSFMLLibraries libraries)
+ foreach(library ${libraries})
+ Execute(output otool -L ${library})
+
+ foreach(oldLocation ${output})
+ string(REGEX REPLACE " \\\(compatibility .*" "" oldLocation ${oldLocation})
+ if(oldLocation MATCHES "^@rpath")
+ string(REPLACE "@rpath/" "@executable_path/" newLocation ${oldLocation})
+ execute_process(
+ COMMAND sh -c "install_name_tool -change ${oldLocation} ${newLocation} ${library}"
+ COMMAND_ECHO STDOUT
+ )
+ endif()
+ endforeach()
+ endforeach()
+endfunction()
+
+function(GatherLibrariesForCopying source)
+ if (CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
+ # Gather runtime paths first.
+ if(NOT source MATCHES "^@rpath")
+ GatherRuntimePaths(${source})
+ endif()
+
+ Execute(output otool -L ${source})
+
+ get_filename_component(LibraryName "${source}" NAME)
+
+ if(LibraryName MATCHES ".*dylib")
+ string(PREPEND LibraryName "${DST}/")
+ else()
+ set(LibraryName "${source}")
+ endif()
+
+ foreach (line ${output})
+ if(line MATCHES "^@rpath/../Frameworks/.*.framework/Versions/.*/.*")
+ continue()
+ endif()
+
+ if(line MATCHES "^@rpath")
+ string(REGEX REPLACE "^@rpath/" "" filename ${line})
+ string(REGEX REPLACE "dylib .*" "dylib" filename ${filename})
+
+ set(dylib_found 0)
+ foreach (runpath ${runpaths})
+ string(CONCAT dylib_location ${runpath} "/" ${filename})
+ if (EXISTS ${dylib_location})
+ set(dylib_location ${dylib_location} PARENT_SCOPE)
+ set(dylib_found 1)
+ break()
+ endif()
+ endforeach()
+
+ if(dylib_found EQUAL 0)
+ message(FATAL_ERROR "Unable to find dynamic library ${filename} within the runtime paths.")
+ endif()
+ endif()
+
+ # Dynamic Libraries
+ if(line MATCHES "^.*libwx.*\\.dylib " )
+ string(REGEX REPLACE "dylib .*" "dylib" line "${line}")
+ if(NOT line STREQUAL "${source}" AND NOT line MATCHES "@executable")
+ set(lib ${line})
+ if(line MATCHES "^@rpath/")
+ list(APPEND libs ${dylib_location})
+ else()
+ list(APPEND libs ${lib})
+ endif()
+ get_filename_component(refname "${lib}" NAME)
+ list(APPEND postcmds "sh -c 'install_name_tool -change ${lib} @executable_path/../Frameworks/${refname} ${LibraryName}'")
+
+ GatherLibrariesForCopying(${lib})
+ endif()
+ elseif(line MATCHES "^.*libsfml.*.[^0-9].[^0-9].[^0-9].*\\.dylib ")
+ string(REGEX REPLACE "dylib .*" "dylib" line "${line}")
+ set(lib ${line})
+ if(line MATCHES "^@rpath/")
+ get_filename_component(refname "${dylib_location}" NAME)
+ list(APPEND postcmds "sh -c 'install_name_tool -change ${lib} @executable_path/../Frameworks/${refname} ${LibraryName}'")
+ list(APPEND libs ${dylib_location})
+ elseif(line MATCHES "^@executable_path/")
+ continue()
+ else()
+ get_filename_component(refname "${lib}" NAME)
+ list(APPEND postcmds "sh -c 'install_name_tool -change ${lib} @executable_path/../Frameworks/${refname} ${LibraryName}'")
+ list(APPEND libs ${lib})
+ endif()
+ get_filename_component(libraryPath "${LibraryName}" DIRECTORY)
+ string(APPEND libraryPath "/../Frameworks/${refname}")
+ list(APPEND sfmllibs ${libraryPath})
+ elseif(line MATCHES "^.*libcurl.[0-9]\\.dylib " OR
+ line MATCHES "^.*libxml2.[0-9]\\.dylib ")
+ string(REGEX REPLACE "dylib .*" "dylib" line "${line}")
+ set(lib ${line})
+
+ if(line MATCHES "^@rpath/")
+ get_filename_component(refname "${dylib_location}" NAME)
+ list(APPEND postcmds "sh -c 'install_name_tool -change ${lib} @executable_path/../Frameworks/${refname} ${LibraryName}'")
+ list(APPEND libs ${dylib_location})
+ elseif(line MATCHES "^@executable_path/")
+ continue()
+ else()
+ get_filename_component(refname "${lib}" NAME)
+ list(APPEND postcmds "sh -c 'install_name_tool -change ${lib} @executable_path/../Frameworks/${refname} ${LibraryName}'")
+ list(APPEND libs ${lib})
+ endif()
+ endif()
+ endforeach()
+ endif()
+
+ set(libs ${libs} PARENT_SCOPE)
+ set(sfmllibs ${sfmllibs} PARENT_SCOPE)
+ set(postcmds ${postcmds} PARENT_SCOPE)
+endfunction()
+
+GatherLibrariesForCopying(${SRC})
+
+list(REMOVE_DUPLICATES libs)
+file(INSTALL ${libs} DESTINATION ${DST} FOLLOW_SYMLINK_CHAIN)
+
+GatherSFMLLibrariesForCopying("${sfmllibs}" "${postcmds}")
+InstallSFMLDependencies("${frameworksToCopy}" "${postcmds}" "${DST}")
+
+foreach(cmd ${postcmds})
+ execute_process(
+ COMMAND sh -c "${cmd}"
+ COMMAND_ECHO STDOUT
+ )
+endforeach()
+
+AdjustSFMLLibraries("${sfmllibs}")
+AdjustSFMLDependencies("${frameworksToCopy}" ${DST})
--- /dev/null
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++ -std=c++11")
+#add_definitions(-std=c++11)
+
+find_library(COREFOUNDATION_FRAMEWORK CoreFoundation)
+find_library(SECURITY_FRAMEWORK Security)
+find_library(SECURITYINTERFACE_FRAMEWORK SecurityInterface)
include(CMakeDependentOption)
option(XestiaAddressBook_UNIT_TESTING "Enable unit testing" OFF)
+
+if(APPLE)
+ set(SFML_FRAMEWORKS_LOCATION "" CACHE PATH "Location for the SFML framework dependencies.")
+
+ if(NOT EXISTS ${SFML_FRAMEWORKS_LOCATION})
+ message(FATAL_ERROR "The location given by SFML_FRAMEWORKS_LOCATION does not exist.")
+ endif()
+endif()
find_package(LibXml2 REQUIRED)
include_directories(${LIBXML2_INCLUDE_DIRS})
+if (APPLE)
+ if (LIBXML2_LIBRARY MATCHES "^/usr/lib/.*")
+ message(FATAL_ERROR "Use of macOS's internal libxml2 dynamic library is not allowed.")
+ endif()
+endif()
-find_package(Iconv REQUIRED)
-include_directories(${Iconv_INCLUDE_DIR})
+if(!APPLE)
+ find_package(Iconv REQUIRED)
+ include_directories(${Iconv_INCLUDE_DIR})
+endif()
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
+if (APPLE)
+ if (LIBXML2_LIBRARY MATCHES "^/usr/lib/.*")
+ message(FATAL_ERROR "Use of macOS's internal libcurl dynamic library is not allowed.")
+ endif()
+endif()
find_package(SFML COMPONENTS audio REQUIRED)
include_directories(${SFML_DIR}/../include)
include(Options)
include(Packages)
+if (APPLE)
+ include(MacOSSupport)
+endif()
+
if (XestiaAddressBook_UNIT_TESTING)
enable_testing()
find_package(GTest REQUIRED)
frmActivityMgr.h
frmActivityMgr-tasks.cpp)
-if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
- list(APPEND ${FILE_LIST} frmActivityMgr.mm)
+if(APPLE)
+ list(APPEND FILE_LIST frmActivityMgr.mm)
endif()
add_library(${TARGET_NAME}
// Write out the data to the console.
FinalData.Trim();
- std::cout << FinalData << std::endl;
+ std::cout << FinalData.ToStdString() << std::endl;
}
return CONVERTRESULT_OK;
-}
\ No newline at end of file
+}
std::map<int, wxString> AccountAccDirList;
#if defined(__APPLE__)
std::map<int, SecTrustRef> AccountTrustData;
- NSRunningApplication *helpBrowserProcess;
+ NSRunningApplication *helpBrowserProcess = nil;
#elif defined(__WIN32__)
std::map<int, PCCERT_CONTEXT> AccountCertificateData;
#else
helpBrowserDocumentationPath = [[NSBundle mainBundle] pathForResource:@"Documentation (en_GB)" ofType:@"fodt"];
}
- NSURL *helpBrowserExecutableURL = [[NSBundle mainBundle] URLForResource:@"ODTHelpBrowser" withExtension:@"app"];
+ NSURL *helpBrowserExecutableURL = [[NSBundle mainBundle] URLForResource:@"odthelpbrowser" withExtension:@"app"];
NSArray *args = [NSArray arrayWithObjects:@"-d", helpBrowserDocumentationPath, nil];
NSDictionary *helpBrowserArguments = [NSDictionary dictionaryWithObject:args
// Setup the locale.
wxLocale locale;
- locale.Init(wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT);
+ locale.Init(wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT);
static const wxCmdLineEntryDesc g_cmdLineDesc [] =
{
return true;
-}
\ No newline at end of file
+}
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
- <string>$(DEVELOPMENT_LANGUAGE)</string>
+ <string>English</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
- <key>CFBundleIconFile</key>
+ <key>CFBundleGetInfoString</key>
<string></string>
+ <key>CFBundleIconFile</key>
+ <string>XestiaAddressBook</string>
<key>CFBundleIdentifier</key>
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <string>uk.co.xestia.addressbook</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
- <string>$(PRODUCT_VERSION) (c) 2013 - 2018 Xestia Software Development</string>
+ <string></string>
<key>CFBundleName</key>
- <string>$(PRODUCT_NAME)</string>
+ <string></string>
<key>CFBundlePackageType</key>
- <string>XSD</string>
+ <string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.0.0</string>
+ <string></string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
<key>CFBundleVersion</key>
- <string>1.0.0</string>
- <key>LSApplicationCategoryType</key>
- <string>public.app-category.productivity</string>
- <key>LSMinimumSystemVersion</key>
- <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <string>0.24</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
<key>NSHumanReadableCopyright</key>
- <string>Copyright © 2018 Xestia Software Development. All rights reserved.</string>
- <key>NSPrincipalClass</key>
- <string>wxNSApplication</string>
+ <string>(c) 2012-2020 Xestia Software Development</string>
</dict>
</plist>
add_executable(bitmapcode
bitmapcode.cpp)
-
+
if (MSVC)
add_custom_command(
TARGET bitmapcode
target_link_libraries(bitmapcode
LINK_PUBLIC
+ c++
${wxWidgets_LIBRARIES})
set (sources
if (WIN32)
add_executable(odthelpbrowser WIN32 ${sources})
+elseif (APPLE)
+ add_executable(odthelpbrowser MACOSX_BUNDLE ${sources})
else()
add_executable(odthelpbrowser ${sources})
endif()
// Setup the inclusion guard.
cppfile << "#include <iostream>" << endl << endl;
- cppfile << "#ifndef " << outname.c_str() << "_CPP" << endl;
- cppfile << "#define " << outname.c_str() << "_CPP" << endl << endl;
+ cppfile << "#ifndef " << outname.ToStdString() << "_CPP" << endl;
+ cppfile << "#define " << outname.ToStdString() << "_CPP" << endl << endl;
outname.Clear();
outname.Append(wxString::FromUTF8(DirFilenameOnly.c_str()));
// Convert the PNG file into an unsigned char array.
- cppfile << "static unsigned char " << outname.c_str() <<
+ cppfile << "static unsigned char " << outname.ToStdString() <<
"[] = {" << endl;
while (pngfile){
cppfile << "#endif" << endl << endl;
cppfile.close();
- cout << "CPP\t" << CPPFilename.c_str() << endl;
+ cout << "CPP\t" << CPPFilename.ToStdString() << endl;
++*counter;
-
}
void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist,
bool fmatch = FALSE;
wxString finaldirname;
- wxString HPPFilename = dirfilename.c_str();
+ wxString HPPFilename = dirfilename.ToStdString();
wxString DirFilenameOnly;
wxString HPPFilenameOnly;
#endif
hppfile << "#include <iostream>" << endl << endl;
- hppfile << "#ifndef " << finaldirname.c_str() << "_H" << endl;
- hppfile << "#define " << finaldirname.c_str() << "_H" << endl << endl;
+ hppfile << "#ifndef " << finaldirname.ToStdString() << "_H" << endl;
+ hppfile << "#define " << finaldirname.ToStdString() << "_H" << endl << endl;
hppfile << "// List all CPP files in the directory." << endl << endl;
// Write each CPP file into the header file.
CPPFileOnly.RemoveLast(4);
CPPFileOnly.Append(wxT(".cpp"));
- hppfile << "#include \"" << DirFilenameOnly.c_str() <<
- "/" << CPPFileOnly.c_str() << "\"" << endl;
+ hppfile << "#include \"" << DirFilenameOnly.ToStdString() <<
+ "/" << CPPFileOnly.ToStdString() << "\"" << endl;
}
// Increment the HPP file counter.
- cout << "HPPDIR\t" << HPPFilename.c_str() << endl;
+ cout << "HPPDIR\t" << HPPFilename.ToStdString() << endl;
++*counter;
}
DirFilenameWxS.Empty();
- std::cout << BitmapHeaderFilename.c_str() << std::endl;
+ std::cout << BitmapHeaderFilename.ToStdString() << std::endl;
#if defined(__WIN32__)
for (int fi = 0; fi < filelist.GetCount(); fi++)
{
- CreateCPPFile(dirlist[bi].wc_str(), filelist[fi].wc_str(), &cppg);
+ CreateCPPFile(dirlist[bi].ToStdString(), filelist[fi].ToStdString(), &cppg);
fp++;
}
#elif defined(__WIN32__)
- finalhppfile << "#include \"bitmaps\\" << DirNameSplit.c_str() <<
+ finalhppfile << "#include \"bitmaps\\" << DirNameSplit.ToStdString() <<
".h\"" << endl;
#else
- finalhppfile << "#include \"bitmaps/" << DirNameSplit.c_str() <<
+ finalhppfile << "#include \"bitmaps/" << DirNameSplit.ToStdString() <<
".h\"" << endl;
#endif
--- /dev/null
+#!/bin/sh
+
+if [ -z $1 ]; then
+ echo "Usage: $0 <pngfile>"
+ exit
+fi
+
+IMAGELOCATION=$1
+IMAGEFILENAME=${IMAGELOCATION##*/}
+IMAGENAME="${IMAGEFILENAME%.*}"
+
+mkdir $IMAGENAME.iconset
+sips $IMAGELOCATION -z 16 16 --out $IMAGENAME.iconset/icon_16x16.png
+sips $IMAGELOCATION -z 32 32 --out $IMAGENAME.iconset/icon_16x16@2x.png
+sips $IMAGELOCATION -z 32 32 --out $IMAGENAME.iconset/icon_32x32.png
+sips $IMAGELOCATION -z 64 64 --out $IMAGENAME.iconset/icon_32x32@2x.png
+sips $IMAGELOCATION -z 128 128 --out $IMAGENAME.iconset/icon_128x128.png
+sips $IMAGELOCATION -z 256 256 --out $IMAGENAME.iconset/icon_128x128@2x.png
+sips $IMAGELOCATION -z 256 256 --out $IMAGENAME.iconset/icon_256x256.png
+sips $IMAGELOCATION -z 512 512 --out $IMAGENAME.iconset/icon_256x256@2x.png
+sips $IMAGELOCATION -z 512 512 --out $IMAGENAME.iconset/icon_512x512.png
+cp $IMAGELOCATION $IMAGENAME.iconset/icon_512x512@2x.png
+iconutil -c icns $IMAGENAME.iconset
+rm $IMAGENAME.iconset/*
+rmdir $IMAGENAME.iconset