Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'remotes/orbweaver/master'
  • Loading branch information
codereader committed Dec 15, 2020
2 parents 602c278 + a8a19be commit 279b924
Show file tree
Hide file tree
Showing 85 changed files with 984 additions and 13,586 deletions.
16 changes: 11 additions & 5 deletions .gitignore
@@ -1,13 +1,19 @@
# Linux build files
*.o
*.lo
*.la
Makefile
.libs
.deps
CMakeFiles
CMakeCache.txt
cmake_install.cmake
/config.h
/install_manifest.txt
/radiant/darkradiant
/install/darkradiant.desktop
*.o
*.so
*.a

# Editor temporary files
*.swp
tags

# Windows directories
w32deps
Expand Down
147 changes: 147 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,147 @@
cmake_minimum_required(VERSION 3.12)

# Project name and version
project(darkradiant VERSION 2.10.0)

# C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Expose some build options
option(ENABLE_DM_PLUGINS "Build Dark Mod specific plugins" ON)
option(ENABLE_RELOCATION
"Avoid hard-coded absolute paths to libraries or resources"
ON)

# Define GNU-style directory structure by default
include(GNUInstallDirs)

# Set up core build paths
set(CORE_MODULE_LIBRARY "libradiantcore")
set(PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/darkradiant")
set(PKGLIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}/darkradiant")
if (NOT ${ENABLE_RELOCATION})
set(HTMLDIR "${CMAKE_INSTALL_FULL_DATADIR}/doc/darkradiant")
endif()

# Build shared libraries by default
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
if (${ENABLE_RELOCATION})
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib/darkradiant")
else()
set(CMAKE_INSTALL_RPATH "${PKGLIBDIR}")
endif()

# Debug or release mode
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
add_compile_definitions(
$<$<CONFIG:Debug>:_DEBUG>
$<$<CONFIG:Release>:NDEBUG>
)

# Locate system packages
include(FindPkgConfig)
pkg_check_modules(XML libxml-2.0 REQUIRED)
pkg_check_modules(SIGC sigc++-2.0 REQUIRED)
pkg_check_modules(FTGL ftgl REQUIRED)
pkg_check_modules(FREETYPE freetype2 REQUIRED)
pkg_check_modules(XML libxml-2.0 REQUIRED)
pkg_check_modules(GL gl REQUIRED)
pkg_check_modules(GLEW glew REQUIRED)
pkg_check_modules(JPEG libjpeg REQUIRED)
pkg_check_modules(PNG libpng REQUIRED)
pkg_check_modules(AL openal REQUIRED)
pkg_check_modules(OGG ogg REQUIRED)
pkg_check_modules(VORBIS vorbisfile REQUIRED)
pkg_check_modules(X11 x11 REQUIRED)

# Locate wxWidgets
find_package(wxWidgets REQUIRED
COMPONENTS base core stc adv gl xrc)
include(${wxWidgets_USE_FILE})

# Locate Python
find_package(Python REQUIRED COMPONENTS Development)

# Global includes and flags
include_directories(libs libs/libfmt include)
add_compile_definitions(POSIX
WXINTL_NO_GETTEXT_MACRO
FMT_HEADER_ONLY
HAVE_STD_FILESYSTEM)
add_link_options(LINKER:-z,defs)

# Generate config.h
configure_file(config.h.in config.h)
add_compile_definitions(HAVE_CONFIG_H)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# Supporting libraries
add_subdirectory(libs/math)
add_subdirectory(libs/xmlutil)
add_subdirectory(libs/scene)
add_subdirectory(libs/wxutil)
add_subdirectory(libs/module)

# Mandatory modules
add_subdirectory(plugins/script)
add_subdirectory(plugins/sound)

# Dark Mod plugins
if (${ENABLE_DM_PLUGINS})
add_subdirectory(plugins/dm.stimresponse)
add_subdirectory(plugins/dm.objectives)
add_subdirectory(plugins/dm.difficulty)
add_subdirectory(plugins/dm.editing)
add_subdirectory(plugins/dm.gui)
add_subdirectory(plugins/dm.gameconnection)
endif()

# Main radiant components
add_subdirectory(radiantcore)
add_subdirectory(radiant)

# Tests
pkg_check_modules(GTEST gtest)
pkg_check_modules(GTEST_MAIN gtest_main)
if (${GTEST_FOUND} AND ${GTEST_MAIN_FOUND})
add_subdirectory(test)
endif()

# Install main targets
install(TARGETS darkradiant math xmlutil scenegraph wxutil
LIBRARY DESTINATION ${PKGLIBDIR})
install(TARGETS radiantcore script sound
LIBRARY DESTINATION ${PKGLIBDIR}/modules)

# Install Dark Mod plugins
if (${ENABLE_DM_PLUGINS})
install(TARGETS dm_stimresponse dm_objectives dm_difficulty dm_editing
dm_gui dm_gameconnection
LIBRARY DESTINATION ${PKGLIBDIR}/plugins)
endif()

# Generate and install the .desktop file
configure_file(install/darkradiant.desktop.in install/darkradiant.desktop)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/install/darkradiant.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)

