Skip to content

Commit

Permalink
Merge pull request #723 from TheJJ/searchpaths
Browse files Browse the repository at this point in the history
Installation improvements
  • Loading branch information
TheJJ committed Mar 21, 2017
2 parents db976c0 + cd5fb3e commit bb4b53e
Show file tree
Hide file tree
Showing 254 changed files with 9,190 additions and 3,943 deletions.
28 changes: 23 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2013-2017 the openage authors. See copying.md for legal info.

cmake_minimum_required(VERSION 3.1.0)
# required for CMAKE_CXX_STANDARD

Expand Down Expand Up @@ -60,9 +62,15 @@ if(NOT DEFINED WANT_GPERFTOOLS_TCMALLOC)
set(WANT_GPERFTOOLS_TCMALLOC false)
endif()

# option processing is now done.


# add search paths to helper modules
set(BUILDSYSTEM_DIR "${CMAKE_SOURCE_DIR}/buildsystem")
set(CMAKE_MODULE_PATH "${BUILDSYSTEM_DIR}" "${BUILDSYSTEM_DIR}/modules/")

# load helper modules
include(GNUInstallDirs)
include(CheckInSourceBuild)
include(HandleCXXOptions)
include(CheckCompilerFeatures)
Expand All @@ -73,12 +81,13 @@ include(DetectProjectVersion)
# include build configuration modules
include(CTest)

include(util)
include(cpp)
include(python)
# initialize language support
include(codegen)
include(version)
include(cpp)
include(doxygen)
include(options)
include(python)
include(util)


# now that all modules and settings are loaded,
Expand All @@ -87,13 +96,22 @@ include(doxygen)
# create documentation
doxygen_configure(libopenage/ openage/)

# static content
set(INSTALLED_GLOBAL_ASSET_DIR "${CMAKE_INSTALL_PREFIX}/share/openage")
set(INSTALLED_GLOBAL_CONFIG_DIR "/etc/openage")
add_subdirectory(assets/)
add_subdirectory(dist/)
add_subdirectory(cfg/)

# C++ content
add_subdirectory(libopenage/)

# Python content (uses the C++ library)
set(PYEXT_LINK_LIBRARY libopenage)
set(PYEXT_CXXFLAGS "${PYEXT_CXXFLAGS} -include \"${CMAKE_SOURCE_DIR}/libopenage/pyinterface/hacks.h\"")
add_cython_modules(EMBED NOINSTALL run.py)
add_py_modules(BININSTALL run.py AS openage)
add_subdirectory(openage/)
add_subdirectory(dist/)

python_finalize()

Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ tests: build
build: $(BUILDDIR)
@$(MAKE) $(MAKEARGS) -C $(BUILDDIR)

.PHONY: ninja
ninja: $(BUILDDIR)
@ninja -C $(BUILDDIR)

.PHONY: libopenage
libopenage: $(BUILDDIR)
@$(MAKE) $(MAKEARGS) -C $(BUILDDIR) libopenage
Expand Down Expand Up @@ -133,6 +137,10 @@ checkchanged:
checkuncommited:
python3 -m buildsystem.codecompliance --all --only-changed-files=HEAD

.PHONY: checkpy
checkpy:
python3 -m buildsystem.codecompliance --pystyle --pylint

