git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6874 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
beaglejoe 2020-03-30 05:21:39 +00:00
parent b3a1204093
commit 88c8583bb7
10 changed files with 152 additions and 146 deletions

View File

@ -134,6 +134,7 @@ SD_SETUP_SETTINGS_VERSION()
SET_PROPERTY(GLOBAL PROPERTY SD_MODULE_LIST "")
SET_PROPERTY(GLOBAL PROPERTY SD_ROBOT_LIST "")
SET_PROPERTY(GLOBAL PROPERTY SD_OSG_PLUGIN_LIST "")
SET_PROPERTY(GLOBAL PROPERTY SD_EXE_LIST "")
# Sub-dirs to build ...
ADD_SUBDIRECTORY(src)
@ -147,6 +148,9 @@ SD_UPDATE_SETTINGS_VERSION()
# Usefull for using an installation of SD as a robot development framework without building it.
INSTALL_SD_CMAKE()
# Must be the last ADD_SUBDIRECTORY for FIXUP_BUNDLE to work
ADD_SUBDIRECTORY(packaging)
# Generate a 'make clobber'-like clobber.sh/.bat script in case of an in-source build.
IF("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
SD_GENERATE_CLOBBER_SCRIPT()
@ -169,5 +173,4 @@ IF(OPTION_PACKAGING)
ELSE(OPTION_PACKAGING)
# Configure CPack.
INCLUDE(cmake/packagemaker.cmake)
ENDIF(OPTION_PACKAGING)
ENDIF(OPTION_PACKAGING)

65
cmake/fixbundle.cmake.in Normal file
View File

@ -0,0 +1,65 @@
#==============================================================================
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#==============================================================================
INCLUDE(BundleUtilities)
SET(BU_CHMOD_BUNDLE_ITEMS ON)
SET(bundle "@CMAKE_BINARY_DIR@/@CMAKE_INSTALL_PREFIX@/@SD_BINDIR@/@PROJECT_NAME@@CMAKE_EXECUTABLE_SUFFIX@")
SET(loadables @SD_MODULE_LIST_ITEMS@)
SET(robots @SD_ROBOT_LIST_ITEMS@)
SET(osg-plugins @SD_OSG_PLUGIN_LIST_ITEMS@)
SET(plugins ${osg-plugins})
SET(_prefix_path @CMAKE_PREFIX_PATH@)
foreach(_MODULE ${loadables})
#message(STATUS "${_MODULE}")
LIST(APPEND plugins "@CMAKE_BINARY_DIR@/@CMAKE_INSTALL_PREFIX@/${_MODULE}")
endforeach()
message(STATUS "Robots...")
foreach(_ROBOT ${robots})
#message(STATUS "${_ROBOT}")
LIST(APPEND plugins "@CMAKE_BINARY_DIR@/@CMAKE_INSTALL_PREFIX@/${_ROBOT}")
endforeach()
#message(STATUS "plugins...")
#foreach(_MODULE ${plugins})
# message(STATUS "plugins = ${_MODULE}")
#endforeach()
# TODO - APPLE specific ?
SET(search_dirs )
IF(_prefix_path)
LIST(APPEND search_dirs "${_prefix_path}")
ENDIF(_prefix_path)
LIST(APPEND search_dirs "@CMAKE_BINARY_DIR@/@CMAKE_INSTALL_PREFIX@")
LIST(APPEND search_dirs "@CMAKE_INSTALL_PREFIX@/Frameworks")
LIST(APPEND search_dirs "@CMAKE_INSTALL_PREFIX@/MacOS")
LIST(APPEND search_dirs "@CMAKE_INSTALL_PREFIX@/lib64/games/speed-dreams-2/lib")
LIST(APPEND search_dirs "@CMAKE_INSTALL_PREFIX@/games/Plugins/osgPlugins-@OSG_PLUGIN_VERSION@")
FIXUP_BUNDLE("${bundle}" "${plugins}" "${search_dirs}")
message(STATUS bundle = "${bundle}")
message(STATUS plugins = "${plugins}")
message(STATUS search_dirs = "${search_dirs}")
message(STATUS _prefix_path = "${_prefix_path}")

View File

@ -206,6 +206,8 @@ MACRO(SD_ADD_EXECUTABLE TARGET_NAME)
ENDIF(MSVC)
SET_PROPERTY(GLOBAL APPEND PROPERTY SD_EXE_LIST "${SD_BINDIR}/${TARGET_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
# Make the "settings_versions" target depend on this target,
# in order settings_versions is built after them.
ADD_DEPENDENCIES(settings_versions ${TARGET_NAME})

79
packaging/CMakeLists.txt Normal file
View File

@ -0,0 +1,79 @@
#==============================================================================
#
# file : CMakeLists.txt
# copyright : (C) 2019 Joe Thompson
# email : beaglejoe@users.sourceforge.net
# web : www.speed-dreams.org
# version : $Id$
#
#==============================================================================
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#==============================================================================
INCLUDE(../cmake/macros.cmake)
#==============================================================================
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
# TODO get these elsewhwere...
SET(OSG_PLUGIN_VERSION 3.6.4)
SET(OSG_PLUGIN_DIR /opt/local/lib/osgPlugins-${OSG_PLUGIN_VERSION})
IF(OPTION_OSGGRAPH)
FILE(GLOB osg_plugins "${OSG_PLUGIN_DIR}/*.so")
message("osg_plugins = ${osg_plugins}")
FOREACH(pi ${osg_plugins})
INSTALL(FILES ${pi} DESTINATION ./games/PlugIns/osgPlugins-${OSG_PLUGIN_VERSION})
GET_FILENAME_COMPONENT(fname ${pi} NAME)
SET_PROPERTY(GLOBAL APPEND PROPERTY SD_OSG_PLUGIN_LIST "${CMAKE_INSTALL_PREFIX}/games/PlugIns/osgPlugins-${OSG_PLUGIN_VERSION}/${fname}")
ENDFOREACH()
ENDIF(OPTION_OSGGRAPH)
ENDIF()
#==============================================================================
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
GET_PROPERTY(SD_MODULE_LIST_ITEMS GLOBAL PROPERTY SD_MODULE_LIST)
GET_PROPERTY(SD_ROBOT_LIST_ITEMS GLOBAL PROPERTY SD_ROBOT_LIST)
GET_PROPERTY(SD_OSG_PLUGIN_LIST_ITEMS GLOBAL PROPERTY SD_OSG_PLUGIN_LIST)
#GET_PROPERTY(SD_EXE_LIST_ITEMS GLOBAL PROPERTY SD_EXE_LIST)
SET (_bundle "${CMAKE_INSTALL_PREFIX}/${SD_BINDIR}/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
SET(_loadables )
foreach(_MODULE ${SD_MODULE_LIST_ITEMS})
LIST(APPEND _loadables "${CMAKE_INSTALL_PREFIX}/${_MODULE}")
endforeach()
foreach(_ROBOT ${SD_ROBOT_LIST_ITEMS})
LIST(APPEND _loadables "${CMAKE_INSTALL_PREFIX}/${_MODULE}")
endforeach()
#================
# TODO figure out if this is needed...
IF(NOT OPTION_OFFICIAL_ONLY)
LIST(APPEND _loadables "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/libephemeris.dylib")
ENDIF(NOT OPTION_OFFICIAL_ONLY)
LIST(APPEND _loadables "${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/liblearning.dylib")
#================
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.in
${CMAKE_BINARY_DIR}/fixbundle.cmake @ONLY)
INSTALL(SCRIPT "${CMAKE_BINARY_DIR}/fixbundle.cmake")
#ADD_CUSTOM_TARGET(${_UNINST_TGT_NAME} "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake" )
ENDIF()

View File

@ -48,91 +48,9 @@ ENDIF(UNIX)
SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
GET_PROPERTY(SD_MODULE_LIST_ITEMS GLOBAL PROPERTY SD_MODULE_LIST)
GET_PROPERTY(SD_ROBOT_LIST_ITEMS GLOBAL PROPERTY SD_ROBOT_LIST)
GET_PROPERTY(SD_OSG_PLUGIN_LIST_ITEMS GLOBAL PROPERTY SD_OSG_PLUGIN_LIST)
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
SET(OSG_PLUGIN_VERSION 3.6.4)
SET(OSG_PLUGIN_DIR /opt/local/lib/osgPlugins-${OSG_PLUGIN_VERSION})
message("OSG_PLUGIN_DIR = ${OSG_PLUGIN_DIR}")
INSTALL(FILES ../../packaging/OSX/Info.plist DESTINATION ./Contents)
INSTALL(FILES ../../packaging/OSX/sd-icon-mac-256.icns DESTINATION ./Contents/Resources)
SET(APPS "\${CMAKE_INSTALL_PREFIX}/games/${_TARGET_NAME}")
SET(DIRS )
SET(PlugIns )
#SET(DIRS ${DIRS} "${OSG_PLUGIN_DIR}")
# need to switch on CMake version 3.8.0 ??
# use MacOS before 3.8.0
# use Frameworks from 3.8.0 onward
SET(DIRS ${DIRS} "\${CMAKE_INSTALL_PREFIX}/MacOS")
SET(DIRS ${DIRS} "\${CMAKE_INSTALL_PREFIX}/Frameworks")
SET(DIRS ${DIRS} "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib")
SET(DIRS ${DIRS} /opt/local/lib)
# TODO need to fixup some of these..
# These should be pulled into "\${CMAKE_INSTALL_PREFIX}/MacOS" as needed by others
IF(NOT OPTION_OFFICIAL_ONLY)
LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/libephemeris.dylib")
ENDIF(NOT OPTION_OFFICIAL_ONLY)
LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/liblearning.dylib")
#LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/libnetworking.dylib")
#LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/libportability.dylib")
#LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/librobottools.dylib")
#LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/libtgf.dylib")
#LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/libtgfclient.dylib")
#LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib/libtgfdata.dylib")
ENDIF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
foreach(_MODULE ${SD_MODULE_LIST_ITEMS})
#message(STATUS "\${CMAKE_INSTALL_PREFIX}/${_MODULE}")
LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/${_MODULE}")
endforeach()
foreach(_ROBOT ${SD_ROBOT_LIST_ITEMS})
#message(STATUS "\${CMAKE_INSTALL_PREFIX}/${_ROBOT}")
LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/${_ROBOT}")
endforeach()
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
IF(OPTION_OSGGRAPH)
#SET(OSG_PLUGIN_DIR /opt/local/lib/osgPlugins-${OSG_PLUGIN_VERSION})
#INSTALL(DIRECTORY "${OSG_PLUGIN_DIR}" DESTINATION ./MacOS FILES_MATCHING PATTERN "*.so")
LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/modules/graphic/osggraph.so")
FILE(GLOB osg_plugins "${OSG_PLUGIN_DIR}/*.so")
message("osg_plugins = ${osg_plugins}")
FOREACH(pi ${osg_plugins})
INSTALL(FILES ${pi} DESTINATION ./games/PlugIns/osgPlugins-${OSG_PLUGIN_VERSION})
GET_FILENAME_COMPONENT(fname ${pi} NAME)
message("fname = ${fname}")
LIST(APPEND PlugIns "\${CMAKE_INSTALL_PREFIX}/games/PlugIns/osgPlugins-${OSG_PLUGIN_VERSION}/${fname}")
ENDFOREACH()
ENDIF(OPTION_OSGGRAPH)
message("PlugIns = ${PlugIns}")
message("DIRS = ${DIRS}")
# These are installed by their respective CMakeLists.txt
# Executables
#LIST(APPEND PlugIns ${CMAKE_INSTALL_PREFIX}/games/sd2-accc)
#LIST(APPEND PlugIns ${CMAKE_INSTALL_PREFIX}/games/sd2-menuview)
#LIST(APPEND PlugIns ${CMAKE_INSTALL_PREFIX}/games/sd2-nfs2ac)
#LIST(APPEND PlugIns ${CMAKE_INSTALL_PREFIX}/games/sd2-nfsperf)
#LIST(APPEND PlugIns ${CMAKE_INSTALL_PREFIX}/games/sd2-sd2-trackgen)
INSTALL(CODE "
INCLUDE(BundleUtilities)
SET(BU_CHMOD_BUNDLE_ITEMS ON)
FIXUP_BUNDLE(\"${APPS}\" \"${PlugIns}\" \"${DIRS}\")")
INSTALL(FILES ../../packaging/OSX/sd-icon-mac-256.icns DESTINATION ./Contents/Resources)
ENDIF()
# Under Windows, install needed 3rd party DLLs close to Speed Dreams executable.

View File

@ -19,15 +19,3 @@ IF(UNIX)
ENDIF(UNIX)
SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
SET(APPS "\${CMAKE_INSTALL_PREFIX}/games/${_TARGET_NAME}")
SET(DIRS /opt/local)
SET(DIRS ${DIRS} "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib")
SET(PlugIns)
INSTALL(CODE "
INCLUDE(BundleUtilities)
SET(BU_CHMOD_BUNDLE_ITEMS ON)
FIXUP_BUNDLE(\"${APPS}\" \"${PlugIns}\" \"${DIRS}\")")
endif()

View File

@ -58,16 +58,3 @@ IF(UNIX)
ENDIF(UNIX)
SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
SET(APPS "\${CMAKE_INSTALL_PREFIX}/games/${_TARGET_NAME}")
SET(DIRS /opt/local)
SET(DIRS ${DIRS} "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib")
SET(PlugIns)
INSTALL(CODE "
INCLUDE(BundleUtilities)
SET(BU_CHMOD_BUNDLE_ITEMS ON)
FIXUP_BUNDLE(\"${APPS}\" \"${PlugIns}\" \"${DIRS}\")")
endif()

View File

@ -13,15 +13,3 @@ IF(UNIX)
ENDIF(UNIX)
SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
set(APPS "\${CMAKE_INSTALL_PREFIX}/games/${_TARGET_NAME}")
set(DIRS /opt/local)
set(DIRS ${DIRS} "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib")
set(PlugIns)
INSTALL(CODE "
include(BundleUtilities)
fixup_bundle(\"${APPS}\" \"${PlugIns}\" \"${DIRS}\")
" COMPONENT Runtime)
endif()

View File

@ -25,15 +25,3 @@ IF(UNIX)
ENDIF(UNIX)
SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
SET(APPS "\${CMAKE_INSTALL_PREFIX}/games/${_TARGET_NAME}")
SET(DIRS /opt/local)
SET(DIRS ${DIRS} "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib")
SET(PlugIns)
INSTALL(CODE "
INCLUDE(BundleUtilities)
SET(BU_CHMOD_BUNDLE_ITEMS ON)
FIXUP_BUNDLE(\"${APPS}\" \"${PlugIns}\" \"${DIRS}\")")
endif()

View File

@ -63,15 +63,3 @@ IF(UNIX)
ENDIF(UNIX)
SD_INSTALL_FILES(BIN TARGETS ${_TARGET_NAME})
IF((APPLE) AND ("${CMAKE_INSTALL_PREFIX}" MATCHES "\\.app$"))
SET(APPS "\${CMAKE_INSTALL_PREFIX}/games/${_TARGET_NAME}")
SET(DIRS /opt/local)
SET(DIRS ${DIRS} "\${CMAKE_INSTALL_PREFIX}/lib64/games/${_TARGET_NAME}/lib")
SET(PlugIns)
INSTALL(CODE "
INCLUDE(BundleUtilities)
SET(BU_CHMOD_BUNDLE_ITEMS ON)
FIXUP_BUNDLE(\"${APPS}\" \"${PlugIns}\" \"${DIRS}\")")
endif()