Skip to content

Commit

Permalink
Merge pull request #7 from womendoushihaoyin/engine
Browse files Browse the repository at this point in the history
feature: Build Snapmaker_Orca_Engine
  • Loading branch information
womendoushihaoyin authored Sep 25, 2024
2 parents bc74c94 + 90607b4 commit 23c927b
Show file tree
Hide file tree
Showing 21 changed files with 526 additions and 53 deletions.
56 changes: 44 additions & 12 deletions .github/workflows/build_orca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,37 @@ jobs:
shell: bash
run: sudo chown $USER -R ./

- name: Build Slicer-Engine
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
shell: bash
env:
ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }}
run: |
./BuildLinux.sh -eisr
mv -n ./build/Snapmaker_Orca_Linux_V${{ env.ver_pure }}.AppImage ./build/Snapmaker_Orca_Engine_Linux${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
chmod +x ./build/Snapmaker_Orca_Engine_Linux${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
- name: Upload artifacts Ubuntu Engine
if: ${{ ! env.ACT && inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' }}
env:
ubuntu-ver: ${{ (inputs.os == 'ubuntu-20.04' && '2004') || (inputs.os == 'ubuntu-24.04' && '2404') || '' }}
ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }}
uses: actions/upload-artifact@v4
with:
name: Snapmaker_Orca_Engine_Linux_ubuntu_${{ env.ubuntu-ver }}_${{ env.ver }}
path: './build/Snapmaker_Orca_Engine_Linux${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage'

- name: Deploy Ubuntu-Engine release
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04' }}
uses: WebFreak001/[email protected]
with:
upload_url: https://uploads.github.com/repos/Snapmaker/OrcaSlicer/releases/169912305/assets{?name,label}
release_id: 169912305
asset_path: ./build/Snapmaker_Orca_Engine_Linux${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
asset_name: Snapmaker_Orca_Engine_Linux${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
asset_content_type: application/octet-stream
max_releases: 1

- name: Build slicer
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
shell: bash
Expand All @@ -256,16 +287,7 @@ jobs:
./BuildLinux.sh -isr
mv -n ./build/Snapmaker_Orca_Linux_V${{ env.ver_pure }}.AppImage ./build/Snapmaker_Orca_Linux${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
chmod +x ./build/Snapmaker_Orca_Linux${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
- name: Build orca_custom_preset_tests
if: github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04'
working-directory: ${{ github.workspace }}/build/src
shell: bash
run: |
./Snapmaker_Orca_profile_validator -p ${{ github.workspace }}/resources/profiles -g 1
cd ${{ github.workspace }}/resources/profiles
zip -r orca_custom_preset_tests.zip user/
- name: Upload artifacts Ubuntu
if: ${{ ! env.ACT && inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' }}
env:
Expand All @@ -275,7 +297,8 @@ jobs:
with:
name: Snapmaker_Orca_Linux_ubuntu_${{ env.ubuntu-ver }}_${{ env.ver }}
path: './build/Snapmaker_Orca_Linux${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage'



- name: Deploy Ubuntu release
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
env:
Expand All @@ -289,6 +312,15 @@ jobs:
asset_content_type: application/octet-stream
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted

- name: Build orca_custom_preset_tests
if: github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04'
working-directory: ${{ github.workspace }}/build/src
shell: bash
run: |
./Snapmaker_Orca_profile_validator -p ${{ github.workspace }}/resources/profiles -g 1
cd ${{ github.workspace }}/resources/profiles
zip -r orca_custom_preset_tests.zip user/
- name: Deploy orca_custom_preset_tests
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04' }}
uses: WebFreak001/[email protected]
Expand All @@ -298,4 +330,4 @@ jobs:
asset_path: ${{ github.workspace }}/resources/profiles/orca_custom_preset_tests.zip
asset_name: orca_custom_preset_tests.zip
asset_content_type: application/octet-stream
max_releases: 1
max_releases: 1
17 changes: 14 additions & 3 deletions BuildLinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,23 @@ function check_available_memory_and_disk() {
}

function usage() {
echo "Usage: ./BuildLinux.sh [-1][-b][-c][-d][-i][-r][-s][-u]"
echo "Usage: ./BuildLinux.sh [-1][-b][-c][-d][-e][-i][-r][-s][-u]"
echo " -1: limit builds to 1 core (where possible)"
echo " -b: build in debug mode"
echo " -c: force a clean build"
echo " -d: build deps (optional)"
echo " -e: build linux orca engine (optional)"
echo " -h: this help output"
echo " -i: Generate appimage (optional)"
echo " -r: skip ram and disk checks (low ram compiling)"
echo " -s: build snapmaker-slicer (optional)"
echo " -s: build snapmaker-orca (optional)"
echo " -u: update and build dependencies (optional and need sudo)"
echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'"
echo " and then './BuildLinux.sh -dsi'"
}

unset name
while getopts ":1bcdghirsu" opt; do
while getopts ":1bcdeghirsu" opt; do
case ${opt} in
1 )
export CMAKE_BUILD_PARALLEL_LEVEL=1
Expand All @@ -54,6 +55,9 @@ while getopts ":1bcdghirsu" opt; do
d )
BUILD_DEPS="1"
;;
e )
BUILD_ENGINE="1"
;;
h ) usage
exit 0
;;
Expand Down Expand Up @@ -151,6 +155,11 @@ then
then
BUILD_ARGS="-DSLIC3R_GTK=3"
fi
if [[ -n "${BUILD_ENGINE}" ]]
then
echo "BUILD_ENGINE=ON"
BUILD_ARGS="${BUILD_ARGS} -DSERVER_ENGINE=ON"
fi
if [[ -n "${BUILD_DEBUG}" ]]
then
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug -DBBL_INTERNAL_TESTING=1"
Expand All @@ -166,6 +175,7 @@ then
echo "done"
echo "Building Snapmaker_Orca ..."
cmake --build build --target Snapmaker_Orca

echo "Building Snapmaker_Orca_profile_validator .."
cmake --build build --target Snapmaker_Orca_profile_validator
./run_gettext.sh
Expand All @@ -187,3 +197,4 @@ echo "[9/9] Generating Linux app..."
popd
echo "done"
fi

16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if (APPLE)
if (CMAKE_MACOSX_BUNDLE)
set(CMAKE_INSTALL_RPATH @executable_path/../Frameworks)
endif()
SET(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.snapmaker.snapmaker-slicer")
SET(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.snapmaker.snapmaker-orca")

message(STATUS "Orca: IS_CROSS_COMPILE: ${IS_CROSS_COMPILE}")
endif ()
Expand All @@ -86,6 +86,10 @@ foreach (_cache_var ${_cache_vars})
endif ()
endforeach()

if (SERVER_ENGINE)
add_definitions(-DSERVER_ENGINE)
endif ()

if (SLIC3R_GUI)
add_definitions(-DSLIC3R_GUI)
endif ()
Expand Down Expand Up @@ -738,7 +742,7 @@ if(SLIC3R_BUILD_TESTS)
endif()

if (NOT WIN32 AND NOT APPLE)
set(SLIC3R_APP_CMD "snapmaker-slicer")
set(SLIC3R_APP_CMD "snapmaker-orca")
configure_file(${LIBDIR}/platform/unix/build_appimage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/build_appimage.sh @ONLY)
endif()

Expand Down Expand Up @@ -788,17 +792,17 @@ set (CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/images\\\\Snapmaker_Orca.ico")
set (CPACK_NSIS_MUI_ICON "${CPACK_PACKAGE_ICON}")
set (CPACK_NSIS_MUI_UNIICON "${CPACK_PACKAGE_ICON}")
set (CPACK_NSIS_INSTALLED_ICON_NAME "$INSTDIR\\\\snapmaker-slicer.exe")
set (CPACK_NSIS_INSTALLED_ICON_NAME "$INSTDIR\\\\snapmaker-orca.exe")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
CreateShortCut \\\"$DESKTOP\\\\Snapmaker_Orca.lnk\\\" \\\"$INSTDIR\\\\snapmaker-slicer.exe\\\"
CreateShortCut \\\"$DESKTOP\\\\Snapmaker_Orca.lnk\\\" \\\"$INSTDIR\\\\snapmaker-orca.exe\\\"
")
set (CPACK_PACKAGE_CHECKSUM SHA256)
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Snapmaker_Orca")
set (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set (CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
# set (CPACK_NSIS_MODIFY_PATH "ON")
set(CPACK_PACKAGE_EXECUTABLES "snapmaker-slicer;Snapmaker_Orca")
set(CPACK_CREATE_DESKTOP_LINKS "snapmaker-slicer")
set(CPACK_PACKAGE_EXECUTABLES "snapmaker-orca;Snapmaker_Orca")
set(CPACK_CREATE_DESKTOP_LINKS "snapmaker-orca")
set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt) # must also include in install command

set(CPACK_WIX_UPGRADE_GUID "058245e8-20e0-4a95-9ab7-1acfe17ad511")
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ RUN [[ "$UID" != "0" ]] \

# Using an entrypoint instead of CMD because the binary
# accepts several command line arguments.
ENTRYPOINT ["/Snapmaker_Orca/build/package/bin/snapmaker-slicer"]
ENTRYPOINT ["/Snapmaker_Orca/build/package/bin/snapmaker-orca"]
2 changes: 1 addition & 1 deletion cmake/modules/MacOSXBundleInfo.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>com.snapmaker.snapmaker-slicer</string>
<string>com.snapmaker.snapmaker-orca</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
Expand Down
2 changes: 1 addition & 1 deletion flatpak/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ if [ $BAMBU_STUDIO_DARK_THEME == true ]; then
# echo "Message: $(date +%T): INFO: using dark theme variant"
fi

exec /app/bin/snapmaker-slicer "$@" &
exec /app/bin/snapmaker-orca "$@" &
$(/app/bin/set-dark-theme-variant.py) &
29 changes: 19 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ if (WIN32)
add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp BaseException.cpp BaseException.h StackWalker.cpp StackWalker.h)
else ()
add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp)

endif ()

if (MINGW)
Expand All @@ -130,12 +131,14 @@ endif (MINGW)

if (NOT WIN32 AND NOT APPLE)
# Binary name on unix like systems (Linux, Unix)
set_target_properties(Snapmaker_Orca PROPERTIES OUTPUT_NAME "snapmaker-slicer")
set(SLIC3R_APP_CMD "snapmaker-slicer")
set_target_properties(Snapmaker_Orca PROPERTIES OUTPUT_NAME "snapmaker-orca")
set(SLIC3R_APP_CMD "snapmaker-orca")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/unix/BuildLinuxImage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/BuildLinuxImage.sh @ONLY)
endif ()


target_link_libraries(Snapmaker_Orca libslic3r cereal::cereal)

if (APPLE)
# add_compile_options(-stdlib=libc++)
# add_definitions(-DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE)
Expand All @@ -152,7 +155,8 @@ endif ()
# Add the Slic3r GUI library, libcurl, OpenGL and GLU libraries.
if (SLIC3R_GUI)
# target_link_libraries(Snapmaker_Orca ws2_32 uxtheme setupapi libslic3r_gui ${wxWidgets_LIBRARIES})
target_link_libraries(Snapmaker_Orca libslic3r_gui)
target_link_libraries(Snapmaker_Orca libslic3r_gui)

if (MSVC)
# Generate debug symbols even in release mode.
target_link_options(Snapmaker_Orca PUBLIC "$<$<CONFIG:RELEASE>:/DEBUG>")
Expand All @@ -163,6 +167,7 @@ target_link_libraries(Snapmaker_Orca libslic3r_gui)
target_link_libraries(Snapmaker_Orca "-framework OpenGL")
else ()
target_link_libraries(Snapmaker_Orca -ldl)

endif ()
#if (WIN32)
# find_library(PSAPI_LIB NAMES Psapi)
Expand All @@ -184,7 +189,7 @@ if (WIN32)
endif()
target_compile_definitions(Snapmaker_Orca_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE)
add_dependencies(Snapmaker_Orca_app_gui Snapmaker_Orca)
set_target_properties(Snapmaker_Orca_app_gui PROPERTIES OUTPUT_NAME "snapmaker-slicer")
set_target_properties(Snapmaker_Orca_app_gui PROPERTIES OUTPUT_NAME "snapmaker-orca")
target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly)
endif ()

Expand Down Expand Up @@ -232,13 +237,14 @@ else ()
if (APPLE AND NOT CMAKE_MACOSX_BUNDLE)
# On OSX, the name of the binary matches the name of the Application.
add_custom_command(TARGET Snapmaker_Orca POST_BUILD
COMMAND ln -sf Snapmaker_Orca snapmaker-slicer
COMMAND ln -sf Snapmaker_Orca snapmaker-orca
WORKING_DIRECTORY "$<TARGET_FILE_DIR:Snapmaker_Orca>"
VERBATIM)
else ()
add_custom_command(TARGET Snapmaker_Orca POST_BUILD
WORKING_DIRECTORY "$<TARGET_FILE_DIR:Snapmaker_Orca>"
VERBATIM)
WORKING_DIRECTORY "$<TARGET_FILE_DIR:Snapmaker_Orca>"
VERBATIM)

endif ()
if (XCODE)
# Because of Debug/Release/etc. configurations (similar to MSVC) the slic3r binary is located in an extra level
Expand All @@ -252,16 +258,19 @@ else ()
set(BIN_RESOURCES_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/Snapmaker_Orca.app/Contents/Resources")
else()
set(BIN_RESOURCES_DIR "${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.app/Contents/Resources")

endif()
set(MACOSX_BUNDLE_ICON_FILE Icon.icns)
set(MACOSX_BUNDLE_BUNDLE_NAME "Snapmaker_Orca")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${SoftFever_VERSION})
set(MACOSX_BUNDLE_COPYRIGHT "Copyright(C) 2022-2024 Li Jiang All Rights Reserved")
endif()

add_custom_command(TARGET Snapmaker_Orca POST_BUILD
COMMAND ln -sfn "${SLIC3R_RESOURCES_DIR}" "${BIN_RESOURCES_DIR}"
COMMENT "Symlinking the resources directory into the build tree"
VERBATIM)
COMMAND ln -sfn "${SLIC3R_RESOURCES_DIR}" "${BIN_RESOURCES_DIR}"
COMMENT "Symlinking the resources directory into the build tree"
VERBATIM)

endif ()

# Slic3r binary install target. Default build type is release in case no CMAKE_BUILD_TYPE is provided.
Expand Down
10 changes: 6 additions & 4 deletions src/Snapmaker_Orca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6024,7 +6024,7 @@ void CLI::print_help(bool include_print_options, PrinterTechnology printer_techn
boost::nowide::cout
<< SLIC3R_APP_KEY <<"-"<< SLIC3R_VERSION << ":"
<< std::endl
<< "Usage: snapmaker-slicer [ OPTIONS ] [ file.3mf/file.stl ... ]" << std::endl
<< "Usage: snapmaker-orca [ OPTIONS ] [ file.3mf/file.stl ... ]" << std::endl
<< std::endl
<< "OPTIONS:" << std::endl;
cli_misc_config_def.print_cli_help(boost::nowide::cout, false);
Expand Down Expand Up @@ -6263,9 +6263,11 @@ LONG WINAPI VectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo)
extern "C" {
__declspec(dllexport) int __stdcall Snapmaker_Orca_main(int argc, wchar_t **argv)
{
// Convert wchar_t arguments to UTF8.
std::vector<std::string> argv_narrow;
std::vector<char*> argv_ptrs(argc + 1, nullptr);
std::vector<std::string> argv_narrow;
std::vector<char*> argv_ptrs(argc + 1, nullptr);

argv_ptrs.resize(argc + 1, nullptr);

for (size_t i = 0; i < argc; ++ i)
argv_narrow.emplace_back(boost::nowide::narrow(argv[i]));
for (size_t i = 0; i < argc; ++ i)
Expand Down
2 changes: 1 addition & 1 deletion src/platform/msw/Snapmaker_Orca.rc.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PRODUCTVERSION @SLIC3R_VERSION@
VALUE "ProductVersion", "@SLIC3R_BUILD_ID@"
VALUE "InternalName", "@SLIC3R_APP_NAME@"
VALUE "LegalCopyright", ""
VALUE "OriginalFilename", "snapmaker-slicer.exe"
VALUE "OriginalFilename", "snapmaker-orca.exe"
}
}
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion src/platform/unix/BambuGcodeviewer.desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Desktop Entry]
Name=Bambu GCode viewer
Exec=snapmaker-slicer --gcodeviewer %F
Exec=snapmaker-orca --gcodeviewer %F
Icon=Snapmaker_Orca-gcodeviewer
Terminal=false
Type=Application
Expand Down
4 changes: 2 additions & 2 deletions src/platform/unix/Snapmaker_Orca.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Name=Snapmaker_Orca
GenericName=3D Printing Software
Icon=Snapmaker_Orca
Exec=snapmaker-slicer %U
Exec=snapmaker-orca %U
Terminal=false
Type=Application
MimeType=model/stl;model/3mf;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;application/x-amf;
Categories=Graphics;3DGraphics;Engineering;
Keywords=3D;Printing;Slicer;slice;3D;printer;convert;gcode;stl;obj;amf;SLA
StartupNotify=false
StartupWMClass=snapmaker-slicer
StartupWMClass=snapmaker-orca
2 changes: 2 additions & 0 deletions src/slic3r/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ set(SLIC3R_GUI_SOURCES
Utils/SimplyPrint.hpp
)

include_directories(${CMAKE_SOURCE_DIR}/src)

if (WIN32)
list(APPEND SLIC3R_GUI_SOURCES
GUI/dark_mode/dark_mode.hpp
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/DesktopIntegrationDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void DesktopIntegrationDialog::perform_desktop_integration()
"Categories=Graphics;3DGraphics;Engineering;\n"
"Keywords=3D;Printing;Slicer;slice;3D;printer;convert;gcode;stl;obj;amf;SLA\n"
"StartupNotify=false\n"
"StartupWMClass=snapmaker-slicer\n", name_suffix, version_suffix, excutable_path);
"StartupWMClass=snapmaker-orca\n", name_suffix, version_suffix, excutable_path);

std::string path = GUI::format("%1%/applications/Snapmaker_Orca%2%.desktop", target_dir_desktop, version_suffix);
if (create_desktop_file(path, desktop_file)){
Expand Down
Loading

0 comments on commit 23c927b

Please sign in to comment.