Create macOS bundle for simplified installation #58
This commit is contained in:
16
.gitignore
vendored
16
.gitignore
vendored
@@ -1,14 +1,16 @@
|
||||
.DS_Store
|
||||
.cache/
|
||||
.vs/
|
||||
Info.plist
|
||||
build*/
|
||||
compile_commands.json
|
||||
cspell.json
|
||||
.vs/
|
||||
support/Dockerfile
|
||||
dist/
|
||||
deps/
|
||||
scripts/cleanup.cmd
|
||||
scripts/cleanup.sh
|
||||
version.rc
|
||||
version.cpp
|
||||
dist/
|
||||
override.sh
|
||||
repertory.iss
|
||||
scripts/cleanup.cmd
|
||||
scripts/cleanup.sh
|
||||
support/Dockerfile
|
||||
version.cpp
|
||||
version.rc
|
||||
|
@@ -1,7 +1,20 @@
|
||||
set(CMAKE_CXX_FLAGS "-include common.hpp ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
if (PROJECT_IS_DARWIN)
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/Info.plist.in
|
||||
${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/Info.plist
|
||||
@ONLY
|
||||
)
|
||||
endif()
|
||||
|
||||
add_project_library(lib${PROJECT_NAME} "" "" "${PROJECT_ADDITIONAL_SOURCES}")
|
||||
|
||||
add_project_executable(${PROJECT_NAME} lib${PROJECT_NAME} lib${PROJECT_NAME})
|
||||
if (PROJECT_IS_DARWIN)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/Info.plist
|
||||
)
|
||||
endif()
|
||||
|
||||
add_project_test_executable(${PROJECT_NAME}_test lib${PROJECT_NAME} lib${PROJECT_NAME})
|
||||
|
19
repertory/Info.plist.in
Normal file
19
repertory/Info.plist.in
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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>CFBundleExecutable</key>
|
||||
<string>@PROJECT_NAME@</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.fifthgrid.blockstorage.@PROJECT_NAME@</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>@PROJECT_NAME@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@PROJECT_MAJOR_VERSION@.@PROJECT_MINOR_VERSION@.@PROJECT_REVISION_VERSION@-@PROJECT_RELEASE_ITER@_@PROJECT_GIT_REV@</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
@@ -49,12 +49,22 @@ auto main(int argc, char **argv) -> int {
|
||||
std::ranges::copy(args_span, std::back_inserter(args));
|
||||
}
|
||||
|
||||
int ret{0};
|
||||
|
||||
if (argc == 1) {
|
||||
#if defined(__APPLE__)
|
||||
args.push_back("-ui");
|
||||
#else // !defined(__APPLE__)
|
||||
args.push_back("-h");
|
||||
#endif // defined(__APPLE__)
|
||||
}
|
||||
|
||||
int ret{0};
|
||||
if (utils::cli::has_option(args, utils::cli::options::ui_option)) {
|
||||
if (utils::cli::has_option(args, utils::cli::options::help_option)) {
|
||||
cli::actions::help<repertory_drive>(args);
|
||||
} else if (utils::cli::has_option(args,
|
||||
utils::cli::options::version_option)) {
|
||||
cli::actions::version<repertory_drive>(args);
|
||||
} else if (utils::cli::has_option(args, utils::cli::options::ui_option)) {
|
||||
ui::mgmt_app_config config{
|
||||
utils::cli::has_option(args, utils::cli::options::hidden_option),
|
||||
utils::cli::has_option(args, utils::cli::options::launch_only_option),
|
||||
@@ -71,7 +81,11 @@ auto main(int argc, char **argv) -> int {
|
||||
ret = static_cast<std::int32_t>(exit_code::ui_failed);
|
||||
} else {
|
||||
httplib::Server server;
|
||||
#if defined(__APPLE__)
|
||||
if (not server.set_mount_point("/ui", "../Resources/web")) {
|
||||
#else // !defined(__APPLE__)
|
||||
if (not server.set_mount_point("/ui", "./web")) {
|
||||
#endif // defined(__APPLE__)
|
||||
ret = static_cast<std::int32_t>(exit_code::ui_failed);
|
||||
} else {
|
||||
ui::handlers handlers(&config, &server);
|
||||
@@ -133,8 +147,7 @@ auto main(int argc, char **argv) -> int {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ((prov == provider_type::s3) || (prov == provider_type::sia) ||
|
||||
(prov == provider_type::encrypt)) {
|
||||
} else {
|
||||
std::string data;
|
||||
res = utils::cli::parse_string_option(
|
||||
args, utils::cli::options::name_option, data);
|
||||
@@ -160,12 +173,6 @@ auto main(int argc, char **argv) -> int {
|
||||
|
||||
int mount_result{};
|
||||
if (res == exit_code::success) {
|
||||
if (utils::cli::has_option(args, utils::cli::options::help_option)) {
|
||||
cli::actions::help<repertory_drive>(args);
|
||||
} else if (utils::cli::has_option(args,
|
||||
utils::cli::options::version_option)) {
|
||||
cli::actions::version<repertory_drive>(args);
|
||||
} else {
|
||||
res = exit_code::option_not_found;
|
||||
for (std::size_t idx = 0U;
|
||||
(res == exit_code::option_not_found) &&
|
||||
@@ -173,8 +180,8 @@ auto main(int argc, char **argv) -> int {
|
||||
idx++) {
|
||||
try {
|
||||
res = cli::actions::perform_action(
|
||||
utils::cli::options::option_list[idx], args, data_directory,
|
||||
prov, unique_id, user, password);
|
||||
utils::cli::options::option_list[idx], args, data_directory, prov,
|
||||
unique_id, user, password);
|
||||
} catch (const std::exception &ex) {
|
||||
res = exit_code::exception;
|
||||
} catch (...) {
|
||||
@@ -187,7 +194,6 @@ auto main(int argc, char **argv) -> int {
|
||||
remote_host, remote_port, unique_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = ((res == exit_code::mount_result) ? mount_result
|
||||
: static_cast<std::int32_t>(res));
|
||||
|
@@ -61,7 +61,9 @@ fi
|
||||
|
||||
for APP in ${PROJECT_APP_LIST[@]}; do
|
||||
if [ "${PROJECT_BUILD_SHARED_LIBS}" == "ON" ]; then
|
||||
if [ "${PROJECT_IS_MINGW}" != "1" ]; then
|
||||
if [ "${PROJECT_IS_MINGW}" == "1" ]; then
|
||||
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${PROJECT_APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
|
||||
else
|
||||
rm "${PROJECT_DIST_DIR}/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||
if [ "${PROJECT_ENABLE_CURL}" == "ON" ]; then
|
||||
mv "${PROJECT_DIST_DIR}/cacert.pem" "${PROJECT_DIST_DIR}/bin/cacert.pem"
|
||||
@@ -77,18 +79,27 @@ export LD_LIBRARY_PATH="\${PROJECT_SCRIPTS_DIR}/lib:\${PROJECT_SCRIPTS_DIR}/lib6
|
||||
\${PROJECT_SCRIPTS_DIR}/bin/${APP}${PROJECT_APP_BINARY_EXT} \$*
|
||||
EOF
|
||||
chmod +x "${PROJECT_DIST_DIR}/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||
else
|
||||
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${PROJECT_APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
|
||||
fi
|
||||
else
|
||||
elif [ ! -d "${PROJECT_BUILD_DIR}/build/${APP}.app" ]; then
|
||||
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${PROJECT_APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d "${PROJECT_BUILD_DIR}/build/${PROJECT_NAME}.app" ]; then
|
||||
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${PROJECT_NAME}.app/" \
|
||||
"${PROJECT_DIST_DIR}/${PROJECT_NAME}.app/"
|
||||
fi
|
||||
|
||||
if [ -f "${PROJECT_SOURCE_DIR}/web/${PROJECT_NAME}/pubspec.yaml" ]; then
|
||||
if [ -d "${PROJECT_DIST_DIR}/${PROJECT_NAME}.app" ]; then
|
||||
rsync -av --progress "${PROJECT_SOURCE_DIR}/web/${PROJECT_NAME}/build/web/" \
|
||||
"${PROJECT_DIST_DIR}/${PROJECT_NAME}.app/Contents/Resources/web/"
|
||||
cp "${PROJECT_DIST_DIR}/cacert.pem" "${PROJECT_DIST_DIR}/${PROJECT_NAME}.app/Contents/MacOS/cacert.pem"
|
||||
else
|
||||
rsync -av --progress "${PROJECT_SOURCE_DIR}/web/${PROJECT_NAME}/build/web/" \
|
||||
"${PROJECT_DIST_DIR}/web/"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${PROJECT_IS_MINGW}" == "1" ]; then
|
||||
. "${PROJECT_SCRIPTS_DIR}/copy_mingw64_deps.sh" "$1" "$2" "$3" "$4" "$5"
|
||||
|
@@ -50,10 +50,12 @@ popd
|
||||
rsync -av --progress ${PROJECT_DIST_DIR}/ ${TEMP_DIR}/${PROJECT_NAME}/ || error_exit "failed to rsync" 1
|
||||
|
||||
for APP in ${PROJECT_APP_LIST[@]}; do
|
||||
if [ "${PROJECT_BUILD_SHARED_LIBS}" == "ON" ] && [ "${PROJECT_IS_MINGW}" != "1" ]; then
|
||||
strip ${TEMP_DIR}/${PROJECT_NAME}/bin/${APP}${PROJECT_APP_BINARY_EXT}
|
||||
if [ -d "${TEMP_DIR}/${PROJECT_NAME}/${APP}.app" ]; then
|
||||
strip "${TEMP_DIR}/${PROJECT_NAME}/${APP}.app/Contents/MacOS/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||
elif [ "${PROJECT_BUILD_SHARED_LIBS}" == "ON" ] && [ "${PROJECT_IS_MINGW}" != "1" ]; then
|
||||
strip "${TEMP_DIR}/${PROJECT_NAME}/bin/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||
else
|
||||
strip ${TEMP_DIR}/${PROJECT_NAME}/${APP}${PROJECT_APP_BINARY_EXT}
|
||||
strip "${TEMP_DIR}/${PROJECT_NAME}/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
Reference in New Issue
Block a user