1
0
mirror of https://github.com/ScrelliCopter/tmx2gba.git synced 2025-02-21 03:29:25 +11:00

Add install rule and update readme with new instructions

This commit is contained in:
2023-01-09 03:23:12 +11:00
parent ccde64ab4e
commit 46ad0da66c
3 changed files with 32 additions and 4 deletions

View File

@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.1 FATAL_ERROR) cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(tmx2gba) project(tmx2gba)
# Options
option(TMX2GBA_DKP_INSTALL "Install into DEVKITPRO prefix" OFF)
# C++11 & C99 # C++11 & C99
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)

View File

@@ -35,13 +35,27 @@ tmx2gba [-h] [-r offset] [-lyc name] [-p 0-15] <-i inpath> <-o outpath>
Dependencies for building are CMake 3.x and a C++11 compliant compiler, Dependencies for building are CMake 3.x and a C++11 compliant compiler,
all other dependencies are in-tree so you should be able to build with: all other dependencies are in-tree so you should be able to build with:
```bash ```bash
cmake -B build cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -C build -j$(nproc --all) make -C build -j$(nproc --all)
``` ```
Optionally, to make it convenient for my dkp projects: Optionally, you may install it to use it system wide:
```bash ```bash
sudo cp tmx2gba $DEVKITPRO/tools/bin/tmx2gba sudo cmake --install build
```
Which will copy the tmx2gba executable to /usr/local/bin/tmx2gba by default,
if you prefer to use /usr for some reason you may specify a prefix like so:
```bash
sudo cmake --install build --prefix /usr
```
If you're a devkitPro user and would prefer to keep all your development tools compartmentalised
you may optionally install to the tools directory with the `TMX2GBA_DKP_INSTALL` option (OFF by default).
The build scripts will respect your `DEVKITPRO` environment variable but if not set will install to
`/opt/devkitpro/tools/bin/tmx2gba` directly, the `--prefix` argument has no effect in this mode.
```bash
cmake -B build -DCMAKE_BUILD_TYPE=Release -DTMX2GBA_DKP_INSTALL:BOOL=ON
cmake --build build
sudo cmake --install build
``` ```
### Todo list ### ### Todo list ###
@@ -58,7 +72,7 @@ sudo cp tmx2gba $DEVKITPRO/tools/bin/tmx2gba
[ultragetopt](https://github.com/kevinoid/ultragetopt) is licensed under the MIT license. [ultragetopt](https://github.com/kevinoid/ultragetopt) is licensed under the MIT license.
``` ```
Copyright (C) 2015-2022 a dinosaur Copyright (C) 2015-2023 a dinosaur
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -9,3 +9,14 @@ target_link_libraries(tmx2gba
External::miniz External::miniz
External::rapidxml External::rapidxml
External::ultragetopt) External::ultragetopt)
if (TMX2GBA_DKP_INSTALL)
if (DEFINED ENV{DEVKITPRO})
set(TMX2GBA_INSTALL_DESTINATION "$ENV{DEVKITPRO}/tools/bin")
else()
set(TMX2GBA_INSTALL_DESTINATION /opt/devkitpro/tools/bin)
endif()
else()
set(TMX2GBA_INSTALL_DESTINATION bin)
endif()
install(TARGETS tmx2gba RUNTIME DESTINATION "${TMX2GBA_INSTALL_DESTINATION}")