# Install resources
file(GLOB XML_FILES "${PROJECT_SOURCE_DIR}/install/*.xml")
install(FILES ${XML_FILES} DESTINATION ${PKGDATADIR})

install(DIRECTORY install/games DESTINATION ${PKGDATADIR})
install(DIRECTORY install/bitmaps DESTINATION ${PKGDATADIR})
install(DIRECTORY install/gl DESTINATION ${PKGDATADIR})
install(DIRECTORY install/ui DESTINATION ${PKGDATADIR}
FILES_MATCHING PATTERN "*.ttf" PATTERN "*.xrc")

# Install locale data
install(DIRECTORY install/i18n/de TYPE LOCALE
FILES_MATCHING PATTERN "*.mo")

# Install scripts
install(DIRECTORY install/scripts DESTINATION ${PKGDATADIR}
FILES_MATCHING PATTERN "*.py")
41 changes: 0 additions & 41 deletions Makefile.am

This file was deleted.

21 changes: 13 additions & 8 deletions README.md
Expand Up @@ -44,7 +44,7 @@ placed into the `install/` folder.

## Prerequisites

To compile DarkRadiant, a number of libraries (with development headers) and a standards-compliant C++11 compiler (GCC 5.3+) are required. On an Ubuntu system, the requirements may include any or all of the following packages:
To compile DarkRadiant, a number of libraries (with development headers) and a standards-compliant C++17 compiler are required. On an Ubuntu system, the requirements may include any or all of the following packages:

* zlib1g-dev
* libjpeg62-dev
Expand All @@ -62,24 +62,29 @@ To compile DarkRadiant, a number of libraries (with development headers) and a s
This does not include core development tools such as g++ or the git client
to download the sources (use sudo apt-get install git for that). One possible set of packages might be:

`sudo apt-get install git automake libtool g++ gettext pkg-config`
`sudo apt-get install git cmake g++ gettext pkg-config`

More required package lists for various Linux distributions are [listed in the Wiki Article](https://wiki.thedarkmod.com/index.php?title=DarkRadiant_-_Compiling_in_Linux).

## Build

To build DarkRadiant the standard Autotools build process is used:
To build DarkRadiant the standard CMake build process is used:

```
./autogen.sh
./configure
cmake .
make
sudo make install
```

The available configure options are listed with `./configure --help`. There are
options for debug builds, and enabling or disabling various optional components
such as audio support and the Dark Mod-specific plugins (`--enable-darkmod-plugins`).
To install somewhere other than the default of `/usr/local`, use the `CMAKE_INSTALL_PREFIX` variable.

```
cmake -DCMAKE_INSTALL_PREFIX=/opt/darkradiant
make
sudo make install
```

Other useful variables are `CMAKE_BUILD_TYPE` to choose Debug or Release builds, `ENABLE_DM_PLUGINS` to disable the building of Dark Mod specific plugins (enabled by default), and `ENABLE_RELOCATION` to control whether DarkRadiant uses hard-coded absolute paths like `/usr/lib` or paths relative to the binary (useful for certain package formats like Snappy or FlatPak).

# Compiling on macOS

Expand Down
11 changes: 0 additions & 11 deletions autogen.sh

This file was deleted.

0 comments on commit 279b924

Please sign in to comment.