Commit 63baddcf authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - now shaders and config files get copied to share instead of bin

parent e9ea8c81
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT( OpenWalnut ) PROJECT( OpenWalnut )
# append search path for FindModules: # append search path for FindModules:
#------------------------------------ #------------------------------------
LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../tools/CMakeModules ) LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../tools/CMakeModules )
...@@ -13,6 +12,7 @@ INCLUDE( ${PROJECT_SOURCE_DIR}/../tools/CMakeModules/Utils.cmake ) ...@@ -13,6 +12,7 @@ INCLUDE( ${PROJECT_SOURCE_DIR}/../tools/CMakeModules/Utils.cmake )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin ) SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib ) SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib ) SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib )
SET( SHARED_FILES_RELATIVE "../share/${CMAKE_PROJECT_NAME}" CACHE PATH "Relative path to bin/ denoting the destination for shaders and cfg files." ) # this path us the relative path to bin/ used for all shared files like shaders and config file
# CMAKE automatism to select static vs. shared building: # CMAKE automatism to select static vs. shared building:
#------------------------------------------------------- #-------------------------------------------------------
...@@ -133,6 +133,8 @@ ENDIF() ...@@ -133,6 +133,8 @@ ENDIF()
SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DDEBUG -O2" CACHE STRING "" FORCE ) SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DDEBUG -O2" CACHE STRING "" FORCE )
add_definitions( '-DW_SHARED_FILES_RELATIVE="${SHARED_FILES_RELATIVE}"' ) # this relative path is used for all shared files like shaders and config files
ADD_SUBDIRECTORY( dataHandler ) ADD_SUBDIRECTORY( dataHandler )
ADD_SUBDIRECTORY( graphicsEngine ) ADD_SUBDIRECTORY( graphicsEngine )
ADD_SUBDIRECTORY( gui ) ADD_SUBDIRECTORY( gui )
...@@ -147,7 +149,7 @@ option( OW_COPY_SHADERS "This enables copying shaders with every make call." ON ...@@ -147,7 +149,7 @@ option( OW_COPY_SHADERS "This enables copying shaders with every make call." ON
if( OW_COPY_SHADERS ) if( OW_COPY_SHADERS )
add_custom_target( shaderDirectoryConfiguration add_custom_target( shaderDirectoryConfiguration
ALL ALL
COMMAND ${CMAKE_COMMAND} -D OW_SOURCE_DIR:STRING=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/../tools/CMakeModules/UpdateShaders.cmake COMMAND ${CMAKE_COMMAND} -D OW_SOURCE_DIR:STRING=${PROJECT_SOURCE_DIR} -D SHARED_FILES_RELATIVE:PATH=${SHARED_FILES_RELATIVE} -P ${PROJECT_SOURCE_DIR}/../tools/CMakeModules/UpdateShaders.cmake
COMMENT "Put all shaders to the right place or update them if they are already there." COMMENT "Put all shaders to the right place or update them if they are already there."
) )
endif( OW_COPY_SHADERS ) endif( OW_COPY_SHADERS )
...@@ -175,9 +177,9 @@ ELSE() ...@@ -175,9 +177,9 @@ ELSE()
ENDIF() ENDIF()
#---------- walnut.cfg file ------------- #---------- walnut.cfg file -------------
IF( NOT EXISTS ${PROJECT_BINARY_DIR}/bin/walnut.cfg ) IF( NOT EXISTS ${PROJECT_BINARY_DIR}/bin/${SHARED_FILES_RELATIVE}/walnut.cfg )
CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/../doc/user/walnut.cfg.mpi ${PROJECT_BINARY_DIR}/bin/walnut.cfg COPYONLY ) CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/../doc/user/walnut.cfg.mpi ${PROJECT_BINARY_DIR}/bin/${SHARED_FILES_RELATIVE}/walnut.cfg COPYONLY )
MESSAGE( STATUS "Copied ${PROJECT_SOURCE_DIR}/../doc/user/walnut.cfg.mpi to ${PROJECT_BINARY_DIR}/bin/walnut.cfg" ) MESSAGE( STATUS "Copied ${PROJECT_SOURCE_DIR}/../doc/user/walnut.cfg.mpi to ${PROJECT_BINARY_DIR}/bin/${SHARED_FILES_RELATIVE}/walnut.cfg" )
ENDIF() ENDIF()
# Special targets: # Special targets:
......
...@@ -138,7 +138,7 @@ int WQt4Gui::run() ...@@ -138,7 +138,7 @@ int WQt4Gui::run()
boost::filesystem::path walnutBin = boost::filesystem::path( std::string( m_argv[0] ) ); boost::filesystem::path walnutBin = boost::filesystem::path( std::string( m_argv[0] ) );
boost::filesystem::path appPath = walnutBin.parent_path(); boost::filesystem::path appPath = walnutBin.parent_path();
// init preference system // init preference system
WPreferences::setPreferenceFile( appPath / "walnut.cfg" ); WPreferences::setPreferenceFile( appPath / W_SHARED_FILES_RELATIVE / "walnut.cfg" );
QApplication appl( m_argc, m_argv, true ); QApplication appl( m_argc, m_argv, true );
......
...@@ -211,7 +211,7 @@ void WKernel::findAppPath() ...@@ -211,7 +211,7 @@ void WKernel::findAppPath()
WLogger::getLogger()->addLogMessage( "Application path: " + m_appPath.file_string(), "Kernel", LL_DEBUG ); WLogger::getLogger()->addLogMessage( "Application path: " + m_appPath.file_string(), "Kernel", LL_DEBUG );
m_shaderPath = boost::filesystem::path( m_appPath / "shaders" ); m_shaderPath = boost::filesystem::path( m_appPath / W_SHARED_FILES_RELATIVE / "shaders" );
WLogger::getLogger()->addLogMessage( "Shader path: " + m_shaderPath.file_string(), "Kernel", LL_DEBUG ); WLogger::getLogger()->addLogMessage( "Shader path: " + m_shaderPath.file_string(), "Kernel", LL_DEBUG );
// NOTE: currently, OpenSceneGraph has hard-coded its search path for fonts. So we can't change it to somewhere else currently. // NOTE: currently, OpenSceneGraph has hard-coded its search path for fonts. So we can't change it to somewhere else currently.
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
# updates them if they are already there. # updates them if they are already there.
#-------------------------------------------------------------------- #--------------------------------------------------------------------
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/shaders) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/${SHARED_FILES_RELATIVE}/shaders)
FILE( GLOB_RECURSE ALL_GE_SHADERS ${OW_SOURCE_DIR}/graphicsEngine/shaders/* ) FILE( GLOB_RECURSE ALL_GE_SHADERS ${OW_SOURCE_DIR}/graphicsEngine/shaders/* )
FOREACH( fname ${ALL_GE_SHADERS} ) FOREACH( fname ${ALL_GE_SHADERS} )
#message( ${fname} ) #message( ${fname} )
configure_file( ${fname} ${CMAKE_BINARY_DIR}/bin/shaders/ COPYONLY) configure_file( ${fname} ${CMAKE_BINARY_DIR}/bin/${SHARED_FILES_RELATIVE}/shaders/ COPYONLY)
ENDFOREACH( fname ) ENDFOREACH( fname )
FILE( GLOB_RECURSE ALL_MODULE_SHADERS ${OW_SOURCE_DIR}/modules/*/shaders/* ) FILE( GLOB_RECURSE ALL_MODULE_SHADERS ${OW_SOURCE_DIR}/modules/*/shaders/* )
FOREACH( fname ${ALL_MODULE_SHADERS} ) FOREACH( fname ${ALL_MODULE_SHADERS} )
#message( ${fname} ) message( WARNING ${SHARED_FILES_RELATIVE} )
configure_file( ${fname} ${CMAKE_BINARY_DIR}/bin/shaders/ COPYONLY) configure_file( ${fname} ${CMAKE_BINARY_DIR}/bin/${SHARED_FILES_RELATIVE}/shaders/ COPYONLY)
ENDFOREACH( fname ) ENDFOREACH( fname )
FILE( GLOB_RECURSE ALL_KERNELMODULE_SHADERS ${OW_SOURCE_DIR}/kernel/modules/*/shaders/* ) FILE( GLOB_RECURSE ALL_KERNELMODULE_SHADERS ${OW_SOURCE_DIR}/kernel/modules/*/shaders/* )
FOREACH( fname ${ALL_KERNELMODULE_SHADERS} ) FOREACH( fname ${ALL_KERNELMODULE_SHADERS} )
#message( ${fname} ) #message( ${fname} )
configure_file( ${fname} ${CMAKE_BINARY_DIR}/bin/shaders/ COPYONLY) configure_file( ${fname} ${CMAKE_BINARY_DIR}/bin/${SHARED_FILES_RELATIVE}/shaders/ COPYONLY)
ENDFOREACH( fname ) ENDFOREACH( fname )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment