mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Build: Fix install targets, add SLIC3R_FHS, check resource dir on GUI_App init
Fix #1515
This commit is contained in:
		
							parent
							
								
									02e1636831
								
							
						
					
					
						commit
						8bc8dfaba4
					
				
					 5 changed files with 45 additions and 7 deletions
				
			
		|  | @ -33,6 +33,7 @@ if(PNG_FOUND AND NOT RASTERIZER_FORCE_BUILTIN_LIBPNG) | |||
| else() | ||||
|     set(ZLIB_LIBRARY "") | ||||
|     message(WARNING "Using builtin libpng. This can cause crashes on some platforms.") | ||||
|     set(SKIP_INSTALL_ALL 1)   # Prevent png+zlib from creating install targets | ||||
|     add_subdirectory(png/zlib) | ||||
|     set(ZLIB_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/png/zlib ${CMAKE_CURRENT_BINARY_DIR}/png/zlib) | ||||
|     include_directories(${ZLIB_INCLUDE_DIR}) | ||||
|  | @ -188,3 +189,15 @@ else () | |||
|         VERBATIM | ||||
|     ) | ||||
| endif() | ||||
| 
 | ||||
| # Slic3r binary install target | ||||
| if (WIN32) | ||||
|     install(TARGETS slic3r RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") | ||||
|     if (MSVC) | ||||
|         install(TARGETS slic3r_app_gui RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") | ||||
|         install(TARGETS slic3r_app_console RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") | ||||
|         install(TARGETS slic3r_app_noconsole RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") | ||||
|     endif () | ||||
| else () | ||||
|     install(TARGETS slic3r RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") | ||||
| endif () | ||||
|  |  | |||
							
								
								
									
										2
									
								
								src/platform/unix/fhs.hpp.in
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/platform/unix/fhs.hpp.in
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | |||
| #cmakedefine SLIC3R_FHS @SLIC3R_FHS@ | ||||
| #define SLIC3R_FHS_RESOURCES "@SLIC3R_FHS_RESOURCES@" | ||||
|  | @ -22,6 +22,8 @@ | |||
| #include <boost/nowide/cenv.hpp> | ||||
| #include <boost/nowide/iostream.hpp> | ||||
| 
 | ||||
| #include "unix/fhs.hpp"  // Generated by CMake from ../platform/unix/fhs.hpp.in
 | ||||
| 
 | ||||
| #include "libslic3r/libslic3r.h" | ||||
| #include "libslic3r/Config.hpp" | ||||
| #include "libslic3r/Geometry.hpp" | ||||
|  | @ -77,6 +79,10 @@ int main(int argc, char **argv) | |||
|     // The resources are packed to 'resources'
 | ||||
|     // Path from Slic3r binary to resources:
 | ||||
|     boost::filesystem::path path_resources = path_to_binary.parent_path() / "resources"; | ||||
| #elif defined SLIC3R_FHS | ||||
|     // The application is packaged according to the Linux Filesystem Hierarchy Standard
 | ||||
|     // Resources are set to the 'Architecture-independent (shared) data', typically /usr/share or /usr/local/share
 | ||||
|     boost::filesystem::path path_resources = SLIC3R_FHS_RESOURCES; | ||||
| #else | ||||
|     // The application is packed in the .tar.bz archive (or in AppImage) as 'bin/slic3r',
 | ||||
|     // The resources are packed to 'resources'
 | ||||
|  |  | |||
|  | @ -5,7 +5,6 @@ | |||
| 
 | ||||
| #include <boost/lexical_cast.hpp> | ||||
| #include <boost/algorithm/string.hpp> | ||||
| #include <boost/filesystem.hpp> | ||||
| 
 | ||||
| #include <wx/stdpaths.h> | ||||
| #include <wx/imagpng.h> | ||||
|  | @ -15,6 +14,7 @@ | |||
| #include <wx/filedlg.h> | ||||
| #include <wx/dir.h> | ||||
| #include <wx/wupdlock.h> | ||||
| #include <wx/filefn.h> | ||||
| 
 | ||||
| #include "libslic3r/Utils.hpp" | ||||
| #include "libslic3r/Model.hpp" | ||||
|  | @ -83,6 +83,11 @@ GUI_App::GUI_App() | |||
| 
 | ||||
| bool GUI_App::OnInit() | ||||
| { | ||||
|     // Verify resources path
 | ||||
|     const wxString resources_dir = from_u8(Slic3r::resources_dir()); | ||||
|     wxCHECK_MSG(wxDirExists(resources_dir), false, | ||||
|         wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir)); | ||||
| 
 | ||||
| #if ENABLE_IMGUI | ||||
|     wxCHECK_MSG(m_imgui->init(), false, "Failed to initialize ImGui"); | ||||
| #endif // ENABLE_IMGUI
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vojtech Kral
						Vojtech Kral