Skip to content

Commit

Permalink
Merge pull request #12 from CleverRaven/master
Browse files Browse the repository at this point in the history
Bring up to date
  • Loading branch information
Inglonias authored Jan 8, 2019
2 parents 76c1024 + 4a1ab34 commit 1862742
Show file tree
Hide file tree
Showing 625 changed files with 121,030 additions and 94,540 deletions.
8 changes: 4 additions & 4 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pull_requests:
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PROJECT: /msvc-full-features/Cataclysm-vcpkg.sln
PROJECT: /msvc-full-features/Cataclysm-vcpkg-static.sln
COMPILER: msvc2017
TOOLCHAIN: msvc15
PLATFORM: x64
Expand All @@ -19,12 +19,12 @@ cache:
- 'c:\tools\vcpkg\installed'
install:
# Install dependency packages
- cmd: vcpkg --triplet %PLATFORM%-windows install sdl2 sdl2-image sdl2-mixer sdl2-ttf gettext lua
- cmd: vcpkg --triplet %PLATFORM%-windows-static install sdl2 sdl2-image sdl2-mixer sdl2-ttf gettext lua
# Add LUA binary folder to PATH
- cmd: set PATH=c:\tools\vcpkg\installed\%PLATFORM%-windows\tools\lua;%PATH%
- cmd: set PATH=c:\tools\vcpkg\installed\%PLATFORM%-windows-static\tools\lua;%PATH%
# Report LUA binary version
- cmd: lua.exe -v
build:
parallel: true
project: /msvc-full-features/Cataclysm-vcpkg.sln
project: /msvc-full-features/Cataclysm-vcpkg-static.sln
verbosity: minimal
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/save/
/src/lua/catabindings.cpp
/src/version.h
/sound/
/templates/
/tools/format/json_formatter.cgi
CataclysmWin.cscope_file_list
Expand Down
78 changes: 29 additions & 49 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ option(LUA "Lua support (required for some mods)." "OFF")
option(TILES "Build graphical tileset version." "OFF")
option(CURSES "Build curses version." "ON" )
option(SOUND "Support for in-game sounds & music." "OFF")
option(RELEASE "Disable debug. Use it for user-ready buils." "OFF")
option(BACKTRACE "Support for printing stack backtraces on crash" "ON" )
option(USE_HOME_DIR "Use user's home directory for save files." "ON" )
option(LOCALIZE "Support for language localizations. Also enable UTF support." "ON" )
Expand All @@ -28,7 +27,6 @@ include(CTest)
include(GetGitRevisionDescription)
git_describe(GIT_VERSION)

