Fix MinGW build and add instruction

pull/347/head
U-DESKTOP-5KURQFU\dlshc 2019-08-07 01:42:19 +02:00 committed by Hleb Valoshka
parent 3bc970c780
commit ad8eda79f4
3 changed files with 65 additions and 14 deletions

View File

@ -81,7 +81,7 @@ include(GNUInstallDirs)
include(CheckIncludeFiles)
include(rpath)
include(install_to_extras_subdir)
if (NOT MSVC)
if (NOT MSVC AND NOT MINGW)
include(cotire)
else()
macro(cotire _target)
@ -189,17 +189,30 @@ set(FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
if (NOT GIT_COMMIT)
find_program(GIT_FOUND git)
if (GIT_FOUND)
execute_process(
COMMAND git log --pretty=format:"%h" -1
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT
)
if (NOT MINGW)
execute_process(
COMMAND git log --pretty=format:"%h" -1
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT
)
endif()
if (MINGW)
execute_process(
COMMAND git log --pretty=format:'%h' -1
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT
)
endif()
if ("${GIT_COMMIT}" STREQUAL "")
set(GIT_COMMIT "unknown")
endif()
else()
set(GIT_COMMIT "unknown")
endif()
if (MINGW)
set(GIT_COMMIT "\"${GIT_COMMIT}\"")
endif()
endif()
add_definitions(

44
INSTALL
View File

@ -9,6 +9,8 @@ official 32/64 bit development snapshots for Windows.
To build from sources please follow instructions below.
Common building instructions
----------------------------
@ -24,6 +26,8 @@ If you have fmtlib and Eigen3 installed from other sources (OS repository or
vcpg) or don't want to build Celestia with SPICE support then you can skip the
2nd step.
Celestia Install instructions for UNIX
--------------------------------------
@ -85,8 +89,8 @@ following option to cmake: -DCMAKE_INSTALL_PREFIX=/another/path.
Celestia Install instructions for Windows
-----------------------------------------
Celestia Install instructions for Windows (MSVC)
------------------------------------------------
Currently to build on Windows you need a Visual Studio 2015 or later, CMake
and vcpkg (*).
@ -123,7 +127,6 @@ CMAKE_PREFIX_PATH to cmake call used to configure Celestia, e.g.
Not supported yet:
- automatic installation using cmake
- building using GNU toolchain (Mingw32), currently Work-In-Progress
- using Ninja instead of MSBuild
Notes:
@ -132,6 +135,41 @@ Notes:
Celestia Install instructions for Windows (MINGW64), qt-only
------------------------------------------------------------
It is recommended to build the source with MSYS2
https://www.msys2.org/ .
Do the following in the MINGW64 shell (mingw64.exe).
Install required packages:
pacman -S mingw-w64-x86_64-toolchain
pacman -S base-devel
pacman -S git
pacman -S mingw-w64-x86_64-cmake
pacman -S mingw-w64-x86_64-qt5
pacman -S mingw-w64-x86_64-freeglut mingw-w64-x86_64-glew mingw-w64-x86_64-lua
pacman -S mingw-w64-x86_64-libtheora mingw-w64-x86_64-mesa
Install optional packages:
pacman -S mingw-w64-x86_64-fmt mingw-w64-x86_64-eigen3 mingw-w64-x86_64-luajit
Clone the source and go to the source directory.
Configure and build:
mkdir build
cd build
cmake .. -G"MSYS Makefiles" -DENABLE_WIN=OFF
mingw32-make.exe -jN
Instead of N, pass a number of CPU cores you want to use during a build.
Celestia Install instructions for OS X
--------------------------------------

View File

@ -22,15 +22,15 @@ void CenterWindow(HWND hParent, HWND hWnd)
//Center window with hWnd handle relative to hParent.
if (hParent && hWnd)
{
RECT or, ir;
if (GetWindowRect(hParent, &or))
RECT ort, irt;
if (GetWindowRect(hParent, &ort))
{
if (GetWindowRect(hWnd, &ir))
if (GetWindowRect(hWnd, &irt))
{
int x, y;
x = or.left + (or.right - or.left - (ir.right - ir.left)) / 2;
y = or.top + (or.bottom - or.top - (ir.bottom - ir.top)) / 2;;
x = ort.left + (ort.right - ort.left - (irt.right - irt.left)) / 2;
y = ort.top + (ort.bottom - ort.top - (irt.bottom - irt.top)) / 2;;
SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
}