Browse Source

Get version from git (#331)

* Get version from git

For debug builds the textual version will be latest tag+short hash

* Configure nightly builds
pull/335/head
Anders Jenbo 7 years ago committed by GitHub
parent
commit
ebe846d6ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      .circleci/config.yml
  2. 11
      .travis.yml
  3. 32
      CMakeLists.txt
  4. 18
      README.md
  5. 2
      SourceS/config.h.in
  6. 2
      appveyor.yml
  7. 1
      build/.gitignore

31
.circleci/config.yml

@ -7,11 +7,10 @@ jobs:
steps:
- checkout
- run: apt-get update -y
- run: apt-get install -y g++ libsdl2-dev libsdl2-mixer-dev libsdl2-ttf-dev
- run: apt-get install -y g++ libsdl2-dev libsdl2-mixer-dev libsdl2-ttf-dev git
- run: apt-get install -y -t stretch-backports cmake libsodium-dev
- run: mkdir build
- run: cd build && cmake ..
- run: cd build && make -j$(nproc)
- run: cd build && cmake .. -DNIGHTLY_BUILD=ON
- run: cd build && cmake --build . -j $(nproc)
- store_artifacts: {path: ./build/devilutionx, destination: devilutionx_linux_x86_64}
linux_x86_64_sdl1:
docker:
@ -20,11 +19,10 @@ jobs:
steps:
- checkout
- run: apt-get update -y
- run: apt-get install -y g++ libsdl-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
- run: apt-get install -y g++ libsdl-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev git
- run: apt-get install -y -t stretch-backports cmake libsodium-dev
- run: mkdir build
- run: cd build && cmake .. -DUSE_SDL1=ON
- run: cd build && make -j$(nproc)
- run: cd build && cmake .. -DNIGHTLY_BUILD=ON -DUSE_SDL1=ON
- run: cd build && cmake --build . -j $(nproc)
- store_artifacts: {path: ./build/devilutionx, destination: devilutionx_linux_x86_64_sdl1}
linux_x86:
docker:
@ -34,21 +32,19 @@ jobs:
- checkout
- run: dpkg --add-architecture i386
- run: apt-get update -y
- run: apt-get install -y g++-multilib libsdl2-dev:i386 libsdl2-mixer-dev:i386 libsdl2-ttf-dev:i386 libsodium-dev
- run: apt-get install -y g++-multilib libsdl2-dev:i386 libsdl2-mixer-dev:i386 libsdl2-ttf-dev:i386 libsodium-dev git
- run: apt-get install -y -t stretch-backports cmake libsodium-dev:i386
- run: mkdir build
- run: cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../CMake/32bit.cmake ..
- run: cd build && make -j$(nproc)
- run: cd build && cmake -DNIGHTLY_BUILD=ON -DCMAKE_TOOLCHAIN_FILE=../CMake/32bit.cmake ..
- run: cd build && cmake --build . -j $(nproc)
- store_artifacts: {path: ./build/devilutionx, destination: devilutionx_linux_x86}
windows_x86:
docker:
- image: debian:stretch-backports
- image: debian:stable
working_directory: ~/repo
steps:
- checkout
- run: apt-get update -y
- run: apt-get install -y gcc-mingw-w64-i686 g++-mingw-w64-i686 wget
- run: apt-get install -y -t stretch-backports cmake
- run: apt-get install -y cmake gcc-mingw-w64-i686 g++-mingw-w64-i686 wget git
- run: wget https://www.libsdl.org/release/SDL2-devel-2.0.9-mingw.tar.gz
- run: tar -xzf SDL2-devel-2.0.9-mingw.tar.gz
- run: wget https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-mingw.tar.gz
@ -59,9 +55,8 @@ jobs:
- run: tar -xzf libsodium-1.0.17-mingw.tar.gz --no-same-owner
- run: cp -r libsodium-win32/* /usr/i686-w64-mingw32
- run: cp -r SDL2*/i686-w64-mingw32 /usr
- run: mkdir build
- run: cd build && cmake -DASAN=OFF -DBINARY_RELEASE=ON -DCMAKE_TOOLCHAIN_FILE=../CMake/mingwcc.cmake ..
- run: cd build && make -j$(nproc)
- run: cd build && cmake -DNIGHTLY_BUILD=ON -DCMAKE_TOOLCHAIN_FILE=../CMake/mingwcc.cmake ..
- run: cd build && cmake --build . -j $(nproc)
- store_artifacts: {path: ./build/devilutionx.exe, destination: devilutionx_x86.exe}
workflows:

11
.travis.yml

@ -1,18 +1,21 @@
language: cpp
os: osx
osx_image: xcode10.3
git:
depth: false
quiet: true
addons:
homebrew:
brewfile: true
script:
- mkdir build
- cd build
- cmake ..
- make package -j$(sysctl -n hw.physicalcpu)
- cmake --DBINARY_RELEASE=ON ..
- cmake --build . --target package -j $(sysctl -n hw.physicalcpu)
deploy:
provider: releases

32
CMakeLists.txt

@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.10)
include(CMake/out_of_tree.cmake)
project(DevilutionX
VERSION 0.5.0
LANGUAGES C CXX)
list(APPEND CMAKE_MODULE_PATH "${DevilutionX_SOURCE_DIR}/CMake")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
@ -41,13 +35,33 @@ if(BINARY_RELEASE)
endif()
if(NIGHTLY_BUILD)
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
set(ASAN OFF)
set(DEBUG ON)
set(DIST ON)
set(FASTER ON)
set(FASTER OFF)
endif()
execute_process(
COMMAND git describe --abbrev=0 --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT CMAKE_BUILD_TYPE MATCHES "Release")
execute_process(
COMMAND git log -1 --format=-%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
project(DevilutionX
VERSION ${GIT_TAG}
LANGUAGES C CXX)
list(APPEND CMAKE_MODULE_PATH "${DevilutionX_SOURCE_DIR}/CMake")
if(${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD)
set(ASAN OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DO_LARGEFILE=0 -Dstat64=stat -Dlstat64=lstat -Dlseek64=lseek -Doff64_t=off_t -Dfstat64=fstat -Dftruncate64=ftruncate")
@ -293,7 +307,7 @@ foreach(target devilution devilutionx)
endif()
endforeach(target devilution devilutionx)
if(DIST AND NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(DIST AND CMAKE_CXX_COMPILER_ID MATCHES "GCC")
target_link_libraries(devilutionx PUBLIC -static-libgcc -static-libstdc++)
endif()

18
README.md

@ -30,10 +30,9 @@ sudo dnf install cmake glibc-devel SDL2-devel SDL2_ttf-devel SDL2_mixer-devel li
```
### Compiling
```
mkdir build
cd build
cmake ..
make -j$(nproc)
cmake --build . -j $(nproc)
```
</details>
@ -43,10 +42,9 @@ Make sure you have [Homebrew](https://brew.sh/) installed, then run:
```
brew bundle
mkdir build
cd build
cmake ..
make -j$(sysctl -n hw.physicalcpu)
cmake --build . -j $(sysctl -n hw.physicalcpu)
```
</details>
<details><summary>FreeBSD</summary>
@ -58,10 +56,9 @@ pkg install cmake gcc8 sdl2_mixer sdl2_ttf libsodium
```
### Compiling
```
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=/usr/local/bin/gcc8 -DCMAKE_CXX_COMPILER=/usr/local/bin/g++8 ..
make -j$(sysctl -n hw.ncpu)
cmake --build . -j $(sysctl -n hw.ncpu)
```
</details>
@ -76,10 +73,9 @@ sudo apt-get install cmake gcc-mingw-w64-i686 g++-mingw-w64-i686
```
### Compiling
```
mkdir build
cd build
cmake -DASAN=OFF -DCMAKE_TOOLCHAIN_FILE=../CMake/mingwcc.cmake ..
make -j$(nproc)
cmake --build . -j $(nproc)
```
</details>
<details><summary>Windows via Visual Studio</summary>
@ -132,17 +128,15 @@ pkgman install cmake devel:libsdl2 devel:libsdl2_mixer devel:libsdl2_ttf devel:l
```
### Compiling on 32 bit Haiku
```
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=gcc-x86 -DCMAKE_CXX_COMPILER=g++-x86 -DBINARY_RELEASE=ON ..
make -j$(nproc)
cmake --build . -j $(nproc)
```
### Compiling on 64 bit Haiku
```
mkdir build
cd build
cmake ..
make -j$(nproc)
cmake --build . -j $(nproc)
```
</details>

2
SourceS/config.h.in

@ -1,4 +1,4 @@
#pragma once
#define PROJECT_NAME "@PROJECT_NAME@"
#define PROJECT_VERSION "@PROJECT_VERSION@"
#define PROJECT_VERSION "@PROJECT_VERSION@@GIT_COMMIT_HASH@"

2
appveyor.yml

@ -10,7 +10,7 @@ install:
- vcpkg install sdl2:x86-windows sdl2-mixer:x86-windows sdl2-ttf:x86-windows libsodium:x86-windows
before_build:
- cmake -G "Visual Studio 15 2017" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake .
- cmake -G "Visual Studio 15 2017" -DNIGHTLY_BUILD=ON -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake .
build:
project: $(APPVEYOR_BUILD_FOLDER)\$(APPVEYOR_PROJECT_NAME).sln

1
build/.gitignore vendored

@ -0,0 +1 @@
*
Loading…
Cancel
Save