IF (RELEASE)
MESSAGE("\n * Cataclysm: Dark Days Ahead is a roguelike set in a post-apocalyptic world.")
MESSAGE(" _________ __ .__ ")
MESSAGE(" \\_ ___ \\ _____ _/ |_ _____ ____ | | ___.__ ______ _____ ")
Expand All @@ -38,12 +36,15 @@ MESSAGE(" \\______ /\(____ / |__| \(____ / \\___ >|____/ / ____|/____ >
MESSAGE(" \\/ \\/ \\/ \\/ \\/ \\/ \\/ ")
MESSAGE(" --= Dark Days Ahead =--")
MESSAGE("\n * http://en.cataclysmdda.com/\n")
ENDIF (RELEASE)

MESSAGE(STATUS "${PROJECT} build environment -- \n")

MESSAGE(STATUS "Build realm is : ${CMAKE_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_PROCESSOR}")

IF(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
ENDIF(NOT CMAKE_BUILD_TYPE)

if (NOT ${GIT_VERSION} MATCHES GIT-NOTFOUND)
string(REPLACE "-NOTFOUND" "" GIT_VERSION ${GIT_VERSION})
FILE(WRITE ${CMAKE_SOURCE_DIR}/src/version.h "\#define VERSION \"${GIT_VERSION}\"\n")
Expand Down Expand Up @@ -176,7 +177,20 @@ IF(TILES)
ENDIF(TILES)

# Set build types and display info
IF(RELEASE)
IF(CMAKE_BUILD_TYPE STREQUAL Debug)
MESSAGE("\n")
MESSAGE(STATUS "Build ${PROJECT} in development mode --\n")
MESSAGE(STATUS "Binaries will be located in: " ${CMAKE_SOURCE_DIR})
SET(CMAKE_VERBOSE_MAKEFILE ON)
# Since CataclusmDDA does not respect PREFIX for development builds
# and has funny path handlers, we should create resulting Binaries
# in the source redectory
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY
${CMAKE_SOURCE_DIR}
CACHE PATH "Single Directory for all Executables."
)
SET(BIN_PREFIX ${CMAKE_SOURCE_DIR})
ELSE (CMAKE_BUILD_TYPE STREQUAL Debug)
MESSAGE(STATUS "CMAKE_INSTALL_PREFIX : ${CMAKE_INSTALL_PREFIX}")
MESSAGE(STATUS "BIN_PREFIX : ${BIN_PREFIX}")
MESSAGE(STATUS "DATA_PREFIX : ${DATA_PREFIX}")
Expand All @@ -187,55 +201,12 @@ IF(RELEASE)
MESSAGE(STATUS "PIXMAPS_ENTRY_PATH : ${PIXMAPS_ENTRY_PATH}")
MESSAGE(STATUS "PIXMAPS_UNITY_ENTRY_PATH : ${PIXMAPS_UNITY_ENTRY_PATH}")
MESSAGE(STATUS "MANPAGE_ENTRY_PATH : ${MANPAGE_ENTRY_PATH}\n")
SET(CMAKE_BUILD_TYPE RELEASE)
ADD_DEFINITIONS(-DRELEASE)
# FIXME: Removed -Werror for a while. Currently it is broken in upstream.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os")
IF(NOT MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wall -std=c++11 -MMD")
ELSE()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-D_AMD64_)
else()
add_definitions(-D_X86_)
endif()
ENDIF()
IF(MINGW)
# Workaround for: http://ehc.ac/p/mingw/bugs/2250/
ADD_DEFINITIONS(-D__NO_INLINE__)
ENDIF(MINGW)
# Use PREFIX as storage of data,gfx,lua etc.. Usefull only on *nix OS.
IF (PREFIX AND NOT WIN32)
ADD_DEFINITIONS(-DDATA_DIR_PREFIX)
ENDIF (PREFIX AND NOT WIN32)
ELSE (RELEASE)
MESSAGE("\n")
MESSAGE(STATUS "Build ${PROJECT} in development mode (RELEASE=OFF) --\n")
MESSAGE(STATUS "Binaries will be located in: " ${CMAKE_SOURCE_DIR})
SET(CMAKE_BUILD_TYPE DEBUG)
IF(NOT WIN32)
# Reduce objects and binary size to avoid 'file too big' error
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG")
ENDIF(NOT WIN32)
IF(NOT MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wall -std=c++11 -MMD")
ELSE()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-D_AMD64_)
else()
add_definitions(-D_X86_)
endif()
ENDIF()
SET(CMAKE_VERBOSE_MAKEFILE ON)
# Since CataclusmDDA does not respect PREFIX for development builds
# and has funny path handlers, we should create resulting Binaries
# in the source redectory
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY
${CMAKE_SOURCE_DIR}
CACHE PATH "Single Directory for all Executables."
)
SET(BIN_PREFIX ${CMAKE_SOURCE_DIR})
ENDIF (RELEASE)
ENDIF (CMAKE_BUILD_TYPE STREQUAL Debug)

