Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
Added dependency on Worlds through Conan.
Browse files Browse the repository at this point in the history
We also allow for developers to specify a specific installation path using WORLDFORGE_WORLDS_PATH cmake variable.
  • Loading branch information
erikogenvik committed Oct 30, 2023
1 parent d871319 commit 901d8c9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ if (BT_USE_DOUBLE_PRECISION)
add_definitions(-DBT_USE_DOUBLE_PRECISION=1)
endif ()

#You can specify an exernal installation of the Worlds though WORLDFORGE_WORLDS_PATH environment variable. If that's not specified,
#Worlds data will be installed as specified by the WORLDFORGE_WORLDS_SOURCE_PATH environment variable (which is set by Conan).
if (WORLDFORGE_WORLDS_PATH)
message(STATUS "An installation of the Worldforge Worlds has been specified through the WORLDFORGE_WORLDS_PATH environment variable: ${WORLDFORGE_WORLDS_PATH}.")
else ()
set(WORLDFORGE_WORLDS_PATH "${CMAKE_INSTALL_PREFIX}/share/cyphesis/worlds")

if (WORLDFORGE_WORLDS_SOURCE_PATH)
install(DIRECTORY ${WORLDFORGE_WORLDS_SOURCE_PATH}/ DESTINATION ${WORLDFORGE_WORLDS_PATH})
message(STATUS "Added installation of the Worldforge Worlds from '${WORLDFORGE_WORLDS_SOURCE_PATH}' to the 'install' target.")
else ()
message(STATUS "No Worldforge Worlds installation has been specified (through the WORLDFORGE_WORLDS_SOURCE_PATH environment variable); we will work on the assumption that there's an installation already at '${WORLDFORGE_WORLDS_PATH}'.")
endif ()
endif ()

#add_custom_target(assets-download)
#if (RSYNC_CMD)
Expand Down Expand Up @@ -151,7 +165,7 @@ macro(wf_generate_stubs DIRECTORY)
COMMAND ${CMAKE_COMMAND} -E echo "Generating stubs for ${FILE}\n"
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/scripts/generator/generate_stub.py ${FILE} ${STUB_DIRECTORY}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src
)
)

list(APPEND STUB_HEADERS ${STUB_FILE})
endforeach (FILE)
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ The simplest way to install all required dependencies is by using [Conan](https:

```bash
conan remote add worldforge https://artifactory.ogenvik.org/artifactory/api/conan/conan
mkdir cmake-build && cd cmake-build
conan install .. --output-folder=. --build=missing
cmake --preset conan-release .. -DCMAKE_INSTALL_PREFIX=../cmake-install
make -j all mediarepo-checkout install
conan install . --build missing
cmake --preset conan-release -DCMAKE_INSTALL_PREFIX=./build/install/release
cmake --build --preset conan-release -j --target all --target mediarepo-checkout --target install
```

Alternatively you can use the [Hammer](http://wiki.worldforge.org/wiki/Hammer_Script "The Hammer script") tool.
Expand Down
7 changes: 6 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMakeDeps, CMakeToolchain

Expand All @@ -19,6 +21,7 @@ def requirements(self):
self.requires("wfmath/1.0.3@worldforge")
self.requires("libxdg-basedir/1.2.3@worldforge")
self.requires("squall/0.1.0@worldforge")
self.requires("worldforge-worlds/0.1.0@worldforge")
self.requires("libsigcpp/3.0.7")
self.requires("libgcrypt/1.8.4")
self.requires("zlib/1.2.13")
Expand All @@ -36,7 +39,9 @@ def generate(self):
tc = CMakeToolchain(self)
tc.variables["PYTHON_IS_STATIC"] = "TRUE"
# The default CMake FindPython3 component will set the Python3_EXECUTABLE, which is then used in Cyphesis. Therefore do this here.
tc.variables["Python3_EXECUTABLE"] = self.dependencies["cpython"].package_folder + "/bin/python"
tc.variables["Python3_EXECUTABLE"] = os.path.join(self.dependencies["cpython"].package_folder, "bin/python")
tc.variables["WORLDFORGE_WORLDS_SOURCE_PATH"] = os.path.join(
self.dependencies["worldforge-worlds"].package_folder, "worlds")
tc.preprocessor_definitions["PYTHONHOME"] = "\"{}\"".format(self.dependencies["cpython"].package_folder)
tc.generate()

Expand Down
2 changes: 1 addition & 1 deletion tools/cyphesis.vconf.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ assetsdir="@CMAKE_INSTALL_PREFIX@/share/cyphesis/assets"
# Automatically import this world if the server is unpopulated.
# The default value relies on the content of the "Worldforge World" project
# being installed.
autoimport="@CMAKE_INSTALL_PREFIX@/share/worldforge/worlds/deeds/braga/world.xml"
autoimport="@WORLDFORGE_WORLDS_PATH@/deeds/braga/world.xml"

0 comments on commit 901d8c9

Please sign in to comment.