Compare commits
45 commits
master
...
gui2_help_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
713cbca0ad | ||
![]() |
29ffc91bdc | ||
![]() |
c68968a900 | ||
![]() |
ffbc768de5 | ||
![]() |
0a394732a0 | ||
![]() |
a638e8cc33 | ||
![]() |
50e27afc47 | ||
![]() |
86debf7c21 | ||
![]() |
5d69e6c03c | ||
![]() |
116edad6f4 | ||
![]() |
92f786f7e0 | ||
![]() |
0e21a6425b | ||
![]() |
b81b5ba66e | ||
![]() |
81388ad250 | ||
![]() |
0dc8869110 | ||
![]() |
b2f6b174d4 | ||
![]() |
23026434ff | ||
![]() |
be8340db2e | ||
![]() |
669c80c255 | ||
![]() |
39d823ccde | ||
![]() |
d7dc0cbdf6 | ||
![]() |
36571cad61 | ||
![]() |
06fb491e1e | ||
![]() |
4ba895f0fc | ||
![]() |
e82471a972 | ||
![]() |
88d8b9c933 | ||
![]() |
e8d23ccf33 | ||
![]() |
a4beeee390 | ||
![]() |
bfe5f4a2ec | ||
![]() |
5b99f3ae83 | ||
![]() |
1fc9500af1 | ||
![]() |
c2e100a937 | ||
![]() |
25ab7f04f7 | ||
![]() |
9fa470ddfc | ||
![]() |
67e4235918 | ||
![]() |
8dbd895b21 | ||
![]() |
8ac0ba61b4 | ||
![]() |
f421a74864 | ||
![]() |
ec5cdb4fe4 | ||
![]() |
0630ca6d9a | ||
![]() |
3ddd5670d9 | ||
![]() |
02b472b05c | ||
![]() |
820687baf3 | ||
![]() |
b12ffe752b | ||
![]() |
40214da0a1 |
31
.appveyor.vs2015.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
version: Wesnoth-VS2015-{branch}-{build}
|
||||
clone_folder: C:\projects\wesnoth
|
||||
image: Visual Studio 2015
|
||||
configuration:
|
||||
- Release
|
||||
- Debug
|
||||
platform: win32
|
||||
skip_branch_with_pr: true
|
||||
shallow_clone: true
|
||||
matrix:
|
||||
fast_finish: true # Stop after a build failure
|
||||
before_build:
|
||||
- cd ..
|
||||
- ps: wget https://github.com/aquileia/external/archive/VC14.zip -O VC14.zip
|
||||
- 7z x VC14.ZIP
|
||||
- ren external-VC14 external
|
||||
- cd wesnoth
|
||||
- set PATH=C:\projects\external\dll;%PATH%
|
||||
build_script:
|
||||
- msbuild projectfiles\VC14\wesnoth.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
|
||||
notifications:
|
||||
- provider: Webhook
|
||||
url: http://ai0867.net:6661/wesnoth
|
||||
headers:
|
||||
User-Agent: WesnothAppveyor/1.0
|
||||
Version: vs2015
|
||||
Num-Versions: 3
|
||||
Authorization: TODO
|
||||
on_build_success: true
|
||||
on_build_failure: true
|
35
.appveyor.vs2017.yml
Normal file
|
@ -0,0 +1,35 @@
|
|||
version: Wesnoth-VS2017-{branch}-{build}
|
||||
clone_folder: C:\projects\wesnoth
|
||||
image: Visual Studio 2017
|
||||
configuration:
|
||||
- Release
|
||||
- Debug
|
||||
platform: win32
|
||||
skip_branch_with_pr: true
|
||||
shallow_clone: true
|
||||
matrix:
|
||||
fast_finish: true # Stop after a build failure
|
||||
before_build:
|
||||
- cd ..
|
||||
- ps: wget https://github.com/aquileia/external/archive/VC15.zip -O VC15.zip
|
||||
- 7z x VC15.ZIP
|
||||
- ren external-VC15 external
|
||||
- cd wesnoth
|
||||
- set PATH=C:\projects\external\dll;%PATH%
|
||||
build_script:
|
||||
- msbuild projectfiles\VC14\wesnoth.sln /property:PlatformToolset=v141 /m /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
|
||||
artifacts:
|
||||
- path: wesnoth.exe
|
||||
- path: wesnothd.exe
|
||||
|
||||
notifications:
|
||||
- provider: Webhook
|
||||
url: http://ai0867.net:6661/wesnoth
|
||||
headers:
|
||||
User-Agent: WesnothAppveyor/1.0
|
||||
Version: vs2017
|
||||
Num-Versions: 3
|
||||
Authorization: TODO
|
||||
on_build_success: true
|
||||
on_build_failure: true
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
Checks: '-*,modernize-use-nullptr,performance-unnecessary-value-param'
|
||||
WarningsAsErrors: true
|
||||
...
|
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
.git
|
|
@ -1,19 +0,0 @@
|
|||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
|
||||
[*.cfg]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{cpp,hpp}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.lua]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
7
.gitattributes
vendored
|
@ -2,8 +2,5 @@
|
|||
/attic export-ignore
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
/.github export-ignore
|
||||
/changelog_entries export-ignore
|
||||
|
||||
# help github's language detection and syntax highlighting
|
||||
*.cfg linguist-language=INI
|
||||
.travis.yml export-ignore
|
||||
RELEASE_NOTES export-ignore
|
||||
|
|
12
.github/FUNDING.yml
vendored
|
@ -1,12 +0,0 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: Wesnoth
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
46
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -1,46 +0,0 @@
|
|||
name: Bug Report
|
||||
description: Create a bug report to help us improve the game.
|
||||
labels: ['Bug']
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
id: info
|
||||
attributes:
|
||||
label: Game and System Information
|
||||
description: |
|
||||
- What version of the game are you running? (If you built wesnoth yourself, mention the exact commit)
|
||||
- What OS are you running?
|
||||
value: |
|
||||
- **Version:**
|
||||
- **OS:**
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description of the bug
|
||||
description: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: to_reproduce
|
||||
attributes:
|
||||
label: Steps to reproduce the behavior
|
||||
placeholder: |
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
- type: textarea
|
||||
id: expectation
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: |
|
||||
A clear and concise description of what you expected to happen. If applicable, add screenshots or savefiles to help explain your problem.
|
||||
To find savefiles, start Wesnoth, click on the `i` button at the bottom left corner of the title screen, and open the `Saved games` directory.
|
||||
|
||||
- type: textarea
|
||||
id: more_info
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context (compiler logs, console output, etc) about the problem here.
|
14
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
@ -1,14 +0,0 @@
|
|||
name: Feature Request
|
||||
description: Request a new feature to enhance the game.
|
||||
labels: ['Enhancement']
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Describe the desired feature
|
||||
description: |
|
||||
Try to explain the desired end result, rather than speculating about how the feature could be implemented.
|
||||
If applicable, add screenshots or mockups to help explain your request.
|
||||
validations:
|
||||
required: true
|
|
@ -1,42 +0,0 @@
|
|||
name: Text Typos or Improvements
|
||||
description: Any typo fixes or improvement suggestions for campaign dialog, unit descriptions, or other game text.
|
||||
labels: ['Prose']
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: >
|
||||
**Note:** The house style of Wesnoth uses a good many words and constructions that are archaic, poetic,
|
||||
or dialectal. If you speak modern English as a second language you may incorrectly read these as errors.
|
||||
Please see [NotSpellingMistakes](https://wiki.wesnoth.org/NotSpellingMistakes) for a list of things you
|
||||
will encounter that may look like spelling or usage errors but are not.
|
||||
|
||||
Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em
|
||||
dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.
|
||||
|
||||
- type: input
|
||||
id: language
|
||||
attributes:
|
||||
label: Language
|
||||
description: What language does the typo appear in?
|
||||
|
||||
- type: input
|
||||
id: location
|
||||
attributes:
|
||||
label: Source
|
||||
description: Where does the typo appear? If part of a campaign, specify the scenario.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: original_text
|
||||
attributes:
|
||||
label: Original Text
|
||||
description: Quote the text verbatim. You can use `**bold**` to highlight the issue.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: new_text
|
||||
attributes:
|
||||
label: Proposed Change
|
284
.github/labeler.yml
vendored
|
@ -1,284 +0,0 @@
|
|||
Achievements:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/achievements.hpp
|
||||
- src/achievements.cpp
|
||||
- src/gui/dialogs/achievements_dialog.hpp
|
||||
- src/gui/dialogs/achievements_dialog.cpp
|
||||
- data/achievements.cfg
|
||||
- data/campaigns/*/achievements.cfg
|
||||
|
||||
Add-ons:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/server/campaignd/**
|
||||
- src/server/common/**
|
||||
- src/addon/**
|
||||
- src/gui/dialogs/addon/**
|
||||
|
||||
AI:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/ai/**/*
|
||||
- data/campaigns/*/ai/**
|
||||
- src/ai/**/*
|
||||
|
||||
Audio:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/*/sounds/**
|
||||
- data/core/music/*
|
||||
- data/core/sounds/**/*
|
||||
- sounds/*
|
||||
|
||||
Building:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- projectfiles/**/*
|
||||
- source_lists/*
|
||||
- CMakeLists.txt
|
||||
- cmake/*
|
||||
- src/CMakeLists.txt
|
||||
- SConstruct
|
||||
- scons/*
|
||||
- src/SConscript
|
||||
- src/SConstruct
|
||||
|
||||
Campaign AToTB:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Two_Brothers/**
|
||||
|
||||
Campaign DW:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Dead_Water/**
|
||||
|
||||
Campaign DM:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Delfadors_Memoirs/**
|
||||
|
||||
Campaign DiD:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Descent_Into_Darkness/**
|
||||
|
||||
Campaign EI:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Eastern_Invasion/**
|
||||
|
||||
Campaign HttT:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Heir_To_The_Throne/**
|
||||
|
||||
Campaign LoW:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Legend_of_Wesmere/**
|
||||
|
||||
Campaign L:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Liberty/**
|
||||
|
||||
Campaign NR:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Northern_Rebirth/**
|
||||
|
||||
Campaign SoF:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Sceptre_of_Fire/**
|
||||
|
||||
Campaign SotA:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Secrets_of_the_Ancients/**
|
||||
|
||||
Campaign SotBE:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Son_Of_The_Black_Eye/**
|
||||
|
||||
Campaign THoT:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/The_Hammer_of_Thursagan/**
|
||||
|
||||
Campaign TRoW:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/The_Rise_Of_Wesnoth/**
|
||||
|
||||
Campaign TSG:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/The_South_Guard/**
|
||||
|
||||
Campaign Tutorial:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/tutorial/**
|
||||
|
||||
Campaign UtBS:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Under_the_Burning_Suns/**
|
||||
|
||||
Campaign WoF:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/Winds_of_Fate/**
|
||||
|
||||
Campaign WC:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/campaigns/World_Conquest/**
|
||||
|
||||
CMake:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- CMakeLists.txt
|
||||
- cmake/*
|
||||
- src/CMakeLists.txt
|
||||
|
||||
Docker:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- .dockerignore
|
||||
- utils/dockerbuilds/travis/*
|
||||
- utils/travis/docker_run.sh
|
||||
|
||||
Docs:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- doc/**/*
|
||||
|
||||
Editor:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/core/editor/*
|
||||
- src/editor/**/*
|
||||
|
||||
Graphics:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- images/**/*
|
||||
- data/campaigns/*/images/**
|
||||
- data/core/images/**/*
|
||||
|
||||
Help:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/tips.cfg
|
||||
- data/core/help.cfg
|
||||
- src/help/*
|
||||
- src/gui/dialogs/help_browser.*
|
||||
|
||||
Input:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/core/hotkeys.cfg
|
||||
|
||||
Lua API:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/scripting/**/*
|
||||
- data/lua/**/*
|
||||
|
||||
macOS:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- projectfiles/Xcode/**/*
|
||||
- src/macosx/*
|
||||
|
||||
MP:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/multiplayer/**/*
|
||||
- src/server/wesnothd/**
|
||||
- src/server/common/**
|
||||
|
||||
Packaging:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- packaging/**/*
|
||||
|
||||
Schema:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- utils/travis/schema_validation.sh
|
||||
- data/schema/**/*
|
||||
- src/serialization/schema/*
|
||||
|
||||
SCons:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- SConstruct
|
||||
- scons/*
|
||||
- src/SConscript
|
||||
- src/SConstruct
|
||||
|
||||
Services:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- utils/mp-server/**
|
||||
|
||||
Terrain:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/terrain/**/*
|
||||
- data/campaigns/*/images/terrain/**
|
||||
- data/campaigns/**/terrain.cfg
|
||||
- data/campaigns/**/terrain_graphics.cfg
|
||||
- data/core/images/terrain/**
|
||||
- data/core/terrain.cfg
|
||||
- data/core/terrain-graphics.cfg
|
||||
- data/core/terrain-graphics/**
|
||||
|
||||
Translations:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- po/**/*
|
||||
- data/languages/*
|
||||
|
||||
Travis:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- utils/travis/**/*
|
||||
|
||||
UI:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/gui/**/*
|
||||
- data/gui/**/*
|
||||
- data/schema/gui.cfg
|
||||
- data/themes/*
|
||||
|
||||
Unit Tests:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/test/**/*
|
||||
|
||||
Units:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/units/**/*
|
||||
- data/campaigns/*/units/**
|
||||
- data/core/units/**/*
|
||||
- data/core/images/units/**/*
|
||||
|
||||
WML Tools:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- data/tools/**/*
|
||||
|
||||
WFL:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/formula/**
|
||||
- src/ai/formula/**
|
391
.github/workflows/ci-main.yml
vendored
|
@ -1,391 +0,0 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
checks: # checks that don't need a wesnoth binary
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: wesnoth/wesnoth:2404-master
|
||||
options: --tty # docker create options
|
||||
env:
|
||||
CLICOLOR_FORCE: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set git safe directory
|
||||
if: success() || failure()
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
- name: Check for invalid characters
|
||||
if: success() || failure()
|
||||
run: |
|
||||
./utils/CI/check_utf8.sh
|
||||
./utils/CI/utf8_bom_dog.sh
|
||||
- name: Whitespace and WML indentation check
|
||||
if: success() || failure()
|
||||
run: ./utils/CI/fix_whitespace.sh; git status; git diff --exit-code
|
||||
- name: WML missing images check
|
||||
if: success() || failure()
|
||||
run: utils/CI/check_wml_images.sh
|
||||
- name: Run luacheck
|
||||
if: success() || failure()
|
||||
run: luacheck .
|
||||
- name: Doxygen check
|
||||
if: success() || failure()
|
||||
run: doxygen doc/doxygen/Doxyfile
|
||||
|
||||
copyright: # check takes a bit longer and does not need to run in docker (sound/music only)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { fetch-depth: 50 } }
|
||||
|
||||
- name: Sound/Music copyright check
|
||||
run: ./update_copyrights
|
||||
|
||||
ubuntu:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# the check for WML tests below may need to be adjusted if configurations are changed
|
||||
- { cfg: debug, tool: scons, cc: gcc, cxx: g++, std: 17, lto: false, sys_lua: false }
|
||||
- { cfg: release, tool: cmake, cc: gcc, cxx: g++, std: 20, lto: true, sys_lua: false }
|
||||
- { cfg: release, tool: cmake, cc: clang, cxx: clang++, std: 17, lto: true, sys_lua: true }
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: wesnoth/wesnoth:2404-master
|
||||
options: --tty # docker create options
|
||||
env:
|
||||
TOOL: ${{ matrix.tool }}
|
||||
CFG: ${{ matrix.cfg }}
|
||||
CC: ${{ matrix.cc }}
|
||||
CXX: ${{ matrix.cxx }}
|
||||
CXX_STD: ${{ matrix.std }}
|
||||
LTO: ${{ matrix.lto }}
|
||||
SYS_LUA: ${{ matrix.sys_lua }}
|
||||
CLICOLOR_FORCE: 1
|
||||
SDL_VIDEODRIVER: dummy
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
# 1) wesnothd and campaignd should be buildable without SDL2 being present
|
||||
# 2) boost is installed via apt as well as built and installed into /usr/local (for _GLIBCXX_DEBUG support in boost program options)
|
||||
# 3) mariadbpp currently has a deprecation warning that causes strict builds to fail
|
||||
# scons doesn't build it for the wesnoth client and the boost tests, but cmake apparently does
|
||||
- name: Build wesnoth, wesnothd, campaignd and unit tests
|
||||
id: build # needed to check step outcome
|
||||
run: |
|
||||
case $TOOL in
|
||||
scons)
|
||||
build() {
|
||||
ldconfig
|
||||
scons "$@" build="$CFG" ctool="$CC" cxxtool="$CXX" cxx_std="$CXX_STD" \
|
||||
extra_flags_config="-pipe" forum_user_handler=true \
|
||||
nls=false enable_lto="$LTO" system_lua="$SYS_LUA" force_color=true \
|
||||
jobs=2 --debug=time glibcxx_debug=true glibcxx_assertions=true compile_db=true
|
||||
}
|
||||
build strict=true wesnoth boost_unit_tests
|
||||
|
||||
build cdb
|
||||
# disable all warnings since we have coverage on them in a standard build, and clang-tidy
|
||||
# triggers false positive compiler warnings that clang itself won't
|
||||
run-clang-tidy -quiet -use-color -j 2 -extra-arg="-w" -warnings-as-errors='*' '^(?!.*src/modules/|.*build/)'
|
||||
|
||||
apt remove -y -qq libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev
|
||||
|
||||
build strict=false wesnothd campaignd
|
||||
;;
|
||||
cmake)
|
||||
build() {
|
||||
ldconfig
|
||||
cmake "$@" -DCMAKE_BUILD_TYPE="$CFG" -DCXX_STD="$CXX_STD" \
|
||||
-DEXTRA_FLAGS_CONFIG="-pipe" -DENABLE_MYSQL=true \
|
||||
-DENABLE_NLS=false -DENABLE_LTO="$LTO" -DFORCE_COLOR_OUTPUT=true -DLTO_JOBS=2 \
|
||||
-DENABLE_SYSTEM_LUA="$SYS_LUA -DCLANG_TIDY=true" .
|
||||
}
|
||||
rm -R /usr/local/lib/cmake
|
||||
rm /usr/local/lib/libboost*
|
||||
rm -R /usr/local/include/boost
|
||||
build -DENABLE_GAME=true -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=true -DENABLE_STRICT_COMPILATION=false
|
||||
make conftests
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
apt remove -y -qq libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev
|
||||
|
||||
build -DENABLE_GAME=false -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true -DENABLE_TESTS=false -DENABLE_STRICT_COMPILATION=false
|
||||
make VERBOSE=1 -j2
|
||||
;;
|
||||
esac
|
||||
- name: Check path options
|
||||
if: success() || steps.build.outcome == 'success'
|
||||
run: |
|
||||
./wesnoth --version
|
||||
for opt in data userdata usercache
|
||||
do
|
||||
output=$(./wesnoth --nobanner --"$opt"-path)
|
||||
if [ "$output" = "" ]; then printf 'option --%s-path prints nothing to stdout!\n' "$opt" >&2; exit 1; fi
|
||||
printf '%s-path: %s\n' "$opt" "$output"
|
||||
done
|
||||
- name: WML validation
|
||||
# only run on release builds (takes ~10 times as long on debug); since there are multiple release builds
|
||||
# but running the following tests multiple times doesn't make much sense use cc==clang as the check
|
||||
if: matrix.cc == 'clang' && (success() || steps.build.outcome == 'success')
|
||||
run: ./utils/CI/schema_validation.sh
|
||||
- name: Run WML tests
|
||||
# only run on release builds (takes ~6 times as long on debug)
|
||||
if: matrix.cc == 'clang' && (success() || steps.build.outcome == 'success')
|
||||
run: ./run_wml_tests -v -v -g -c -t 20 -bt 1000 -a=--userdata-dir=ud
|
||||
- name: Upload userdata files from WML unit tests (logs, replays)
|
||||
if: matrix.cc == 'clang' && (success() || failure())
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: WMLTest-userdata-Linux
|
||||
path: ud
|
||||
- name: Run play tests
|
||||
if: success() || steps.build.outcome == 'success'
|
||||
run: ./utils/CI/play_test_executor.sh
|
||||
- name: Run MP tests
|
||||
if: success() || steps.build.outcome == 'success'
|
||||
run: ./utils/CI/mp_test_executor.sh
|
||||
- name: Run unit tests
|
||||
if: success() || steps.build.outcome == 'success'
|
||||
run: ./run_boost_tests
|
||||
|
||||
steam-runtime:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
- name: Steam Runtime
|
||||
run: |
|
||||
version=$(sed -n 's/#define VERSION "\(.*\)"/\1/p' src/wesconfig.h)
|
||||
cd utils/dockerbuilds && ./make_steam_build
|
||||
tar -cf "steambuild-$version.tar" steambuild
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Steam-Linux
|
||||
path: utils/dockerbuilds/steambuild-*.tar
|
||||
|
||||
mingw:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
- name: MinGW Crosscompile
|
||||
run: |
|
||||
version=$(sed -n 's/#define VERSION "\(.*\)"/\1/p' src/wesconfig.h)
|
||||
git archive --format=tar HEAD > "wesnoth-$version.tar"
|
||||
tar -rf "wesnoth-$version.tar" src/modules/
|
||||
bzip2 "wesnoth-$version.tar"
|
||||
|
||||
cd utils/dockerbuilds && ./make_mingw_build
|
||||
mv mingwbuild/wesnoth*-win64.exe "wesnoth-$version-win64.exe"
|
||||
|
||||
- name: Upload Source
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Source
|
||||
path: wesnoth-*.tar.bz2
|
||||
|
||||
- name: Upload Windows-Installer
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Windows-Installer
|
||||
path: utils/dockerbuilds/wesnoth-*-win64.exe
|
||||
|
||||
flatpak:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: wesnoth/wesnoth:flatpak-master
|
||||
options: --tty --cap-add=ALL --privileged # docker create options
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive", fetch-depth: 500, fetch-tags: true } }
|
||||
|
||||
- name: Flatpak
|
||||
run: |
|
||||
# write to an ignored filename so the build is not marked as modified
|
||||
jq '.modules |= map(select(.name == "wesnoth").sources[0]={type:"dir",path:"."})' packaging/flatpak/org.wesnoth.Wesnoth.json > wesnoth-manifest.json
|
||||
git config --global --add safe.directory "$PWD"
|
||||
branch=ci-$(git describe || git log -n 1 --format=%h) # if git describe fails fall back to the commit hash
|
||||
flatpak-builder --force-clean --default-branch="$branch" --disable-rofiles-fuse --jobs=2 wesnoth-app wesnoth-manifest.json
|
||||
flatpak build-export export wesnoth-app "$branch"
|
||||
flatpak build-bundle export wesnoth.flatpak org.wesnoth.Wesnoth "$branch" --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
- name: Upload flatpak bundle
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Flatpak-Bundle
|
||||
path: wesnoth.flatpak
|
||||
|
||||
translations:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: wesnoth/wesnoth:2404-master
|
||||
env:
|
||||
LANGUAGE: en_US.UTF-8
|
||||
LANG: en_US.UTF-8
|
||||
LC_ALL: en_US.UTF-8
|
||||
CLICOLOR_FORCE: 1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: Translations
|
||||
run: |
|
||||
cmake -DENABLE_NLS=true -DENABLE_GAME=false -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=false -DENABLE_POT_UPDATE_TARGET=TRUE .
|
||||
make update-po4a-man; echo "Ran make update-po4a-man"
|
||||
make update-po4a-manual; echo "Ran make update-po4a-manual"
|
||||
make pot-update; echo "Ran make pot-update"
|
||||
make mo-update; echo "Ran make mo-update"
|
||||
make clean
|
||||
|
||||
scons translations build=release --debug=time nls=true jobs=2; echo "Ran scons translations"
|
||||
scons pot-update; echo "Ran scons pot-update"
|
||||
scons update-po4a; echo "Ran scons update-po4a"
|
||||
scons manual
|
||||
|
||||
macos-intel:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cfg: [ Release ]
|
||||
runs-on: macos-13
|
||||
env:
|
||||
CFG: ${{ matrix.cfg }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install scons
|
||||
./projectfiles/Xcode/Fix_Xcode_Dependencies
|
||||
- name: Build translations
|
||||
run: scons translations build=release --debug=time nls=true jobs=2
|
||||
- name: Build wesnoth and unit tests
|
||||
working-directory: projectfiles/Xcode
|
||||
run: |
|
||||
xcodebuild ARCHS=x86_64 -project "The Battle for Wesnoth.xcodeproj" -target "The Battle for Wesnoth" -target "unit_tests" -configuration "$CFG"
|
||||
# xcodebuild or maybe clang do not appear to fail properly when input files cannot be found; double check executables were produced
|
||||
[ -x "build/$CFG/The Battle for Wesnoth.app" ] || { printf 'Failed to build wesnoth executable!\n' >&2; exit 1; }
|
||||
[ -x "build/$CFG/unit_tests" ] || { printf 'Failed to build unit test executable!\n' >&2; exit 1; }
|
||||
- name: Create disk image
|
||||
working-directory: projectfiles/Xcode
|
||||
continue-on-error: true # allow failures since this is not essential and it does fail spuriously (hdiutil: create failed - Resource busy)
|
||||
run: hdiutil create -volname "Wesnoth_$CFG" -fs 'HFS+' -srcfolder "build/$CFG" -ov -format UDBZ "Wesnoth_${CFG}.dmg"
|
||||
- name: Upload disk image
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: MacOS ${{ matrix.cfg }} disk image
|
||||
path: projectfiles/Xcode/Wesnoth_${{ matrix.cfg }}.dmg
|
||||
- name: Run WML tests
|
||||
if: matrix.cfg == 'Release'
|
||||
run: ./run_wml_tests -g -c -t 30 -bt 350 -p "projectfiles/Xcode/build/$CFG/The Battle for Wesnoth.app/Contents/MacOS/The Battle for Wesnoth" -a=--userdata-dir="$PWD/ud"
|
||||
- name: Upload userdata files from WML unit tests (logs, replays)
|
||||
if: matrix.cfg == 'Release' && (success() || failure())
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: WMLTest-userdata-MacOS
|
||||
path: ud
|
||||
- name: Run unit tests
|
||||
run: ./run_boost_tests --path=projectfiles/Xcode/build/"$CFG" --executable=unit_tests
|
||||
|
||||
windows:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cfg: [Release]
|
||||
env:
|
||||
CFG: ${{ matrix.cfg }}
|
||||
VCPKG_FEATURE_FLAGS: dependencygraph
|
||||
permissions:
|
||||
contents: write # for dependency graph
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
- name: Make version of the runner image (https://github.com/actions/runner-images/releases) accessible to expression
|
||||
run: echo IMAGE_VERSION=%ImageVersion%>> %GITHUB_ENV%
|
||||
|
||||
- name: Cache object files
|
||||
id: windows-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vcpkg_installed # vcpkg generates this dir next to vcpkg.json
|
||||
# the final key part needs to be changed if anything in the build process changes that is not already included here
|
||||
key: win-cache-master-${{ matrix.cfg }}-${{ env.IMAGE_VERSION }}-${{ hashFiles('vcpkg.json') }}-0001
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Run cmake
|
||||
run: cmake -DCMAKE_BUILD_TYPE=%CFG% -DENABLE_GAME=true -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true
|
||||
-DENABLE_TESTS=true -DENABLE_MYSQL=false -DENABLE_NLS=false
|
||||
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_INSTALL_OPTIONS=--debug
|
||||
-DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_GENERATOR_PLATFORM=x64 -G "Visual Studio 17 2022" .
|
||||
|
||||
- name: Build wesnoth, wesnothd, campaignd and unit tests
|
||||
run: MSBuild.exe wesnoth.sln -p:Configuration=%CFG%
|
||||
|
||||
- name: Run WML unit tests
|
||||
if: matrix.cfg == 'Release'
|
||||
run: python run_wml_tests -v -g -c -t 20 -p %CFG%/wesnoth.exe -a=--userdata-dir=ud
|
||||
|
||||
- name: Upload userdata files from WML unit tests (logs, replays)
|
||||
if: matrix.cfg == 'Release' && (success() || failure())
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: WMLTest-userdata-Windows
|
||||
path: ud
|
||||
|
||||
# run after all other jobs have completed to check overall build status
|
||||
notification:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [checks, copyright, ubuntu, steam-runtime, mingw, flatpak, translations, macos-intel, windows]
|
||||
if: failure() && github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- name: Discord Notification
|
||||
uses: rjstone/discord-webhook-notify@v1
|
||||
with:
|
||||
severity: error
|
||||
webhookUrl: ${{ secrets.DISCORD_CI_WEBHOOK }}
|
||||
description: |-
|
||||
pusher: ${{ github.actor }}
|
||||
commit: ${{ github.event.head_commit.message }}
|
||||
commit url: ${{ github.event.head_commit.url }}
|
||||
- name: Prepare message
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
MSG: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
printf COMMIT_SUBJECT=%s "${MSG}" | head -n 1 >> "$GITHUB_ENV"
|
||||
- name: IRC Notification
|
||||
uses: rectalogic/notify-irc@v1
|
||||
with:
|
||||
channel: ${{ vars.IRC_CHANNEL }}
|
||||
server: ${{ vars.IRC_SERVER }}
|
||||
nickname: ${{ vars.IRC_NICK }} # is also used for sasl username
|
||||
sasl_password: ${{ secrets.IRC_SASL_PASSWORD }}
|
||||
message: "❌ ${{ github.workflow }} workflow run ${{ github.run_number }} failed on \x0306${{ github.ref_name }}\x0F: ${{ env.COMMIT_SUBJECT }} by \x0315${{ github.actor }}\x0F: \x0302${{ github.event.head_commit.url }}\x0F"
|
67
.github/workflows/codeql.yml
vendored
|
@ -1,67 +0,0 @@
|
|||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners
|
||||
# Consider using larger runners for possible analysis time improvements.
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 360
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp', 'python', 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
|
||||
# Use only 'java' to analyze code written in Java, Kotlin or both
|
||||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- { name: Checkout repository, uses: actions/checkout@v4, with: { submodules: "recursive" } }
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
- name: Install dependencies
|
||||
if: matrix.language == 'cpp'
|
||||
run: |
|
||||
utils/autorevision.sh -t h > src/revision.h
|
||||
sudo apt update
|
||||
sudo apt install scons libboost-system1.83-dev libboost-filesystem1.83-dev libboost-iostreams1.83-dev \
|
||||
libboost-serialization1.83-dev libboost-locale1.83-dev libboost-regex1.83-dev libboost-random1.83-dev \
|
||||
libboost-program-options1.83-dev libboost-thread1.83-dev libboost-context1.83-dev libboost-test-dev \
|
||||
libboost-coroutine1.83-dev libboost-graph1.83-dev libasio-dev libsdl2-dev libsdl2-image-dev \
|
||||
libsdl2-mixer-dev libvorbis-dev libpango1.0-dev libssl-dev libcurl4-openssl-dev liblua5.4-dev
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
88
.github/workflows/image_metadata.yml
vendored
|
@ -1,88 +0,0 @@
|
|||
name: Image metadata check CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
paths: [ '**.webp', '**.png', '**.jpg', '**.jpeg' ]
|
||||
pull_request:
|
||||
paths: [ '**.webp', '**.png', '**.jpg', '**.jpeg' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Image Metadata
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BASE_SHA: ${{ github.event_name == 'push' && github.event.before || github.event.pull_request.base.sha }}
|
||||
HEAD_SHA: ${{ github.event_name == 'push' && github.event.after || github.event.pull_request.head.sha }}
|
||||
|
||||
steps:
|
||||
- name: exiftool installation
|
||||
run: |
|
||||
sudo apt-get install --assume-yes exiftool
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: check image EXIF metadata
|
||||
run: |
|
||||
mapfile -t image_files < <(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" | grep -E '\.(webp|je?pg)$')
|
||||
# cycle through the changed image files, make sure they have the right fields
|
||||
for file in "${image_files[@]}"; do
|
||||
# check Artist tag, fail if missing
|
||||
artist="$(exiftool -p '$Artist' "$file")"
|
||||
if [ "$artist" ]; then
|
||||
printf 'Artist tag in %s is %s\n' "$file" "$artist"
|
||||
else
|
||||
printf 'no Artist EXIF tag in %s\n' "$file"
|
||||
exit 1
|
||||
fi
|
||||
# check Copyright tag, fail if missing or wrong type
|
||||
copyright="$(exiftool -p '$Copyright' "$file")"
|
||||
case $copyright in
|
||||
'GNU GPL v2+'|'CC BY-SA 4.0'|CC0)
|
||||
printf 'Copyright tag in %s is %s\n' "$file" "$copyright"
|
||||
;;
|
||||
'')
|
||||
printf 'no Copyright EXIF tag in %s\n' "$file"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
printf 'Copyright tag %s in file %s is not an accepted license! Must be one of: "GNU GPL v2+", "CC BY-SA 4.0", "CC0"\n' "$copyright" "$file"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
- name: check png XMP metadata
|
||||
run: |
|
||||
mapfile -t image_files < <(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" | grep -E '\.png$')
|
||||
# cycle through the changed image files, make sure they have the right fields
|
||||
for file in "${image_files[@]}"; do
|
||||
# check Creator tag, fail if missing
|
||||
artist="$(exiftool -p '$XMP:Creator' "$file")"
|
||||
if [ "$artist" ]; then
|
||||
printf 'Creator tag in %s is %s\n' "$file" "$artist"
|
||||
else
|
||||
printf 'no Creator XMP tag in %s\n' "$file"
|
||||
exit 1
|
||||
fi
|
||||
# check Rights tag, fail if missing or wrong type
|
||||
copyright="$(exiftool -p '$XMP:Rights' "$file")"
|
||||
case $copyright in
|
||||
'GNU GPL v2+'|'CC BY-SA 4.0'|CC0)
|
||||
printf 'Rights tag in %s is %s\n' "$file" "$copyright"
|
||||
;;
|
||||
'')
|
||||
printf 'no Rights XMP tag in %s\n' "$file"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
printf 'Rights tag %s in file %s is not an accepted license! Must be one of: "GNU GPL v2+", "CC BY-SA 4.0", "CC0"\n' "$copyright" "$file"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
45
.github/workflows/irc-notify.yml
vendored
|
@ -1,45 +0,0 @@
|
|||
name: IRC Notification
|
||||
on:
|
||||
push:
|
||||
pull_request_target:
|
||||
types: [ opened, closed, reopened ]
|
||||
issues:
|
||||
types: [ opened, closed, reopened ]
|
||||
# create: # creation also gets mentioned when pushing
|
||||
delete:
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
if: vars.IRC_CHANNEL != '' # skip if not set up (like in a fork for example)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Prepare message
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
MSG: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
printf COMMIT_SUBJECT=%s "${MSG}" | head -n 1 >> "$GITHUB_ENV"
|
||||
- uses: rectalogic/notify-irc@v1
|
||||
env: { COLOR: "\x03", BLUE: "02", PURPLE: "06", ACTOR: "\x0315${{ github.actor }}\x03" }
|
||||
with:
|
||||
channel: ${{ vars.IRC_CHANNEL }}
|
||||
server: ${{ vars.IRC_SERVER }}
|
||||
nickname: ${{ vars.IRC_NICK }} # is also used for sasl username
|
||||
sasl_password: ${{ secrets.IRC_SASL_PASSWORD }}
|
||||
# See https://docs.github.com/en/actions/learn-github-actions/expressions
|
||||
# github context: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
|
||||
# github.event data: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads
|
||||
message: >-
|
||||
${{ (github.event_name == 'push' &&
|
||||
format('{1} {2} {0}{3}{4}{0}: {5}: {0}{6}{7}{0}', env.COLOR, env.ACTOR,
|
||||
(github.event.created && (github.event.tag && 'tagged' || 'created')) || (github.event.deleted && 'deleted') || (github.event.forced && 'force-pushed to') || 'pushed to',
|
||||
env.PURPLE, github.ref_name, env.COMMIT_SUBJECT, env.BLUE, github.event.compare)
|
||||
) || (github.event_name == 'pull_request_target' &&
|
||||
format('{1} {2} PR #{3} for {0}{4}{5}{0}: {6}: {0}{7}{8}{0}', env.COLOR, env.ACTOR, github.event.action, github.event.number, env.PURPLE, github.base_ref, github.event.pull_request.title, env.BLUE, github.event.pull_request.html_url)
|
||||
) || (github.event_name == 'issues' &&
|
||||
format('{1} {2} issue {0}{3}#{4}{0}: {5}: {0}{6}{7}{0}', env.COLOR, env.ACTOR, github.event.action, env.PURPLE, github.event.issue.number, github.event.issue.title, env.BLUE, github.event.issue.html_url)
|
||||
) || ((github.event_name == 'create' || github.event_name == 'delete') &&
|
||||
format('{1} {2}d {3} {0}{4}{5}{0}', env.COLOR, env.ACTOR, github.event_name, github.event.ref_type, env.PURPLE, github.event.ref)
|
||||
)
|
||||
}}
|
||||
_debug: ${{ toJSON(github) }}
|
12
.github/workflows/labeler.yml
vendored
|
@ -1,12 +0,0 @@
|
|||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@main
|
78
.github/workflows/map-diff.yml
vendored
|
@ -1,78 +0,0 @@
|
|||
name: Map Diff
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
paths:
|
||||
- '**.map'
|
||||
|
||||
jobs:
|
||||
comment-map-diff:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-20.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: utils/wesnoth-map-diff
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Package install
|
||||
run: npm install
|
||||
- name: Package build
|
||||
run: npm run build:prod
|
||||
- name: Get maps diff
|
||||
id: get-maps-diff
|
||||
env:
|
||||
SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
sudo apt-get -y -q install pngquant
|
||||
comment_body=""
|
||||
log() { printf '\e[1m%s\e[m\n' "$*"; } # write log message in bold
|
||||
|
||||
## Get changed maps
|
||||
git fetch --depth=1 origin "$SHA"
|
||||
mapfile -t map_paths < <(git diff --name-only HEAD "$SHA" | grep '\.map$')
|
||||
|
||||
for map_path in "${map_paths[@]}"
|
||||
do
|
||||
## Get new map version
|
||||
log "Check out $map_path from $SHA..."
|
||||
new_map=${map_path##*/}
|
||||
git show "$SHA":"$map_path" > "$new_map"
|
||||
|
||||
log "Generate map diff image for $map_path..."
|
||||
node build/index.js "../../$map_path" "$new_map" diff_image.png
|
||||
identify diff_image.png
|
||||
|
||||
log 'Compress image...'
|
||||
pngquant --force --output diff_image.png diff_image.png
|
||||
identify diff_image.png
|
||||
|
||||
log 'Uploading diff_image.png...'
|
||||
json=$(curl -s -F image=@diff_image.png https://api.imgur.com/3/upload | tee /dev/stderr) || continue
|
||||
|
||||
log 'Generating HTML comment...'
|
||||
html=$(jq -r --arg path "$map_path" 'if .data.link != null
|
||||
then @html "<h3>\($path)</h3><img src=\"\(.data.link)\" /> <br />"
|
||||
elif has("errors") then .errors[].status | halt_error
|
||||
else "Unexpected JSON structure!\n" | halt_error end' <<< "$json") || continue
|
||||
comment_body+=$html
|
||||
done
|
||||
|
||||
printf 'COMMENT_BODY=%s\n' "$comment_body" >> "$GITHUB_OUTPUT"
|
||||
- name: Find comment
|
||||
uses: peter-evans/find-comment@v2
|
||||
id: fc
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
- name: Add comment
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||
edit-mode: replace
|
||||
body: ${{ steps.get-maps-diff.outputs.COMMENT_BODY }}
|
61
.gitignore
vendored
|
@ -18,16 +18,6 @@ CPack*Config.cmake
|
|||
uninstall.cmake
|
||||
CMakeCache.txt
|
||||
install_manifest.txt
|
||||
out/**/*
|
||||
CTestTestfile.cmake
|
||||
DartConfiguration.tcl
|
||||
Testing/*
|
||||
doc/CTestTestfile.cmake
|
||||
doc/design/CTestTestfile.cmake
|
||||
doc/man/CTestTestfile.cmake
|
||||
doc/manual/CTestTestfile.cmake
|
||||
src/CTestTestfile.cmake
|
||||
src/Testing/
|
||||
|
||||
# scons
|
||||
.scons-option-cache
|
||||
|
@ -45,8 +35,7 @@ projectfiles/Xcode/**/Wesnoth.dmgCanvas
|
|||
projectfiles/Xcode/**/*.mode1v3
|
||||
projectfiles/Xcode/**/*.pbxuser
|
||||
projectfiles/Xcode/**/xcuserdata
|
||||
projectfiles/Xcode/**/*.xcworkspace
|
||||
!projectfiles/Xcode/**/project.pbxproj
|
||||
projectfiles/Xcode/**/project.xcworkspace
|
||||
|
||||
# CodeBlocks
|
||||
projectfiles/**/.clang
|
||||
|
@ -59,21 +48,25 @@ projectfiles/**/*_build_log.html
|
|||
projectfiles/**/*objs*
|
||||
|
||||
# Visual Studio
|
||||
projectfiles/VC*
|
||||
!projectfiles/VC14
|
||||
projectfiles/VC*/.vs/
|
||||
projectfiles/VC*/*.vc.*db
|
||||
projectfiles/VC*/*.sdf
|
||||
projectfiles/VC*/*.suo
|
||||
projectfiles/VC*/*.aps
|
||||
projectfiles/VC*/*.user
|
||||
ALL_BUILD.vcproj
|
||||
INSTALL.vcproj
|
||||
PACKAGE.vcproj
|
||||
ZERO_CHECK.vcproj
|
||||
uninstall.vcproj
|
||||
*.vcproj.*.user
|
||||
src/**/*.vcproj
|
||||
/WindowsTimeout.ilk
|
||||
/WindowsTimeout.pdb
|
||||
.vscode
|
||||
/.vs
|
||||
vcpkg_installed/
|
||||
*.vcxproj
|
||||
*.vcxproj.filters
|
||||
doc/**/*.vcxproj
|
||||
doc/**/*.vcxproj.filters
|
||||
src/**/*.vcxproj
|
||||
src/**/*.vcxproj.filters
|
||||
vcpkg-manifest-install.log
|
||||
|
||||
# CLion
|
||||
/.idea
|
||||
cmake-build-debug
|
||||
cmake-build-release
|
||||
|
||||
# eclipse
|
||||
.settings
|
||||
|
@ -97,7 +90,9 @@ stamp-h1
|
|||
# build directories
|
||||
/wesnoth*
|
||||
/wesnothd*
|
||||
wesnothd/
|
||||
/campaignd*
|
||||
campaignd/
|
||||
/cutter*
|
||||
cutter/
|
||||
/exploder*
|
||||
|
@ -127,7 +122,6 @@ wesnoth.plg
|
|||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
compile_commands.json
|
||||
|
||||
# library files
|
||||
.libs
|
||||
|
@ -147,7 +141,6 @@ src/test
|
|||
error*.log
|
||||
boost_test_result.xml
|
||||
*build*.sh
|
||||
boost_tests.log
|
||||
|
||||
# translations
|
||||
locales
|
||||
|
@ -166,8 +159,6 @@ po/**/Makefile*
|
|||
data/tools/unit_tree/**/files
|
||||
data/tools/unit_tree/**/reports
|
||||
data/tools/unit_tree/**/Locale
|
||||
data/tools/macro_reference.html
|
||||
about.wiki
|
||||
|
||||
# doc
|
||||
doc/doxygen/html
|
||||
|
@ -207,12 +198,6 @@ fonts/.uuid
|
|||
*~
|
||||
.deps
|
||||
.dirstamp
|
||||
*.cfg-bak
|
||||
*.orig
|
||||
|
||||
# might be good to have, but not in data
|
||||
data/**/*.xcf
|
||||
data/**/*.psd
|
||||
|
||||
# uncategorized
|
||||
revision*
|
||||
|
@ -220,9 +205,3 @@ config.h
|
|||
6not
|
||||
.kdev*
|
||||
callgrind.out.*
|
||||
data/dist
|
||||
clean.sh
|
||||
widgets_tested.log
|
||||
|
||||
# clangd cache
|
||||
.cache/clangd
|
||||
|
|
7
.gitmodules
vendored
|
@ -1,7 +0,0 @@
|
|||
[submodule "src/modules/mariadbpp"]
|
||||
path = src/modules/mariadbpp
|
||||
url = https://github.com/viaduck/mariadbpp.git
|
||||
ignore = untracked
|
||||
[submodule "src/modules/lua"]
|
||||
path = src/modules/lua
|
||||
url = https://github.com/lua/lua.git
|
15
.luacheckrc
|
@ -1,15 +0,0 @@
|
|||
-- ignore line length warnings
|
||||
max_line_length=false
|
||||
max_code_line_length=false
|
||||
max_string_line_length=false
|
||||
max_comment_line_length=false
|
||||
-- show the warning/error codes as well
|
||||
codes=true
|
||||
-- don't show files with no issues
|
||||
quiet=1
|
||||
-- don't show undefined variable usage
|
||||
-- there are thousands of warnings here because luacheck is unaware of Wesnoth's lua environment and has no way to check which have been loaded
|
||||
global=false
|
||||
-- don't show unused variables
|
||||
unused=false
|
||||
exclude_files={"src/modules/lua/testes/*.lua"}
|
55
.travis.yml
Normal file
|
@ -0,0 +1,55 @@
|
|||
language: cpp
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
cache:
|
||||
ccache: true
|
||||
directories:
|
||||
- $HOME/build-cache
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- compiler: gcc
|
||||
env: CXXSTD=14 NLS=true LTS=1604 BRANCH=master
|
||||
|
||||
- compiler: gcc
|
||||
env: TOOL=scons CXXSTD=17 NLS=false LTS=1804 BRANCH=master
|
||||
|
||||
- compiler: gcc
|
||||
env: TOOL=scons CXXSTD=14 NLS=false LTS=1604 BRANCH=master OPT=-O0
|
||||
|
||||
- compiler: gcc
|
||||
env: TOOL=cmake CXXSTD=14 NLS=false LTS=1604 BRANCH=master
|
||||
|
||||
- compiler: clang
|
||||
env: TOOL=scons CXXSTD=14 NLS=false LTS=1604 BRANCH=master OPT=-O0
|
||||
|
||||
- compiler: clang
|
||||
env: TOOL=cmake CXXSTD=14 NLS=false LTS=1604 BRANCH=master
|
||||
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: TOOL=scons CXXSTD=14 NLS=false OPT=-O0
|
||||
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: TOOL=xcodebuild
|
||||
|
||||
install:
|
||||
- . ./utils/travis/steps/install.sh
|
||||
|
||||
script:
|
||||
- ./utils/travis/steps/script.sh
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
irc:
|
||||
channels:
|
||||
- "chat.freenode.net#wesnoth-dev"
|
||||
template:
|
||||
- "\x02%{repository}\x0f#\x0312%{build_number}\x0f (\x0307%{branch}\x0f - \x02%{commit}\x0f : \x0303%{author}\x0f): \x02%{message}\x0f"
|
||||
- "Build details : \x0302%{build_url}\x0f"
|
||||
on_success: change
|
||||
on_failure: always
|
698
CMakeLists.txt
|
@ -1,10 +1,12 @@
|
|||
|
||||
# set minimum version
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
cmake_minimum_required(VERSION 2.8.5)
|
||||
|
||||
project(wesnoth)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CTest)
|
||||
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
# use our own version of FindBoost.cmake and other Find* scripts
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
@ -39,6 +41,9 @@ set(LOCALEDIR "translations" CACHE STRING "change the name of the locale data di
|
|||
set(PREFERENCES_DIR "" CACHE STRING "Use a non-default preferences directory (.wesnoth on unix)")
|
||||
set(DEFAULT_PREFS_FILE "" CACHE STRING "Set system wide preferences file")
|
||||
|
||||
#Game options
|
||||
option(ENABLE_FRIBIDI "Enable FriBIDi support" ON)
|
||||
|
||||
#server options
|
||||
set(SERVER_UID "" CACHE STRING "User id of the user who runs wesnothd")
|
||||
set(SERVER_GID "" CACHE STRING "Group id of the user who runs wesnothd")
|
||||
|
@ -51,61 +56,35 @@ option(ENABLE_SERVER "Enable compilation of MP server" ON)
|
|||
option(ENABLE_MYSQL "Enable building MP/add-ons servers with mysql support" OFF)
|
||||
option(ENABLE_TESTS "Build unit tests")
|
||||
option(ENABLE_NLS "Enable building of translations" ${ENABLE_GAME})
|
||||
|
||||
set(BOOST_VERSION "1.67")
|
||||
|
||||
if(NOT WIN32)
|
||||
set(Lua_FIND_VERSION_MAJOR 5)
|
||||
set(Lua_FIND_VERSION_MINOR 4)
|
||||
option(ENABLE_SYSTEM_LUA "Enable use of system Lua ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR} (compiled as C++)" OFF)
|
||||
endif()
|
||||
if(ENABLE_SYSTEM_LUA)
|
||||
set(Lua_FIND_VERSION_EXACT ON)
|
||||
set(Lua_FIND_VERSION_COUNT 2)
|
||||
include(FindLua)
|
||||
if(NOT LUA_FOUND)
|
||||
message(FATAL_ERROR "Lua ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR} C++ not found. Try setting 'LUA_DIR'.")
|
||||
endif()
|
||||
else()
|
||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/src/modules/lua/.git")
|
||||
message(FATAL_ERROR "Lua submodule does not exist. You must run 'git submodule update --init --recursive' to initialize it.")
|
||||
else()
|
||||
message("-- Lua submodule found.")
|
||||
endif()
|
||||
endif()
|
||||
option(ENABLE_HISTORY "Enable using GNU history for history in lua console" ON)
|
||||
|
||||
# set what std version to use
|
||||
if(NOT CXX_STD)
|
||||
set(CXX_STD "17")
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD ${CXX_STD})
|
||||
# make sure to force using it
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
# forbid defaulting to gnu++NN instead of c++NN
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
find_package(OpenSSL 1.0 REQUIRED)
|
||||
|
||||
if(APPLE)
|
||||
find_library(APPKIT_LIBRARY AppKit REQUIRED)
|
||||
find_library(FOUNDATION_LIBRARY Foundation REQUIRED)
|
||||
find_library(IOKIT_LIBRARY IOKit REQUIRED)
|
||||
find_library(SECURITY_LIBRARY Security REQUIRED)
|
||||
set(CXX_STD "14")
|
||||
endif()
|
||||
|
||||
find_package(Boost ${BOOST_VERSION} REQUIRED COMPONENTS iostreams program_options regex system thread random coroutine locale filesystem graph)
|
||||
find_package(ICU REQUIRED COMPONENTS data i18n uc)
|
||||
if(ENABLE_GAME OR ENABLE_TESTS)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(SDL2 2.0.4 REQUIRED)
|
||||
endif(ENABLE_GAME OR ENABLE_TESTS)
|
||||
find_package(Crypto 1.0 REQUIRED)
|
||||
find_package(Boost 1.56 REQUIRED COMPONENTS iostreams program_options regex system thread random)
|
||||
|
||||
# no, gettext executables are not required when NLS is deactivated
|
||||
find_package(Gettext)
|
||||
find_package(Python)
|
||||
|
||||
find_package(X11)
|
||||
|
||||
if(NOT WIN32 AND NOT ENABLE_SYSTEM_LUA)
|
||||
# needed to get some SDL2 defines in... (as of rev31694 -D_GNU_SOURCE=1 is required!)
|
||||
set(SDL2_CONFIG "sdl2-config" CACHE STRING "Path to sdl2-config script")
|
||||
exec_program(${SDL2_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE SDL2_CFLAGS)
|
||||
add_definitions(${SDL2_CFLAGS})
|
||||
|
||||
if(NOT WIN32)
|
||||
# Use the safer `mkstemp' instead of `tmpnam' on POSIX systems.
|
||||
add_definitions(-DLUA_USE_POSIX)
|
||||
endif()
|
||||
endif(NOT WIN32)
|
||||
|
||||
#check for some compiler/arch specific things and export defines accordingly...
|
||||
include(SearchForStuff)
|
||||
|
@ -114,37 +93,35 @@ include(SearchForStuff)
|
|||
# optimization (c.f. bug #23445), work around this by enforcing "release" type
|
||||
# if nothing was selected
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
message("No build type specified, defaulting to Release")
|
||||
endif()
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release Profile RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
if(NOT DEFINED ENABLE_DISPLAY_REVISION)
|
||||
# can't run the shell script on windows
|
||||
if(NOT WIN32)
|
||||
# Test whether the code is used in a repository if not autorevision will
|
||||
# fail and should be disabled by default. If inside a repository enable
|
||||
# the display of revision numbers by default.
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/utils/autorevision.sh -t h > ${CMAKE_CURRENT_BINARY_DIR}/revision.dummy
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE
|
||||
ENABLE_DISPLAY_REVISION_TEST_OUTPUT
|
||||
ERROR_VARIABLE
|
||||
ENABLE_DISPLAY_REVISION_TEST_ERRNO
|
||||
)
|
||||
# Test whether the code is used in a repository if not autorevision will
|
||||
# fail and should be disabled by default. If inside a repository enable
|
||||
# the display of revision numbers by default.
|
||||
execute_process(
|
||||
COMMAND
|
||||
${CMAKE_SOURCE_DIR}/utils/autorevision.sh
|
||||
-t h
|
||||
> ${CMAKE_CURRENT_BINARY_DIR}/revision.dummy
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE
|
||||
ENABLE_DISPLAY_REVISION_TEST_OUTPUT
|
||||
ERROR_VARIABLE
|
||||
ENABLE_DISPLAY_REVISION_TEST_ERRNO
|
||||
)
|
||||
|
||||
if("${ENABLE_DISPLAY_REVISION_TEST_ERRNO}" STREQUAL "")
|
||||
set(DEFAULT_ENABLE_DISPLAY_REVISION true)
|
||||
else()
|
||||
set(DEFAULT_ENABLE_DISPLAY_REVISION false)
|
||||
endif()
|
||||
|
||||
unset(ENABLE_DISPLAY_REVISION_TEST_OUTPUT)
|
||||
unset(ENABLE_DISPLAY_REVISION_TEST_ERRNO)
|
||||
if("${ENABLE_DISPLAY_REVISION_TEST_ERRNO}" STREQUAL "")
|
||||
set(DEFAULT_ENABLE_DISPLAY_REVISION true)
|
||||
else()
|
||||
set(DEFAULT_ENABLE_DISPLAY_REVISION false)
|
||||
endif()
|
||||
|
||||
unset(ENABLE_DISPLAY_REVISION_TEST_OUTPUT)
|
||||
unset(ENABLE_DISPLAY_REVISION_TEST_ERRNO)
|
||||
|
||||
endif()
|
||||
|
||||
option(
|
||||
|
@ -153,13 +130,21 @@ option(
|
|||
${DEFAULT_ENABLE_DISPLAY_REVISION}
|
||||
)
|
||||
|
||||
|
||||
# The use of shared libraries makes compilation debug versions faster but
|
||||
# results in extra shared libraries. For installation this is not practical
|
||||
# since the libraries need to be given SONAMES and kept in sync. Therefore
|
||||
# installation is not supported for this option and will probably fail.
|
||||
set(ENABLE_SHARED_LIBRARIES OFF CACHE BOOL "Enables shared libraries, this option is meant for development only, installation is *NOT* supported")
|
||||
mark_as_advanced(on ENABLE_SHARED_LIBRARIES)
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT CYGWIN)
|
||||
option(ENABLE_DESKTOP_ENTRY "enable installation of desktop entry files" ON)
|
||||
endif()
|
||||
endif(UNIX AND NOT APPLE AND NOT CYGWIN)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
option(ENABLE_APPDATA_FILE "enable installation of an appdata file for appstream" ON)
|
||||
endif()
|
||||
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
||||
option(HARDEN "Whether to enable options to harden the executables" ON)
|
||||
option(ENABLE_STRICT_COMPILATION "Sets the strict compilation mode" OFF)
|
||||
|
@ -167,15 +152,12 @@ option(ENABLE_PEDANTIC_COMPILATION "Sets the pedantic compilation mode" OFF)
|
|||
option(ENABLE_DEBUG_WINDOW_LAYOUT "Add the debug option to allow the generation of debug layout files in dot format" OFF)
|
||||
option(ENABLE_DESIGN_DOCUMENTS "Enables the generation of design documents, and has additional dependencies" OFF)
|
||||
option(ENABLE_LTO "Sets Link Time Optimization for Release builds" OFF)
|
||||
option(GLIBCXX_ASSERTIONS "Whether to define _GLIBCXX_ASSERTIONS" OFF)
|
||||
option(GLIBCXX_DEBUG "Whether to define _GLIBCXX_DEBUG and _GLIBCXX_DEBUG_PEDANTIC. Requires a version of Boost's program_options that's compiled with __GLIBCXX_DEBUG too." OFF)
|
||||
option(GLIBCXX_DEBUG "Whether to define _GLIBCXX_DEBUG and _GLIBCXX_DEBUG_PEDANTIC" OFF)
|
||||
option(ENABLE_POT_UPDATE_TARGET "Enables the tools to update the pot files and manuals. This target has extra dependencies." OFF)
|
||||
option(FORCE_COLOR_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE)
|
||||
option(CLANG_TIDY "Enable clang-tidy linter checks." OFF)
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT CYGWIN)
|
||||
option(ENABLE_NOTIFICATIONS "Enable Window manager notification messages" ON)
|
||||
endif()
|
||||
endif(UNIX AND NOT APPLE AND NOT CYGWIN)
|
||||
|
||||
set(BINARY_SUFFIX "" CACHE STRING "Suffix behind all binaries")
|
||||
set(BINARY_PREFIX "" CACHE STRING "Prefix in front of all binaries")
|
||||
|
@ -186,315 +168,304 @@ set(BINARY_PREFIX "" CACHE STRING "Prefix in front of all binaries")
|
|||
|
||||
### Set the environment compiler flags.
|
||||
|
||||
if(NOT MSVC)
|
||||
if(NOT DEFINED CXX_FLAGS_USER)
|
||||
if(CONFIGURED)
|
||||
# The CONFIGURED flag was replaced when trunk `was' 1.11, before the release of 1.11.0
|
||||
message("Builed files depending on 'CONFIGURED' found, please regenerate your build files.")
|
||||
set(CXX_FLAGS_USER
|
||||
"${CMAKE_CXX_FLAGS}"
|
||||
CACHE
|
||||
STRING
|
||||
"The CXXFLAGS environment variable used for the initial generation."
|
||||
FORCE
|
||||
)
|
||||
unset(CONFIGURED CACHE)
|
||||
endif(CONFIGURED)
|
||||
|
||||
MESSAGE(STATUS "Environment compiler flags set to »${CXX_FLAGS_USER}«")
|
||||
set(CXX_FLAGS_USER
|
||||
"$ENV{CXXFLAGS}"
|
||||
CACHE
|
||||
STRING
|
||||
"The CXXFLAGS environment variable used for the initial generation."
|
||||
FORCE
|
||||
)
|
||||
if(NOT DEFINED CXX_FLAGS_USER)
|
||||
|
||||
endif()
|
||||
message(STATUS "Environment compiler flags set to »${CXX_FLAGS_USER}«")
|
||||
set(CXX_FLAGS_USER
|
||||
"$ENV{CXXFLAGS}"
|
||||
CACHE
|
||||
STRING
|
||||
"The CXXFLAGS environment variable used for the initial generation."
|
||||
FORCE
|
||||
)
|
||||
|
||||
set(COMPILER_FLAGS "-Wall -Wextra -Werror=non-virtual-dtor -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wold-style-cast -Wtrampolines")
|
||||
endif(NOT DEFINED CXX_FLAGS_USER)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Qunused-arguments -Wno-unknown-warning-option -Wmismatched-tags -Wno-conditional-uninitialized -Wno-unused-lambda-capture")
|
||||
endif()
|
||||
set(COMPILER_FLAGS "-std=c++${CXX_STD} -Wall -Wextra -Werror=non-virtual-dtor -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wold-style-cast -Wtrampolines")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU"
|
||||
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13
|
||||
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
|
||||
# GCC-13 added this new warning, and included it in -Wextra,
|
||||
# however in GCC-13 it has a lot of false positives.
|
||||
#
|
||||
# It's likely to generate false postives with GCC-14 too, but
|
||||
# I'm using a narrow version check as GCC-14 is still in dev.
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110075
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-dangling-reference")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Qunused-arguments -Wno-unknown-warning-option -Wmismatched-tags -Wno-conditional-uninitialized")
|
||||
endif()
|
||||
|
||||
### Set strict compiler flags.
|
||||
|
||||
if(ENABLE_STRICT_COMPILATION)
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Werror")
|
||||
endif()
|
||||
if(ENABLE_STRICT_COMPILATION)
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -Werror")
|
||||
endif(ENABLE_STRICT_COMPILATION)
|
||||
|
||||
### Set pedantic compiler flags.
|
||||
|
||||
if(ENABLE_PEDANTIC_COMPILATION)
|
||||
if(ENABLE_PEDANTIC_COMPILATION)
|
||||
|
||||
set(CXX_FLAGS_PEDANTIC_COMPILATION "-Wlogical-op -Wmissing-declarations -Wredundant-decls -Wctor-dtor-privacy -Wdouble-promotion -Wuseless-cast -Wnoexcept")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CXX_FLAGS_PEDANTIC_COMPILATION "${CXX_FLAGS_PEDANTIC_COMPILATION} -Wdocumentation -Wno-documentation-deprecated-sync")
|
||||
endif()
|
||||
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_PEDANTIC_COMPILATION}")
|
||||
set(CXX_FLAGS_PEDANTIC_COMPILATION "-Wlogical-op -Wmissing-declarations -Wredundant-decls -Wctor-dtor-privacy -Wdouble-promotion -Wuseless-cast -Wnoexcept")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CXX_FLAGS_PEDANTIC_COMPILATION "${CXX_FLAGS_PEDANTIC_COMPILATION} -Wdocumentation -Wno-documentation-deprecated-sync")
|
||||
endif()
|
||||
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_PEDANTIC_COMPILATION}")
|
||||
|
||||
endif(ENABLE_PEDANTIC_COMPILATION)
|
||||
|
||||
# check for sanitizer options
|
||||
if(SANITIZE)
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsanitize=${SANITIZE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${SANITIZE}")
|
||||
# manually disable some optimizations to get better stacktraces if sanitizers are used
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
endif()
|
||||
|
||||
### Force colour output (for example for Ninja, or piped CI)
|
||||
|
||||
if(FORCE_COLOR_OUTPUT)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fdiagnostics-color=always")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fcolor-diagnostics")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
### Enable clang-tidy linting
|
||||
if (CLANG_TIDY)
|
||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy -Wno-unknown-warning-option")
|
||||
endif()
|
||||
if(SANITIZE)
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsanitize=${SANITIZE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${SANITIZE}")
|
||||
# manually disable some optimizations to get better stacktraces if sanitizers are used
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
endif(SANITIZE)
|
||||
|
||||
### Set the final compiler flags.
|
||||
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_USER}")
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} ${CXX_FLAGS_USER}")
|
||||
|
||||
if(NOT "${CMAKE_CXX_FLAGS}" STREQUAL "${COMPILER_FLAGS}")
|
||||
MESSAGE(STATUS "CMake compiler flags set to »${COMPILER_FLAGS}«")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${COMPILER_FLAGS}"
|
||||
CACHE
|
||||
STRING
|
||||
"Global flags used by the CXX compiler during all builds."
|
||||
FORCE
|
||||
)
|
||||
endif()
|
||||
if(NOT "${CMAKE_CXX_FLAGS}" STREQUAL "${COMPILER_FLAGS}")
|
||||
message(STATUS "CMake compiler flags set to »${COMPILER_FLAGS}«")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${COMPILER_FLAGS}"
|
||||
CACHE
|
||||
STRING
|
||||
"Global flags used by the CXX compiler during all builds."
|
||||
FORCE
|
||||
)
|
||||
endif(NOT "${CMAKE_CXX_FLAGS}" STREQUAL "${COMPILER_FLAGS}")
|
||||
|
||||
# #
|
||||
# Determine optimization level
|
||||
# #
|
||||
|
||||
if(NOT OPT)
|
||||
if(PROFILER STREQUAL "perf")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Og")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-Og")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${OPT}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${OPT}")
|
||||
if(NOT OPT)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${OPT}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${OPT}")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O0")
|
||||
|
||||
if(PROFILER STREQUAL "perf")
|
||||
set(CMAKE_CXX_FLAGS_PROFILE "-Og")
|
||||
set(CMAKE_C_FLAGS_PROFILE "-Og")
|
||||
else(PROFILER STREQUAL "perf")
|
||||
set(CMAKE_CXX_FLAGS_PROFILE "-O0")
|
||||
set(CMAKE_C_FLAGS_PROFILE "-O0")
|
||||
endif(PROFILER STREQUAL "perf")
|
||||
else(NOT OPT)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${OPT}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${OPT}")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${OPT}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${OPT}")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_PROFILE "${OPT}")
|
||||
set(CMAKE_C_FLAGS_PROFILE "${OPT}")
|
||||
endif(NOT OPT)
|
||||
|
||||
# check for hardening options
|
||||
if(HARDEN)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -fstack-protector-strong")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE -fstack-protector-strong")
|
||||
if(HARDEN AND NOT WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -fstack-protector-strong")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE -fstack-protector-strong")
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -Wl,-pie")
|
||||
elseif(WIN32 AND MINGW)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie -Wl,-z,relro,-z,now")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_FLAGS_DEBUG STREQUAL "-O0")
|
||||
add_definitions(-D_FORTIFY_SOURCE=2)
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -Wl,-pie")
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie -Wl,-z,relro,-z,now")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-lstdc++ -lm ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
if(NOT CMAKE_CXX_FLAGS_DEBUG STREQUAL "-O0")
|
||||
add_definitions(-D_FORTIFY_SOURCE=2)
|
||||
endif()
|
||||
endif(HARDEN AND NOT WIN32)
|
||||
|
||||
if(UNIX AND NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Assume the compiler is the clang compiler.
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-lstdc++ -lm ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif(UNIX AND NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if(NOT WIN32)
|
||||
add_definitions(-DWESNOTH_PATH="${CMAKE_INSTALL_FULL_DATADIR}/${DATADIRNAME}")
|
||||
endif(NOT WIN32)
|
||||
|
||||
if(X11_FOUND)
|
||||
add_definitions(-D_X11)
|
||||
endif()
|
||||
if(X11_FOUND)
|
||||
add_definitions(-D_X11)
|
||||
endif(X11_FOUND)
|
||||
|
||||
add_definitions(-DLOCALEDIR="${LOCALEDIR}")
|
||||
|
||||
# -rdynamic is automatically added, but we don't need it, and it increases the executable size
|
||||
RemoveFlag(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS SCRIPT "-rdynamic" "")
|
||||
RemoveFlag(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS SCRIPT "-rdynamic" "")
|
||||
add_definitions(-DLOCALEDIR="${LOCALEDIR}")
|
||||
|
||||
# -DNDEBUG is automatically added to all release build types, so manually remove this define from the related variables
|
||||
RemoveFlag(CMAKE_CXX_FLAGS_RELWITHDEBINFO CACHE "-DNDEBUG" "Default C++ flags for RelWithDebInfo")
|
||||
RemoveFlag(CMAKE_C_FLAGS_RELWITHDEBINFO CACHE "-DNDEBUG" "Default C flags for RelWithDebInfo")
|
||||
RemoveFlag(CMAKE_CXX_FLAGS_MINSIZEREL CACHE "-DNDEBUG" "Default C++ flags for MinSizeRel")
|
||||
RemoveFlag(CMAKE_C_FLAGS_MINSIZEREL CACHE "-DNDEBUG" "Default C flags for MinSizeRel")
|
||||
RemoveFlag(CMAKE_CXX_FLAGS_RELWITHDEBINFO CACHE "-DNDEBUG" "Default C++ flags for RelWithDebInfo")
|
||||
RemoveFlag(CMAKE_C_FLAGS_RELWITHDEBINFO CACHE "-DNDEBUG" "Default C flags for RelWithDebInfo")
|
||||
RemoveFlag(CMAKE_CXX_FLAGS_MINSIZEREL CACHE "-DNDEBUG" "Default C++ flags for MinSizeRel")
|
||||
RemoveFlag(CMAKE_C_FLAGS_MINSIZEREL CACHE "-DNDEBUG" "Default C flags for MinSizeRel")
|
||||
|
||||
# -rdynamic is automatically added, but we don't need it, and it increases the executable size
|
||||
RemoveFlag(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS SCRIPT "-rdynamic" "")
|
||||
RemoveFlag(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS SCRIPT "-rdynamic" "")
|
||||
|
||||
# #
|
||||
# Start determining options for Release build
|
||||
# #
|
||||
|
||||
# reset the base Release build option
|
||||
MESSAGE("Replacing default flags used for Release build with ${OPT} ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_RELEASE}" CACHE STRING "Release build flags" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_RELEASE}" CACHE STRING "Release build flags" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE STRING "" FORCE)
|
||||
MESSAGE("Replacing default flags used for Release build with ${OPT} ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_RELEASE}" CACHE STRING "Release build flags" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_RELEASE}" CACHE STRING "Release build flags" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE STRING "" FORCE)
|
||||
# set the arch to use for Release build if provided
|
||||
if(ARCH)
|
||||
MESSAGE("adding -march=${ARCH} to Release build")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=${ARCH}" CACHE STRING "Release build flags" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=${ARCH}" CACHE STRING "Release build flags" FORCE)
|
||||
endif()
|
||||
if(ARCH)
|
||||
MESSAGE("adding -march=${ARCH} to Release build")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=${ARCH}" CACHE STRING "Release build flags" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=${ARCH}" CACHE STRING "Release build flags" FORCE)
|
||||
endif(ARCH)
|
||||
# add pentiumpro arch for windows builds with -O3 if no other arch provided, otherwise resulting executable may not work
|
||||
if(WIN32 AND NOT ARCH)
|
||||
MESSAGE("WIN32 and no arch provided, defaulting to pentiumpro")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=pentiumpro" CACHE STRING "Release build flags" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -march=pentiumpro" CACHE STRING "Release build flags" FORCE)
|
||||
endif(WIN32 AND NOT ARCH)
|
||||
|
||||
# PGO and LTO for GCC
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if(PGO_DATA STREQUAL "generate")
|
||||
MESSAGE("Generating PGO data")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-generate=${CMAKE_SOURCE_DIR}/pgo_data/" CACHE STRING "Release build flags generating PGO data" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fprofile-generate=${CMAKE_SOURCE_DIR}/pgo_data/" CACHE STRING "Release build flags generating PGO data" FORCE)
|
||||
endif()
|
||||
|
||||
if(PGO_DATA STREQUAL "use")
|
||||
MESSAGE("Using PGO data from previous runs")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-correction -fprofile-use=${CMAKE_SOURCE_DIR}/pgo_data/" CACHE STRING "Release build flags for using PGO data" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fprofile-correction -fprofile-use=${CMAKE_SOURCE_DIR}/pgo_data/" CACHE STRING "Release build flags for using PGO data" FORCE)
|
||||
endif()
|
||||
|
||||
if(ENABLE_LTO)
|
||||
if(NOT LTO_JOBS)
|
||||
MESSAGE("LTO_JOBS not set, defaulting to 1")
|
||||
set(LTO_JOBS "1" CACHE STRING "Number of threads to use for LTO with gcc" FORCE)
|
||||
endif()
|
||||
|
||||
MESSAGE("added -flto=${LTO_JOBS} to Release build")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=${LTO_JOBS}" CACHE STRING "Release build flags with LTO" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=${LTO_JOBS}" CACHE STRING "Release build flags with LTO" FORCE)
|
||||
|
||||
MESSAGE("Using GCC gold linker")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -fuse-ld=gold -Wno-stringop-overflow" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if(PGO_DATA STREQUAL "generate")
|
||||
MESSAGE("Generating PGO data")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-generate=${CMAKE_SOURCE_DIR}/pgo_data/" CACHE STRING "Release build flags generating PGO data" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fprofile-generate=${CMAKE_SOURCE_DIR}/pgo_data/" CACHE STRING "Release build flags generating PGO data" FORCE)
|
||||
endif()
|
||||
|
||||
if(PGO_DATA STREQUAL "use")
|
||||
MESSAGE("Using PGO data from previous runs")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-correction -fprofile-use=${CMAKE_SOURCE_DIR}/pgo_data/" CACHE STRING "Release build flags for using PGO data" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fprofile-correction -fprofile-use=${CMAKE_SOURCE_DIR}/pgo_data/" CACHE STRING "Release build flags for using PGO data" FORCE)
|
||||
endif()
|
||||
|
||||
if(ENABLE_LTO)
|
||||
if(NOT LTO_JOBS)
|
||||
MESSAGE("LTO_JOBS not set, defaulting to 1")
|
||||
set(LTO_JOBS "1" CACHE STRING "Number of threads to use for LTO with gcc" FORCE)
|
||||
endif(NOT LTO_JOBS)
|
||||
|
||||
MESSAGE("added -flto=${LTO_JOBS} to Release build")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=${LTO_JOBS}" CACHE STRING "Release build flags with LTO" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=${LTO_JOBS}" CACHE STRING "Release build flags with LTO" FORCE)
|
||||
|
||||
MESSAGE("Using GCC gold linker")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -fuse-ld=gold" CACHE STRING "" FORCE)
|
||||
endif(ENABLE_LTO)
|
||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
|
||||
# PGO and LTO for Clang
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(PGO_DATA STREQUAL "generate")
|
||||
MESSAGE("Generating PGO data")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-instr-generate=${CMAKE_SOURCE_DIR}/pgo_data/wesnoth-%p.profraw" CACHE STRING "Release build flags generating PGO data" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fprofile-instr-generate=${CMAKE_SOURCE_DIR}/pgo_data/wesnoth-%p.profraw" CACHE STRING "Release build flags generating PGO data" FORCE)
|
||||
endif()
|
||||
|
||||
if(PGO_DATA STREQUAL "use")
|
||||
MESSAGE("Using PGO data from previous runs")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-instr-use=${CMAKE_SOURCE_DIR}/pgo_data/wesnoth.profdata" CACHE STRING "Release build flags for using PGO data" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fprofile-instr-use=${CMAKE_SOURCE_DIR}/pgo_data/wesnoth.profdata" CACHE STRING "Release build flags for using PGO data" FORCE)
|
||||
endif()
|
||||
|
||||
if(ENABLE_LTO)
|
||||
MESSAGE("added -flto=thin to Release build")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=thin" CACHE STRING "Release build flags with LTO" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=thin" CACHE STRING "Release build flags with LTO" FORCE)
|
||||
|
||||
MESSAGE("Using Clang LLD linker")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -fuse-ld=lld" CACHE STRING "Linker flag for building with LTO and clang" FORCE)
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(PGO_DATA STREQUAL "generate")
|
||||
MESSAGE("Generating PGO data")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-instr-generate=${CMAKE_SOURCE_DIR}/pgo_data/wesnoth-%p.profraw" CACHE STRING "Release build flags generating PGO data" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fprofile-instr-generate=${CMAKE_SOURCE_DIR}/pgo_data/wesnoth-%p.profraw" CACHE STRING "Release build flags generating PGO data" FORCE)
|
||||
endif()
|
||||
|
||||
if(PGO_DATA STREQUAL "use")
|
||||
MESSAGE("Using PGO data from previous runs")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-instr-use=${CMAKE_SOURCE_DIR}/pgo_data/wesnoth.profdata" CACHE STRING "Release build flags for using PGO data" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fprofile-instr-use=${CMAKE_SOURCE_DIR}/pgo_data/wesnoth.profdata" CACHE STRING "Release build flags for using PGO data" FORCE)
|
||||
endif()
|
||||
|
||||
if(ENABLE_LTO)
|
||||
MESSAGE("added -flto=thin to Release build")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=thin" CACHE STRING "Release build flags with LTO" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto=thin" CACHE STRING "Release build flags with LTO" FORCE)
|
||||
|
||||
MESSAGE("Using Clang LLD linker")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -fuse-ld=lld" CACHE STRING "Linker flag for building with LTO and clang" FORCE)
|
||||
endif(ENABLE_LTO)
|
||||
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
# set CMAKE_AR and CMAKE_RANLIB to use LTO-enabled variants if LTO is enabled
|
||||
if(ENABLE_LTO)
|
||||
MESSAGE("Using gcc-ar and gcc-ranlib")
|
||||
find_program(LTO_AR NAMES gcc-ar)
|
||||
find_program(LTO_RANLIB NAMES gcc-ranlib)
|
||||
set(CMAKE_AR "${LTO_AR}" CACHE STRING "Supports LTO" FORCE)
|
||||
set(CMAKE_RANLIB "${LTO_RANLIB}" CACHE STRING "Supports LTO" FORCE)
|
||||
endif()
|
||||
MARK_AS_ADVANCED(LTO_AR LTO_RANLIB NON_LTO_AR NON_LTO_RANLIB)
|
||||
if(ENABLE_LTO)
|
||||
MESSAGE("Using gcc-ar and gcc-ranlib")
|
||||
find_program(LTO_AR NAMES gcc-ar)
|
||||
find_program(LTO_RANLIB NAMES gcc-ranlib)
|
||||
set(CMAKE_AR "${LTO_AR}" CACHE STRING "Supports LTO" FORCE)
|
||||
set(CMAKE_RANLIB "${LTO_RANLIB}" CACHE STRING "Supports LTO" FORCE)
|
||||
else()
|
||||
MESSAGE("Using ar, ranlib, and default linker")
|
||||
find_program(NON_LTO_AR NAMES ar)
|
||||
find_program(NON_LTO_RANLIB NAMES ranlib)
|
||||
set(CMAKE_AR "${NON_LTO_AR}" CACHE STRING "Does not support LTO" FORCE)
|
||||
set(CMAKE_RANLIB "${NON_LTO_RANLIB}" CACHE STRING "Does not support LTO" FORCE)
|
||||
endif()
|
||||
MARK_AS_ADVANCED(LTO_AR LTO_RANLIB NON_LTO_AR NON_LTO_RANLIB)
|
||||
|
||||
# add in extra flags
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${LINK_EXTRA_FLAGS_CONFIG} ${LINK_EXTRA_FLAGS_RELEASE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${LINK_EXTRA_FLAGS_CONFIG} ${LINK_EXTRA_FLAGS_RELEASE}")
|
||||
|
||||
# clean the pgo data
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_SOURCE_DIR}/pgo_data/")
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_SOURCE_DIR}/pgo_data/")
|
||||
|
||||
# #
|
||||
# End determining options for Release build
|
||||
# Start setting options for Debug build
|
||||
# #
|
||||
|
||||
# replace the default Debug flag of -g with -O0 -DDEBUG -ggdb3
|
||||
# this matches the flags of scons' debug build
|
||||
MESSAGE("Replacing flags used for Debug build ${OPT} -DDEBUG -ggdb3 ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_DEBUG}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -ggdb3 ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_DEBUG}" CACHE STRING "change cmake's Debug flags to match scons' flags" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -ggdb3 ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_DEBUG}" CACHE STRING "change cmake's Debug flags to match scons' flags" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${LINK_EXTRA_FLAGS_CONFIG} ${LINK_EXTRA_FLAGS_DEBUG}" CACHE STRING "" FORCE)
|
||||
# replace the default Debug flag of -g with -O0 -DDEBUG -ggdb3
|
||||
# this matches the flags of scons' debug build
|
||||
MESSAGE("Replacing flags used for Debug build ${OPT} -DDEBUG -ggdb3 ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_DEBUG}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -ggdb3 ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_DEBUG}" CACHE STRING "change cmake's Debug flags to match scons' flags" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -ggdb3 ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_DEBUG}" CACHE STRING "change cmake's Debug flags to match scons' flags" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${LINK_EXTRA_FLAGS_CONFIG} ${LINK_EXTRA_FLAGS_DEBUG}" CACHE STRING "" FORCE)
|
||||
|
||||
# Enabling GLIBCXX_ASSERTIONS puts bounds-checks on std::vector::operator[], etc
|
||||
if(GLIBCXX_ASSERTIONS)
|
||||
MESSAGE("Defining _GLIBCXX_ASSERTIONS")
|
||||
add_definitions(-D_GLIBCXX_ASSERTIONS)
|
||||
endif()
|
||||
|
||||
# GLIBCXX_DEBUG enables more checks that GLIBCXX_ASSERTIONS, but changes the ABI of Boost's program_options library.
|
||||
# When _GLIBCXX_DEBUG is defined, _GLIBCXX_ASSERTIONS is automatically implied (Gnu's c++config.h will define it).
|
||||
if(GLIBCXX_DEBUG)
|
||||
MESSAGE("Defining _GLIBCXX_DEBUG and _GLIBCXX_DEBUG_PEDANTIC")
|
||||
add_definitions(-D_GLIBCXX_DEBUG)
|
||||
add_definitions(-D_GLIBCXX_DEBUG_PEDANTIC)
|
||||
endif()
|
||||
# adds GLIBCXX_DEBUG definitions
|
||||
if(GLIBCXX_DEBUG)
|
||||
MESSAGE("Defining _GLIBCXX_DEBUG and _GLIBCXX_DEBUG_PEDANTIC")
|
||||
add_definitions(-D_GLIBCXX_DEBUG)
|
||||
add_definitions(-D_GLIBCXX_DEBUG_PEDANTIC)
|
||||
endif(GLIBCXX_DEBUG)
|
||||
|
||||
# #
|
||||
# Setup profiler build options
|
||||
# End setting options for Debug build
|
||||
# Start setting options for Profile build
|
||||
# #
|
||||
set(PROFILER "" CACHE STRING "Enable performance-measuring tools (and choose which tool to use)")
|
||||
|
||||
if(PROFILER STREQUAL "gprof")
|
||||
MESSAGE("Profiler is gprof")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg ${EXTRA_FLAGS_CONFIG}" CACHE STRING "Flags for profiling with gprof" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -pg ${EXTRA_FLAGS_CONFIG}" CACHE STRING "Flags for profiling with gprof" FORCE)
|
||||
endif()
|
||||
|
||||
if(PROFILER STREQUAL "gcov")
|
||||
MESSAGE("Profiler is gcov")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage ${EXTRA_FLAGS_CONFIG}" CACHE STRING "Flags for profiling with gcov" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage ${EXTRA_FLAGS_CONFIG}" CACHE STRING "Flags for profiling with gcov" FORCE)
|
||||
endif()
|
||||
|
||||
if(PROFILER STREQUAL "gperftools")
|
||||
MESSAGE("Profiler is gperftools")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,--no-as-needed,-lprofiler ${LINK_EXTRA_FLAGS_CONFIG}" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
if(PROFILER STREQUAL "perf")
|
||||
MESSAGE("Profiler is perf")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ggdb -fno-omit-frame-pointer ${EXTRA_FLAGS_CONFIG}" CACHE STRING "Flags for profiling with perf" FORCE)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ggdb -fno-omit-frame-pointer ${EXTRA_FLAGS_CONFIG}" CACHE STRING "Flags for profiling with perf" FORCE)
|
||||
endif()
|
||||
# #
|
||||
# End setting profiler build options
|
||||
# #
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "/W3 /WX /wd4503 /wd4351 /wd4250 /wd4244 /wd4267 /we4239 /wd4275 /EHsc /utf-8 /Zc:__cplusplus" CACHE STRING "Global flags used by the CXX compiler during all builds." FORCE)
|
||||
set(CMAKE_C_FLAGS "/WX" CACHE STRING "Global flags used by the C compiler during all builds." FORCE)
|
||||
add_definitions(-D_WIN32_WINNT=0x0A00 -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -DNOMINMAX)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG_LUA")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:MSVCRT")
|
||||
|
||||
# -DNDEBUG is automatically added to all release build types, so manually remove this define from the related variables
|
||||
RemoveFlag(CMAKE_CXX_FLAGS_RELEASE CACHE "/DNDEBUG" "Default C++ flags for RELEASE")
|
||||
RemoveFlag(CMAKE_C_FLAGS_RELEASE CACHE "/DNDEBUG" "Default C flags for RELEASE")
|
||||
RemoveFlag(CMAKE_CXX_FLAGS_RELWITHDEBINFO CACHE "/DNDEBUG" "Default C++ flags for RelWithDebInfo")
|
||||
RemoveFlag(CMAKE_C_FLAGS_RELWITHDEBINFO CACHE "/DNDEBUG" "Default C flags for RelWithDebInfo")
|
||||
RemoveFlag(CMAKE_CXX_FLAGS_MINSIZEREL CACHE "/DNDEBUG" "Default C++ flags for MinSizeRel")
|
||||
RemoveFlag(CMAKE_C_FLAGS_MINSIZEREL CACHE "/DNDEBUG" "Default C flags for MinSizeRel")
|
||||
if(PROFILER STREQUAL "gprof" OR NOT PROFILER)
|
||||
MESSAGE("Profiler is gprof")
|
||||
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -pg ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_PROFILE}" CACHE STRING "Flags for profiling with gprof" FORCE)
|
||||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -pg ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_PROFILE}" CACHE STRING "Flags for profiling with gprof" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${LINK_EXTRA_FLAGS_CONFIG} ${LINK_EXTRA_FLAGS_PROFILE}" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
if(PROFILER STREQUAL "gcov")
|
||||
MESSAGE("Profiler is gcov")
|
||||
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -fprofile-arcs -ftest-coverage ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_PROFILE}" CACHE STRING "Flags for profiling with gcov" FORCE)
|
||||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -fprofile-arcs -ftest-coverage ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_PROFILE}" CACHE STRING "Flags for profiling with gcov" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${LINK_EXTRA_FLAGS_CONFIG} ${LINK_EXTRA_FLAGS_PROFILE}" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
if(PROFILER STREQUAL "gperftools")
|
||||
MESSAGE("Profiler is gperftools")
|
||||
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_PROFILE}" CACHE STRING "Flags for profiling with gperftools" FORCE)
|
||||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_PROFILE}" CACHE STRING "Flags for profiling with gperftools" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "-Wl,--no-as-needed,-lprofiler ${LINK_EXTRA_FLAGS_CONFIG} ${LINK_EXTRA_FLAGS_PROFILE}" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
if(PROFILER STREQUAL "perf")
|
||||
MESSAGE("Profiler is perf")
|
||||
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -ggdb ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_PROFILE}" CACHE STRING "Flags for profiling with perf" FORCE)
|
||||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -ggdb ${EXTRA_FLAGS_CONFIG} ${EXTRA_FLAGS_PROFILE}" CACHE STRING "Flags for profiling with perf" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${LINK_EXTRA_FLAGS_CONFIG} ${LINK_EXTRA_FLAGS_PROFILE}" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
# #
|
||||
# End setting options for Profile build
|
||||
# #
|
||||
|
||||
# When the path starts with a / on a Unix system it's an absolute path.
|
||||
# This means that on Windows the path used is always relative.
|
||||
if(IS_ABSOLUTE "${LOCALEDIR}")
|
||||
|
@ -509,7 +480,7 @@ add_definitions(-DFIFODIR="${FIFO_DIR}")
|
|||
|
||||
if(PREFERENCES_DIR)
|
||||
add_definitions(-DPREFERENCES_DIR="${PREFERENCES_DIR}")
|
||||
endif()
|
||||
endif(PREFERENCES_DIR)
|
||||
|
||||
|
||||
if(DEFAULT_PREFS_FILE)
|
||||
|
@ -517,72 +488,78 @@ if(DEFAULT_PREFS_FILE)
|
|||
|
||||
if(NOT DEFAULT_PREFS_FILE MATCHES "^/")
|
||||
add_definitions(-DHAS_RELATIVE_DEFPREF)
|
||||
endif()
|
||||
endif()
|
||||
endif(NOT DEFAULT_PREFS_FILE MATCHES "^/")
|
||||
endif(DEFAULT_PREFS_FILE)
|
||||
|
||||
if(ENABLE_DEBUG_WINDOW_LAYOUT)
|
||||
add_definitions(-DDEBUG_WINDOW_LAYOUT_GRAPHS)
|
||||
endif()
|
||||
endif(ENABLE_DEBUG_WINDOW_LAYOUT)
|
||||
|
||||
#
|
||||
# Libraries that are only required by some targets
|
||||
#
|
||||
|
||||
if(ENABLE_GAME OR ENABLE_TESTS)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package( SDL2_image 2.0.0 REQUIRED )
|
||||
endif(ENABLE_GAME OR ENABLE_TESTS)
|
||||
|
||||
if(ENABLE_GAME OR ENABLE_TESTS)
|
||||
find_package( SDL2_mixer 2.0.0 REQUIRED )
|
||||
find_package( SDL2_ttf 2.0.12 REQUIRED )
|
||||
find_package(VorbisFile REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Fontconfig REQUIRED)
|
||||
find_package(SDL2 2.0.18 REQUIRED)
|
||||
if(NOT MSVC)
|
||||
# for everything else, use pkgconfig
|
||||
# SDL2_image and SDL2_mixer don't seem to have any cmake configuration available at all
|
||||
pkg_check_modules(SDL2IMAGE REQUIRED SDL2_image>=2.0.2)
|
||||
pkg_check_modules(SDL2MIXER REQUIRED SDL2_mixer>=2.0.0)
|
||||
else()
|
||||
# for MSVC, vcpkg builds and provides custom SDL2-related modules for cmake to use, so use those
|
||||
# this also fixes the issue with our previous FindSDL2* scripts incorrectly using the Release version of these libs instead of the Debug version
|
||||
find_package(SDL2_image CONFIG REQUIRED)
|
||||
find_package(SDL2_mixer CONFIG REQUIRED)
|
||||
endif()
|
||||
pkg_check_modules(CAIRO REQUIRED cairo>=1.10)
|
||||
pkg_check_modules(PANGOCAIRO REQUIRED pangocairo>=1.44.0)
|
||||
pkg_check_modules(PANGO REQUIRED pango>=1.44.0)
|
||||
pkg_check_modules(LIBREADLINE readline)
|
||||
endif()
|
||||
find_package( PkgConfig REQUIRED )
|
||||
pkg_check_modules( CAIRO REQUIRED cairo>=1.10 )
|
||||
pkg_check_modules( PANGOCAIRO REQUIRED pangocairo>=1.22.0 )
|
||||
pkg_check_modules( FONTCONFIG REQUIRED fontconfig>=2.4.1 )
|
||||
pkg_check_modules( SYSTEMD systemd )
|
||||
endif(ENABLE_GAME OR ENABLE_TESTS)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
find_package( Boost ${BOOST_VERSION} REQUIRED COMPONENTS unit_test_framework )
|
||||
endif()
|
||||
find_package( Boost 1.56 REQUIRED COMPONENTS unit_test_framework )
|
||||
endif(ENABLE_TESTS)
|
||||
|
||||
if(ENABLE_GAME)
|
||||
if(ENABLE_FRIBIDI)
|
||||
PKG_CHECK_MODULES(FRIBIDI fribidi>=0.10.9)
|
||||
if(FRIBIDI_FOUND)
|
||||
add_definitions(-DHAVE_FRIBIDI)
|
||||
elseif(NOT FRIBIDI_FOUND)
|
||||
message("Could not find FriBiDi. Disabling FriBiDi support.")
|
||||
endif(FRIBIDI_FOUND)
|
||||
endif(ENABLE_FRIBIDI)
|
||||
|
||||
if(ENABLE_NOTIFICATIONS)
|
||||
pkg_check_modules(LIBDBUS dbus-1)
|
||||
if(LIBDBUS_FOUND)
|
||||
add_definitions(-DHAVE_LIBDBUS)
|
||||
else()
|
||||
else(LIBDBUS_FOUND)
|
||||
message("Could not find dbus-1, Disabling notification support.")
|
||||
endif()
|
||||
endif(LIBDBUS_FOUND)
|
||||
else()
|
||||
unset(LIBDBUS_FOUND CACHE)
|
||||
endif()
|
||||
|
||||
find_package(History)
|
||||
if(HISTORY_FOUND)
|
||||
find_package( History )
|
||||
if(ENABLE_HISTORY AND HISTORY_FOUND)
|
||||
add_definitions(-DHAVE_HISTORY)
|
||||
endif()
|
||||
endif()
|
||||
else(ENABLE_HISTORY AND HISTORY_FOUND)
|
||||
message("Could not find GNU history. Disabling support for command history in lua console.")
|
||||
endif(ENABLE_HISTORY AND HISTORY_FOUND)
|
||||
endif(ENABLE_GAME)
|
||||
|
||||
find_package(Boost 1.56 REQUIRED COMPONENTS filesystem)
|
||||
find_package(Boost 1.56 REQUIRED COMPONENTS locale)
|
||||
|
||||
if(ENABLE_POT_UPDATE_TARGET)
|
||||
find_package(TranslationTools REQUIRED)
|
||||
endif()
|
||||
endif(ENABLE_POT_UPDATE_TARGET)
|
||||
|
||||
# get languages
|
||||
if(ENABLE_NLS)
|
||||
file(READ po/LINGUAS LINGUAS)
|
||||
string(REPLACE "\n" "" LINGUAS ${LINGUAS})
|
||||
separate_arguments(LINGUAS)
|
||||
endif()
|
||||
endif(ENABLE_NLS)
|
||||
|
||||
#
|
||||
# Include subdirectories
|
||||
|
@ -590,9 +567,9 @@ endif()
|
|||
|
||||
add_subdirectory(doc)
|
||||
|
||||
if(GETTEXT_FOUND AND Python_FOUND AND ENABLE_NLS)
|
||||
if(GETTEXT_FOUND AND ENABLE_NLS)
|
||||
add_subdirectory(po)
|
||||
endif()
|
||||
endif (GETTEXT_FOUND AND ENABLE_NLS)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
|
@ -601,24 +578,24 @@ add_subdirectory(src)
|
|||
#
|
||||
if(ENABLE_GAME)
|
||||
install(DIRECTORY data fonts images sounds DESTINATION ${CMAKE_INSTALL_DATADIR}/${DATADIRNAME} USE_SOURCE_PERMISSIONS PATTERN ".git" EXCLUDE )
|
||||
endif()
|
||||
endif(ENABLE_GAME)
|
||||
|
||||
# install file for add-ons server
|
||||
if(ENABLE_CAMPAIGN_SERVER AND NOT ENABLE_GAME)
|
||||
install(FILES data/COPYING.txt DESTINATION ${CMAKE_INSTALL_DATADIR}/${DATADIRNAME}/data)
|
||||
endif()
|
||||
endif(ENABLE_CAMPAIGN_SERVER AND NOT ENABLE_GAME)
|
||||
|
||||
#
|
||||
# Install desktop file so wesnoth appears in the application start menu with an icon
|
||||
#
|
||||
if(ENABLE_DESKTOP_ENTRY AND ENABLE_GAME)
|
||||
install(FILES packaging/org.wesnoth.Wesnoth.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications )
|
||||
install(DIRECTORY packaging/icons/hicolor packaging/icons/HighContrast DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons )
|
||||
endif()
|
||||
install(FILES packaging/wesnoth.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications )
|
||||
install(DIRECTORY packaging/icons/hicolor DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons )
|
||||
endif(ENABLE_DESKTOP_ENTRY AND ENABLE_GAME)
|
||||
|
||||
if(ENABLE_APPDATA_FILE AND ENABLE_GAME)
|
||||
install(FILES packaging/org.wesnoth.Wesnoth.appdata.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo )
|
||||
endif()
|
||||
install(FILES packaging/wesnoth.appdata.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo )
|
||||
endif(ENABLE_APPDATA_FILE AND ENABLE_GAME)
|
||||
|
||||
if(ENABLE_SERVER AND FIFO_DIR)
|
||||
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory \$ENV{DESTDIR}/${FIFO_DIR})")
|
||||
|
@ -627,6 +604,11 @@ if(ENABLE_SERVER AND FIFO_DIR)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# Index for checking states of localized images at runtime.
|
||||
if(ENABLE_GAME)
|
||||
install(FILES l10n-track DESTINATION ${CMAKE_INSTALL_DATADIR}/${DATADIRNAME})
|
||||
endif(ENABLE_GAME)
|
||||
|
||||
#
|
||||
# uninstall
|
||||
#
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"variables": []
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
The Battle for Wesnoth's Code of Conduct may be found in the following forum post:
|
||||
https://forums.wesnoth.org/viewtopic.php?t=24277
|
146
CONTRIBUTING.md
|
@ -1,144 +1,14 @@
|
|||
# Contributing to Wesnoth
|
||||
|
||||
Wesnoth was built with the hard work of volunteers all over the world! Everyone is welcome to come and contribute code, art, and music to improve the game for everyone who wants to play it.
|
||||
Submitting Issues
|
||||
=================
|
||||
|
||||
## Contacting Us
|
||||
Please follow the guidelines [here](https://wiki.wesnoth.org/ReportingBugs) when submitting bug reports or feature requests.
|
||||
|
||||
The best place to get in touch with the development team is on our [official Discord community server](https://discord.gg/battleforwesnoth) or on the [Wesnoth forums](https://forums.wesnoth.org/).
|
||||
When submitting an issue that involves a long log, we recommend using gist and linking to it, as that allows it to be viewed without downloading. If the issue involves a screenshot or save file, please attach the screenshot or savefile by dragging it into the issue submission textbox.
|
||||
|
||||
The Discord server is mirrored to [Libera.Chat IRC](https://libera.chat), channels: [`#wesnoth`](https://web.libera.chat/#wesnoth) (general discussions), [`#wesnoth-umc-dev`](https://web.libera.chat/#wesnoth-umc-dev) (questions about creating add-ons), [`#wesnoth-dev`](https://web.libera.chat/#wesnoth-dev) (development of wesnoth mainline).
|
||||
If you have push access, please remember when creating issues to add the bug or enhancement label as well as at least one applicable purple label.
|
||||
|
||||
## Art and Music
|
||||
Submitting Pull Requests
|
||||
========================
|
||||
|
||||
Art and music submissions are accepted usually to fill in missing or outdated assets. If you are interested in contributing, we recommend that you contact us first to determine the best resources for you to work on based on need and interest. We also commission larger projects such as character portraits, story art, and music tracks.
|
||||
|
||||
## Engine
|
||||
|
||||
Wesnoth's engine conforms to the C++17 standard. We encourage the use of standard library APIs over third-party libraries whenever possible. However, third-party libraries are preferred over adding new, custom in-engine APIs, when appropriate.
|
||||
|
||||
### Code Formatting
|
||||
|
||||
All C++, WML and Lua files are in UTF-8, as we use Gettext-style translations, and translatable strings use some punctuation that's outside of the ASCII subset. More details are in the [Typography Style Guide](https://wiki.wesnoth.org/Typography_Style_Guide) and the guide to [using Gettext strings](https://wiki.wesnoth.org/GettextForWesnothDevelopers).
|
||||
|
||||
If your pull request touches the engine's C++ source code, we recommend (but don't require) you run `clang-format` on your changes before submission (Visual Studio Code gives you a handy context menu option to do so). This ensures that your code remains formatted according to our conventions. Make a local commit before running `clang-format`, in case more code than expected gets changed.
|
||||
|
||||
Generally, we follow these conventions in our C++ code:
|
||||
|
||||
```cpp
|
||||
// Use pragma once instead of an include guard. Those are clumsy.
|
||||
#pragma once
|
||||
|
||||
// Includes for files from the src/... directories should use double-quotes.
|
||||
#include "help/help.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
||||
// Use angle brackets for system and external includes.
|
||||
// Includes should also be sorted alphabetically.
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Classes should have scope specifiers (public, protected, private), but structs can omit them.
|
||||
struct my_struct
|
||||
{
|
||||
// Public members do not need a trailing underscore.
|
||||
// Inline initialization is acceptable over a constructor.
|
||||
bool member = false;
|
||||
};
|
||||
|
||||
// Class names are lower-case with underscores between words.
|
||||
// Put braces on new lines after class and struct declarations.
|
||||
class my_class
|
||||
{
|
||||
public:
|
||||
// Use using directives over typedefs. They're easier to read.
|
||||
using alias_t = std::vector<my_struct>;
|
||||
|
||||
// Use leading commas in the ctor list
|
||||
// Use the T& foo or T* foo reference and pointer styles, not T &foo or T *foo.
|
||||
// Use the "explicit" keyword for single-argument constructors.
|
||||
explicit my_class(alias_t& ref)
|
||||
: the_array_of_doom_()
|
||||
, vec_ptr_(nullptr) // Use nullptr instead of NULL or 0
|
||||
{
|
||||
// Use C++ casts (static_cast and dynamic_cast) instead of C-style casts.
|
||||
// Do try and avoid reinterpret_cast and const_cast if at all possible.
|
||||
const float cast_test = static_cast<float>(how_far_to_destination_);
|
||||
|
||||
// Don't put a space after conditional keywords, and keep their opening brackets on the same line.
|
||||
if(!ref.empty()) {
|
||||
vec_ptr_ = &ref;
|
||||
|
||||
// Use lambdas for short functions like this.
|
||||
// We also encourage the use of auto in lambdas and other places where
|
||||
// type names are long and can be inferred.
|
||||
std::sort(ref.begin(), ref.end(), [](const auto& a, const auto& b) {
|
||||
return a.member && !b.member;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep class method brackets on their own line, and always utilize const for methods and
|
||||
* variables when possible.
|
||||
*
|
||||
* For documenting functions, we loosely follow Doxygen conventions. You don't need to document
|
||||
* every single function, but important ones should optimally have at least a one-line comment
|
||||
* explaining what it does.
|
||||
*
|
||||
* This returns a translatable string, using gettext's _ function.
|
||||
*
|
||||
* @param speaker_id The person speaking
|
||||
*/
|
||||
t_string exclaim(const std::string& speaker_id) const
|
||||
{
|
||||
if(how_far_to_destination_ < 100) {
|
||||
if(speaker_id == "signboard") {
|
||||
return _("Oldwood — enter at own risk");
|
||||
} else {
|
||||
// TRANSLATORS: The lake is the small underground one in S06 Temple in the Deep
|
||||
return _("Hmm, someone has written underneath “Fire-carrying trespassers will be thrown in the lake.”");
|
||||
}
|
||||
} else {
|
||||
return _("Clearwater — just keep following the river");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// End private class members with an underscore. Additionally, use C++ standard
|
||||
// like std::array as opposed to C equivalents (such as int[])
|
||||
std::array<int, 8> the_array_of_doom_;
|
||||
|
||||
alias_t* vec_ptr_;
|
||||
|
||||
// Use static or constexpr for constants. Don't use macros.
|
||||
static const int how_far_to_destination_ = 1000;
|
||||
};
|
||||
```
|
||||
|
||||
## Translations
|
||||
For specific information on how to update and submit translations, see [here](https://wiki.wesnoth.org/WesnothTranslationsHowTo).
|
||||
|
||||
## Bug Reports
|
||||
|
||||
Please report any bugs here on GitHub (preferred) or on the forums.
|
||||
|
||||
### Bugs in User-Made Content
|
||||
|
||||
If you encounter an engine bug such as a crash, scripting error, etc., report it here. Otherwise, issues with user-made content should be reported to their respective creators on the forums. You can usually find a thread for the add-on in question in the [Scenario & Campaign Development](http://www.wesnoth.org/forum/viewforum.php?f=8), [Faction & Era Development](http://www.wesnoth.org/forum/viewforum.php?f=19) or [Multiplayer Development](http://www.wesnoth.org/forum/viewforum.php?f=15) sections.
|
||||
|
||||
### Feature Requests
|
||||
|
||||
We accept suggestions for campaign improvements, WML or Lua API changes, and other game enhancements here on GitHub. We encourage you to attempt to implement your idea yourself and submit a pull request containing relevant information to your feature.
|
||||
|
||||
### Information to Include
|
||||
|
||||
We have several issue templates to choose from when opening a bug report. Please choose the one that best fits the bug. You do not need to include everything (we don't need screenshots for a compiling issue, for example), but the more information you can provide, the better. We need at least enough information to replicate the bug before we can track down the root cause.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
Pull requests (PRs) can be created by forking the [wesnoth/wesnoth](https://github.com/wesnoth/wesnoth) repository on the github website, making your own changes to your forked repository, and then clicking the "Pull request" button. All pull requests must follow the above guidelines in order to be merged and whenever possible should include additional unit tests in order to both prove the proposed fix or feature works as intended as well as to allow quickly detecting other bugs in that area of code the future. WML and lua tests are run with the `run_wml_tests` python script (the tests themselves can be found [here](https://github.com/wesnoth/wesnoth/tree/master/data/test/test)) and C++ unit tests are run by the `boost_unit_tests` executable (current tests can be found [here](https://github.com/wesnoth/wesnoth/tree/master/src/tests)). Additionally, no new code can contain use of deprecated WML or lua API features.
|
||||
|
||||
It is also highly recommended to use an editor that at least support syntax highlighting (such as VSCode or Notepad++) regardless of what you're changing - just because you *can* edit files through the github website or with plain Notepad does not mean you *should*.
|
||||
Before submitting a pull request, please make sure your code conforms to the standards outlined [here](https://wiki.wesnoth.org/CodingStandards).
|
||||
|
|
157
INSTALL.md
|
@ -1,14 +1,22 @@
|
|||
# Building Wesnoth from Source
|
||||
Contents
|
||||
========
|
||||
|
||||
## Prerequisites
|
||||
1. Prerequisites
|
||||
2. Build Environment
|
||||
3. SCons Build
|
||||
4. CMake Build
|
||||
5. Build Options
|
||||
|
||||
Wesnoth requires a compiler with sufficient C++17 support such as GCC 11 and
|
||||
later, or a version of Clang with equivalent support.
|
||||
|
||||
## 1. Prerequisites
|
||||
|
||||
Wesnoth requires a compiler with sufficient C++14 support such as GCC 5.0 and
|
||||
later, or Clang 3.8 and later.
|
||||
|
||||
You'll need to have these libraries and their development headers installed in
|
||||
order to build Wesnoth:
|
||||
|
||||
* Boost libraries >= 1.66.0
|
||||
* Boost libraries >= 1.56.0
|
||||
Most headers plus the following binary libs:
|
||||
* Filesystem
|
||||
* Locale
|
||||
|
@ -17,22 +25,19 @@ order to build Wesnoth:
|
|||
* Regex
|
||||
* Program Options
|
||||
* System
|
||||
* Coroutine
|
||||
* Graph
|
||||
* Charconv (This requires boost 1.85 or higher and is optional but reccomended especially for clang builds)
|
||||
* Thread
|
||||
* SDL2 libraries:
|
||||
* SDL2 >= 2.0.18 (macOS: 2.0.22 due to needing https://github.com/libsdl-org/SDL/commit/3bebdaccb7bff8c40438856081d404a7ce3def30)
|
||||
* SDL2_image >= 2.0.2 (with PNG, JPEG, and WEBP support)
|
||||
* SDL2 >= 2.0.4
|
||||
* SDL2_image >= 2.0.0 (with PNG and JPEG support)
|
||||
* SDL2_mixer >= 2.0.0 (with Ogg Vorbis support)
|
||||
* SDL2_ttf >= 2.0.12
|
||||
* Fontconfig >= 2.4.1
|
||||
* Cairo >= 1.10.0
|
||||
* Pango >= 1.44.0 (with Cairo backend)
|
||||
* Vorbisfile aka libvorbis
|
||||
* Pango >= 1.22.0 (with Cairo backend)
|
||||
* Vorbisfile
|
||||
* libbz2
|
||||
* libz
|
||||
* libssl
|
||||
* libcrypto (from OpenSSL)
|
||||
* libcurl4 (OpenSSL version)
|
||||
|
||||
The following libraries are optional dependencies that enable additional
|
||||
features:
|
||||
|
@ -43,8 +48,12 @@ features:
|
|||
* GNU history (libreadline):
|
||||
Command history and history expansion in the built-in Lua console.
|
||||
|
||||
* FriBiDi >= 0.10.9:
|
||||
Bidirectional text support for RTL languages (Hebrew, etc.) in some parts
|
||||
of the user interface.
|
||||
|
||||
## Build Environment
|
||||
|
||||
## 2. Build Environment
|
||||
|
||||
You can obtain the source code tarball for the latest version from
|
||||
<https://www.wesnoth.org/downloads>.
|
||||
|
@ -55,13 +64,16 @@ created directory:
|
|||
$ tar xvjf wesnoth-<version>.tar.bz2
|
||||
$ cd wesnoth-<version>
|
||||
|
||||
Alternatively, you can clone this git repository. Since Wesnoth uses submodules, when cloning you must add the `--recurse-submodules` option, or if you have already cloned the repository without using that option then you must run the command `git submodule update --init --recursive`.
|
||||
Or:
|
||||
|
||||
$ tar xvzf wesnoth-<version>.tar.gz
|
||||
$ cd wesnoth-<version>
|
||||
|
||||
The following build systems are fully supported for compiling Wesnoth on Linux,
|
||||
*BSD, and other Unix-like platforms:
|
||||
|
||||
* SCons >= 0.98.3
|
||||
* CMake >= 3.14
|
||||
* CMake >= 2.8.5
|
||||
|
||||
You will also need to have a working installation of GNU gettext to build the
|
||||
translations.
|
||||
|
@ -71,15 +83,11 @@ also possible to run it directly from the source directory after building. This
|
|||
may be useful in situations where you don't have root access or need to
|
||||
rebuild Wesnoth frequently (i.e. for development and testing).
|
||||
|
||||
### macOS/OS X
|
||||
See [here](https://github.com/wesnoth/wesnoth/blob/master/projectfiles/Xcode/README.md) for instructions on using Xcode.
|
||||
For Windows users, a Visual C++ 2013 solution is included in _projectfiles/VC12_.
|
||||
For OS X users, an XCode project is included in _projectfiles/XCode_.
|
||||
|
||||
### Windows
|
||||
Wesnoth uses CMake for project configuration and vcpkg for installing dependencies. See [here](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio) for information on using Visual Studio with cmake. The first time it's run, vcpkg will build all the required dependencies which may take over an hour, however it will only need to be done once.
|
||||
|
||||
NOTE 1: You will need to run `vcpkg integrate install` on the command line to make Visual Studio aware of vcpkg. If Visual Studio is open when this is executed, then you will need to close and re-open Visual Studio.
|
||||
|
||||
## SCons Build
|
||||
## 3. SCons Build
|
||||
|
||||
Unlike CMake or the classic "autotools" build-system (configure && make),
|
||||
configuration and building are done in the same step with SCons.
|
||||
|
@ -103,7 +111,7 @@ Building the MP server only:
|
|||
The `install` target will install any binaries that were previously compiled
|
||||
(use su or sudo if necessary to write files into the installation prefix):
|
||||
|
||||
$ scons install
|
||||
# scons install
|
||||
|
||||
SCons takes a `prefix=` argument that specifies where to install the game and
|
||||
its resource files. The prefix defaults to `/usr/local`; for production builds,
|
||||
|
@ -112,7 +120,7 @@ you may wish to use `/usr` instead:
|
|||
$ scons prefix=/usr
|
||||
|
||||
|
||||
## CMake Build
|
||||
## 4. CMake Build
|
||||
|
||||
Unlike SCons, CMake has separate configuration and build steps. Configuration
|
||||
is done using CMake itself, and the actual build is done using `make`.
|
||||
|
@ -147,7 +155,7 @@ and their cached values on a console and graphical UI, respectively.
|
|||
$ cmake-gui ..
|
||||
|
||||
|
||||
## Build Options
|
||||
## 5. Build Options
|
||||
|
||||
A full list of options supported by SCons along with their descriptions and
|
||||
defaults is available by running `scons --help` from the Wesnoth source. For
|
||||
|
@ -162,21 +170,82 @@ With SCons, boolean options take `yes` or `true` for a true value, and `no` or
|
|||
`false` for a false value. CMake uses `ON` for a true value, and `OFF` for a
|
||||
false value.
|
||||
|
||||
### Some of the most important options follow.
|
||||
Some of the most important options follow.
|
||||
|
||||
| SCons | CMake | Description |
|
||||
|------------------------------------------------------------------------|--------------------------------------------------------------------| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `build=<build type>` | `CMAKE_BUILD_TYPE=<build type>` | Selects a specific build configuration when compiling. `release` produces the default, optimized (-O3) build for regular use. `debug` produces a slower and larger unoptimized (-O0) build with full debug symbols, which is often needed for obtaining detailed backtraces when reporting bugs. |
|
||||
| `wesnoth` | `ENABLE_GAME=<boolean>` | Whether to build the game client binary. To disable just don't mention the target for SCons. |
|
||||
| `wesnothd` | `ENABLE_SERVER=<boolean>` | Whether to build the MP server binary. To disable just don't mention the target for SCons. |
|
||||
| `prefix=<full path>` | `CMAKE_INSTALL_PREFIX=<full path>` | Installation prefix for binaries, resources, and documentation files. |
|
||||
| `nls=<boolean>` | `ENABLE_NLS=<boolean>` | Whether to compile and install translations. |
|
||||
| `strict=<boolean>` | `ENABLE_STRICT_COMPILATION=<boolean>` | Whether to treat compiler warnings as errors or not. Primarily intended for developers. |
|
||||
| `prefsdir=<directory name>` | `PREFERENCES_DIR=<directory name>` | Hardcoded user preferences and user data directory. The default is to leave this unspecified so that Wesnoth will use separate XDG paths such as .config/wesnoth and .local/share/wesnoth/<version> for its user preferences and data, respectively. |
|
||||
| `cxxtool=<program>` | `CMAKE_CXX_COMPILER=<program>` | Specifies which C++ compiler to use. By default, the system's default C++ compiler will be automatically selected during configuration. |
|
||||
| `ccache=<boolean>` | `CMAKE_CXX_COMPILER_LAUNCHER=ccache` | Whether to run the compiler through ccache first. Useful if the compiler executable is not a symbolic link to ccache. Requires ccache to be installed first. If using CMake, use CMAKE_C_COMPILER and CMAKE_CXX_COMPILER instead. |
|
||||
| `extra_flags_<buildtype>=<flags>` `extra_flags_config=<flags>` | `CXX_FLAGS_USER=<flags>` | Additional compiler flags to use when compiling a specific build type (SCons-only). To apply the same flags to all builds, use extra_flags_config (SCons) or CXX_FLAGS_USER (CMake) without a build type suffix. Alternatively, you may specify your flags in the CXXFLAGS environment variable. |
|
||||
| `fifodir=<full path>` `server_uid=<UID>` `server_gid=<GID>` | `FIFO_DIR=<full path>` `SERVER_UID=<UID>` `SERVER_GID=<GID>` | Directory and owner id for the wesnothd control FIFO file. This is relevant only if you wish to be able to communicate with a local wesnothd instance through a named pipe. You must run wesnothd with the same UID specified at build time for this to work. |
|
||||
| `enable_lto=<boolean>` | `ENABLE_LTO=<boolean>` | Controls using Link Time Optimization. Enabling will result in a smaller, faster executable at the cost of increased time to compile and link. For cmake, use LTO_JOBS=N tells how many threads to use during linking. |
|
||||
| `--debug=time` | `VERBOSE=1` (make option) | Enables some additional output while building. |
|
||||
| `jobs=N` | `-jN` (make option) | Enables compiling with multiple threads, where N is the number of threads to use. |
|
||||
* build=<build type> (SCons)
|
||||
CMAKE_BUILD_TYPE=<build type> (CMake)
|
||||
|
||||
Selects a specific build configuration when compiling. `release` produces
|
||||
the default, optimized (-O3) build for regular use. `debug` produces a
|
||||
slower and larger unoptimized (-O0) build with full debug symbols, which is
|
||||
often needed for obtaining detailed backtraces when reporting bugs.
|
||||
|
||||
* ENABLE_GAME=<boolean> (CMake)
|
||||
|
||||
Whether to build the game client binary. Use command line target selection
|
||||
selection with SCons instead.
|
||||
|
||||
* ENABLE_SERVER=<boolean> (CMake)
|
||||
|
||||
Whether to build the MP server binary. Use command line target selection
|
||||
selection with SCons instead.
|
||||
|
||||
* prefix=<full path> (SCons)
|
||||
CMAKE_INSTALL_PREFIX=<full path> (CMake)
|
||||
|
||||
Installation prefix for binaries, resources, and documentation files.
|
||||
|
||||
* nls=<boolean> (SCons)
|
||||
ENABLE_NLS=<boolean> (CMake)
|
||||
|
||||
Whether to compile and install translations.
|
||||
|
||||
* strict=<boolean> (SCons)
|
||||
ENABLE_STRICT_COMPILATION=<boolean> (CMake)
|
||||
|
||||
Whether to treat compiler warnings as errors or not. Primarily intended for
|
||||
developers.
|
||||
|
||||
* prefsdir=<directory name> (SCons)
|
||||
PREFERENCES_DIR=<directory name> (CMake)
|
||||
|
||||
Hardcoded user preferences and user data directory. The default is to leave
|
||||
this unspecified so that Wesnoth will use separate XDG paths such as
|
||||
.config/wesnoth and .local/share/wesnoth/<version> for its user preferences
|
||||
and data, respectively.
|
||||
|
||||
* cxxtool=<program> (SCons)
|
||||
CMAKE_CXX_COMPILER=<program> (CMake)
|
||||
|
||||
Specifies which C++ compiler to use. By default, the system's default C++
|
||||
compiler will be automatically selected during configuration.
|
||||
|
||||
* ccache=<boolean> (SCons)
|
||||
|
||||
Whether to run the compiler through ccache first. Useful if the compiler
|
||||
executable is not a symbolic link to ccache. Requires ccache to be
|
||||
installed first.
|
||||
|
||||
If using CMake, use CMAKE_CXX_COMPILER instead.
|
||||
|
||||
* extra_flags_<buildtype>=<flags> (SCons)
|
||||
extra_flags_config=<flags> (SCons)
|
||||
CXX_FLAGS_USER=<flags> (CMake)
|
||||
|
||||
Additional compiler flags to use when compiling a specific build type
|
||||
(SCons-only). To apply the same flags to all builds, use extra_flags_config
|
||||
(SCons) or CXX_FLAGS_USER (CMake) without a build type suffix.
|
||||
|
||||
Alternatively, you may specify your flags in the CXXFLAGS environment
|
||||
variable.
|
||||
|
||||
* fifodir=<full path> (SCons)
|
||||
FIFO_DIR=<full path> (CMake)
|
||||
|
||||
server_uid=<UID> server_gid=<GID> (SCons)
|
||||
SERVER_UID=<UID> SERVER_GID=<GID> (CMake)
|
||||
|
||||
Directory and owner id for the wesnothd control FIFO file. This is relevant
|
||||
only if you wish to be able to communicate with a local wesnothd instance
|
||||
through a named pipe. You must run wesnothd with the same UID specified at
|
||||
build time for this to work.
|
||||
|
|
106
README.md
|
@ -1,109 +1,45 @@
|
|||
[](https://travis-ci.org/wesnoth/wesnoth)
|
||||
[](https://ci.appveyor.com/project/wesnoth/wesnoth)
|
||||
[](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
|
||||
|
||||
|Branch|CI status|
|
||||
|------|---------|
|
||||
|Master|[](https://github.com/wesnoth/wesnoth/actions/workflows/ci-main.yml?query=branch%3Amaster)|
|
||||
|1.18|[](https://github.com/wesnoth/wesnoth/actions/workflows/ci-main.yml?query=branch%3A1.18)|
|
||||
[](https://scan.coverity.com/projects/wesnoth)
|
||||
|
||||
About
|
||||
=====
|
||||
|
||||
**The Battle for Wesnoth** is an Open Source, turn-based tactical strategy game with a high fantasy theme, featuring both singleplayer and online/hotseat multiplayer combat. Fight a desperate battle to reclaim the throne of Wesnoth, search for the key to immortality, or take part in any number of other adventures.
|
||||
|
||||
Community
|
||||
---------
|
||||
|
||||
The official Battle for Wesnoth Forums:
|
||||
<https://forums.wesnoth.org/>
|
||||
|
||||
Discord:
|
||||
<https://discord.gg/battleforwesnoth>
|
||||
|
||||
IRC:
|
||||
<https://wiki.wesnoth.org/Support#IRC>
|
||||
|
||||
Mastodon:
|
||||
<https://fosstodon.org/@wesnoth>
|
||||
|
||||
Steam forums:
|
||||
<https://steamcommunity.com/app/599390/discussions/>
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* A variety of different campaigns, each with their own tactical challenges, emotionally charged story, and multiple difficulty levels.
|
||||
* A detailed world and storytelling with hundreds of sprites, animations, and characters.
|
||||
* Many different unit skills and traits across several factions.
|
||||
* A map editor with multiple tools, hundreds types of terrain, and the ability for you to save and share maps with others. Create your own scenarios/battles for near infinite replayability.
|
||||
* Highly moddable, allowing a wide array of community created map packs, eras, and entire campaigns.
|
||||
* Online and local multiplayer gameplay to play with friends, strangers, or against the AI.
|
||||
* Changeable settings for base gameplay, with nearly limitless options for different hotkey configurations.
|
||||
* Beautifully composed playlist that captures the era and grandiosity of this lore-filled high-fantasy world.
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Wesnoth can be played on Windows, macOS, and Linux, and can be installed using:
|
||||
* [Steam](https://store.steampowered.com/app/599390/Battle_for_Wesnoth/) (all)
|
||||
* [itch.io](https://wesnoth.itch.io/battle-for-wesnoth) (Windows and macOS)
|
||||
* The [macOS App Store](https://apps.apple.com/us/app/the-battle-for-wesnoth/id1450738104)
|
||||
* standalone installers on [SourceForge](https://sourceforge.net/projects/wesnoth/files/) (Windows and macOS)
|
||||
* [Flatpak](https://flathub.org/apps/details/org.wesnoth.Wesnoth) (Linux)
|
||||
|
||||
Additionally, Wesnoth is available for [iOS](https://apps.apple.com/us/app/battle-for-wesnoth/id575852062) and [Android](https://sourceforge.net/projects/wesnoth-on-android/files/).
|
||||
|
||||
To build the game from source, see [INSTALL](/INSTALL.md) for instructions.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Wesnoth is most in need of skilled C++ developers (C++14 and later), however there are things that nearly anyone can help with:
|
||||
* Simple tasks in C++.
|
||||
* The Lua and WML used for content scripting.
|
||||
* Python used by various external tools.
|
||||
* Even play testing and giving feedback on updated campaigns!
|
||||
|
||||
Additionally, Wesnoth lacks art for a variety of unit animations - anyone who would be interested in lending a hand in updating existing unit sprites or creating animations should take a look at the [Art Contributions](https://forums.wesnoth.org/viewforum.php?f=9) forum as well as contact our current art director.
|
||||
|
||||
See also: [CONTRIBUTING](/CONTRIBUTING.md)
|
||||
|
||||
For any questions, the best place to start is to simply join Wesnoth's forums, Discord, or IRC and start asking!
|
||||
|
||||
|
||||
Donations
|
||||
---------
|
||||
|
||||
Donations can be sent via [Software in the Public Interest](https://www.spi-inc.org/projects/wesnoth/), [Liberapay](https://liberapay.com/Wesnoth), as well as when downloading through itch.io. All money donated is used to pay for project expenses such as server rent and art commissions, and is very much appreciated.
|
||||
**The Battle for Wesnoth** is an Open Source, turn-based tactical strategy game with a
|
||||
high fantasy theme, featuring both singleplayer and online/hotseat multiplayer
|
||||
combat. Fight a desperate battle to reclaim the throne of Wesnoth, or take
|
||||
hand in any number of other adventures.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
All source code is licensed under the GNU GPL v2+. Most art and music is also licensed under the GNU GPL v2+, however new contributions are now licensed under the Creative Commons BY-SA v4.0. For more detailed information on Wesnoth's licensing, see the wiki:
|
||||
Please see the wiki for information regarding The Battle for Wesnoth's licensing:
|
||||
|
||||
<https://wiki.wesnoth.org/Wesnoth:Copyrights>
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
See INSTALL.md for instructions on how to build the game from source code.
|
||||
|
||||
|
||||
More Information
|
||||
----------------
|
||||
|
||||
For extensive documentation about all aspects of the game, see the official Battle for Wesnoth web site:
|
||||
For extensive documentation about all aspects of the game, see the
|
||||
official Battle for Wesnoth web site.
|
||||
|
||||
<https://www.wesnoth.org/>
|
||||
<https://wiki.wesnoth.org/>
|
||||
|
||||
A (translated) description of how to play the game can be found in doc/manual/manual.*.html, or online at:
|
||||
A (translated) description of how to play the game can be found in
|
||||
doc/manual/manual.*.html, or online at:
|
||||
|
||||
<https://wiki.wesnoth.org/WesnothManual>
|
||||
|
||||
For information on creating your own maps, scenarios, and other content, see:
|
||||
The official Battle for Wesnoth Forums (with over 400,000 posts from more than
|
||||
20,000 registered members) can be found at:
|
||||
|
||||
<https://wiki.wesnoth.org/Create>
|
||||
|
||||
Gallery
|
||||
-------
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
<https://forums.wesnoth.org/>
|
||||
|
|
73
RELEASE_NOTES
Normal file
|
@ -0,0 +1,73 @@
|
|||
This file is here to allow devs to easily add stuff in the release notes for the next release, it allows easy syncing with the release team, since you don't have to be around when the release takes place...
|
||||
|
||||
Just dump whatever you want to have mentioned in the release notes here. Please take care that it is in a way that allows copy&paste to the release notes. That is making sure that spelling/grammar/whatever is usable and that you are using complete sentences, not just single words. Please do use forum syntax and do *NOT* split lines after 80 chars!
|
||||
|
||||
Stuff that belongs in here:
|
||||
* groundbreaking changes (new campaigns, extremely new feature, ...)
|
||||
* changed dependencies (new things, version bumps, stuff that was removed)
|
||||
* known bugs
|
||||
|
||||
The release team should empty this file after each release.
|
||||
|
||||
|
||||
=======
|
||||
CHANGES
|
||||
=======
|
||||
|
||||
[rasection="Campaigns"]
|
||||
[list]
|
||||
[/list]
|
||||
[/rasection]
|
||||
|
||||
[rasection="User Interface"]
|
||||
[list]
|
||||
[/list]
|
||||
[/rasection]
|
||||
|
||||
[rawarn="Deprecations and breaking changes"]
|
||||
[list]
|
||||
[*][set_menu_item] no longer fires repeatedly if the player holds the hotkey (bug #1711). If you were relying on repeated firing, add repeat_on_hold=yes to [default_hotkey].
|
||||
[*][tt]ai.synced_command[/tt] was removed
|
||||
[/list]
|
||||
[/rawarn]
|
||||
|
||||
[rasection="New Lua/WML features"]
|
||||
[list]
|
||||
[*]Add-on creators can now specify a comma-separated list of tags in the .pbl file, which are used by the Add-ons Manager when filtering add-ons by typing key words into the Filter box. This may be used to make it easier for people to find add-ons, e.g. by including their acronym among the tags. See [wiki]PblWML[/wiki] for details.
|
||||
[/list]
|
||||
[/rasection]
|
||||
|
||||
==========
|
||||
KNOWN BUGS
|
||||
==========
|
||||
|
||||
[raissue="Newly introduced in 1.13.x"]
|
||||
[b]General bugs:[/b]
|
||||
|
||||
[list]
|
||||
[/list]
|
||||
|
||||
[b]Bugs specific to macOS:[/b]
|
||||
[list]
|
||||
[*]The game may crash when opening the file dialog.
|
||||
[/list]
|
||||
[/raissue]
|
||||
|
||||
[raissue="Carried over from 1.12.x"]
|
||||
[b]General bugs:[/b]
|
||||
|
||||
[list]
|
||||
[*]The game can crash when planning recruits in Planning Mode.
|
||||
[/list]
|
||||
|
||||
[b]Bugs specific to Microsoft Windows:[/b]
|
||||
|
||||
[list]
|
||||
[/list]
|
||||
|
||||
[b]Bugs specific to macOS:[/b]
|
||||
|
||||
[list]
|
||||
[*]Trackpad tap clicking is sometimes not recognized ([url=http://forums.wesnoth.org/viewtopic.php?f=4&t=39788]forum post[/url]).
|
||||
[/list]
|
||||
[/raissue]
|
306
SConstruct
|
@ -9,8 +9,6 @@
|
|||
|
||||
EnsureSConsVersion(0,98,3)
|
||||
|
||||
lua_ver = "5.4"
|
||||
|
||||
import os, sys, shutil, re, subprocess
|
||||
from glob import glob
|
||||
from subprocess import Popen, PIPE, call, check_output
|
||||
|
@ -49,7 +47,7 @@ def OptionalPath(key, val, env):
|
|||
opts.AddVariables(
|
||||
ListVariable('default_targets', 'Targets that will be built if no target is specified in command line.',
|
||||
"wesnoth,wesnothd", Split("wesnoth wesnothd campaignd boost_unit_tests")),
|
||||
EnumVariable('build', 'Build variant: release, debug, or profile', "release", ["release", "debug"]),
|
||||
EnumVariable('build', 'Build variant: release, debug, or profile', "release", ["release", "debug", "profile"]),
|
||||
PathVariable('build_dir', 'Build all intermediate files(objects, test programs, etc) under this dir', "build", PathVariable.PathAccept),
|
||||
('extra_flags_config', "Extra compiler and linker flags to use for configuration and all builds. Whether they're compiler or linker is determined by env.ParseFlags. Unknown flags are compile flags by default. This applies to all extra_flags_* variables", ""),
|
||||
('extra_flags_release', 'Extra compiler and linker flags to use for release builds', ""),
|
||||
|
@ -59,18 +57,18 @@ opts.AddVariables(
|
|||
('arch', 'What -march option to use for build=release, will default to pentiumpro on Windows', ""),
|
||||
('opt', 'override for the build\'s optimization level', ""),
|
||||
BoolVariable('harden', 'Whether to enable options to harden the executables', True),
|
||||
BoolVariable('glibcxx_assertions', 'Whether to define _GLIBCXX_ASSERTIONS for build=debug', False),
|
||||
BoolVariable('glibcxx_debug', "Whether to define _GLIBCXX_DEBUG and _GLIBCXX_DEBUG_PEDANTIC for build=debug. Requires a version of Boost's program_options that's compiled with __GLIBCXX_DEBUG too.", False),
|
||||
EnumVariable('profiler', 'profiler to be used', "", ["", "gprof", "gcov", "gperftools", "perf"]),
|
||||
BoolVariable('glibcxx_debug', 'Whether to define _GLIBCXX_DEBUG and _GLIBCXX_DEBUG_PEDANTIC for build=debug', False),
|
||||
EnumVariable('profiler', 'profiler to be used for build=profile', "gprof", ["gprof", "gcov", "gperftools", "perf"]),
|
||||
EnumVariable('pgo_data', 'whether to generate profiling data for PGO, or use existing profiling data', "", ["", "generate", "use"]),
|
||||
BoolVariable('use_srcdir', 'Whether to place object files in src/ or not', False),
|
||||
PathVariable('bindir', 'Where to install binaries', "bin", PathVariable.PathAccept),
|
||||
('cachedir', 'Directory that contains a cache of derived files.', ''),
|
||||
PathVariable('datadir', 'read-only architecture-independent game data', "$datarootdir/$datadirname", PathVariable.PathAccept),
|
||||
PathVariable('fifodir', 'directory for the wesnothd fifo socket file', "/var/run/wesnothd", PathVariable.PathAccept),
|
||||
BoolVariable('fribidi','Clear to disable bidirectional-language support', True),
|
||||
BoolVariable('desktop_entry','Clear to disable desktop-entry', True),
|
||||
BoolVariable('appdata_file','Clear to not install appdata file', True),
|
||||
BoolVariable('systemd','Install systemd unit file for wesnothd', bool(WhereIs("systemctl"))),
|
||||
BoolVariable('systemd','Install systemd unit file for wesnothd', bool(WhereIs("systemd"))),
|
||||
PathVariable('datarootdir', 'sets the root of data directories to a non-default location', "share", PathVariable.PathAccept),
|
||||
PathVariable('datadirname', 'sets the name of data directory', "wesnoth$version_suffix", PathVariable.PathAccept),
|
||||
PathVariable('desktopdir', 'sets the desktop entry directory to a non-default location', "$datarootdir/applications", PathVariable.PathAccept),
|
||||
|
@ -90,7 +88,7 @@ opts.AddVariables(
|
|||
BoolVariable('prereqs','abort if prerequisites cannot be detected',True),
|
||||
('program_suffix', 'suffix to append to names of installed programs',"$version_suffix"),
|
||||
('version_suffix', 'suffix that will be added to default values of prefsdir, program_suffix and datadirname', ""),
|
||||
BoolVariable('forum_user_handler', 'Enable forum user handler in wesnothd and campaignd', False),
|
||||
BoolVariable('forum_user_handler', 'Enable forum user handler in wesnothd', False),
|
||||
('server_gid', 'group id of the user who runs wesnothd', ""),
|
||||
('server_uid', 'user id of the user who runs wesnothd', ""),
|
||||
BoolVariable('strict', 'Set to strict compilation', False),
|
||||
|
@ -103,7 +101,6 @@ opts.AddVariables(
|
|||
('boost_suffix', 'Suffix of boost libraries.'),
|
||||
PathVariable('gettextdir', 'Root directory of Gettext\'s installation.', "", OptionalPath),
|
||||
PathVariable('gtkdir', 'Directory where GTK SDK is installed.', "", OptionalPath),
|
||||
BoolVariable('system_lua', 'Enable use of system Lua ' + lua_ver + ' (compiled as C++, only for non-Windows systems).', False),
|
||||
PathVariable('luadir', 'Directory where Lua binary package is unpacked.', "", OptionalPath),
|
||||
('host', 'Cross-compile host.', ''),
|
||||
EnumVariable('multilib_arch', 'Address model for multilib compiler: 32-bit or 64-bit', "", ["", "32", "64"]),
|
||||
|
@ -112,15 +109,12 @@ opts.AddVariables(
|
|||
BoolVariable('ccache', "Use ccache", False),
|
||||
('ctool', 'Set c compiler command if not using standard compiler.'),
|
||||
('cxxtool', 'Set c++ compiler command if not using standard compiler.'),
|
||||
EnumVariable('cxx_std', 'Target c++ std version', '17', ['17', '20']),
|
||||
EnumVariable('cxx_std', 'Target c++ std version', '14', ['14', '17']),
|
||||
('sanitize', 'Enable clang and GCC sanitizer functionality. A comma separated list of sanitize suboptions must be passed as value.', ''),
|
||||
BoolVariable("fast", "Make scons faster at cost of less precise dependency tracking.", False),
|
||||
BoolVariable("autorevision", 'Use autorevision tool to fetch current git revision that will be embedded in version string', True),
|
||||
BoolVariable("lockfile", "Create a lockfile to prevent multiple instances of scons from being run at the same time on this working copy.", False),
|
||||
BoolVariable("OS_ENV", "Forward the entire OS environment to scons", False),
|
||||
BoolVariable("history", "Clear to disable GNU history support in lua console", True),
|
||||
BoolVariable('force_color', 'Always produce ANSI-colored output (GNU/Clang only).', False),
|
||||
BoolVariable('compile_db', 'Produce a compile_commands.json file.', False),
|
||||
BoolVariable("history", "Clear to disable GNU history support in lua console", True)
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -134,16 +128,12 @@ for repo in Dir(".").repositories:
|
|||
# source code root and supplying this path with -Y option.
|
||||
toolpath.append(repo.abspath + "/scons")
|
||||
sys.path = toolpath + sys.path
|
||||
env = Environment(tools=["tar", "gettext_tool", "install", "scanreplace"], options = opts, toolpath = toolpath)
|
||||
env = Environment(tools=["tar", "gettext_tool", "install", "python_devel", "scanreplace"], options = opts, toolpath = toolpath)
|
||||
|
||||
if env["lockfile"]:
|
||||
print("Creating lockfile")
|
||||
lockfile = os.path.abspath("scons.lock")
|
||||
if sys.version_info.major >= 3:
|
||||
create = "x"
|
||||
else:
|
||||
create = "wx"
|
||||
open(lockfile, create).write(str(os.getpid()))
|
||||
open(lockfile, "wx").write(str(os.getpid()))
|
||||
import atexit
|
||||
atexit.register(os.remove, lockfile)
|
||||
|
||||
|
@ -167,8 +157,7 @@ else:
|
|||
from cross_compile import *
|
||||
setup_cross_compile(env)
|
||||
|
||||
if sys.platform != 'win32':
|
||||
env.Tool("system_include")
|
||||
env.Tool("system_include")
|
||||
|
||||
if 'HOME' in os.environ:
|
||||
env['ENV']['HOME'] = os.environ['HOME']
|
||||
|
@ -190,12 +179,8 @@ if env['distcc']:
|
|||
|
||||
if env['ccache']: env.Tool('ccache')
|
||||
|
||||
if env['compile_db']:
|
||||
env.Tool('compilation_db')
|
||||
cdb = env.CompilationDatabase()
|
||||
Alias('cdb', cdb)
|
||||
boost_version = '1.56.0'
|
||||
|
||||
boost_version = "1.67"
|
||||
|
||||
def SortHelpText(a, b):
|
||||
return (a > b) - (a < b)
|
||||
|
@ -211,7 +196,9 @@ Important switches include:
|
|||
in build/release and copy resulting binaries
|
||||
into distribution/working copy root.
|
||||
build=debug same for debug build variant
|
||||
binaries will be copied with -debug suffix
|
||||
build=profile build with instrumentation for a supported profiler
|
||||
binaries will be copied with -profile suffix
|
||||
|
||||
With no arguments, the recipe builds wesnoth and wesnothd. Available
|
||||
build targets include the individual binaries:
|
||||
|
@ -232,7 +219,6 @@ You can make the following special build targets:
|
|||
update-po = merge message catalog templates with localized message catalogs for particular lingua
|
||||
update-po4a = update translations of manual and manpages
|
||||
af bg ca ... = linguas for update-po
|
||||
translations = build all translations
|
||||
dist = make distribution tarball as wesnoth.tar.bz2 (*).
|
||||
data-dist = make data tarball as wesnoth-data.tar.bz2 (*).
|
||||
binary-dist = make data tarball as wesnoth-binaries.tar.bz2 (*).
|
||||
|
@ -322,7 +308,7 @@ def Warning(message):
|
|||
|
||||
from metasconf import init_metasconf
|
||||
configure_args = dict(
|
||||
custom_tests = init_metasconf(env, ["cplusplus", "sdl", "boost", "cairo", "pango", "pkgconfig", "gettext_tool", "lua"]),
|
||||
custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "cairo", "pango", "pkgconfig", "gettext_tool", "lua", "gl"]),
|
||||
config_h = "$build_dir/config.h",
|
||||
log_file="$build_dir/config.log", conf_dir="$build_dir/sconf_temp")
|
||||
|
||||
|
@ -337,24 +323,20 @@ env.PrependENVPath('LD_LIBRARY_PATH', env["boostlibdir"])
|
|||
|
||||
# Some tests require at least C++11
|
||||
if "gcc" in env["TOOLS"]:
|
||||
env.AppendUnique(CCFLAGS = Split("-Wall -Wextra"))
|
||||
env.AppendUnique(CXXFLAGS = Split("-Werror=non-virtual-dtor -std=c++" + env["cxx_std"]))
|
||||
|
||||
# GCC-13 added this new warning, and included it in -Wextra,
|
||||
# however in GCC-13 it has a lot of false positives.
|
||||
#
|
||||
# It's likely to generate false postives with GCC-14 too, but
|
||||
# I'm using a narrow version check as GCC-14 is still in dev.
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110075
|
||||
if "CXXVERSION" in env and env["CXXVERSION"].startswith("13."):
|
||||
env.AppendUnique(CXXFLAGS = "-Wno-dangling-reference")
|
||||
env.AppendUnique(CCFLAGS = Split("-Wall -Wextra -Werror=non-virtual-dtor"))
|
||||
env.AppendUnique(CXXFLAGS = "-std=c++" + env["cxx_std"])
|
||||
|
||||
if env["prereqs"]:
|
||||
conf = env.Configure(**configure_args)
|
||||
|
||||
if env["PLATFORM"] == "posix":
|
||||
conf.CheckCHeader("poll.h", "<>")
|
||||
conf.CheckCHeader("sys/poll.h", "<>")
|
||||
conf.CheckCHeader("sys/select.h", "<>")
|
||||
if conf.CheckCHeader("sys/sendfile.h", "<>"):
|
||||
conf.CheckFunc("sendfile")
|
||||
conf.CheckLib("m")
|
||||
conf.CheckFunc("round")
|
||||
|
||||
def CheckAsio(conf):
|
||||
if env["PLATFORM"] == 'win32':
|
||||
|
@ -364,28 +346,26 @@ if env["prereqs"]:
|
|||
have_libpthread = conf.CheckLib("pthread")
|
||||
return have_libpthread & \
|
||||
conf.CheckBoost("system") & \
|
||||
conf.CheckBoost("asio", header_only = True) & \
|
||||
conf.CheckBoost("context") & \
|
||||
conf.CheckBoost("coroutine")
|
||||
conf.CheckBoost("asio", header_only = True)
|
||||
|
||||
def have_sdl_other():
|
||||
return \
|
||||
conf.CheckSDL2('2.0.18') & \
|
||||
conf.CheckSDL2Mixer() & \
|
||||
conf.CheckSDL2Image()
|
||||
conf.CheckSDL(require_version = '2.0.4') & \
|
||||
conf.CheckSDL("SDL2_ttf", header_file = "SDL_ttf") & \
|
||||
conf.CheckSDL("SDL2_mixer", header_file = "SDL_mixer") & \
|
||||
conf.CheckSDL("SDL2_image", header_file = "SDL_image")
|
||||
|
||||
if sys.platform == "msys":
|
||||
env["PKG_CONFIG_FLAGS"] = "--dont-define-prefix"
|
||||
|
||||
have_server_prereqs = (\
|
||||
conf.CheckCPlusPlus(gcc_version = "8") & \
|
||||
conf.CheckCPlusPlus(gcc_version = "4.8") & \
|
||||
conf.CheckLib("libcrypto") & \
|
||||
conf.CheckBoost("iostreams", require_version = boost_version) & \
|
||||
conf.CheckBoostIostreamsGZip() & \
|
||||
conf.CheckBoostIostreamsBZip2() & \
|
||||
conf.CheckBoost("program_options", require_version = boost_version) & \
|
||||
conf.CheckBoost("random", require_version = boost_version) & \
|
||||
conf.CheckBoost("smart_ptr", header_only = True) & \
|
||||
conf.CheckBoostCharconv() & \
|
||||
CheckAsio(conf) & \
|
||||
conf.CheckBoost("thread") & \
|
||||
conf.CheckBoost("locale") & \
|
||||
|
@ -399,40 +379,23 @@ if env["prereqs"]:
|
|||
if env['harden']:
|
||||
env["have_fortify"] = conf.CheckFortifySource()
|
||||
|
||||
if(env["PLATFORM"] != 'darwin'):
|
||||
# Otherwise, use Security.framework
|
||||
have_server_prereqs = have_server_prereqs & conf.CheckLib("libcrypto") & conf.CheckLib("ssl")
|
||||
|
||||
env = conf.Finish()
|
||||
|
||||
client_env = env.Clone()
|
||||
conf = client_env.Configure(**configure_args)
|
||||
have_client_prereqs = have_server_prereqs & have_sdl_other()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckLib("vorbisfile") & conf.CheckOgg()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckPNG()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckJPG()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckWebP()
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckCairo(min_version = "1.10")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckPango("cairo", require_version = "1.44.0")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckPKG("fontconfig")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckBoost("regex")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckLib("curl")
|
||||
have_client_prereqs = have_client_prereqs & conf.CheckBoost("graph")
|
||||
|
||||
if env["system_lua"]:
|
||||
if env["PLATFORM"] == 'win32':
|
||||
Warning("System Lua cannot be used on Windows.")
|
||||
if not conf.CheckLua(lua_ver):
|
||||
have_client_prereqs = False
|
||||
else:
|
||||
if not File("#/src/modules/lua/.git").rfile().exists():
|
||||
have_client_prereqs = False
|
||||
Warning("Lua submodule does not exist. You must run 'git submodule update --init --recursive' to initialize it.")
|
||||
else:
|
||||
print("Lua submodule found.")
|
||||
|
||||
if not have_client_prereqs:
|
||||
Warning("Client prerequisites are not met. wesnoth cannot be built.")
|
||||
have_client_prereqs = have_server_prereqs & have_sdl_other() & \
|
||||
(('TRAVIS' in os.environ and os.environ["TRAVIS_OS_NAME"] == "osx") or (conf.CheckLib("vorbisfile") & \
|
||||
conf.CheckOgg())) & \
|
||||
conf.CheckPNG() & \
|
||||
conf.CheckJPG() & \
|
||||
conf.CheckOpenGL() and \
|
||||
conf.CheckGLEW() and \
|
||||
conf.CheckCairo(min_version = "1.10") & \
|
||||
conf.CheckPango("cairo", require_version = "1.22.0") & \
|
||||
conf.CheckPKG("fontconfig") & \
|
||||
conf.CheckBoost("program_options", require_version = boost_version) & \
|
||||
conf.CheckBoost("regex") \
|
||||
or Warning("Client prerequisites are not met. wesnoth cannot be built")
|
||||
|
||||
have_X = False
|
||||
if have_client_prereqs:
|
||||
|
@ -440,34 +403,24 @@ if env["prereqs"]:
|
|||
have_X = conf.CheckLib('X11')
|
||||
|
||||
env["notifications"] = env["notifications"] and conf.CheckPKG("dbus-1")
|
||||
if env["notifications"]:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_LIBDBUS"])
|
||||
|
||||
client_env['fribidi'] = client_env['fribidi'] and (conf.CheckPKG('fribidi >= 0.10.9') or Warning("Can't find FriBiDi, disabling FriBiDi support."))
|
||||
if client_env['fribidi']:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_FRIBIDI"])
|
||||
|
||||
env["history"] = env["history"] and (conf.CheckLib("history") or Warning("Can't find GNU history, disabling history support."))
|
||||
|
||||
client_env = conf.Finish()
|
||||
|
||||
# We set those outside of Configure() section because SCons doesn't merge CPPPATH var properly in conf.Finish()
|
||||
if env["notifications"]:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_LIBDBUS"])
|
||||
if env["history"]:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_HISTORY"])
|
||||
|
||||
env.Append(CPPDEFINES = ["BOOST_COROUTINES_NO_DEPRECATION_WARNING"])
|
||||
if env["history"]:
|
||||
client_env.Append(CPPDEFINES = ["HAVE_HISTORY"])
|
||||
|
||||
if env["forum_user_handler"]:
|
||||
found_connector = False
|
||||
for sql_config in ["mariadb_config", "mysql_config"]:
|
||||
try:
|
||||
mysql_config = check_output([sql_config, "--libs", "--cflags"]).decode("utf-8").replace("\n", " ").replace("-DNDEBUG", "")
|
||||
mysql_flags = env.ParseFlags(mysql_config+"-I"+Dir("#/src/modules/mariadbpp/include/").rdir().abspath)
|
||||
env.Append(CPPDEFINES = ["HAVE_MYSQLPP"])
|
||||
env.MergeFlags(mysql_flags)
|
||||
found_connector = True
|
||||
break
|
||||
except OSError:
|
||||
print("Failed to run script '%s'" % sql_config)
|
||||
mysql_config = check_output(["mysql_config", "--libs", "--cflags"]).replace("\n", " ").replace("-DNDEBUG", "")
|
||||
mysql_flags = env.ParseFlags(mysql_config)
|
||||
env.Append(CPPDEFINES = ["HAVE_MYSQLPP"])
|
||||
env.MergeFlags(mysql_flags)
|
||||
|
||||
if not found_connector:
|
||||
Exit("Failed to find sql connector library but forum user handler support is requested.")
|
||||
have_server_prereqs = False
|
||||
client_env = conf.Finish()
|
||||
|
||||
test_env = client_env.Clone()
|
||||
conf = test_env.Configure(**configure_args)
|
||||
|
@ -508,19 +461,15 @@ for env in [test_env, client_env, env]:
|
|||
if os.path.isabs(env["build_dir"]):
|
||||
build_root = ""
|
||||
env.Prepend(CPPPATH = [build_root + "$build_dir", "#/src"])
|
||||
if env["system_lua"]:
|
||||
env.Append(CPPDEFINES = ["HAVE_SYSTEM_LUA"])
|
||||
|
||||
env.Append(CPPDEFINES = ["HAVE_CONFIG_H"])
|
||||
|
||||
if "clang" in env["CXX"]:
|
||||
# Silence warnings about unused -I options and unknown warning switches.
|
||||
env.AppendUnique(CCFLAGS = Split("-Qunused-arguments -Wno-unknown-warning-option -Wmismatched-tags -Wno-conditional-uninitialized -Wno-unused-lambda-capture"))
|
||||
env.AppendUnique(CCFLAGS = Split("-Qunused-arguments -Wno-unknown-warning-option -Wmismatched-tags -Wno-conditional-uninitialized"))
|
||||
|
||||
if env['pedantic']:
|
||||
env.AppendUnique(CXXFLAGS = Split("-Wdocumentation -Wno-documentation-deprecated-sync"))
|
||||
if env['force_color']:
|
||||
env.AppendUnique(CCFLAGS = ["-fcolor-diagnostics"])
|
||||
|
||||
if "gcc" in env["TOOLS"]:
|
||||
env.AppendUnique(CCFLAGS = Split("-Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wtrampolines"))
|
||||
|
@ -534,9 +483,6 @@ for env in [test_env, client_env, env]:
|
|||
if env['sanitize']:
|
||||
env.AppendUnique(CCFLAGS = ["-fsanitize=" + env["sanitize"]], LINKFLAGS = ["-fsanitize=" + env["sanitize"]])
|
||||
env.AppendUnique(CCFLAGS = Split("-fno-omit-frame-pointer -fno-optimize-sibling-calls"))
|
||||
if env['force_color']:
|
||||
env.AppendUnique(CCFLAGS = ["-fdiagnostics-color=always"])
|
||||
|
||||
|
||||
# #
|
||||
# Determine optimization level
|
||||
|
@ -545,7 +491,7 @@ for env in [test_env, client_env, env]:
|
|||
if not env["opt"]:
|
||||
if env["build"] == "release":
|
||||
env["opt"] = "-O3 "
|
||||
elif env["profiler"] == "perf":
|
||||
elif env["build"] == "profile" and env["profiler"] == "perf":
|
||||
env["opt"] = "-Og "
|
||||
else:
|
||||
env["opt"] = "-O0 "
|
||||
|
@ -560,7 +506,7 @@ for env in [test_env, client_env, env]:
|
|||
|
||||
if env['harden'] and env["PLATFORM"] != 'win32':
|
||||
env.AppendUnique(CCFLAGS = ["-fPIE", "-fstack-protector-strong"])
|
||||
if not env.get("have_fortify") and "-O0" not in env["opt"]:
|
||||
if not env["have_fortify"] and "-O0" not in env["opt"]:
|
||||
env.AppendUnique(CPPDEFINES = ["_FORTIFY_SOURCE=2"])
|
||||
|
||||
if env["enable_lto"] == True:
|
||||
|
@ -576,16 +522,11 @@ for env in [test_env, client_env, env]:
|
|||
# #
|
||||
|
||||
debug_flags = env["opt"]+"-DDEBUG -ggdb3"
|
||||
if "mingw" in env["TOOLS"]:
|
||||
debug_flags += " -Wa,-mbig-obj"
|
||||
debug_flags = Split(debug_flags)
|
||||
debug_flags.append("${ '-O3' if TARGET.name == 'gettext.o' else '' }") # workaround for "File too big" errors
|
||||
|
||||
glibcxx_debug_flags = ""
|
||||
if env["glibcxx_assertions"] == True:
|
||||
glibcxx_debug_flags = " ".join([glibcxx_debug_flags, "_GLIBCXX_ASSERTIONS"])
|
||||
if env["glibcxx_debug"] == True:
|
||||
glibcxx_debug_flags = " ".join([glibcxx_debug_flags, "_GLIBCXX_DEBUG", "_GLIBCXX_DEBUG_PEDANTIC"])
|
||||
glibcxx_debug_flags = "_GLIBCXX_DEBUG _GLIBCXX_DEBUG_PEDANTIC"
|
||||
else:
|
||||
glibcxx_debug_flags = ""
|
||||
|
||||
# #
|
||||
# End determining options for debug build
|
||||
|
@ -596,26 +537,6 @@ for env in [test_env, client_env, env]:
|
|||
rel_comp_flags = env["opt"]
|
||||
rel_link_flags = ""
|
||||
|
||||
# #
|
||||
# Add flags if using profiling
|
||||
# #
|
||||
|
||||
if env["profiler"] == "gprof":
|
||||
rel_comp_flags += " -pg"
|
||||
rel_link_flags += " -pg"
|
||||
|
||||
if env["profiler"] == "gcov":
|
||||
rel_comp_flags += " --coverage"
|
||||
rel_link_flags += " --coverage"
|
||||
|
||||
if env["profiler"] == "gperftools":
|
||||
rel_comp_flags += ""
|
||||
rel_link_flags += " -Wl,--no-as-needed,-lprofiler"
|
||||
|
||||
if env["profiler"] == "perf":
|
||||
rel_comp_flags += " -ggdb -fno-omit-frame-pointer"
|
||||
rel_link_flags += ""
|
||||
|
||||
# use the arch if provided, or if on Windows and no arch was passed in then default to pentiumpro
|
||||
# without setting to pentiumpro, compiling on Windows with 64-bit tdm-gcc and -O3 currently fails
|
||||
if env["arch"]:
|
||||
|
@ -624,40 +545,61 @@ for env in [test_env, client_env, env]:
|
|||
if env["PLATFORM"] == "win32" and not env["arch"]:
|
||||
env["arch"] = " -march=pentiumpro"
|
||||
|
||||
rel_comp_flags += env["arch"]
|
||||
rel_comp_flags = rel_comp_flags + env["arch"]
|
||||
|
||||
# PGO and LTO setup
|
||||
if "gcc" in env["CC"]:
|
||||
if env["pgo_data"] == "generate":
|
||||
rel_comp_flags += " -fprofile-generate=pgo_data/"
|
||||
rel_link_flags += " -fprofile-generate=pgo_data/"
|
||||
rel_comp_flags = rel_comp_flags + " -fprofile-generate=pgo_data/"
|
||||
rel_link_flags = "-fprofile-generate=pgo_data/"
|
||||
|
||||
if env["pgo_data"] == "use":
|
||||
rel_comp_flags += " -fprofile-correction -fprofile-use=pgo_data/"
|
||||
rel_link_flags += " -fprofile-correction -fprofile-use=pgo_data/"
|
||||
rel_comp_flags = rel_comp_flags + " -fprofile-correction -fprofile-use=pgo_data/"
|
||||
rel_link_flags = "-fprofile-correction -fprofile-use=pgo_data/"
|
||||
|
||||
if env["enable_lto"] == True:
|
||||
rel_comp_flags += " -flto=" + str(env["jobs"])
|
||||
rel_link_flags += rel_comp_flags + " -fuse-ld=gold -Wno-stringop-overflow"
|
||||
rel_comp_flags = rel_comp_flags + " -flto=" + str(env["jobs"])
|
||||
rel_link_flags = rel_comp_flags + " -fuse-ld=gold"
|
||||
elif "clang" in env["CXX"]:
|
||||
if env["pgo_data"] == "generate":
|
||||
rel_comp_flags += " -fprofile-instr-generate=pgo_data/wesnoth-%p.profraw"
|
||||
rel_link_flags += " -fprofile-instr-generate=pgo_data/wesnoth-%p.profraw"
|
||||
rel_comp_flags = rel_comp_flags + " -fprofile-instr-generate=pgo_data/wesnoth-%p.profraw"
|
||||
rel_link_flags = "-fprofile-instr-generate=pgo_data/wesnoth-%p.profraw"
|
||||
|
||||
if env["pgo_data"] == "use":
|
||||
rel_comp_flags += " -fprofile-instr-use=pgo_data/wesnoth.profdata"
|
||||
rel_link_flags += " -fprofile-instr-use=pgo_data/wesnoth.profdata"
|
||||
rel_comp_flags = rel_comp_flags + " -fprofile-instr-use=pgo_data/wesnoth.profdata"
|
||||
rel_link_flags = "-fprofile-instr-use=pgo_data/wesnoth.profdata"
|
||||
|
||||
if env["enable_lto"] == True:
|
||||
rel_comp_flags += " -flto=thin"
|
||||
rel_link_flags += rel_comp_flags + " -fuse-ld=lld"
|
||||
rel_comp_flags = rel_comp_flags + " -flto=thin"
|
||||
rel_link_flags = rel_comp_flags + " -fuse-ld=lld"
|
||||
|
||||
# Enable ASLR and NX bit support on mingw
|
||||
if "mingw" in env["TOOLS"]:
|
||||
rel_link_flags += " -Wl,--dynamicbase -Wl,--nxcompat"
|
||||
rel_link_flags += "-Wl,--dynamicbase -Wl,--nxcompat"
|
||||
|
||||
# #
|
||||
# End setting options for release build
|
||||
# Start setting options for profile build
|
||||
# #
|
||||
|
||||
if env["profiler"] == "gprof":
|
||||
prof_comp_flags = env["opt"]+"-pg"
|
||||
prof_link_flags = "-pg"
|
||||
|
||||
if env["profiler"] == "gcov":
|
||||
prof_comp_flags = env["opt"]+"-fprofile-arcs -ftest-coverage"
|
||||
prof_link_flags = "-fprofile-arcs"
|
||||
|
||||
if env["profiler"] == "gperftools":
|
||||
prof_comp_flags = env["opt"]
|
||||
prof_link_flags = "-Wl,--no-as-needed,-lprofiler"
|
||||
|
||||
if env["profiler"] == "perf":
|
||||
prof_comp_flags = env["opt"]+"-ggdb"
|
||||
prof_link_flags = ""
|
||||
|
||||
# #
|
||||
# End setting options for profile build
|
||||
# #
|
||||
|
||||
if env['internal_data']:
|
||||
|
@ -672,28 +614,21 @@ for env in [test_env, client_env, env]:
|
|||
env[d] = os.path.join(env["prefix"], env[d])
|
||||
|
||||
if env["PLATFORM"] == 'win32':
|
||||
env.Append(LIBS = ["wsock32", "crypt32", "iconv", "z", "shlwapi", "winmm", "ole32", "uuid"], CCFLAGS = ["-mthreads"], LINKFLAGS = ["-mthreads"], CPPDEFINES = ["_WIN32_WINNT=0x0A00"])
|
||||
env.Append(LIBS = ["wsock32", "iconv", "z", "shlwapi", "winmm", "ole32", "uuid"], CCFLAGS = ["-mthreads"], LINKFLAGS = ["-mthreads"], CPPDEFINES = ["_WIN32_WINNT=0x0601"])
|
||||
|
||||
if env["PLATFORM"] == 'darwin': # Mac OS X
|
||||
env.Append(FRAMEWORKS = "Cocoa") # Cocoa GUI
|
||||
env.Append(FRAMEWORKS = "Security") # commonCrypto (after OpenSSL replacement on Mac)
|
||||
env.Append(FRAMEWORKS = "IOKit") # IOKit
|
||||
env.Append(FRAMEWORKS = "CoreGraphics") # CoreGraphics
|
||||
|
||||
if env["PLATFORM"] == 'sunos':
|
||||
env.Append(LINKFLAGS = "-lsocket")
|
||||
|
||||
if not env['static_test']:
|
||||
test_env.Append(CPPDEFINES = "BOOST_TEST_DYN_LINK")
|
||||
|
||||
if env['autorevision']:
|
||||
try:
|
||||
if call(env.subst("utils/autorevision.sh -t h > $build_dir/revision.h"), shell=True) == 0:
|
||||
env["have_autorevision"] = True
|
||||
if not call(env.subst("cmp -s $build_dir/revision.h src/revision.h"), shell=True) == 0:
|
||||
call(env.subst("cp $build_dir/revision.h src/revision.h"), shell=True)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if call(env.subst("utils/autorevision.sh -t h > $build_dir/revision.h"), shell=True) == 0:
|
||||
env["have_autorevision"] = True
|
||||
if not call(env.subst("cmp -s $build_dir/revision.h src/revision.h"), shell=True) == 0:
|
||||
call(env.subst("cp $build_dir/revision.h src/revision.h"), shell=True)
|
||||
except:
|
||||
pass
|
||||
|
||||
Export(Split("env client_env test_env have_client_prereqs have_server_prereqs have_test_prereqs"))
|
||||
SConscript(dirs = Split("po doc packaging/windows packaging/systemd"))
|
||||
|
@ -701,7 +636,8 @@ SConscript(dirs = Split("po doc packaging/windows packaging/systemd"))
|
|||
binaries = Split("wesnoth wesnothd campaignd boost_unit_tests")
|
||||
builds = {
|
||||
"release" : dict(CCFLAGS = Split(rel_comp_flags) , LINKFLAGS = Split(rel_link_flags)),
|
||||
"debug" : dict(CCFLAGS = Split(debug_flags) , CPPDEFINES = Split(glibcxx_debug_flags))
|
||||
"debug" : dict(CCFLAGS = Split(debug_flags) , CPPDEFINES = Split(glibcxx_debug_flags)),
|
||||
"profile" : dict(CCFLAGS = Split(prof_comp_flags), LINKFLAGS = Split(prof_link_flags))
|
||||
}
|
||||
build = env["build"]
|
||||
|
||||
|
@ -715,6 +651,9 @@ if env["use_srcdir"] == True:
|
|||
else:
|
||||
build_dir = os.path.join("$build_dir", build)
|
||||
|
||||
if build == "release" : build_suffix = ""
|
||||
else : build_suffix = "-" + build
|
||||
Export("build_suffix")
|
||||
env.SConscript("src/SConscript", variant_dir = build_dir, duplicate = False)
|
||||
Import(binaries + ["sources"])
|
||||
binary_nodes = [eval(binary) for binary in binaries]
|
||||
|
@ -743,7 +682,7 @@ env.Clean(all, 'TAGS')
|
|||
# Unix installation productions
|
||||
#
|
||||
# These will not be portable to Windows or Mac. They assume a Unix-like
|
||||
# directory structure and FreeDesktop standard locations for icon, app,
|
||||
# directory structure and FreeDesktop standard locations foicon, app,
|
||||
# and doc files.
|
||||
#
|
||||
|
||||
|
@ -756,7 +695,7 @@ else:
|
|||
env["localedir"] = "$datadir/$localedirname"
|
||||
|
||||
pythontools = Split("wmlscope wmllint wmlindent wesnoth_addon_manager")
|
||||
pythonmodules = Split("wmltools3.py wmlparser.py wmlparser3.py wmldata.py wmliterator3.py campaignserver_client.py __init__.py")
|
||||
pythonmodules = Split("wmltools.py wmlparser.py wmldata.py wmliterator.py campaignserver_client.py __init__.py")
|
||||
|
||||
def CopyFilter(fn):
|
||||
"Filter out data-tree things that shouldn't be installed."
|
||||
|
@ -764,18 +703,13 @@ def CopyFilter(fn):
|
|||
|
||||
env["copy_filter"] = CopyFilter
|
||||
|
||||
def MoFileFilter(fn):
|
||||
"Don't install .mo files for manual and manpages. They're built only to catch broken po files"
|
||||
return not "wesnoth-manual.mo" in str(fn) and not "wesnoth-manpages.mo" in str(fn)
|
||||
|
||||
linguas = Split(File("po/LINGUAS").get_contents().decode("utf-8"))
|
||||
|
||||
def InstallManpages(env, component):
|
||||
env.InstallData("mandir", component, os.path.join("doc", "man", component + ".6"), "man6")
|
||||
for lingua in linguas:
|
||||
manpage = FindFile(os.path.join(lingua, component + ".6"), "doc/man")
|
||||
if manpage:
|
||||
env.InstallData("mandir", component, manpage, os.path.join(lingua, "man6"))
|
||||
manpage = os.path.join("doc", "man", lingua, component + ".6")
|
||||
env.InstallData("mandir", component, manpage, os.path.join(lingua, "man6"))
|
||||
|
||||
# Now the actual installation productions
|
||||
|
||||
|
@ -784,13 +718,14 @@ env.InstallBinary(wesnoth)
|
|||
env.InstallData("datadir", "wesnoth", [Dir(sub) for sub in installable_subs])
|
||||
env.InstallData("docdir", "wesnoth", [Glob("doc/manual/*.html"), Dir("doc/manual/styles"), Dir("doc/manual/images")])
|
||||
if env["nls"]:
|
||||
env.InstallData("localedir", "wesnoth", Dir("translations"), copy_filter = MoFileFilter)
|
||||
env.InstallData("localedir", "wesnoth", Dir("translations"))
|
||||
env.InstallData("datadir", "wesnoth", "l10n-track")
|
||||
InstallManpages(env, "wesnoth")
|
||||
if have_client_prereqs and have_X and env["desktop_entry"]:
|
||||
env.InstallData("icondir", "wesnoth", "packaging/icons")
|
||||
env.InstallData("desktopdir", "wesnoth", "packaging/org.wesnoth.Wesnoth.desktop")
|
||||
env.InstallData("desktopdir", "wesnoth", "packaging/wesnoth.desktop")
|
||||
if have_client_prereqs and "linux" in sys.platform and env["appdata_file"]:
|
||||
env.InstallData("appdatadir", "wesnoth", "packaging/org.wesnoth.Wesnoth.appdata.xml")
|
||||
env.InstallData("appdatadir", "wesnoth", "packaging/wesnoth.appdata.xml")
|
||||
|
||||
# Python tools
|
||||
env.InstallData("bindir", "pytools", [os.path.join("data", "tools", tool) for tool in pythontools])
|
||||
|
@ -810,8 +745,7 @@ if not access(fifodir, F_OK):
|
|||
env.Alias("install-wesnothd", fifodir)
|
||||
if env["systemd"]:
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.service", "lib/systemd/system")
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.tmpfiles.conf", "lib/tmpfiles.d")
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.sysusers.conf", "lib/sysusers.d")
|
||||
env.InstallData("prefix", "wesnothd", "#packaging/systemd/wesnothd.conf", "lib/tmpfiles.d")
|
||||
|
||||
# Wesnoth campaign server
|
||||
env.InstallBinary(campaignd)
|
||||
|
@ -820,7 +754,7 @@ env.InstallBinary(campaignd)
|
|||
install = env.Alias('install', [])
|
||||
for installable in ('wesnoth',
|
||||
'wesnothd', 'campaignd'):
|
||||
if os.path.exists(installable) or installable in COMMAND_LINE_TARGETS or "all" in COMMAND_LINE_TARGETS:
|
||||
if os.path.exists(installable + build_suffix) or installable in COMMAND_LINE_TARGETS or "all" in COMMAND_LINE_TARGETS:
|
||||
env.Alias('install', env.Alias('install-'+installable))
|
||||
|
||||
#
|
||||
|
|
15
TRAVIS.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
To create the base image with Wesnoth's dependencies:
|
||||
|
||||
docker build -t wesnoth:16.04 -f docker/Dockerfile-base docker
|
||||
|
||||
To create the image that travis will run during a build:
|
||||
|
||||
docker build -t wesnoth-repo:16.04 -f docker/Dockerfile-travis .
|
||||
|
||||
To push a new base image to Docker Hub
|
||||
|
||||
docker login
|
||||
Username: wesnoth
|
||||
|
||||
docker tag <Image ID from `docker images`> wesnoth/wesnoth:16.04
|
||||
docker push wesnoth/wesnoth:16.04
|
332
add_source_file
|
@ -1,332 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# encoding: utf-8
|
||||
|
||||
# known issues:
|
||||
# xcode - if a file already exists in 'wesnoth' target, then it incorrectly thinks it also exists in the 'tests' target even though the tests build will fail
|
||||
|
||||
"""
|
||||
Add files to the specified build targets, supporting
|
||||
CMake, SCons, Xcode and the Code::Blocks projects.
|
||||
|
||||
Valid build targets are:
|
||||
* "wesnoth" - the main game (default if no target is specified)
|
||||
* "wesnothd" - the wesnoth server
|
||||
* "campaignd"
|
||||
* "lua"
|
||||
* "tests" - boost unit tests
|
||||
|
||||
The files will be added to:
|
||||
* the lists used by CMake and SCons in "source_lists"
|
||||
* the Xcode project
|
||||
* The Code::Blocks project
|
||||
|
||||
This only supports files inside the "src" directory.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import inspect
|
||||
import pathlib
|
||||
|
||||
try:
|
||||
import pbxproj
|
||||
except:
|
||||
print('\n'.join((
|
||||
'This script requires the "pbxproj" module.',
|
||||
'Install it using "pip install pbxproj"',
|
||||
'optionally setting up a python3-venv first.',
|
||||
)))
|
||||
exit(1)
|
||||
|
||||
#=========#
|
||||
# Globals #
|
||||
#=========#
|
||||
|
||||
# Either the executable directory or the current working directory
|
||||
# should be the wesnoth root directory
|
||||
rootdir = pathlib.Path(inspect.getsourcefile(lambda:0))
|
||||
if not rootdir.joinpath("projectfiles").exists():
|
||||
rootdir = pathlib.Path()
|
||||
if not rootdir.joinpath("projectfiles").exists():
|
||||
raise Exception("Could not find project file directory")
|
||||
|
||||
# the names of the targets in the Xcode project
|
||||
xcode_target_translations = {
|
||||
"wesnoth": ["The Battle for Wesnoth", "unit_tests"],
|
||||
"wesnothd": ["wesnothd"],
|
||||
"campaignd": ["campaignd"],
|
||||
"lua": ["liblua"],
|
||||
"tests": ["unit_tests"],
|
||||
}
|
||||
|
||||
# the names of the targets in source_lists
|
||||
source_list_target_translations = {
|
||||
"wesnoth": "wesnoth",
|
||||
"wesnothd": "wesnothd",
|
||||
"campaignd": "campaignd",
|
||||
"lua": "lua",
|
||||
"tests": "boost_unit_tests",
|
||||
}
|
||||
|
||||
# the names of the targets in Code::Blocks
|
||||
code_blocks_target_translations = {
|
||||
"wesnoth": "wesnoth",
|
||||
"wesnothd": "wesnothd",
|
||||
"campaignd": "campaignd",
|
||||
"lua": "liblua",
|
||||
"tests": "tests",
|
||||
}
|
||||
|
||||
#=======#
|
||||
# XCode #
|
||||
#=======#
|
||||
|
||||
def modify_xcode(filename, targets, remove):
|
||||
"""Add the given file to the specified targets.
|
||||
"""
|
||||
projectfile = rootdir.joinpath(
|
||||
"projectfiles",
|
||||
"Xcode",
|
||||
"The Battle for Wesnoth.xcodeproj",
|
||||
"project.pbxproj",
|
||||
)
|
||||
|
||||
project = pbxproj.XcodeProject.load(projectfile)
|
||||
|
||||
translated_targets = [item for t in targets for item in xcode_target_translations[t]]
|
||||
translated_targets = list(set(translated_targets))
|
||||
print(" xcode targets:", translated_targets)
|
||||
|
||||
for tname in translated_targets:
|
||||
if not project.get_target_by_name(tname):
|
||||
raise Exception(
|
||||
f"Could not find target '{tname}' in Xcode project file")
|
||||
|
||||
# groups are organized by directory structure under "src"
|
||||
# except for tests, which have a separate root, "tests"
|
||||
if pathlib.Path("tests") in filename.parents:
|
||||
src_groups = project.get_groups_by_name("tests")
|
||||
else:
|
||||
src_groups = project.get_groups_by_name("src")
|
||||
if len(src_groups) != 1:
|
||||
raise Exception("problem finding 'src' group in xcode project")
|
||||
src_group = src_groups[0]
|
||||
parent_group = src_group
|
||||
for d in filename.parts[:-1]:
|
||||
if d == "tests":
|
||||
continue
|
||||
found_groups = project.get_groups_by_name(d, parent=parent_group)
|
||||
if len(found_groups) != 1:
|
||||
groupname = parent_group.get_name()
|
||||
raise Exception(f"problem finding '{d}' group in '{groupname}'")
|
||||
parent_group = found_groups[0]
|
||||
|
||||
if remove :
|
||||
# Remove from all targets if we want to remove
|
||||
for file in project.get_files_by_name(filename.name, parent=parent_group):
|
||||
project.remove_file_by_id(file.get_id())
|
||||
else:
|
||||
# if the group already has an entry with the same filename, loudly skip.
|
||||
# note: this doesn't allow adding to targets one at a time.
|
||||
# a new file should be added to all targets at once...
|
||||
# or maybe targets could be checked somehow,
|
||||
# or maybe the file could simply be completely removed and readded.
|
||||
if project.get_files_by_name(filename.name, parent=parent_group):
|
||||
print(" '"+filename.name+"' already found in Xcode project '"+",".join(translated_targets)+"', skipping")
|
||||
return
|
||||
|
||||
# force is True here because otherwise a duplicate filename in
|
||||
# a different place will block addition of the new file.
|
||||
# the rest is just to match existing project file structure.
|
||||
project.add_file(filename.name,
|
||||
force=True,
|
||||
tree="<group>",
|
||||
parent=parent_group,
|
||||
target_name=translated_targets,
|
||||
)
|
||||
|
||||
# that's done, save the file
|
||||
project.save()
|
||||
return
|
||||
|
||||
#==============#
|
||||
# source_lists #
|
||||
#==============#
|
||||
|
||||
def modify_source_list(filename, source_list, remove):
|
||||
source_list_file = rootdir.joinpath("source_lists", source_list)
|
||||
sl_lines = open(source_list_file).readlines()
|
||||
file_line = filename.as_posix() + '\n'
|
||||
|
||||
# we only need source files in the source_lists, not header files
|
||||
if filename.suffix != ".cpp":
|
||||
return
|
||||
|
||||
if remove:
|
||||
if file_line in sl_lines: sl_lines.remove(file_line)
|
||||
else:
|
||||
# if the target already has an entry with the same filename, loudly skip
|
||||
if file_line in sl_lines:
|
||||
print(f" '{filename}' already found in '{source_list}', skipping")
|
||||
return
|
||||
|
||||
sl_lines.append(file_line)
|
||||
|
||||
sl_lines.sort()
|
||||
open(source_list_file, 'w').writelines(sl_lines)
|
||||
|
||||
def add_to_source_lists(filename, targets):
|
||||
translated_targets = [source_list_target_translations[t] for t in targets]
|
||||
print(" source_list targets:", translated_targets)
|
||||
for t in translated_targets:
|
||||
modify_source_list(filename, t, False)
|
||||
|
||||
def remove_from_source_lists(filename):
|
||||
# remove from all tagerts if -r was specified.
|
||||
for t in source_list_target_translations.values():
|
||||
modify_source_list(filename, t, True)
|
||||
|
||||
#==============#
|
||||
# Code::Blocks #
|
||||
#==============#
|
||||
|
||||
def modify_code_blocks_target(filename, target, remove):
|
||||
cbp_file = rootdir.joinpath(
|
||||
"projectfiles",
|
||||
"CodeBlocks",
|
||||
f"{target}.cbp",
|
||||
)
|
||||
cbp_lines = open(cbp_file).readlines()
|
||||
|
||||
filename_for_cbp = pathlib.PurePath(
|
||||
"..", "..", "src", filename
|
||||
).as_posix()
|
||||
|
||||
elem = f"\t\t<Unit filename=\"{filename_for_cbp}\" />\n"
|
||||
|
||||
if remove:
|
||||
if elem in cbp_lines: cbp_lines.remove(elem)
|
||||
else:
|
||||
# if the target already has an entry with the same filename, loudly skip
|
||||
if elem in cbp_lines:
|
||||
print(f" '{filename}' already found in '{target}.cbp', skipping")
|
||||
return
|
||||
|
||||
# find an appropriate line to add before/after
|
||||
index = 0
|
||||
for line in cbp_lines:
|
||||
if line.startswith("\t\t<Unit "):
|
||||
if elem < line:
|
||||
break
|
||||
elif line.startswith("\t\t<Extensions>"):
|
||||
# we must be the last entry, as this comes after the Unit section
|
||||
break
|
||||
index += 1
|
||||
cbp_lines.insert(index, elem)
|
||||
|
||||
open(cbp_file, 'w').writelines(cbp_lines)
|
||||
|
||||
def modify_code_blocks(filename, targets, remove):
|
||||
translated_targets = code_blocks_target_translations.values() if remove else [code_blocks_target_translations[t] for t in targets]
|
||||
print(" code::blocks targets:", translated_targets)
|
||||
for t in translated_targets:
|
||||
modify_code_blocks_target(filename, t, remove)
|
||||
|
||||
def sanity_check_existing_cpp_hpp(filenames):
|
||||
"""
|
||||
If we're adding a .cpp file, check whether a .hpp should be added too, etc.
|
||||
Only the files named on the command line are added, this exits if the check fails.
|
||||
"""
|
||||
any_check_failed = False
|
||||
for filename in filenames:
|
||||
if filenames.count(filename) > 1:
|
||||
print(f"ERROR: File '{filename}' given multiple times")
|
||||
any_check_failed = True
|
||||
|
||||
if not rootdir.joinpath("src", filename).exists():
|
||||
print(f"WARN: File '{filename}' does not exist")
|
||||
any_check_failed = True
|
||||
|
||||
spouse = None
|
||||
if filename.suffix == ".cpp":
|
||||
spouse = filename.with_suffix(".hpp")
|
||||
elif filename.suffix == ".hpp":
|
||||
spouse = filename.with_suffix(".cpp")
|
||||
|
||||
if rootdir.joinpath("src", spouse).exists() and not filenames.count(spouse):
|
||||
print(f"WARN: Requested to add '{filename}', should '{spouse}' be added too?")
|
||||
any_check_failed = True
|
||||
|
||||
if any_check_failed:
|
||||
break
|
||||
|
||||
if any_check_failed:
|
||||
print("ERROR: Not making changes, as checks failed and --no-checks option was not used.")
|
||||
exit(1)
|
||||
|
||||
def canonicalise_filenames(original_filenames):
|
||||
"""
|
||||
The script supports giving the filenames with or without the "src/" prefix.
|
||||
|
||||
Strip the "src/" if present, functions that need it will add it again later.
|
||||
"""
|
||||
filenames = []
|
||||
|
||||
# If src/src/ exists, the filenames become ambiguous. No need to support that.
|
||||
if rootdir.joinpath("src", "src").exists():
|
||||
print("Please don't add a file or directory called src/src.")
|
||||
exit(1)
|
||||
|
||||
for filename in options.filename:
|
||||
filename = pathlib.PurePath(filename)
|
||||
parts = filename.parts
|
||||
if parts[0] == "src":
|
||||
filename = pathlib.PurePath(*parts[1:])
|
||||
else:
|
||||
filename = pathlib.PurePath(*parts)
|
||||
filenames.append(filename)
|
||||
|
||||
return filenames
|
||||
|
||||
#======#
|
||||
# main #
|
||||
#======#
|
||||
|
||||
if __name__ == "__main__":
|
||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
# a file argument is mandatory
|
||||
ap.add_argument("filename", action="store", nargs="+",
|
||||
help="the .cpp and .hpp files to add")
|
||||
ap.add_argument("--target", action="store", nargs=1,
|
||||
default=["wesnoth"],
|
||||
help="which build targets to add the file to")
|
||||
ap.add_argument("--no-checks", action="store_true",
|
||||
help="do not check whether the files exist, etc")
|
||||
ap.add_argument("-r", "--remove", action="store_true",
|
||||
help="remove the specified files from projectfiles instead of adding them, --target is then ignored")
|
||||
# By default, recognise --help too
|
||||
options = ap.parse_args()
|
||||
|
||||
# Bail out if someone uses the old syntax of "add_source_file src/foo.cpp campaignd"
|
||||
if not options.no_checks:
|
||||
if len(options.filename) == 2 and not options.filename[1].count('.'):
|
||||
print("The usage has changed, targets now need to be given using --target name")
|
||||
exit(1)
|
||||
|
||||
# Convert the names to pathlib.PurePath objects without leading "src/"
|
||||
filenames = canonicalise_filenames(options.filename)
|
||||
|
||||
if not options.no_checks:
|
||||
sanity_check_existing_cpp_hpp(filenames)
|
||||
|
||||
for filename in filenames:
|
||||
if options.remove:
|
||||
print(f"removing '{filename}' from all targets")
|
||||
modify_xcode(filename, options.target, True)
|
||||
remove_from_source_lists(filename)
|
||||
modify_code_blocks(filename, options.target, True)
|
||||
else:
|
||||
print(f"adding '{filename}' to targets: {options.target}")
|
||||
modify_xcode(filename, options.target, False)
|
||||
add_to_source_lists(filename, options.target)
|
||||
modify_code_blocks(filename, options.target, False)
|
|
@ -2,29 +2,23 @@ This directory contains old art and resources not currently used anywhere in
|
|||
the game. It should not ship with the distribution tarball.
|
||||
Some notes on specific images and image groups follow:
|
||||
|
||||
scepter_of_fire.png:
|
||||
Old story image of the Scepter, quite large.
|
||||
|
||||
units/thain.png,units/thain2.png:
|
||||
Originally from SoF. 1.3-sized.
|
||||
|
||||
desert-elvish-druid-statue.png, desert-elvish-shyde-statue:
|
||||
Used in older versions of UtBS. 1.3-sized.
|
||||
|
||||
keratur.png:
|
||||
The original image for the uncloaked assassin in UtBS. 1.3-sized.
|
||||
|
||||
spider-lich.png:
|
||||
Old unit image from UtBS.
|
||||
|
||||
clasher-attack-mace.png
|
||||
Orphaned when the Drake Clasher lost this attack.
|
||||
|
||||
keratur.png
|
||||
The original image for the uncloaked assassin in UtBS. 1.3-sized.
|
||||
|
||||
perrin.png
|
||||
Originally from THoT. No longer used, removed for GitHub #6602.
|
||||
|
||||
ratheln.png
|
||||
Originally from THoT. No longer used, removed in GitHub #6593.
|
||||
|
||||
righteous-flame-icon.png
|
||||
Originally from THoT. No longer used, removed for GitHub #6602.
|
||||
|
||||
scepter_of_fire.png
|
||||
Old story image of the Scepter, quite large.
|
||||
|
||||
spider-lich.png
|
||||
Old unit image from UtBS.
|
||||
|
||||
thain.png,thain2.png
|
||||
Originally from SoF. 1.3-sized.
|
||||
|
||||
units/fire-dragon-flying-*.png
|
||||
Jetryl plans to finish these. See FR #11041.
|
||||
|
|
BIN
attic/abyss2.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
attic/abyssbridge2.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
attic/bar-energy-tinygui.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
attic/botleft-corner.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
attic/botright-corner.png
Normal file
After Width: | Height: | Size: 175 B |
Before Width: | Height: | Size: 428 B After Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
attic/compass-north.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
attic/compass-south.png
Normal file
After Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
BIN
attic/desert-elvish-druid-statue.png
Normal file
After Width: | Height: | Size: 691 B |
BIN
attic/desert-elvish-shyde-statue.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
attic/disk.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
attic/football-shadow.png
Normal file
After Width: | Height: | Size: 601 B |
BIN
attic/football.png
Normal file
After Width: | Height: | Size: 419 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 799 B After Width: | Height: | Size: 678 B |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
BIN
attic/missing-image-trans.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 160 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
BIN
attic/perrin.png
Before Width: | Height: | Size: 164 KiB |
Before Width: | Height: | Size: 214 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1,014 B |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 677 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 646 B After Width: | Height: | Size: 508 B |
Before Width: | Height: | Size: 914 B After Width: | Height: | Size: 776 B |
Before Width: | Height: | Size: 953 B After Width: | Height: | Size: 815 B |
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 973 B After Width: | Height: | Size: 835 B |
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 953 B |
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 535 B |