🎉 Build DMG with DragNDrop

This commit is contained in:
Edgar 2021-02-19 10:45:18 +01:00 committed by Rasmus Karlsson
parent a89b5a8ab6
commit 6913a6312c
2 changed files with 39 additions and 6 deletions

View file

@ -191,7 +191,7 @@ jobs:
shell: bash shell: bash
- name: Package (MacOS) - name: Package (MacOS)
if: startsWith(matrix.os, 'macos') if: startsWith(matrix.os, 'macos') && matrix.build-system == 'qmake'
run: | run: |
ls -la ls -la
pwd pwd
@ -200,6 +200,13 @@ jobs:
sh ./../.CI/CreateDMG.sh sh ./../.CI/CreateDMG.sh
shell: bash shell: bash
- name: Package (MacOS)
if: startsWith(matrix.os, 'macos') && matrix.build-system == 'cmake'
run: |
cd build
make package
shell: bash
- name: Upload artifact (MacOS) - name: Upload artifact (MacOS)
if: startsWith(matrix.os, 'macos') if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v2.2.2 uses: actions/upload-artifact@v2.2.2

View file

@ -2,10 +2,6 @@ include(SourceFileUtils)
project(chatterino) project(chatterino)
if (MSVC)
add_definitions("/EHsc")
endif (MSVC)
set(SOURCE_FILES main.cpp set(SOURCE_FILES main.cpp
Application.{hpp,cpp} Application.{hpp,cpp}
BaseSettings.{hpp,cpp} BaseSettings.{hpp,cpp}
@ -211,6 +207,16 @@ set(SOURCE_FILES main.cpp
widgets/dialogs/IrcConnectionEditor.ui widgets/dialogs/IrcConnectionEditor.ui
) )
if (WIN32)
# clang-cl doesn't support resource files
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND SOURCE_FILES "${CMAKE_SOURCE_DIR}/resources/windows.rc")
endif ()
elseif (APPLE)
list(APPEND SOURCE_FILES "${CMAKE_SOURCE_DIR}/resources/chatterino.icns")
endif ()
# Expand file extensions (i.e. path/to/file.{h,cpp} becomes path/to/file.h;path/to/file.cpp) # Expand file extensions (i.e. path/to/file.{h,cpp} becomes path/to/file.h;path/to/file.cpp)
expand_file_extensions(SOURCE_FILES ${SOURCE_FILES}) expand_file_extensions(SOURCE_FILES ${SOURCE_FILES})
@ -225,6 +231,14 @@ if (WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE USEWINSDK) target_compile_definitions(${PROJECT_NAME} PRIVATE USEWINSDK)
endif () endif ()
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /EHsc)
endif ()
if (APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE TRUE)
endif ()
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
@ -278,7 +292,6 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Chatterino is a chat client for twitch ch
set(CPACK_PACKAGE_VERSION ${CHATTERINO2_VERSION}) set(CPACK_PACKAGE_VERSION ${CHATTERINO2_VERSION})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/resources/license.rtf") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/resources/license.rtf")
set(CPACK_PACKAGE_EXECUTABLES "chatterino" "Chatterino 2") set(CPACK_PACKAGE_EXECUTABLES "chatterino" "Chatterino 2")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CHATTERINO2_VERSION}")
set(CPACK_GENERATOR ZIP) set(CPACK_GENERATOR ZIP)
@ -304,6 +317,8 @@ if (MSVC)
install(CODE "execute_process(COMMAND ${WINDEPLOYQT_COMAND} --dir \${CMAKE_INSTALL_PREFIX})") install(CODE "execute_process(COMMAND ${WINDEPLOYQT_COMAND} --dir \${CMAKE_INSTALL_PREFIX})")
set(CPACK_PACKAGE_FILE_NAME "chatterino-windows-x86-64")
#For Windows Desktop shortcuts #For Windows Desktop shortcuts
set(CPACK_CREATE_DESKTOP_LINKS "chatterino" "Chatterino 2") set(CPACK_CREATE_DESKTOP_LINKS "chatterino" "Chatterino 2")
@ -322,6 +337,8 @@ if (MSVC)
set(CPACK_GENERATOR ${CPACK_GENERATOR};WIX) set(CPACK_GENERATOR ${CPACK_GENERATOR};WIX)
set(CPACK_MODULE_PATH "") set(CPACK_MODULE_PATH "")
elseif (UNIX) elseif (UNIX)
set(CPACK_PACKAGE_FILE_NAME "Chatterino-x86_64")
install(TARGETS ${PROJECT_NAME} install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
@ -336,6 +353,15 @@ elseif (UNIX)
RENAME com.chatterino.chatterino.png RENAME com.chatterino.chatterino.png
DESTINATION share/icons/hicolor/256x256/apps DESTINATION share/icons/hicolor/256x256/apps
) )
elseif (APPLE)
set(CPACK_PACKAGE_FILE_NAME "chatterino-x86-64")
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
)
set(CPACK_GENERATOR ${CPACK_GENERATOR};DRAGNDROP)
endif () endif ()
include(CPack) include(CPack)