Permalink
Browse files

Made 'INSTALL' target almost working (with MSVC at least)

  • Loading branch information...
1 parent 11a5eec commit 2017b46aac9bc87ab6fa1b1a104e78d63474c635 @Sukender committed Mar 31, 2012
Showing with 45 additions and 16 deletions.
  1. +21 −12 CMakeLists.txt
  2. +3 −3 dependencies.cmake.in
  3. +21 −1 src/CMakeLists.txt
View
@@ -7,14 +7,14 @@
# Current status of these CMake scripts: pre-pre-alpha (Only MSVC-Pioneer compiles and runs, lots of features are missing)
# TODO:
-# - Fix linux linking/compiling (Filesystem...)
# - Prepare scripts for ALL projects (model viewer, etc.)
-# - Debug/Test PCH (seems not functional)
# - Replace PIONEER_VERSION / PIONEER_EXTRAVERSION usage with Version.h.
# Version.h/.cpp allow to grab versionning of VersionNumber.h without recompiling the entire project.
# - Same options as automake (to be listed)
-# - Write packaging code (to create distributions ZIP or installers)
-# - Test everything, especially compared to actual build systems.
+# - Write packaging code (to create distributions ZIP or installers).
+# Please note the install autodetects dependencies (.so, .dll) and install them alongside the executable if needed.
+# The install part should be okay, except for some MSVC system DLLs (MSVCRT...) which go in "/bin" instead of "/".
+# - Test everything, especially compared to actual build systems (TODO: list all features).
# - Eventually write a PNG+zlib finder that handles debug builds (for MSVC, actually)
#
# Date where build scripts have been successfully tested:
@@ -115,7 +115,7 @@ FIND_PACKAGE(VorbisFile REQUIRED)
#FIND_PACKAGE(libtool) # TODO: To create. Unix-like only. Not REQUIRED. According to jpabx: "it hides some of the differences between platforms, and deals with the .so version system so that builds can cope with multiple installed library versions"
#FIND_PACKAGE(Lua51) # Source is in contrib
FIND_PACKAGE(SigCpp2 REQUIRED)
-SET(PNG_NAMES png15_static libpng15_static)
+SET(PNG_NAMES png15_static libpng15_static) # Additional PNG names to look for
FIND_PACKAGE(PNG REQUIRED)
#FIND_PACKAGE(zlib REQUIRED) # Already called by findPNG
@@ -139,7 +139,7 @@ if(WIN32)
endif()
endif()
-ADD_DEFINITIONS(-D_USE_MATH_DEFINES) # Sukender: to get "PI" I guess?
+ADD_DEFINITIONS(-D_USE_MATH_DEFINES) # Sukender: to get "M_PI" I guess?
#########################################################################
# Precompiled headers support
@@ -340,12 +340,21 @@ IF(CMAKE_CPACK_COMMAND)
IF(BUILD_PACKAGES)
INCLUDE("CMakeModules/CPackProject.cmake" REQUIRED)
- # TODO Add files to pack
- #INSTALL(FILES FilesToPack/help_condor_multiple_filesystems.cmd DESTINATION "batch")
-
- # TODO Add directories to pack
- PACK_DATA_DIR("data/icons" ON)
-
+ # Add files to pack
+ INSTALL(FILES
+ AUTHORS.txt
+ Changelog.txt
+ COPYING.txt
+ fonts.COPYING.txt
+ lua.COPYING.txt
+ Modelviewer.txt
+ music.COPYING.txt
+ Quickstart.txt
+ README.txt
+ DESTINATION ".")
+
+ # Add directories to pack
+ PACK_DATA_DIR("data" ON)
ENDIF()
ENDIF()
View
@@ -17,13 +17,13 @@ SET(PREREQ_DIRS @PREREQ_DIRS@)
INCLUDE(GetPrerequisites REQUIRED)
GET_PREREQUISITES("${EXE_PATH}" DEPENDENCIES 1 1 "${EXE_PATH}" "${PREREQ_DIRS}")
-#MESSAGE("Installing dependencies into: ${CMAKE_INSTALL_PREFIX}/bin")
+#MESSAGE("Installing dependencies into: ${CMAKE_INSTALL_PREFIX}/${DESTINATION_DIR}")
FOREACH(DEPENDENCY ${DEPENDENCIES})
#FOREACH(DEPENDENCY ${DEPENDENCIES_FULL_PATHS})
GP_RESOLVE_ITEM("${EXE_PATH}" "${DEPENDENCY}" "${EXE_PATH}" "${PREREQ_DIRS}" ${DEPENDENCY_NAME}_REAL_PATH)
IF(@DEPENDENCIES_VERBOSE@)
MESSAGE("DEPENDENCY_REAL_PATH: ${${DEPENDENCY_NAME}_REAL_PATH}")
ENDIF()
- FILE(COPY ${${DEPENDENCY_NAME}_REAL_PATH} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
- #INSTALL(FILES "${DEPENDENCY}" DESTINATION bin)
+ FILE(COPY ${${DEPENDENCY_NAME}_REAL_PATH} DESTINATION "${CMAKE_INSTALL_PREFIX}/${DESTINATION_DIR}")
+ #INSTALL(FILES "${DEPENDENCY}" DESTINATION ${DESTINATION_DIR})
ENDFOREACH()
View
@@ -541,5 +541,25 @@ SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${${PROJECT_NAME}_VERSION})
#############################################################
# PACKAGE
-INCLUDE(ModuleInstall)
+#INCLUDE(ModuleInstall) # Installs binary in '/bin'
+set(DESTINATION_DIR ".")
+INSTALL(
+ TARGETS ${TARGETNAME}
+ RUNTIME DESTINATION "${DESTINATION_DIR}" COMPONENT mainComponent
+)
+
+IF(${PROJECT_NAME}_INSTALL_DEPENDENCIES)
+ # Install direct dependencies
+ FOREACH(CURCONFIG ${CMAKE_CONFIGURATION_TYPES})
+ GET_TARGET_PROPERTY(LOCATION_${CURCONFIG} "${TARGETNAME}" LOCATION_${CURCONFIG})
+ ENDFOREACH()
+ CONFIGURE_FILE(
+ "${CMAKE_SOURCE_DIR}/dependencies.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/dependencies.${TARGETNAME}.cmake"
+ @ONLY
+ )
+ INCLUDE(InstallRequiredSystemLibraries REQUIRED)
+ INSTALL(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/dependencies.${TARGETNAME}.cmake")
+ENDIF()
+
#############################################################

0 comments on commit 2017b46

Please sign in to comment.