MESSAGE(STATUS "LUA : ${LUA}")
IF (LUA)
Expand All @@ -246,7 +217,6 @@ ENDIF (LUA)
MESSAGE(STATUS "TILES : ${TILES}")
MESSAGE(STATUS "CURSES : ${CURSES}")
MESSAGE(STATUS "SOUND : ${SOUND}")
MESSAGE(STATUS "RELEASE : ${RELEASE}")
MESSAGE(STATUS "BACKTRACE : ${BACKTRACE}")
MESSAGE(STATUS "LOCALIZE : ${LOCALIZE}")
MESSAGE(STATUS "USE_HOME_DIR : ${USE_HOME_DIR}\n")
Expand All @@ -255,6 +225,16 @@ ENDIF (LUA)

MESSAGE(STATUS "See INSTALL file for details and more info --\n")

IF(MSVC)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-D_AMD64_)
else()
add_definitions(-D_X86_)
endif()
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wall -std=c++11")
SET(CMAKE_CXX_FLAGS_DEBUG "-Og -g -D_GLIBCXX_DEBUG")
ENDIF()

# Force out-of-source build
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
Expand Down
15 changes: 14 additions & 1 deletion COMPILING-VS-VCPKG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,25 @@ vcpkg integrate install
vcpkg --triplet x64-windows install sdl2 sdl2-image sdl2-mixer sdl2-ttf gettext lua
```

or (if you want to build statically linked executable)

```cmd
vcpkg --triplet x64-windows-static install sdl2 sdl2-image sdl2-mixer sdl2-ttf gettext lua
```


#### install32 bit dependencies:

```cmd
vcpkg --triplet x86-windows install sdl2 sdl2-image sdl2-mixer sdl2-ttf gettext lua
```

or (if you want to build statically linked executable)

```cmd
vcpkg --triplet x86-windows-static install sdl2 sdl2-image sdl2-mixer sdl2-ttf gettext lua
```

#### upgrade all dependencies:

```cmd
Expand All @@ -60,6 +73,6 @@ git clone https://github.com/CleverRaven/Cataclysm-DDA.git
cd Cataclysm-DDA
```

2. Open provided solution (`msvc-full-features\Cataclysm-vcpkg.sln`) in `Visual Studio`, select configuration (`Release` or `Debug`) an platform (`x64` or `x86`) and build it.
2. Open one of provided solutions (`msvc-full-features\Cataclysm-vcpkg.sln` for dynamically linked executable or `msvc-full-features\Cataclysm-vcpkg-static.sln` for statically linked executable) in `Visual Studio`, select configuration (`Release` or `Debug`) an platform (`x64` or `x86`) and build it.

**Note**: This will compile release version with Lua, Sound, Tiles and Localization support (language files won't be automatically compiled).
18 changes: 11 additions & 7 deletions build-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,31 @@ set -ex

function run_tests
{
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
$WINE "$@" -r cata --rng-seed `gshuf -i 0-1000000000 -n 1`
else
$WINE "$@" -r cata --rng-seed `shuf -i 0-1000000000 -n 1`
fi
$WINE "$@" -d yes -r cata --rng-seed time
}

if [ -n "$CMAKE" ]
then
if [ "$RELEASE" = "1" ]
then
build_type=MinSizeRel
else
build_type=Debug
fi

mkdir build
cd build
cmake \
-DBACKTRACE=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_BUILD_TYPE="$build_type" \
-DTILES=${TILES:-0} \
-DSOUND=${SOUND:-0} \
..
make -j3
cd ..
#[ -f cata_test ] && run_tests ./cata_test
#[ -f cata_test-tiles ] && run_tests ./cata_test-tiles
[ -f cata_test ] && run_tests ./cata_test
[ -f cata_test-tiles ] && run_tests ./cata_test-tiles
else
make -j3 RELEASE=1 BACKTRACE=1 DEBUG_SYMBOLS=1 CROSS="$CROSS_COMPILATION"
run_tests ./tests/cata_test
Expand Down
Loading

0 comments on commit 1862742

Please sign in to comment.