Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Add UNIX install target #131

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ if(WIN32)
)
endif()

if(UNIX)
include(GNUInstallDirs)
install(TARGETS magicseteditor DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/data" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/magicseteditor")
install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/resource" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/magicseteditor")
endif()

# warnings
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
Expand Down
84 changes: 40 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ On windows, the program can be compiled with Visual Studio (recommended) or with
* Download and install [Visual Studio Community edition](https://visualstudio.microsoft.com/vs/community/)
* Download and install [vcpkg](https://github.com/microsoft/vcpkg)
* Use vcpkg to install wxwidgets, boost, hunspell
````
vcpkg install wxwidgets
vcpkg install boost-smart-ptr
vcpkg install boost-regex
vcpkg install boost-logic
vcpkg install boost-pool
vcpkg install hunspell
vcpkg integrate install
````
```shell
> vcpkg install wxwidgets
> vcpkg install boost-smart-ptr
> vcpkg install boost-regex
> vcpkg install boost-logic
> vcpkg install boost-pool
> vcpkg install hunspell
> vcpkg integrate install
```
* Then just use "Open Folder" from inside visual studio to open the Magic Set Editor source code root folder.
* Select the configuration that you want to build, and hit F7.

Expand All @@ -43,52 +43,48 @@ The tests can be run from inside visual studio

* Download and install [msys2](https://www.msys2.org/)
* Install a recent version of the gcc compiler, cmake, and wxWidgets libraries:
````
pacman -S mingw32/mingw-w64-i686-gcc
pacman -S mingw32/mingw-w64-i686-wxWidgets
pacman -S mingw32/mingw-w64-i686-boost
pacman -S mingw32/mingw-w64-i686-hunspell
pacman -S cmake
````
```shell
> pacman -S mingw32/mingw-w64-i686-gcc
> pacman -S mingw32/mingw-w64-i686-wxWidgets
> pacman -S mingw32/mingw-w64-i686-boost
> pacman -S mingw32/mingw-w64-i686-hunspell
> pacman -S cmake
```
Use `mingw64/mingw-w64-x86_64-...` instead of for the 64bit build
* Build
````
cmake -G "MSYS Makefiles" -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build
````
```shell
> cmake -G "MSYS Makefiles" -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
> cmake --build build
```

## Building on linux

Install the dependencies, for example on a debian based system
````
sudo apt install g++
sudo apt install libboost-dev libwxgtk3.0-gtk3-dev libhunspell-dev
````
```shell
$ sudo apt install g++ cmake
$ sudo apt install libboost-dev libboost-regex-dev libwxgtk3.0-gtk3-dev libhunspell-dev
```
Then use cmake to build
````
cmake build -DCMAKE_BUILD_TYPE=Release
cmake --build build
````
```shell
$ cmake -Bbuild -DCMAKE_BUILD_TYPE=Release
$ cmake --build build
# Optinal systemwide install (/usr/local/). Use --prefix to override.
$ cmake --install build
```
Use `CMAKE_BUILD_TYPE=Debug` for a debug build

## Building on Mac

Install the dependencies, for example using Homebrew
````
brew install boost wxwidgets hunspell
````
Note: Tested with boost 1.72.0_3, wxmac (wxwidgets) 3.0.5.1_1, hunspell 1.7.0_2
```shell
$ brew install boost wxwidgets hunspell cmake
```
Note: Tested with boost 1.72.0\_3, wxmac (wxwidgets) 3.0.5.1\_1, hunspell 1.7.0\_2
Then use cmake to build
````
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build ..
````
```shell
$ cmake -Bbuild -DCMAKE_BUILD_TYPE=Release
$ cmake --build build
# Optinal systemwide install (/usr/local/). Use --prefix to override.
$ cmake --install build
```
Use `CMAKE_BUILD_TYPE=Debug` for a debug build

Finally, copy the resources to a SharedSupport directory and run the executable
````
mkdir SharedSupport && cd SharedSupport
cp -r ../resource SharedSupport/
./magicseteditor
````