diff --git a/CMakeLists.txt b/CMakeLists.txt index 00cbb262..d03fde38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,3 +157,33 @@ include_directories("${CURL_INCLUDE_DIRS}") add_subdirectory(Resources) add_subdirectory(Sources) + +install(FILES AUTHORS ChangeLog LICENSE README.md DESTINATION bin) + +#see http://www.cmake.org/cmake/help/v2.8.11/cpack.html + +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenSpades") +set(CPACK_PACKAGE_VENDOR "yvt, assorted") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_VERSION_MAJOR ${OpenSpades_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${OpenSpades_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${OpenSpades_VERSION_REVISION}) +set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") +if(WIN32 AND NOT UNIX) + # There is a bug in NSIS that does not handle full unix paths properly. Make + # sure there is at least one set of four (4) backlasshes. + set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\OpenSpades.exe") + set(CPACK_NSIS_HELP_LINK "https://sites.google.com/a/yvt.jp/openspades/") + set(CPACK_NSIS_URL_INFO_ABOUT "http://buildandshoot.com/viewforum.php?f=57") + #SET(CPACK_NSIS_CONTACT "me@my-personal-home-page.com") + set(CPACK_NSIS_MODIFY_PATH ON) + set(CPACK_PACKAGING_INSTALL_PREFIX "/") +else() + set(CPACK_STRIP_FILES "bin/OpenSpades") + set(CPACK_SOURCE_STRIP_FILES "") +endif(WIN32 AND NOT UNIX) +set(CPACK_PACKAGE_EXECUTABLES "OpenSpades" "OpenSpades") +set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE) #everyone hates a dir inside a zip named exactly like the zip +include(CPack) + diff --git a/Resources/CMakeLists.txt b/Resources/CMakeLists.txt index 56249f95..a4e5d86a 100644 --- a/Resources/CMakeLists.txt +++ b/Resources/CMakeLists.txt @@ -2,13 +2,15 @@ if(RESDIR_DEFINED) add_custom_target(copy_resources ALL COMMENT "Copying resources") - - file(GLOB_RECURSE SHADERS Shaders/*) - foreach(FILE ${SHADERS}) + install(FILES ${RESDIR}/pak000-Base.pak ${RESDIR}/pak001-Models.pak ${RESDIR}/pak002-Sounds.pak DESTINATION bin/Resources) + file(GLOB_RECURSE RESOURCES Shaders/* Scripts/*) + foreach(FILE ${RESOURCES}) string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR} ${RESDIR} TARGETFILE ${FILE}) get_filename_component(TARGETDIR ${TARGETFILE} PATH) add_custom_command(TARGET copy_resources COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGETDIR}") add_custom_command(TARGET copy_resources COMMAND ${CMAKE_COMMAND} -E copy_if_different "${FILE}" "${TARGETFILE}") endforeach() - endif() + +install(DIRECTORY "Scripts" DESTINATION bin/Resources) +install(DIRECTORY "Shaders" DESTINATION bin/Resources) diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index fceedb25..e9a7fe95 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -41,6 +41,7 @@ if(WIN32) string(REGEX REPLACE "\\.lib$" ".dll" SDL_DLL ${LIB}) if(EXISTS "${SDL_DLL}") add_custom_command(TARGET OpenSpades POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL_DLL}" "${CMAKE_BINARY_DIR}/bin/\$\(Configuration\)/") + install(PROGRAMS ${SDL_DLL} DESTINATION bin) endif() endforeach() add_definitions(-DCURL_STATICLIB) @@ -78,3 +79,5 @@ if(WIN32) else() target_link_libraries(OpenSpades Xext) endif() + +install(TARGETS OpenSpades DESTINATION bin)