Skip to content

Commit

Permalink
#156 - Updated [gha] build-ci.yml fixes for macos builds
Browse files Browse the repository at this point in the history
  • Loading branch information
oxy86 committed Dec 2, 2024
1 parent 8ed0fb9 commit a2cc078
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
43 changes: 30 additions & 13 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ jobs:
echo "🔧 Installing dependencies for AppImage creation..."
sudo apt update
sudo apt install -y build-essential libssl-dev cmake ninja-build \
libssl-dev libxkbcommon-x11-dev libxcb-cursor-dev zlib1g-dev \
desktop-file-utils patchelf libglu1-mesa-dev libfontconfig1 libfreetype6 libx11-dev libxext-dev \
libxrandr-dev libxrender-dev libxcb1-dev libx11-xcb-dev libxcb-glx0-dev
libssl-dev libxkbcommon-x11-dev libxcb-cursor-dev zlib1g-dev \
desktop-file-utils patchelf libglu1-mesa-dev libfontconfig1 libfreetype6 libx11-dev libxext-dev \
libxrandr-dev libxrender-dev libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libfuse2
echo "🔎 Check openssl version:"
echo `openssl version`
Expand Down Expand Up @@ -239,22 +239,39 @@ jobs:
make
echo "👉 Building finished. Listing current directory with find for verification:"
find .
# Install into AppDir
echo "🔧 Installing the application into AppDir..."
make install DESTDIR=AppDir
# Verify AppDir contents
echo "Verifying installed files in AppDir..."
find AppDir
# Verify the binary with lipo
echo "🔎 Verifying architectures in the built binary..."
if [[ -f "${{env.EXECUTABLE}}.app/Contents/MacOS/${{env.EXECUTABLE}}" ]]; then
lipo -info "${{env.EXECUTABLE}}.app/Contents/MacOS/${{env.EXECUTABLE}}"
else
echo "❌ Error: Binary file not found!"
exit 1
fi
echo "🔧 Removing items we do not deploy from project dir ..."
rm -rf moc obj qrc
# # Install into AppDir
# echo "🔧 Installing the application into AppDir..."
# make install DESTDIR=AppDir
# # Verify AppDir contents
# echo "Verifying installed files in AppDir..."
# find AppDir
# Run macdeployqt to bundle the app
echo "🚀 Running macdeployqt to create macOS bundle..."
macdeployqt AppDir/usr/bin/SocNetV.app -dmg
macdeployqt "${{env.APPLICATION}}.app" -dmg || {
echo "Error: macdeployqt failed."
exit 1
}
# Rename DMG file
DMG_NAME="SocNetV-${{env.VERSION}}.dmg"
if [[ -f SocNetV.dmg ]]; then
mv "SocNetV.dmg" "${DMG_NAME}"
DMG_NAME="${{env.APPLICATION}}-${{env.VERSION}}.dmg"
if [[ -f ${{env.APPLICATION}}.dmg ]]; then
mv "${{env.APPLICATION}}.dmg" "${DMG_NAME}"
else
echo "Error: DMG creation failed. No DMG file found."
exit 1
Expand Down
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ else()
set(TARGET_NAME socnetv)
endif()

# Override with -DCMAKE_INSTALL_PREFIX=/custom/path.
set(INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME})


# Debug information
message(STATUS "Building ${PROJECT_NAME} (${TARGET_NAME}) ${PROJECT_VERSION}")
Expand All @@ -48,7 +47,10 @@ message(STATUS "CMAKE_CURRENT_LIST_DIR: " ${CMAKE_CURRENT_LIST_DIR})
message(STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY: " ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
message(STATUS "CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH})
message(STATUS "CMAKE_INSTALL_DATADIR: " ${CMAKE_INSTALL_DATADIR})
message(STATUS "INSTALL_DIR: " ${INSTALL_DIR})
# The root directory for the installation.
# Defaults to /usr/local on Unix systems and C:/Program Files/<Project> on Windows.
# You can override this with -DCMAKE_INSTALL_PREFIX=<path>.
message(STATUS "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX})


# Find Qt6
Expand Down Expand Up @@ -229,12 +231,16 @@ elseif(APPLE AND NOT IOS)
MACOSX_BUNDLE_ICON_FILE "socnetv.icns"
)

# Installation

# Install the main app bundle
install(TARGETS ${TARGET_NAME}
BUNDLE DESTINATION "${INSTALL_DIR}"
BUNDLE DESTINATION "${CMAKE_INSTALL_PREFIX}/Applications"
)





elseif(LINUX)

# Define the installation prefix (equivalent to qmake's PREFIX)
Expand Down

0 comments on commit a2cc078

Please sign in to comment.