Skip to content

Instantly share code, notes, and snippets.

@keis
Created February 1, 2011 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keis/806713 to your computer and use it in GitHub Desktop.
Save keis/806713 to your computer and use it in GitHub Desktop.
install stuff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1031631..d8f9b5c 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,10 +16,14 @@ endif()
if(WIN32)
set(CMAKE_MODULE_PATH "$ENV{OGRE_HOME}/CMake/;${CMAKE_MODULE_PATH}")
+ set(DATA_DIR bin/Release/Resources)
+ set(RELEASE_DIR bin/Release)
endif(WIN32)
if(UNIX)
- set(CMAKE_MODULE_PATH "/usr/local/lib/OGRE/cmake/;${CMAKE_MODULE_PATH}")
+ set(CMAKE_MODULE_PATH "/usr/lib/OGRE/cmake/;${CMAKE_MODULE_PATH}")
+ set(DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/OgreMeshy)
+ set(RELEASE_DIR bin/Release_Linux)
endif(UNIX)
if (CMAKE_BUILD_TYPE STREQUAL "")
@@ -48,6 +52,7 @@ include_directories( "${OgreMeshy_SOURCE_DIR}/include" )
set (HEADER_FILES
include/CmdSettings.h
include/Constants.h
+ include/config.h
include/Core/AnimationPanel.h
include/Core/GridSettingsImpl.h
include/Core/Panels/LightsPanel.h
@@ -67,8 +72,39 @@ set (SOURCE_FILES
src/Core/wxOgreRenderWindow.cpp
)
+set (MODEL_FILES
+ scripts/Resources/Other/Grid.material
+ scripts/Resources/Other/Grid.png
+ scripts/Resources/Blender/Axis.material
+ scripts/Resources/Blender/Axis.mesh
+ scripts/Resources/Blender/Bones/BoneMesh.material
+ scripts/Resources/Blender/Bones/Bones.png
+ scripts/Resources/Blender/Bones/BoneTip.mesh
+ scripts/Resources/Blender/Bones/BoneGlobe.mesh
+ )
+
+set (ICON_FILES
+ scripts/Resources/Icons/32x32/File.png
+ scripts/Resources/Icons/32x32/Reload.png
+ scripts/Resources/Icons/32x32/ShowAxes.png
+ scripts/Resources/Icons/32x32/ShowBones.png
+ scripts/Resources/Icons/32x32/BoundingBox.png
+ scripts/Resources/Icons/32x32/Wireframe.png
+ scripts/Resources/Icons/32x32/ChangeBGColour.png
+ )
+
+configure_file (
+ "include/config.h.in"
+ "include/config.h"
+ @ONLY)
+
ADD_EXECUTABLE(OgreMeshy ${HEADER_FILES} ${SOURCE_FILES} )
TARGET_LINK_LIBRARIES( OgreMeshy ${wxWidgets_LIBRARIES} )
TARGET_LINK_LIBRARIES( OgreMeshy ${GTK2_LIBRARIES} )
TARGET_LINK_LIBRARIES( OgreMeshy ${OGRE_LIBRARIES} )
-TARGET_LINK_LIBRARIES( OgreMeshy ${OPENGL_LIBRARIES} )
\ No newline at end of file
+TARGET_LINK_LIBRARIES( OgreMeshy ${OPENGL_LIBRARIES} )
+
+install (TARGETS OgreMeshy DESTINATION bin)
+install (FILES ${RELEASE_DIR}/Plugins.cfg DESTINATION ${DATA_DIR})
+install (FILES ${ICON_FILES} DESTINATION ${DATA_DIR}/Icons/32x32)
+install (FILES ${MODEL_FILES} DESTINATION ${DATA_DIR}/Models)
diff --git a/bin/Release_Linux/Plugins.cfg b/bin/Release_Linux/Plugins.cfg
index f467c0f..b9561ad 100755
--- a/bin/Release_Linux/Plugins.cfg
+++ b/bin/Release_Linux/Plugins.cfg
@@ -1,13 +1,13 @@
# Defines plugins to load
# Define plugin folder
-PluginFolder=Plugins
+PluginFolder=/usr/lib/OGRE
# Define plugins
# Plugin=RenderSystem_Direct3D11
Plugin=RenderSystem_GL
# Plugin=RenderSystem_GLES
# Plugin=RenderSystem_GLES2
- Plugin=Plugin_CgProgramManager
+# Plugin=Plugin_CgProgramManager
Plugin=Plugin_OctreeSceneManager
- Plugin=Plugin_ParticleFX
\ No newline at end of file
+ Plugin=Plugin_ParticleFX
diff --git a/include/config.h.in b/include/config.h.in
new file mode 100644
index 0000000..e3426dd
--- /dev/null
+++ b/include/config.h.in
@@ -0,0 +1 @@
+#define DATA_DIRECTORY "@DATA_DIR@/"
diff --git a/src/Core/wxOgreMeshViewerMainFrame.cpp b/src/Core/wxOgreMeshViewerMainFrame.cpp
index eead365..d82ade5 100755
--- a/src/Core/wxOgreMeshViewerMainFrame.cpp
+++ b/src/Core/wxOgreMeshViewerMainFrame.cpp
@@ -5,6 +5,7 @@
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
+#include "config.h"
#include "Core/wxOgreMeshViewerMainFrame.h"
///////////////////////////////////////////////////////////////////////////
@@ -121,14 +122,14 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co
m_toolBar = this->CreateToolBar( wxTB_HORIZONTAL, wxID_ANY );
m_toolBar->SetToolBitmapSize( wxSize( 32,32 ) );
- m_toolBar->AddTool( wxID_MENUFILELOAD, wxT("tool"), wxBitmap( wxT("Resources/Icons/32x32/File.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_NORMAL, wxT("Loads a new mesh"), wxT("Loads a new mesh") );
- m_toolBar->AddTool( wxID_MENURELOADMESH, wxT("tool"), wxBitmap( wxT("Resources/Icons/32x32/Reload.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_NORMAL, wxT("Reload mesh"), wxT("Reloads active mesh from hard drive") );
+ m_toolBar->AddTool( wxID_MENUFILELOAD, wxT("tool"), wxBitmap( DATA_DIRECTORY wxT("Icons/32x32/File.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_NORMAL, wxT("Loads a new mesh"), wxT("Loads a new mesh") );
+ m_toolBar->AddTool( wxID_MENURELOADMESH, wxT("tool"), wxBitmap( DATA_DIRECTORY wxT("Icons/32x32/Reload.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_NORMAL, wxT("Reload mesh"), wxT("Reloads active mesh from hard drive") );
m_toolBar->AddSeparator();
- m_toolBar->AddTool( wxID_MENUVIEWSHOWAXES, wxT("tool"), wxBitmap( wxT("Resources/Icons/32x32/ShowAxes.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_CHECK, wxT("Show axes"), wxT("Shows XYZ axes") );
- m_toolBar->AddTool( wxID_MENUSHOWBONES, wxT("tool"), wxBitmap( wxT("Resources/Icons/32x32/ShowBones.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_CHECK, wxT("Show Bones"), wxT("Displays the skeleton nodes to view their orientation or spot errors") );
- m_toolBar->AddTool( wxID_MENUSHOWBOUNDINGBOX, wxT("tool"), wxBitmap( wxT("Resources/Icons/32x32/BoundingBox.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_CHECK, wxT("Show Bounding Box"), wxT("Shows or hides a box enclosing the mesh") );
- m_toolBar->AddTool( wxID_MENUTOGGLEWIREFRAME, wxT("Toggle Wireframe"), wxBitmap( wxT("Resources/Icons/32x32/Wireframe.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_CHECK, wxT("Toggles Wireframe mode"), wxT("Turns wireframe mode on & off") );
- m_toolBar->AddTool( wxID_MENUCHANGEBGCOLOUR, wxT("tool"), wxBitmap( wxT("Resources/Icons/32x32/ChangeBGColour.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_NORMAL, wxT("Change background colour"), wxT("Changes the (\"clear\") colour of the background") );
+ m_toolBar->AddTool( wxID_MENUVIEWSHOWAXES, wxT("tool"), wxBitmap( DATA_DIRECTORY wxT("Icons/32x32/ShowAxes.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_CHECK, wxT("Show axes"), wxT("Shows XYZ axes") );
+ m_toolBar->AddTool( wxID_MENUSHOWBONES, wxT("tool"), wxBitmap( DATA_DIRECTORY wxT("Icons/32x32/ShowBones.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_CHECK, wxT("Show Bones"), wxT("Displays the skeleton nodes to view their orientation or spot errors") );
+ m_toolBar->AddTool( wxID_MENUSHOWBOUNDINGBOX, wxT("tool"), wxBitmap( DATA_DIRECTORY wxT("Icons/32x32/BoundingBox.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_CHECK, wxT("Show Bounding Box"), wxT("Shows or hides a box enclosing the mesh") );
+ m_toolBar->AddTool( wxID_MENUTOGGLEWIREFRAME, wxT("Toggle Wireframe"), wxBitmap( DATA_DIRECTORY wxT("Icons/32x32/Wireframe.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_CHECK, wxT("Toggles Wireframe mode"), wxT("Turns wireframe mode on & off") );
+ m_toolBar->AddTool( wxID_MENUCHANGEBGCOLOUR, wxT("tool"), wxBitmap( DATA_DIRECTORY wxT("Icons/32x32/ChangeBGColour.png"), wxBITMAP_TYPE_ANY ), wxNullBitmap, wxITEM_NORMAL, wxT("Change background colour"), wxT("Changes the (\"clear\") colour of the background") );
m_toolBar->Realize();
m_statusBar1 = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
diff --git a/src/Core/wxOgreMeshViewerMainFrameImpl.cpp b/src/Core/wxOgreMeshViewerMainFrameImpl.cpp
index d2a4956..fce5e66 100755
--- a/src/Core/wxOgreMeshViewerMainFrameImpl.cpp
+++ b/src/Core/wxOgreMeshViewerMainFrameImpl.cpp
@@ -35,6 +35,7 @@
#include "iostream"
#include "Constants.h"
+#include "config.h"
MeshyMainFrameImpl::MeshyMainFrameImpl( wxWindow* parent, const CmdSettings &cmdSettings ) :
@@ -94,7 +95,8 @@ MeshyMainFrameImpl::MeshyMainFrameImpl( wxWindow* parent, const CmdSettings &cmd
//Initialize internal, permanent resources
Ogre::ResourceGroupManager::getSingleton().createResourceGroup( c_InterMeshPermGroup );
- Ogre::ResourceGroupManager::getSingleton().addResourceLocation( "Resources/Models", "FileSystem",
+ Ogre::ResourceGroupManager::getSingleton().addResourceLocation( DATA_DIRECTORY "Models",
+ "FileSystem",
c_InterMeshPermGroup );
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup( c_InterMeshPermGroup );
@@ -277,7 +279,8 @@ void MeshyMainFrameImpl::loadSettings()
//-----------------------------------------------------------------------------
void MeshyMainFrameImpl::initOgre( bool bForceSetup )
{
- m_root = new Ogre::Root( "Plugins.cfg", m_configDirectory + "ogre.cfg",
+ m_root = new Ogre::Root( DATA_DIRECTORY "Plugins.cfg",
+ m_configDirectory + "ogre.cfg",
m_configDirectory + "Ogre.log" );
Ogre::LogManager::getSingleton().getDefaultLog()->addListener( this );
if( bForceSetup || !m_root->restoreConfig() )
@@ -1209,4 +1212,4 @@ void MeshyMainFrameImpl::messageLogged( const Ogre::String& message, Ogre::LogMe
{
//TODO: Use colours.
m_ogreLog->AppendText( wxString( (message + "\n").c_str(), wxConvUTF8 ) );
-}
\ No newline at end of file
+}
diff --git a/src/main.cpp b/src/main.cpp
index e33d4be..692f0f9 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -123,11 +123,11 @@ void wxWidgetsApp::setWorkingDirectory()
SetCurrentDirectory( fullAppPath.GetPath() );
#else
//This ought to work in Unix, but I didn't test it, otherwise try setenv()
- chdir( fullAppPath.GetPath().mb_str() );
+ //chdir( fullAppPath.GetPath().mb_str() );
//Most Ogre materials assume floating point to use radix point, not comma.
//Prevent awfull number truncation in non-US systems
//(I love standarization...)
setlocale( LC_NUMERIC, "C" );
#endif
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment