forked from Mirrorlandia_minetest/minetest
Windows: Cpack wix installer (#6153)
Create CPack WIX msi Installer for RUN_IN_PLACE=0 builds Correct paths on Windows for RUN_IN_PLACE=0 Install only required font files Games have their own components, and "minimal" is optional
This commit is contained in:
parent
45b52f6d5a
commit
2322078fe4
@ -164,7 +164,10 @@ if(RUN_IN_PLACE)
|
|||||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/textures/texture_packs_here.txt" DESTINATION "${SHAREDIR}/textures")
|
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/textures/texture_packs_here.txt" DESTINATION "${SHAREDIR}/textures")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games" DESTINATION "${SHAREDIR}" PATTERN ".git*" EXCLUDE)
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minetest_game" DESTINATION "${SHAREDIR}/games/"
|
||||||
|
COMPONENT "SUBGAME_MINETEST_GAME" OPTIONAL PATTERN ".git*" EXCLUDE )
|
||||||
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minimal" DESTINATION "${SHAREDIR}/games/"
|
||||||
|
COMPONENT "SUBGAME_MINIMAL" OPTIONAL PATTERN ".git*" EXCLUDE )
|
||||||
|
|
||||||
if(BUILD_CLIENT)
|
if(BUILD_CLIENT)
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/shaders" DESTINATION "${SHAREDIR}/client")
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/shaders" DESTINATION "${SHAREDIR}/client")
|
||||||
@ -177,12 +180,11 @@ endif()
|
|||||||
|
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}")
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}")
|
||||||
|
|
||||||
install(FILES "README.md" DESTINATION "${DOCDIR}")
|
install(FILES "README.md" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||||
install(FILES "LICENSE.txt" DESTINATION "${DOCDIR}")
|
install(FILES "doc/lua_api.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||||
install(FILES "doc/lua_api.txt" DESTINATION "${DOCDIR}")
|
install(FILES "doc/menu_lua_api.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||||
install(FILES "doc/menu_lua_api.txt" DESTINATION "${DOCDIR}")
|
install(FILES "doc/texture_packs.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||||
install(FILES "doc/texture_packs.txt" DESTINATION "${DOCDIR}")
|
install(FILES "doc/world_format.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs")
|
||||||
install(FILES "doc/world_format.txt" DESTINATION "${DOCDIR}")
|
|
||||||
install(FILES "minetest.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}")
|
install(FILES "minetest.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}")
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
@ -237,14 +239,68 @@ set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
|
|||||||
set(CPACK_PACKAGE_VENDOR "celeron55")
|
set(CPACK_PACKAGE_VENDOR "celeron55")
|
||||||
set(CPACK_PACKAGE_CONTACT "Perttu Ahola <celeron55@gmail.com>")
|
set(CPACK_PACKAGE_CONTACT "Perttu Ahola <celeron55@gmail.com>")
|
||||||
|
|
||||||
if(WIN32)
|
include(CPackComponent)
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win64")
|
|
||||||
else()
|
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CPACK_GENERATOR ZIP)
|
cpack_add_component(Docs
|
||||||
|
DISPLAY_NAME "Documentation"
|
||||||
|
DESCRIPTION "Documentation about Minetest and Minetest modding"
|
||||||
|
)
|
||||||
|
|
||||||
|
cpack_add_component(SUBGAME_MINETEST_GAME
|
||||||
|
DISPLAY_NAME "Minetest Game"
|
||||||
|
DESCRIPTION "The official subgame for the Minetest engine, that can easily extended by mods."
|
||||||
|
GROUP "Subgames"
|
||||||
|
)
|
||||||
|
|
||||||
|
cpack_add_component(SUBGAME_MINIMAL
|
||||||
|
DISPLAY_NAME "Minimal development test"
|
||||||
|
DESCRIPTION "A minimal subgame helping to develop the engine."
|
||||||
|
DISABLED #DISABLED does not mean it is disabled, and is just not selected by default.
|
||||||
|
GROUP "Subgames"
|
||||||
|
)
|
||||||
|
|
||||||
|
cpack_add_component_group(Subgames
|
||||||
|
DESCRIPTION "Games for the Minetest engine."
|
||||||
|
)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# Include all dynamically linked runtime libaries such as MSVCRxxx.dll
|
||||||
|
include(InstallRequiredSystemLibraries)
|
||||||
|
|
||||||
|
if(RUN_IN_PLACE)
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win64")
|
||||||
|
else()
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CPACK_GENERATOR ZIP)
|
||||||
|
|
||||||
|
else()
|
||||||
|
set(CPACK_GENERATOR WIX ZIP)
|
||||||
|
set(CPACK_PACKAGE_NAME "${PROJECT_NAME_CAPITALIZED}")
|
||||||
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME_CAPITALIZED}")
|
||||||
|
set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} "${PROJECT_NAME_CAPITALIZED}")
|
||||||
|
set(CPACK_CREATE_DESKTOP_LINKS ${PROJECT_NAME})
|
||||||
|
|
||||||
|
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/misc/minetest-icon.ico")
|
||||||
|
# Supported languages can be found at
|
||||||
|
# http://wixtoolset.org/documentation/manual/v3/wixui/wixui_localization.html
|
||||||
|
#set(CPACK_WIX_CULTURES "ar-SA,bg-BG,ca-ES,hr-HR,cs-CZ,da-DK,nl-NL,en-US,et-EE,fi-FI,fr-FR,de-DE")
|
||||||
|
set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_BANNER.BMP")
|
||||||
|
set(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_DIALOG.BMP")
|
||||||
|
|
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/lgpl-2.1.txt")
|
||||||
|
|
||||||
|
# The correct way would be to include both x32 and x64 into one installer
|
||||||
|
# and install the appropriate one.
|
||||||
|
# CMake does not support that, so there are two separate GUID's
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(CPACK_WIX_UPGRADE_GUID "745A0FB3-5552-44CA-A587-A91C397CCC56")
|
||||||
|
else()
|
||||||
|
set(CPACK_WIX_UPGRADE_GUID "814A2E2D-2779-4BBD-9ACD-FC3BD51FBBA2")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx")
|
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx")
|
||||||
|
23
README.md
23
README.md
@ -78,9 +78,13 @@ Locations:
|
|||||||
Where each location is on each platform:
|
Where each location is on each platform:
|
||||||
|
|
||||||
* Windows .zip / RUN_IN_PLACE source:
|
* Windows .zip / RUN_IN_PLACE source:
|
||||||
* `bin` = `bin`
|
* bin = `bin`
|
||||||
* `share` = `.`
|
* share = `.`
|
||||||
* `user` = `.`
|
* user = `.`
|
||||||
|
* Windows installed:
|
||||||
|
* $bin = `C:\Program Files\Minetest\bin (Depends on the install location)`
|
||||||
|
* $share = `C:\Program Files\Minetest (Depends on the install location)`
|
||||||
|
* $user = `%Appdata%\Minetest`
|
||||||
* Linux installed:
|
* Linux installed:
|
||||||
* `bin` = `/usr/bin`
|
* `bin` = `/usr/bin`
|
||||||
* `share` = `/usr/share/minetest`
|
* `share` = `/usr/share/minetest`
|
||||||
@ -426,6 +430,19 @@ This is how we build Windows releases.
|
|||||||
echo Failed.
|
echo Failed.
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
|
### Windows Installer using WIX Toolset
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
* Visual Studio 2017
|
||||||
|
* Wix Toolset
|
||||||
|
|
||||||
|
In Visual Studio 2017 Installer select "Optional Features" -> "Wix Toolset"
|
||||||
|
|
||||||
|
Build the binaries like described above, but make sure you unselect "RUN_IN_PLACE".
|
||||||
|
|
||||||
|
Open the generated Project file with VS. Right click "PACKAGE" and choose "Generate".
|
||||||
|
It may take some minutes to generate the installer.
|
||||||
|
|
||||||
Version scheme
|
Version scheme
|
||||||
--------------
|
--------------
|
||||||
We use `major.minor.patch` since 5.0.0-dev. Prior to that we used `0.major.minor`.
|
We use `major.minor.patch` since 5.0.0-dev. Prior to that we used `0.major.minor`.
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
if(MSVC)
|
|
||||||
set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(gmp mini-gmp.c)
|
add_library(gmp mini-gmp.c)
|
||||||
target_link_libraries(gmp)
|
target_link_libraries(gmp)
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
if(MSVC)
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(jsoncpp jsoncpp.cpp)
|
add_library(jsoncpp jsoncpp.cpp)
|
||||||
target_link_libraries(jsoncpp)
|
target_link_libraries(jsoncpp)
|
||||||
|
|
||||||
|
BIN
misc/CPACK_WIX_UI_BANNER.BMP
Normal file
BIN
misc/CPACK_WIX_UI_BANNER.BMP
Normal file
Binary file not shown.
After Width: | Height: | Size: 112 KiB |
BIN
misc/CPACK_WIX_UI_DIALOG.BMP
Normal file
BIN
misc/CPACK_WIX_UI_DIALOG.BMP
Normal file
Binary file not shown.
After Width: | Height: | Size: 451 KiB |
@ -696,7 +696,7 @@ if(MSVC)
|
|||||||
# Visual Studio
|
# Visual Studio
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D WIN32_LEAN_AND_MEAN /MP")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D WIN32_LEAN_AND_MEAN /MP")
|
||||||
# EHa enables SEH exceptions (used for catching segfaults)
|
# EHa enables SEH exceptions (used for catching segfaults)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
|
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MD /GS- /Zi /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE")
|
||||||
endif()
|
endif()
|
||||||
@ -714,8 +714,8 @@ if(MSVC)
|
|||||||
set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1")
|
set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1")
|
||||||
|
|
||||||
# Flags for C files (sqlite)
|
# Flags for C files (sqlite)
|
||||||
# /MT = Link statically with standard library stuff
|
# /MD = dynamically link to MSVCRxxx.dll
|
||||||
set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MT")
|
set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MD")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
# Probably GCC
|
# Probably GCC
|
||||||
@ -828,6 +828,14 @@ if(BUILD_CLIENT)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(USE_FREETYPE)
|
||||||
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}"
|
||||||
|
FILES_MATCHING PATTERN "*.ttf" PATTERN "*.txt")
|
||||||
|
else()
|
||||||
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}"
|
||||||
|
FILES_MATCHING PATTERN "*.png" PATTERN "*.xml")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(DEFINED IRRLICHT_DLL)
|
if(DEFINED IRRLICHT_DLL)
|
||||||
install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR})
|
install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR})
|
||||||
|
@ -380,14 +380,21 @@ bool setSystemPaths()
|
|||||||
"Failed to get current executable path");
|
"Failed to get current executable path");
|
||||||
pathRemoveFile(buf, '\\');
|
pathRemoveFile(buf, '\\');
|
||||||
|
|
||||||
// Use ".\bin\.."
|
std::string exepath(buf);
|
||||||
path_share = std::string(buf) + "\\..";
|
|
||||||
|
|
||||||
// Use "C:\Documents and Settings\user\Application Data\<PROJECT_NAME>"
|
// Use ".\bin\.."
|
||||||
|
path_share = exepath + "\\..";
|
||||||
|
if (detectMSVCBuildDir(exepath)) {
|
||||||
|
// The msvc build dir schould normaly not be present if properly installed,
|
||||||
|
// but its usefull for debugging.
|
||||||
|
path_share += DIR_DELIM "..";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use "C:\Users\<user>\AppData\Roaming\<PROJECT_NAME_C>"
|
||||||
DWORD len = GetEnvironmentVariable("APPDATA", buf, sizeof(buf));
|
DWORD len = GetEnvironmentVariable("APPDATA", buf, sizeof(buf));
|
||||||
FATAL_ERROR_IF(len == 0 || len > sizeof(buf), "Failed to get APPDATA");
|
FATAL_ERROR_IF(len == 0 || len > sizeof(buf), "Failed to get APPDATA");
|
||||||
|
|
||||||
path_user = std::string(buf) + DIR_DELIM + PROJECT_NAME;
|
path_user = std::string(buf) + DIR_DELIM + PROJECT_NAME_C;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,6 +568,10 @@ void initializePaths()
|
|||||||
if (!setSystemPaths())
|
if (!setSystemPaths())
|
||||||
errorstream << "Failed to get one or more system-wide path" << std::endl;
|
errorstream << "Failed to get one or more system-wide path" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef _WIN32
|
||||||
|
path_cache = path_user + DIR_DELIM + "cache";
|
||||||
|
# else
|
||||||
// Initialize path_cache
|
// Initialize path_cache
|
||||||
// First try $XDG_CACHE_HOME/PROJECT_NAME
|
// First try $XDG_CACHE_HOME/PROJECT_NAME
|
||||||
const char *cache_dir = getenv("XDG_CACHE_HOME");
|
const char *cache_dir = getenv("XDG_CACHE_HOME");
|
||||||
@ -577,7 +588,8 @@ void initializePaths()
|
|||||||
}
|
}
|
||||||
// Migrate cache folder to new location if possible
|
// Migrate cache folder to new location if possible
|
||||||
migrateCachePath();
|
migrateCachePath();
|
||||||
#endif
|
# endif // _WIN32
|
||||||
|
#endif // RUN_IN_PLACE
|
||||||
|
|
||||||
infostream << "Detected share path: " << path_share << std::endl;
|
infostream << "Detected share path: " << path_share << std::endl;
|
||||||
infostream << "Detected user path: " << path_user << std::endl;
|
infostream << "Detected user path: " << path_user << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user