.PHONY: help
help: $(BUILDDIR)/Makefile
@echo "openage Makefile"
Expand Down Expand Up @@ -167,6 +175,7 @@ help: $(BUILDDIR)/Makefile
@echo "checkfast -> fast checks only"
@echo "checkchanged -> full check for all files changed since origin/master"
@echo "checkuncommited -> full check for all currently uncommited files"
@echo "checkpy -> check python compliance"
@echo ""
@echo "test -> tests + checkfast. this is what you should use for regular devbuilds"
@echo ""
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ comparable in its goals to projects like [OpenMW](https://openmw.org/), [OpenRA]

openage uses the original game assets (such as sounds and graphics), but (for obvious reasons) doesn't ship them.
To play, you require *an original AoE II : TC installation or [AoE II: HD](http://store.steampowered.com/app/221380/)*
([Wine](https://www.winehq.org/) is your friend; in the near future, setup discs will be supported).
(installation via [Wine](https://www.winehq.org/) or [Steam-Linux](doc/media_convert.md#how-to-use-the-original-game-assets)).

[![github stars](https://img.shields.io/github/stars/SFTtech/openage.svg)](https://github.com/SFTtech/openage/stargazers)
[![#sfttech on Freenode](https://img.shields.io/Freenode/%23sfttech.png)](https://webchat.freenode.net/?channels=sfttech)
Expand Down
23 changes: 16 additions & 7 deletions assets/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# Copyright 2014-2015 the openage authors. See copying.md for legal info.
# Copyright 2014-2017 the openage authors. See copying.md for legal info.

set(GLOBAL_ASSET_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(INSTALLED_GLOBAL_ASSET_DIR "${CMAKE_INSTALL_PREFIX}/share/openage")
add_subdirectory(logo/)
add_subdirectory(shaders/)
add_subdirectory(textures/)

install(DIRECTORY "${GLOBAL_ASSET_DIR}/"

install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/missing.png"
"${CMAKE_CURRENT_SOURCE_DIR}/gaben.png"
DESTINATION "${INSTALLED_GLOBAL_ASSET_DIR}"
)

install(DIRECTORY "qml"
DESTINATION "${INSTALLED_GLOBAL_ASSET_DIR}"
PATTERN .gitignore EXCLUDE)
)

set(GLOBAL_ASSET_DIR "${GLOBAL_ASSET_DIR}" PARENT_SCOPE)
set(INSTALLED_GLOBAL_ASSET_DIR "${INSTALLED_GLOBAL_ASSET_DIR}" PARENT_SCOPE)
# To show QML files in the QtCreator.
file(GLOB QML_SRC "qml/*.qml")
add_custom_target(qtcreator-show-qml SOURCES ${QML_SRC})
10 changes: 10 additions & 0 deletions assets/logo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
install(
FILES "crown.svg"
RENAME "openage.svg"
DESTINATION "share/pixmaps/"
)

install(
FILES "banner.svg"
DESTINATION "${INSTALLED_GLOBAL_ASSET_DIR}/"
)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2016 the openage authors. See copying.md for legal info.
// Copyright 2016-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4
import QtQuick.Controls 1.1
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2016 the openage authors. See copying.md for legal info.
// Copyright 2015-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4
import QtQuick.Controls 1.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2016 the openage authors. See copying.md for legal info.
// Copyright 2015-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4
import QtQuick.Controls 1.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2016 the openage authors. See copying.md for legal info.
// Copyright 2015-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4
import QtQuick.Controls 1.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2016 the openage authors. See copying.md for legal info.
// Copyright 2015-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4
import QtQuick.Controls 1.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2016 the openage authors. See copying.md for legal info.
// Copyright 2015-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4
import QtQuick.Controls 1.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2016 the openage authors. See copying.md for legal info.
// Copyright 2015-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4
import QtQuick.Controls 1.1
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libopenage/gui/qml/Paper.qml → assets/qml/Paper.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2016 the openage authors. See copying.md for legal info.
// Copyright 2015-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2016 the openage authors. See copying.md for legal info.
// Copyright 2015-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4
import QtQuick.Controls 1.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright 2015-2016 the openage authors. See copying.md for legal info.
// Copyright 2015-2017 the openage authors. See copying.md for legal info.

import QtQuick 2.4
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.3

TextFieldStyle {
textColor: "white"

background: Rectangle {
color: "transparent"

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion libopenage/gui/qml/main.qml → assets/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Item {
OA.AssetManager {
id: amObj

dataDir: OA.MainArgs.dataDir
assetDir: OA.MainArgs.assetDir

engine: OA.Engine

Expand Down
4 changes: 4 additions & 0 deletions assets/shaders/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install(DIRECTORY "./"
DESTINATION "${INSTALLED_GLOBAL_ASSET_DIR}/shaders"
FILES_MATCHING PATTERN "*.glsl"
)
4 changes: 4 additions & 0 deletions assets/textures/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install(DIRECTORY "./"
DESTINATION "${INSTALLED_GLOBAL_ASSET_DIR}/textures"
PATTERN "CMakeLists.txt" EXCLUDE
)
12 changes: 11 additions & 1 deletion buildsystem/CheckRuntimeDependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015-2016 the openage authors. See copying.md for legal info.
# Copyright 2015-2017 the openage authors. See copying.md for legal info.

# python modules
# a list of imported modules may be obtained via
Expand Down Expand Up @@ -30,23 +30,33 @@ endfunction()

# loop through all required python modules to find them
foreach(_PYTHON_MODULE ${REQUIRED_PYTHON_MODULES})
if("${PY_MOD_${_PYTHON_MODULE}_EXISTS}" STREQUAL "FOUND")
continue()
endif()

check_python_module_exists(${_PYTHON_MODULE} EXISTS)

if(EXISTS)
message(STATUS "Checking python3 module ${_PYTHON_MODULE} - Success")
set(PY_MOD_${_PYTHON_MODULE}_EXISTS "FOUND" CACHE INTERNAL "Python module availability")
else()
message(FATAL_ERROR "Checking python3 module ${_PYTHON_MODULE} - Not Found")
endif()
endforeach()

# loop through all required utilities to find them
foreach(_UTILITY ${REQUIRED_UTILITIES})
if("${UTILITY_${_UTILITY}_EXISTS}" STREQUAL "FOUND")
continue()
endif()

find_program(${_UTILITY}_EXECUTABLE
NAMES "${_UTILITY}"
)

if(${_UTILITY}_EXECUTABLE)
message(STATUS "Checking utility program ${_UTILITY} - Success")
set(UTILITY_${_UTILITY}_EXISTS "FOUND" CACHE INTERNAL "Helper program availability")
else()
message(FATAL_ERROR "Checking utility program ${_UTILITY} - Not Found")
endif()
Expand Down
4 changes: 2 additions & 2 deletions buildsystem/HandleCXXOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015-2016 the openage authors. See copying.md for legal info.
# Copyright 2015-2017 the openage authors. See copying.md for legal info.

# sets CXXFLAGS and compiler for the project

Expand Down Expand Up @@ -116,7 +116,7 @@ elseif(${CXX_OPTIMIZATION_LEVEL} STREQUAL "g")
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set_cxx_optimize_flags("-Og")
else()
set_cxx_optimize_flags("-O1")
set_cxx_optimize_flags("-O0")
endif()
elseif(${CXX_OPTIMIZATION_LEVEL} STREQUAL "max")
set_cxx_optimize_flags("-O3 -march=native")
Expand Down
4 changes: 2 additions & 2 deletions buildsystem/HandlePythonOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015-2016 the openage authors. See copying.md for legal info.
# Copyright 2015-2017 the openage authors. See copying.md for legal info.

# finds the python interpreter, install destination and extension flags.

Expand Down Expand Up @@ -31,6 +31,6 @@ set(PYEXT_LIBRARY "${PYTHON_LIBRARY}")
set(PYEXT_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR};${NUMPY_INCLUDE_DIR}")

if(NOT CMAKE_PY_INSTALL_PREFIX)
py_exec("import site; print(site.getsitepackages()[0])" PREFIX)
py_exec("import site, os; print(os.path.normpath(site.getsitepackages()[0]))" PREFIX)
set(CMAKE_PY_INSTALL_PREFIX "${PREFIX}")
endif()
3 changes: 3 additions & 0 deletions buildsystem/check_py_file_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def main():
if filename.endswith('.py'):
actual.add(os.path.join(dirname, filename))

# the only non-buildsystem python file which is outside of openage/
actual.add(os.path.abspath("run.py"))

success = True
for filename in sorted(actual - listed):
success = False
Expand Down
Loading

0 comments on commit bb4b53e

Please sign in to comment.