Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ endif()
string(REGEX REPLACE "^v" "" RAILCONTROL_VERSION "${RAILCONTROL_VERSION}")

project(railcontrol VERSION ${RAILCONTROL_VERSION})
include(GNUInstallDirs)

STRING(TIMESTAMP COMPILE_TIMESTAMP "%s" UTC)

Expand Down Expand Up @@ -393,14 +394,28 @@ add_custom_target(rebuild_version ALL COMMAND ${CMAKE_COMMAND} -E touch "${STAMP
set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/Version.cpp" PROPERTIES OBJECT_DEPENDS "${STAMP_FILE}")
add_dependencies(${PROJECT_NAME} rebuild_version)

# Option to install right into the source tree for development purposes
# Usage:
# $ cmake -B <build dir> -DINSTALL_IN_PLACE=1
# $ cmake --build <build dir> ...
# $ cmake --install <build dir>
#
# Default: Install to directories as defined by the GNUInstallDir module
option(INSTALL_IN_PLACE "Install into the source tree (For testing and development)" OFF)

if(INSTALL_IN_PLACE)
set(CMAKE_INSTALL_PREFIX .)
set(CMAKE_INSTALL_BINDIR .)
set(CMAKE_INSTALL_SYSCONFDIR .)
set(CMAKE_INSTALL_DOCDIR doc)
target_compile_definitions(railcontrol PRIVATE HTML_DATA_PATH=\"./html\")
else()
target_compile_definitions(railcontrol PRIVATE HTML_DATA_PATH=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/railcontrol/html\")
install(DIRECTORY html DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/railcontrol)
endif()

set(CMAKE_INSTALL_BINDIR ".")
set(CMAKE_INSTALL_DOCDIR "doc")
set(DATADIR ".")

install(TARGETS ${PROJECT_NAME})
install(FILES railcontrol.conf.dist DESTINATION ${DATADIR})
install(DIRECTORY html DESTINATION ${DATADIR})
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES railcontrol.conf.dist TYPE SYSCONF RENAME railcontrol.conf)

include(CPack)

Expand Down
33 changes: 33 additions & 0 deletions COMPILING-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,39 @@ Ein Update kann folgendermassen durchgeführt werden:
git pull
make
```
## Kompilieren mit cmake

cmake Unterstützung befindet sich noch in Entwicklung. Falls das Bauen mit cmake
nicht klappt, benutze GNU Make.

Konfiguriere das Bauen außerhalb der Quelltextverzeichnisse

```
cmake -B build
```

Kompilieren RailControl mittels

```
cmake --build build
```

Installiere RailControl (als root) mittels

```
cmake --install build
```

### cmake Entwickler-Modus

Um RailControl zu entwickeln, "installiere" RailControl in die Git Arbeitskopie.
Das Ergebnis ist ähnlich zum Bauen mit GNU Make.

```
cmake -B build -DINSTALL_IN_PLACE=1
cmake --build build
cmake --install build
```

# Kompilieren unter Mac OS X

Expand Down
34 changes: 34 additions & 0 deletions COMPILING-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,40 @@ git pull
make
```

## Compile with cmake

cmake support is work in progress. In case the cmake build fails on your system,
please build with GNU Make.

Configure the out-of-tree build directory

```
cmake -B build
```

Compile RailControl with

```
cmake --build build
```

Install RailControl (as root) with

```
cmake --install build
```

### cmake develper mode

To develop RailControl, "install" RailControl in the checked out working copy.
This is similar to building RailControl with GNU Make.

```
cmake -B build -DINSTALL_IN_PLACE=1
cmake --build build
cmake --install build
```

# Compile under Mac OS X

The required developer tools can be installed in a terminal with:
Expand Down
34 changes: 34 additions & 0 deletions COMPILING-es.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,40 @@ git pull
make
```

## TODO TRANSLATE Compile with cmake

cmake support is work in progress. In case the cmake build fails on your system,
please build with GNU Make.

Configure the out-of-tree build directory

```
cmake -B build
```

Compile RailControl with

```
cmake --build build
```

Install RailControl (as root) with

```
cmake --install build
```

### cmake develper mode

To develop RailControl, "install" RailControl in the checked out working copy.
This is similar to building RailControl with GNU Make.

```
cmake -B build -DINSTALL_IN_PLACE=1
cmake --build build
cmake --install build
```

# Compilar sobre Mac OS X

Se puede instalar las heremientas requerido con:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif

CFLAGSSQLITE=-g -O2 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DHAVE_USLEEP
CFLAGSZLIB=-g -O2 -Wno-implicit-function-declaration
CXXFLAGS=-I. -g -O2 -Wall -Wextra -pedantic -Werror -Wno-missing-braces -std=c++11 -D_GNU_SOURCE
CXXFLAGS=-I. -g -O2 -Wall -Wextra -pedantic -Werror -Wno-missing-braces -std=c++11 -D_GNU_SOURCE -DHTML_DATA_PATH=\"./html\"
CXXFLAGSAMALGAMATION=-I. -g -O2 -Wall -Wextra -pedantic -Werror -Wno-missing-braces -std=c++11
LDFLAGS=-g
LIBS=-lpthread -ldl
Expand Down
2 changes: 1 addition & 1 deletion Server/Web/WebClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ namespace Server { namespace Web
char workingDir[128];
if (getcwd(workingDir, sizeof(workingDir)))
{
ss << workingDir << "/html" << virtualFile;
ss << HTML_DATA_PATH << virtualFile;
}
string sFile = ss.str();
const char* realFile = sFile.c_str();
Expand Down
Loading