DATA: refactored the way the assets are installed

master
Martin Gerhardy 2018-06-19 20:20:37 +02:00
parent 210f8db1cd
commit 90a53d6179
107 changed files with 674 additions and 411 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.1)
project(engine VERSION "0.0.1")
project(vengi VERSION "0.0.1")
set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Root dir")
set(SCRIPTS_CMAKE_DIR ${PROJECT_SOURCE_DIR}/cmake)
set(GENERATE_DIR ${CMAKE_BINARY_DIR}/generated CACHE STRING "Generated code dir")
@ -149,5 +149,3 @@ if (DOXYGEN_FOUND)
DEPENDS codegen
)
endif(DOXYGEN_FOUND)
copy_data_files(shared)

View File

@ -28,25 +28,21 @@ Q ?= @
OS := $(shell uname)
LOCAL_CONFIG_DIR = ~/.local/share/engine
UPDATEDIR := /tmp
RUN_POSTFIX = -run
VALGRIND ?=
ifeq ($(VALGRIND),)
VALGRIND_OPTIONS ?=
VALGRIND_CMD ?=
else
VALGRIND_OPTIONS ?=
VALGRIND_CMD ?= valgrind $(VALGRIND_OPTIONS)
ifneq ($(VALGRIND),)
RUN_POSTFIX = -memcheck
endif
VOGL ?=
ifneq ($(VOGL),)
RUN_POSTFIX = -vogl
endif
PERF ?=
ifeq ($(PERF),)
PERF_OPTIONS ?=
PERF_CMD ?=
PERF_REPORT_CMD ?=
else
PERF_OPTIONS ?= --call-graph dwarf
#sudo sh -c 'echo -1 >/proc/sys/kernel/perf_event_paranoid'
PERF_CMD ?= perf record $(PERF_OPTIONS)
ifneq ($(PERF),)
RUN_POSTFIX = -perf
PERF_REPORT_CMD ?= perf report -g srcline -s dso,sym,srcline --inline -n --stdio
endif
@ -66,41 +62,10 @@ endif
CMAKE_OPTIONS ?=
GPROF ?=
GCOV ?=
BUILD_TYPE ?= Debug
# override this in your Makefile.local to use a different directory
BUILDDIRPATH ?= ./
#BUILDDIR ?= $(BUILDDIRPATH)build-$(shell echo $(BUILD_TYPE) | tr '[:upper:]' '[:lower:]')
ifeq ($(GPROF),)
ifneq ($(GCOV),)
BUILDDIR ?= $(BUILDDIRPATH)build/$(BUILD_TYPE)/gcov
CMAKE_OPTIONS += -DUSE_GCOV=True
else
BUILDDIR ?= $(BUILDDIRPATH)build/$(BUILD_TYPE)
endif
else
BUILDDIR ?= $(BUILDDIRPATH)build/$(BUILD_TYPE)/gprof
CMAKE_OPTIONS += -DUSE_GPROF=True
endif
ifneq ($(THREADS),)
BUILDDIR ?= $(BUILDDIRPATH)build/$(BUILD_TYPE)/threads
CMAKE_OPTIONS += -DSANITIZER_THREADS=True
endif
#VOGL_OPTIONS ?= --vogl_force_debug_context --vogl_exit_after_x_frames 2000
VOGL_OPTIONS ?= --vogl_force_debug_context
VOGL ?=
ifeq ($(VOGL),)
VOGL_CMD ?=
else
VOGL_BIN ?= vogl
VOGL_CMD ?= $(VOGL_BIN) trace --vogl_tracepath $(BUILDDIR) --vogl_tracefile $@.trace.bin $(VOGL_OPTIONS)
ARGS_TMP := $(ARGS)
ARGS = "--args $(ARGS_TMP)"
endif
MAKE_PID := $$PPID
JOB_FLAG := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$(MAKE)")))
@ -124,14 +89,7 @@ WINDOWS := 1
endif
INSTALL_DIR ?= $(BUILDDIRPATH)$(OS)
all: build
run: mapedit
.PHONY: clangtidy
clangtidy:
$(Q)mkdir -p $(BUILDDIR)/tidy
$(Q)cd $(BUILDDIR)/tidy; $(CMAKE_BINARY) -DCMAKE_CXX_CLANG_TIDY:STRING="clang-tidy-4.0;-checks=readability-uniqueptr-delete-release,readability-non-const-parameter,readability-redundant-smartptr-get,performance-unnecessary-value-param,performance-unnecessary-copy-initialization,performance-inefficient-string-concatenation,performance-implicit-cast-in-loop,performance-for-range-copy,performance-faster-string-find,modernize-make-shared,clang-analyzer-security.*;-fix" $(CURDIR) $(CMAKE_OPTIONS) && cmake --build .
all: install
.PHONY: cmake
cmake:
@ -150,33 +108,12 @@ $(else),\
)
endef
.PHONY: build
build: cmake
$(call COMPILE, install)
rcon tests tests-math tests-core tests-persistence tests-voxel tests-noise tests-computeshadertool tests-shadertool benchmarks-voxel server client voxedit mapedit shadertool noisetool databasetool uitool testmesh testcamera testdepthbuffer testturbobadger testnuklear testtexture testvoxelfont testplane testimgui testoctree testglslgeom testglslcomp testluaui testoctreevisit testvoxelgpu testshapebuilder flatc computeshadertool: cmake
$(call COMPILE, $@$(RUN_POSTFIX))
clean:
$(Q)rm -rf $(BUILDDIR)
doc: cmake
$(call COMPILE, codegen)
install doc package install clean assimp backward benchmark dearimgui flatbuffers glm gtest libcurl libenet libturbobadger libuv lua53 nativefiledialog restclient-cpp sdl2 selene simplecpp zlib: cmake
$(call COMPILE, $@)
package: cmake
$(call COMPILE, package)
server client voxedit mapedit shadertool noisetool databasetool uitool tests tests-math tests-core tests-persistence tests-voxel benchmarks-voxel tests-noise tests-computeshadertool testmesh testcamera testdepthbuffer testturbobadger testnuklear testtexture testvoxelfont testplane testimgui testoctree testglslgeom testglslcomp testluaui testoctreevisit testvoxelgpu testshapebuilder tests-shadertool flatc computeshadertool: cmake
$(call COMPILE, $@)
$(call COMPILE, copy-data-shared)
$(call COMPILE, copy-data-$@)
$(Q)cd $(BUILDDIR); $(PERF_CMD) $(VALGRIND_CMD) $(DEBUG_CMD) $(VOGL_CMD) ./$@ $(ARGS)
assimp backward benchmark dearimgui flatbuffers glm gtest libcurl libenet libturbobadger libuv lua53 nativefiledialog restclient-cpp sdl2 selene simplecpp zlib: cmake
$(call COMPILE, $@)
rcon: cmake
$(call COMPILE, $@)
$(Q)cd $(BUILDDIR); $(VALGRIND_CMD) $(DEBUG_CMD) $(VOGL_CMD) ./$@ $(ARGS)
define UPDATE_GIT
$(Q)if [ ! -d $(UPDATEDIR)/$(1).sync ]; then \
git clone --depth=1 $(2) $(UPDATEDIR)/$(1).sync; \

12
TODO.md
View File

@ -12,11 +12,6 @@ is related to the bonetrans matrix. Not taking it into account fixes gl_FragCoor
ERROR: (0) Failed to validate: shaders/world
INFO: (0) Validation output: shaders/world
active samplers with a different type refer to the same texture image unit
```
# Data handling
The current approach with data dir must be extended/redone someone. There are way too many files installed per artifact atm. Also there should be CPack support to generate debian packages.
# Persistence
## Checks
@ -159,3 +154,10 @@ doing one query per chunk is most likely a little bit overkill.
- build docker images
- set up kubernetes manifests
# File handling / installation
## keybinding cfg
* move all visual test configs into one file and load a default one in testcore::TestApp
* module related tests might need data, too. Find a good way to let the dependency tree automatically figure out which files must be installed.

View File

@ -1,68 +1,10 @@
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
include(CheckCCompilerFlag)
set(DEFAULT_LUA_EXECUTABLE lua lua5.2 lua5.3 luac luac5.2 luac5.3)
set(GAME_BASE_DIR data CACHE STRING "" FORCE)
macro(copy_data_files TARGET)
add_custom_target(copy-data-${TARGET} ALL
COMMAND cmake -E copy_directory "${ROOT_DIR}/${GAME_BASE_DIR}/${TARGET}/" ${CMAKE_BINARY_DIR}
COMMENT "Copy ${TARGET} data files...")
endmacro()
macro(check_lua_files TARGET)
set(files ${ARGV})
list(REMOVE_AT files 0)
find_program(LUA_EXECUTABLE NAMES ${DEFAULT_LUA_EXECUTABLE})
if (LUA_EXECUTABLE)
message("${LUA_EXECUTABLE} found")
foreach(_file ${files})
string(REGEX REPLACE "[/]" "_" targetname ${_file})
add_custom_target(
${targetname}
COMMAND ${LUA_EXECUTABLE} ${_file}
COMMENT "Validate ${_file}"
WORKING_DIRECTORY ${ROOT_DIR}/${GAME_BASE_DIR}/${TARGET}
)
add_dependencies(${TARGET} ${targetname})
endforeach()
else()
foreach(_file ${files})
string(REGEX REPLACE "[/]" "_" targetname ${_file})
add_custom_target(
${targetname}
COMMAND ${CMAKE_BINARY_DIR}/luac ${_file}
COMMENT "Validate ${_file}"
DEPENDS luac
WORKING_DIRECTORY ${ROOT_DIR}/${GAME_BASE_DIR}/${TARGET}
)
add_dependencies(${TARGET} ${targetname})
endforeach()
endif()
endmacro()
macro(check_ui_turbobadger TARGET)
set(_workingdir "${ROOT_DIR}/${GAME_BASE_DIR}/${TARGET}")
set(_dir "${_workingdir}/ui/window")
file(GLOB UI_FILES ${_dir}/*.tb.txt)
foreach(_file ${UI_FILES})
get_filename_component(_filename ${_file} NAME)
add_custom_target(
${_filename}
COMMAND ${CMAKE_BINARY_DIR}/uitool ui/window/${_filename}
COMMENT "Validate ui file: ${_filename}"
DEPENDS uitool
WORKING_DIRECTORY ${_workingdir}
)
add_dependencies(${TARGET} ${_filename})
endforeach()
if (UI_FILES)
add_dependencies(${TARGET} uitool)
endif()
endmacro()
include(CheckCCompilerFlag)
set(DATA_DIR ${ROOT_DIR}/data CACHE STRING "" FORCE)
check_cxx_compiler_flag("-std=c++14" COMPILER_SUPPORTS_CXX14)
if (COMPILER_SUPPORTS_CXX14)

View File

@ -409,6 +409,60 @@ macro(engine_add_library)
endif()
endmacro()
macro(engine_add_valgrind TARGET)
find_program(VALGRIND_EXECUTABLE NAMES valgrind)
if (VALGRIND_EXECUTABLE)
add_custom_target(${TARGET}-memcheck)
add_custom_command(TARGET ${TARGET}-memcheck
COMMAND
${VALGRIND_EXECUTABLE} --tool=memcheck --leak-check=full --show-reachable=yes
--undef-value-errors=yes --track-origins=no --child-silent-after-fork=no
--trace-children=no --log-file=$<TARGET_FILE:${TARGET}>.memcheck.log
$<TARGET_FILE:${TARGET}>
COMMENT "memcheck log for ${TARGET}: $<TARGET_FILE:${TARGET}>.memcheck.log"
DEPENDS ${TARGET}
)
add_custom_target(${TARGET}-helgrind)
add_custom_command(TARGET ${TARGET}-helgrind
COMMAND
${VALGRIND_EXECUTABLE} --tool=helgrind --child-silent-after-fork=no
--trace-children=no --log-file=$<TARGET_FILE:${TARGET}>.helgrind.log
$<TARGET_FILE:${TARGET}>
COMMENT "helgrind log for ${TARGET}: $<TARGET_FILE:${TARGET}>.helgrind.log"
DEPENDS ${TARGET}
)
endif()
endmacro()
macro(engine_add_perf TARGET)
find_program(PERF_EXECUTABLE NAMES perf)
if (PERF_EXECUTABLE)
add_custom_target(${TARGET}-perf)
add_custom_command(TARGET ${TARGET}-perf
COMMAND
${PERF_EXECUTABLE} record --call-graph dwarf
$<TARGET_FILE:${TARGET}>
DEPENDS ${TARGET}
)
endif()
endmacro()
macro(engina_add_vogl TARGET)
find_program(VOGL_EXECUTABLE NAMES vogl)
if (VOGL_EXECUTABLE)
add_custom_target(${TARGET}-vogl)
add_custom_command(TARGET ${TARGET}-vogl
COMMAND
${VOGL_EXECUTABLE} trace --vogl_tracepath ${CMAKE_BINARY_DIR}
--vogl_tracefile ${TARGET}.trace.bin
--vogl_force_debug_context
$<TARGET_FILE:${TARGET}>
COMMENT "vogl trace file for ${TARGET}: ${CMAKE_BINARY_DIR}/${TARGET}.trace.bin"
DEPENDS ${TARGET}
)
endif()
endmacro()
#-------------------------------------------------------------------------------
# Macros for generating google unit tests.
#-------------------------------------------------------------------------------
@ -456,11 +510,7 @@ macro(gtest_suite_begin name)
endif()
endmacro()
#-------------------------------------------------------------------------------
# gtest_suite_files(files)
# Adds files to a test suite
#
macro(gtest_suite_files name)
macro(gtest_suite_sources name)
if (UNITTESTS)
set(ARG_LIST ${ARGV})
list(REMOVE_AT ARG_LIST 0)
@ -472,10 +522,18 @@ macro(gtest_suite_files name)
endif()
endmacro()
#-------------------------------------------------------------------------------
# gtest_suite_deps(files)
# Adds files to a test suite
#
macro(gtest_suite_files name)
if (UNITTESTS)
set(ARG_LIST ${ARGV})
list(REMOVE_AT ARG_LIST 0)
get_property(list GLOBAL PROPERTY ${name}_Files)
foreach(entry ${ARG_LIST})
list(APPEND list ${entry})
endforeach()
set_property(GLOBAL PROPERTY ${name}_Files ${list})
endif()
endmacro()
macro(gtest_suite_deps name)
if (UNITTESTS)
set(ARG_LIST ${ARGV})
@ -501,17 +559,84 @@ macro(gtest_suite_end name)
list(GET inout 1 out)
generate_db_models(${name} ${in} ${out})
endforeach()
get_property(files GLOBAL PROPERTY ${name}_Files)
foreach (datafile ${files})
string(REPLACE "${name}/" "" target_datafile "${datafile}")
string(REPLACE "shared/" "" target_datafile "${target_datafile}")
get_filename_component(datafiledir ${target_datafile} DIRECTORY)
get_filename_component(filename ${target_datafile} NAME)
configure_file(${DATA_DIR}/${datafile} ${CMAKE_BINARY_DIR}/${datafiledir}/${filename} COPYONLY)
endforeach()
target_link_libraries(${name} ${deps})
# generate a command line app
set_target_properties(${name} PROPERTIES FOLDER "tests")
# add as cmake unit test
add_test(NAME ${name} COMMAND ${name})
copy_data_files(${name})
set_target_properties(${name} PROPERTIES FOLDER ${name})
add_test(NAME ${name} COMMAND $<TARGET_FILE:${name}>)
add_custom_target(${name}-run COMMAND $<TARGET_FILE:${name}> DEPENDS ${_EXE_TARGET} WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
engine_add_valgrind(${name})
engine_add_perf(${name})
endif()
endmacro()
macro(check_lua_files TARGET)
set(files ${ARGV})
list(REMOVE_AT files 0)
find_program(LUA_EXECUTABLE NAMES ${DEFAULT_LUA_EXECUTABLE})
if (LUA_EXECUTABLE)
message("${LUA_EXECUTABLE} found")
foreach(_file ${files})
string(REGEX REPLACE "[/]" "_" targetname ${_file})
add_custom_target(
${targetname}
COMMAND ${LUA_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/lua/${_file}
COMMENT "Validate ${_file}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_dependencies(${TARGET} ${targetname})
endforeach()
else()
foreach(_file ${files})
string(REGEX REPLACE "[/]" "_" targetname ${_file})
add_custom_target(
${targetname}
COMMAND $<TARGET_FILE:luac> ${CMAKE_CURRENT_SOURCE_DIR}/lua/${_file}
COMMENT "Validate ${_file}"
DEPENDS luac
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
add_dependencies(${TARGET} ${targetname})
endforeach()
endif()
endmacro()
macro(check_ui_turbobadger TARGET)
set(_workingdir "${DATA_DIR}/${TARGET}")
set(_dir "${_workingdir}/ui/window")
file(GLOB UI_FILES ${_dir}/*.tb.txt)
foreach(_file ${UI_FILES})
get_filename_component(_filename ${_file} NAME)
add_custom_target(
${_filename}
COMMAND $<TARGET_FILE:uitool> ui/window/${_filename}
COMMENT "Validate ui file: ${_filename}"
DEPENDS uitool
WORKING_DIRECTORY ${_workingdir}
)
add_dependencies(${TARGET} ${_filename})
endforeach()
if (UI_FILES)
add_dependencies(${TARGET} uitool)
endif()
endmacro()
macro(engine_install TARGET FILE DESTINATION INSTALL_DATA)
set(INSTALL_DATA_DIR "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}-${TARGET}")
if (INSTALL_DATA)
install(FILES ${DATA_DIR}/${FILE} DESTINATION ${INSTALL_DATA_DIR}/${DESTINATION} COMPONENT ${TARGET})
endif()
get_filename_component(filename ${FILE} NAME)
configure_file(${DATA_DIR}/${FILE} ${CMAKE_BINARY_DIR}/${TARGET}/${DESTINATION}/${filename} COPYONLY)
endmacro()
#
# set up the binary for the application. This will also set up platform specific stuff for you
#
@ -527,7 +652,7 @@ endmacro()
macro(engine_add_executable)
set(_OPTIONS_ARGS WINDOWED NOINSTALL)
set(_ONE_VALUE_ARGS TARGET)
set(_MULTI_VALUE_ARGS SRCS)
set(_MULTI_VALUE_ARGS SRCS LUA_SRCS FILES)
cmake_parse_arguments(_EXE "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
@ -552,48 +677,113 @@ macro(engine_add_executable)
endif()
endif()
endif()
set_target_properties(${_EXE_TARGET} PROPERTIES OUTPUT_NAME "${CMAKE_PROJECT_NAME}-${_EXE_TARGET}")
set_target_properties(${_EXE_TARGET} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_EXE_TARGET}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_EXE_TARGET}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_EXE_TARGET}"
)
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set_target_properties(${_EXE_TARGET} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "${CMAKE_BINARY_DIR}/${_EXE_TARGET}"
LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "${CMAKE_BINARY_DIR}/${_EXE_TARGET}"
RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "${CMAKE_BINARY_DIR}/${_EXE_TARGET}"
)
endforeach()
set(RESOURCE_DIRS ${ROOT_DIR}/${GAME_BASE_DIR}/${_EXE_TARGET}/ ${ROOT_DIR}/${GAME_BASE_DIR}/shared/)
copy_data_files(${_EXE_TARGET})
# by default, put system related files into the current binary dir on install
set(SHARE_DIR ".")
# by default, put data files into the current binary dir on install
set(GAMES_DIR "${_EXE_TARGET}")
# by default, put the binary into a subdir with the target name
set(BIN_DIR "${_EXE_TARGET}")
set(ICON_DIR ".")
if (_EXE_LUA_SRCS)
check_lua_files(${_EXE_TARGET} ${_EXE_LUA_SRCS})
endif()
set(INSTALL_DATA_DIR "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}-${_EXE_TARGET}")
set(INSTALL_ICON_DIR "${CMAKE_INSTALL_DATADIR}/icons")
set(INSTALL_APPLICATION_DIR "${CMAKE_INSTALL_DATADIR}/applications")
if (SANITIZER_THREADS AND NOT ${_EXE_TARGET} STREQUAL "databasetool" AND NOT ${_EXE_TARGET} STREQUAL "shadertool" AND NOT ${_EXE_TARGET} STREQUAL "uitool")
set_target_properties(${_EXE_TARGET} PROPERTIES COMPILE_FLAGS "${SANITIZE_THREAD_FLAG}")
set_target_properties(${_EXE_TARGET} PROPERTIES LINK_FLAGS "${SANITIZE_THREAD_FLAG}")
endif()
if (NOT _EXE_NOINSTALL)
set(ICON "${_EXE_TARGET}-icon.png")
if (EXISTS ${ROOT_DIR}/contrib/${ICON})
install(FILES ${ROOT_DIR}/contrib/${ICON} DESTINATION ${ICON_DIR} COMPONENT ${_EXE_TARGET})
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(SHARE_DIR "share")
set(GAMES_DIR "${SHARE_DIR}/${_EXE_TARGET}")
set(ICON_DIR "${SHARE_DIR}/icons")
set(BIN_DIR "games")
configure_file(${ROOT_DIR}/contrib/installer/linux/desktop.in ${PROJECT_BINARY_DIR}/${_EXE_TARGET}.desktop)
install(FILES ${PROJECT_BINARY_DIR}/${_EXE_TARGET}.desktop DESTINATION ${SHARE_DIR}/applications)
if (EXISTS ${ROOT_DIR}/contrib/installer/linux/${_EXE_TARGET}.service.in)
configure_file(${ROOT_DIR}/contrib/installer/linux/${_EXE_TARGET}.service.in ${PROJECT_BINARY_DIR}/${_EXE_TARGET}.service)
install(FILES ${PROJECT_BINARY_DIR}/${_EXE_TARGET}.service DESTINATION lib/systemd/user)
endif()
endif()
foreach (dir ${RESOURCE_DIRS})
if (IS_DIRECTORY ${dir})
install(DIRECTORY ${dir} DESTINATION ${GAMES_DIR}/ COMPONENT ${_EXE_TARGET})
endif()
endforeach()
install(TARGETS ${_EXE_TARGET} DESTINATION ${BIN_DIR} COMPONENT ${_EXE_TARGET})
if (_EXE_NOINSTALL)
set(INSTALL_DATA False)
else()
set(INSTALL_DATA True)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# TODO: only if WINDOWED is given?
configure_file(${ROOT_DIR}/contrib/installer/linux/desktop.in ${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${_EXE_TARGET}.desktop)
if (DESKTOP_FILE_VALIDATE_EXECUTABLE)
add_custom_command(TARGET ${_EXE_TARGET} POST_BUILD
COMMAND ${DESKTOP_FILE_VALIDATE_EXECUTABLE} ${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${_EXE_TARGET}.desktop
COMMENT "Validate ${CMAKE_PROJECT_NAME}-${_EXE_TARGET}.desktop"
)
endif()
if (INSTALL_DATA)
install(FILES ${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${_EXE_TARGET}.desktop DESTINATION ${INSTALL_APPLICATION_DIR})
endif()
if (EXISTS ${ROOT_DIR}/contrib/installer/linux/${_EXE_TARGET}.service.in)
# TODO systemd-analyze --user verify build/Debug/src/server/vengi-server.service
configure_file(${ROOT_DIR}/contrib/installer/linux/${_EXE_TARGET}.service.in ${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${_EXE_TARGET}.service)
if (INSTALL_DATA)
install(FILES ${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}-${_EXE_TARGET}.service DESTINATION lib/systemd/user)
endif()
endif()
endif()
set_property(GLOBAL PROPERTY ${_EXE_TARGET}_EXECUTABLE True)
set_property(GLOBAL PROPERTY ${_EXE_TARGET}_INSTALL ${INSTALL_DATA})
set_property(GLOBAL PROPERTY ${_EXE_TARGET}_FILES "${_EXE_FILES}")
foreach (luasrc ${_EXE_LUA_SRCS})
get_filename_component(luasrcdir ${luasrc} DIRECTORY)
if (INSTALL_DATA)
install(FILES lua/${luasrc} DESTINATION ${INSTALL_DATA_DIR}/${luasrcdir} COMPONENT ${_EXE_TARGET})
endif()
configure_file(lua/${luasrc} ${INSTALL_DATA_DIR}/${luasrcdir}/${luasrc})
endforeach()
set(ICON "${_EXE_TARGET}-icon.png")
if (EXISTS ${ROOT_DIR}/contrib/${ICON})
if (INSTALL_DATA)
install(FILES ${ROOT_DIR}/contrib/${ICON} DESTINATION ${INSTALL_ICON_DIR} COMPONENT ${_EXE_TARGET})
endif()
endif()
set(KEYBINDINGS "${_EXE_TARGET}-keybindings.cfg")
if (EXISTS ${ROOT_DIR}/data/${KEYBINDINGS})
if (INSTALL_DATA)
install(FILES ${DATA_DIR}/${KEYBINDINGS} DESTINATION ${INSTALL_DATA_DIR}/ COMPONENT ${_EXE_TARGET})
endif()
configure_file(${DATA_DIR}/${KEYBINDINGS} ${INSTALL_DATA_DIR}/${KEYBINDINGS})
endif()
if (INSTALL_DATA)
install(TARGETS ${_EXE_TARGET} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_EXE_TARGET})
endif()
add_custom_target(${_EXE_TARGET}-run COMMAND $<TARGET_FILE:${_EXE_TARGET}> DEPENDS ${_EXE_TARGET} WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${_EXE_TARGET}")
engine_add_valgrind(${_EXE_TARGET})
engine_add_perf(${_EXE_TARGET})
if (WINDOWED)
engina_add_vogl(${_EXE_TARGET})
endif()
endmacro()
macro(engine_add_module)
set(_OPTIONS_ARGS)
set(_ONE_VALUE_ARGS TARGET)
set(_MULTI_VALUE_ARGS SRCS FILES DEPENDENCIES)
cmake_parse_arguments(_LIB "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN})
add_library(${_LIB_TARGET} ${_LIB_SRCS})
set_target_properties(${_LIB_TARGET} PROPERTIES FOLDER ${_LIB_TARGET})
if (_LIB_DEPENDENCIES)
target_link_libraries(${_LIB_TARGET} ${_LIB_DEPENDENCIES})
foreach (dep ${_LIB_DEPENDENCIES})
get_property(DEP_FILES GLOBAL PROPERTY ${dep}_FILES)
list(APPEND _LIB_FILES ${DEP_FILES})
endforeach()
endif()
set_property(GLOBAL PROPERTY ${_LIB_TARGET}_FILES ${_LIB_FILES})
endmacro()
macro(engine_target_link_libraries)
@ -604,4 +794,24 @@ macro(engine_target_link_libraries)
cmake_parse_arguments(_LIBS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN})
target_link_libraries(${_LIBS_TARGET} ${_LIBS_DEPENDENCIES})
get_property(EXECUTABLE GLOBAL PROPERTY ${_LIBS_TARGET}_EXECUTABLE)
if (EXECUTABLE)
get_property(INSTALL_DATA GLOBAL PROPERTY ${_LIBS_TARGET}_INSTALL)
get_property(INSTALL_FILES GLOBAL PROPERTY ${_LIBS_TARGET}_FILES)
foreach (dep ${_LIBS_DEPENDENCIES})
get_property(FILES GLOBAL PROPERTY ${dep}_FILES)
list(APPEND INSTALL_FILES ${FILES})
endforeach()
if (INSTALL_FILES)
list(REMOVE_DUPLICATES INSTALL_FILES)
foreach (datafile ${INSTALL_FILES})
string(REPLACE "${_LIBS_TARGET}/" "" target_datafile "${datafile}")
string(REPLACE "shared/" "" target_datafile "${target_datafile}")
get_filename_component(datafiledir ${target_datafile} DIRECTORY)
engine_install(${_LIBS_TARGET} "${datafile}" "${datafiledir}" ${INSTALL_DATA})
endforeach()
endif()
endif()
endmacro()

View File

@ -3,7 +3,7 @@ Version=1.0
Name=@_EXE_TARGET@ @CMAKE_PROJECT_VERSION@
GenericName=@_EXE_TARGET@
Comment=@DESCRIPTION@
Exec=@_EXE_TARGET@
Exec=@CMAKE_PROJECT_NAME@-@_EXE_TARGET@
Icon=@ICON@
Terminal=@_EXE_TERMINAL@
Type=Application

View File

@ -4,7 +4,7 @@ After=network.target
[Service]
Type=forking
ExecStart=@_EXE_TARGET@
ExecStart=@CMAKE_PROJECT_NAME@-@_EXE_TARGET@
[Install]
WantedBy=multi-user.target

View File

@ -1,20 +0,0 @@
function range(a, b, step)
if not b then
b = a
a = 1
end
step = step or 1
local f =
step > 0 and
function(_, lastvalue)
local nextvalue = lastvalue + step
if nextvalue <= b then return nextvalue end
end or
step < 0 and
function(_, lastvalue)
local nextvalue = lastvalue + step
if nextvalue >= b then return nextvalue end
end or
function(_, lastvalue) return lastvalue end
return f, nil, a - step
end

View File

@ -1,4 +1,23 @@
require "lua.shared"
function range(a, b, step)
if not b then
b = a
a = 1
end
step = step or 1
local f =
step > 0 and
function(_, lastvalue)
local nextvalue = lastvalue + step
if nextvalue <= b then return nextvalue end
end or
step < 0 and
function(_, lastvalue)
local nextvalue = lastvalue + step
if nextvalue >= b then return nextvalue end
end or
function(_, lastvalue) return lastvalue end
return f, nil, a - step
end
function init()
m = MAT.material()

View File

@ -0,0 +1,4 @@
function init ()
AI.createTree("ANIMAL_RABBIT"):createRoot("PrioritySelector", "ANIMAL_RABBIT")
AI.createTree("ANIMAL_WOLF"):createRoot("PrioritySelector", "ANIMAL_WOLF")
end

View File

@ -16,10 +16,26 @@ set(SRCS
ui/DisconnectWindow.h
ui/LostPasswordWindow.h
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} WINDOWED)
set(FILES
client/mesh/animal_chicken.dae
client/mesh/animal_chicken.png
client/mesh/animal_rabbit.dae
client/mesh/animal_rabbit.png
client/mesh/animal_wolf.dae
client/mesh/animal_wolf.png
client/mesh/chr_fatkid.dae
client/mesh/chr_fatkid.png
client/ui/lang/en.tb.txt
client/ui/window/client-authfailed.tb.txt
client/ui/window/client-disconnect.tb.txt
client/ui/window/client-hud.tb.txt
client/ui/window/client-login.tb.txt
client/ui/window/client-lostpassword.tb.txt
client/ui/window/client-signup.tb.txt
shared/font.ttf
shared/worldparams.lua
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} FILES ${FILES} WINDOWED)
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES turbobadger voxelfont voxelrender util)
check_ui_turbobadger(${PROJECT_NAME})
gtest_suite_files(tests
tests/ClientUITest.cpp
)

View File

@ -1,28 +0,0 @@
/**
* @file
*/
#include "ui/turbobadger/tests/UITest.h"
#include "../ui/LoginWindow.h"
#include "../ui/SignupWindow.h"
#include "../ui/AuthFailedWindow.h"
#include "../ui/DisconnectWindow.h"
#include "../ui/LostPasswordWindow.h"
#include "../ui/HudWindow.h"
namespace ui {
class ClientUITest: public ui::turbobadger::UITest {
};
TEST_F(ClientUITest, testLoadClientUI) {
//ASSERT_DEATH(new frontend::LoginWindow(nullptr), "");
//ASSERT_DEATH(new frontend::SignupWindow(nullptr), "");
//ASSERT_DEATH(new frontend::AuthFailedWindow(nullptr), "");
//ASSERT_DEATH(new frontend::DisconnectWindow(nullptr), "");
//ASSERT_DEATH(new frontend::HudWindow(nullptr, glm::ivec2(0)), "");
//ASSERT_DEATH(new frontend::LostPasswordWindow(nullptr), "");
}
}

View File

@ -105,13 +105,12 @@ set(SRCS
tree/TreeNodeParser.h
)
set(LIB ai)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES commonlua glm)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES commonlua glm)
target_include_directories(${LIB} PUBLIC .)
target_compile_definitions(${LIB} PUBLIC -DAI_INCLUDE_LUA=1)
gtest_suite_files(tests
gtest_suite_files(tests tests/testluaregistry.lua)
gtest_suite_sources(tests
tests/AggroTest.cpp
tests/GeneralTest.cpp
tests/GroupTest.cpp

View File

@ -5,16 +5,12 @@ set(SRCS
ContainerProvider.h ContainerProvider.cpp
)
set(LIB attrib)
add_library(${LIB} ${SRCS})
# the network module will assemble the header with the attribute types
# link it in because we need the directory where the c++ headers are
# generated to be also added to this lib. TODO: find a way to just
# use add_dependencies
#add_dependencies(${LIB} network)
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core commonlua network)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
# generated to be also added to this lib.
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core commonlua network)
gtest_suite_files(tests
gtest_suite_sources(tests
tests/AttributesTest.cpp
tests/ContainerProviderTest.cpp
)

View File

@ -51,13 +51,21 @@ set(SRCS
entity/EntityStorage.cpp entity/EntityStorage.h
entity/Entity.cpp entity/Entity.h
)
set(FILES
shared/worldparams.lua
)
set(LIB backend)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES network io core metric util voxel attrib eventmgr poi cooldown persistence ai stock util)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} FILES ${FILES} DEPENDENCIES network io core metric util voxel attrib eventmgr poi cooldown persistence ai stock util)
generate_db_models(${LIB} ${CMAKE_CURRENT_SOURCE_DIR}/tables.tbl BackendModels.h)
gtest_suite_files(tests
tests/behaviourtrees.lua
tests/test-attributes.lua
shared/worldparams.lua
shared/biomes.lua
)
gtest_suite_sources(tests
tests/AITest.cpp
tests/UserCooldownMgrTest.cpp
tests/MapProviderTest.cpp

View File

@ -42,7 +42,7 @@ public:
_aiRegistry->init();
_loader = std::make_shared<AILoader>(_aiRegistry);
_containerProvider = std::make_shared<attrib::ContainerProvider>();
const std::string& attributes = _testApp->filesystem()->load("attributes.lua");
const std::string& attributes = _testApp->filesystem()->load("test-attributes.lua");
ASSERT_TRUE(_containerProvider->init(attributes)) << _containerProvider->error();
_cooldownProvider = std::make_shared<cooldown::CooldownProvider>();
_mapProvider = std::make_shared<MapProvider>(_testApp->filesystem(), _testApp->eventBus(), _testApp->timeProvider(),

View File

@ -5,13 +5,12 @@ set(SRCS
dummy.cpp
)
set(LIB collection)
add_library(${LIB} ${SRCS})
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS})
set(TEST_SRCS
tests/ConcurrentQueueTest.cpp
tests/SetTest.cpp
)
gtest_suite_files(tests ${TEST_SRCS})
gtest_suite_sources(tests ${TEST_SRCS})
gtest_suite_deps(tests ${LIB})

View File

@ -3,11 +3,9 @@ set(SRCS
LUAFunctions.h LUAFunctions.cpp
)
set(LIB commonlua)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core lua53)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core lua53)
gtest_suite_files(tests
gtest_suite_sources(tests
tests/LUAFunctionsTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -10,18 +10,16 @@ set(SRCS
)
set(LIB compute)
find_package(OpenCL)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core util)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core util)
set(OPENCL_LIBRARY ${OpenCL_LIBRARY})
if (OpenCL_INCLUDE_DIRS)
target_include_directories(${LIB} PUBLIC ${OpenCL_INCLUDE_DIRS})
target_include_directories(${LIB} PRIVATE ${OpenCL_INCLUDE_DIRS})
endif()
set(TEST_SRCS
tests/ComputeShaderTest.cpp
)
gtest_suite_files(tests ${TEST_SRCS})
gtest_suite_sources(tests ${TEST_SRCS})
gtest_suite_deps(tests ${LIB})
generate_compute_shaders(tests test)

View File

@ -6,11 +6,14 @@ set(SRCS
CooldownTriggerState.h
)
set(LIB cooldown)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core commonlua network)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
set(FILES
shared/cooldowns.lua
)
engine_add_module(TARGET ${LIB} SRCS ${SRCS} FILES ${FILES} DEPENDENCIES core commonlua network)
gtest_suite_files(tests
gtest_suite_files(tests ${FILES})
gtest_suite_sources(tests
tests/CooldownProviderTest.cpp
tests/CooldownMgrTest.cpp
)

View File

@ -41,9 +41,10 @@ set(SRCS
Zip.h
)
set(LIB core)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES collection io metric restclient-cpp zlib ${CMAKE_DL_LIBS})
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
set(FILES
shared/autoexec.cfg
)
engine_add_module(TARGET ${LIB} SRCS ${SRCS} FILES ${FILES} DEPENDENCIES collection io metric restclient-cpp zlib ${CMAKE_DL_LIBS})
set(TEST_SRCS
tests/AbstractTest.cpp
@ -62,10 +63,10 @@ set(TEST_SRCS
tests/ReadWriteLockTest.cpp
)
gtest_suite_files(tests ${TEST_SRCS})
gtest_suite_sources(tests ${TEST_SRCS})
gtest_suite_deps(tests ${LIB})
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
gtest_suite_files(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_deps(tests-${LIB} ${LIB})
gtest_suite_end(tests-${LIB})

View File

@ -8,12 +8,10 @@ set(SRCS
LUAFunctions.h
)
set(LIB eventmgr)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core commonlua network persistence)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core commonlua network persistence)
generate_db_models(${LIB} ${CMAKE_CURRENT_SOURCE_DIR}/tables.tbl EventMgrModels.h)
gtest_suite_files(tests
gtest_suite_sources(tests
tests/EventMgrTest.cpp
)
gtest_suite_files(tests

View File

@ -5,6 +5,4 @@ set(SRCS
)
set(LIB frontend)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES network attrib)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES network attrib)

View File

@ -2,6 +2,4 @@ set(SRCS
Image.cpp Image.h
)
set(LIB image)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core io)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core io)

View File

@ -8,14 +8,12 @@ set(SRCS
)
set(LIB io)
add_library(${LIB} ${SRCS})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES sdl2 glm backward libuv)
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES sdl2 glm backward libuv)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
gtest_suite_files(tests
gtest_suite_sources(tests
tests/FilesystemTest.cpp
tests/FileStreamTest.cpp
tests/FileTest.cpp
)
gtest_suite_files(tests tests/iotest.txt)
gtest_suite_deps(tests ${LIB})

View File

@ -10,9 +10,7 @@ set(SRCS
Rect.h
)
set(LIB math)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core)
set(TEST_SRCS
tests/AABBTest.cpp
@ -23,10 +21,10 @@ set(TEST_SRCS
tests/RectTest.cpp
)
gtest_suite_files(tests ${TEST_SRCS})
gtest_suite_sources(tests ${TEST_SRCS})
gtest_suite_deps(tests ${LIB})
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
gtest_suite_files(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_deps(tests-${LIB} ${LIB})
gtest_suite_end(tests-${LIB})

View File

@ -5,11 +5,9 @@ set(SRCS
MetricEvent.h
)
set(LIB metric)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core)
gtest_suite_files(tests
gtest_suite_sources(tests
tests/MetricTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -11,8 +11,5 @@ set(SRCS
ServerNetwork.h ServerNetwork.cpp
)
set(LIB network)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core libenet flatbuffers)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core libenet flatbuffers)
generate_protocol(${LIB} Shared.fbs ClientMessages.fbs ServerMessages.fbs)

View File

@ -8,9 +8,7 @@ set(SRCS
# TODO: maybe provide two noise modules, one noisefast (for e.g. client only stuff) and one noise-slow for stuff that must be cross plattform
set(LIB noise)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core math compute)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core math compute)
#set(MARCH native)
set(MARCH generic)
# http://christian-seiler.de/projekte/fpmath/
@ -29,14 +27,15 @@ else()
endif()
generate_compute_shaders(noise noise)
gtest_suite_files(tests
set(TEST_SRCS
tests/IslandNoiseTest.cpp
tests/NoiseTest.cpp
tests/PoissonDiskDistributionTest.cpp
)
gtest_suite_sources(tests ${TEST_SRCS})
gtest_suite_deps(tests ${LIB} image)
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
gtest_suite_files(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_deps(tests-${LIB} ${LIB} image)
gtest_suite_end(tests-${LIB})

View File

@ -22,17 +22,14 @@ set(SRCS
Structs.h
Timestamp.cpp Timestamp.h
)
set(LIB persistence)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
set(PostgreSQL_ADDITIONAL_VERSIONS "10")
find_package(PostgreSQL)
message(STATUS "Postgresql include dirs: ${PostgreSQL_INCLUDE_DIRS}")
message(STATUS "Postgresql libs: ${PostgreSQL_LIBRARIES}")
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES ${PostgreSQL_LIBRARIES})
target_include_directories(${LIB} PUBLIC ${PostgreSQL_INCLUDE_DIRS} /usr/include/postgresql/)
set(LIB persistence)
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core ${PostgreSQL_LIBRARIES})
set(TEST_SRCS
tests/DatabaseModelTest.cpp
@ -41,6 +38,7 @@ set(TEST_SRCS
)
if (PostgreSQL_FOUND)
target_include_directories(${LIB} PRIVATE ${PostgreSQL_INCLUDE_DIRS} /usr/include/postgresql/)
set(HAVE_POSTGRES 1 CACHE INTERNAL "Found postgres")
list(APPEND TEST_SRCS
tests/PersistenceMgrTest.cpp
@ -52,14 +50,14 @@ else()
set(HAVE_POSTGRES 0 CACHE INTERNAL "Found postgres")
endif()
gtest_suite_files(tests ${TEST_SRCS})
gtest_suite_sources(tests ${TEST_SRCS})
gtest_suite_deps(tests ${LIB})
generate_db_models(${LIB} ${CMAKE_CURRENT_SOURCE_DIR}/tables.tbl PersistenceModels.h)
generate_db_models(tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/tests.tbl TestModels.h)
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
gtest_suite_files(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_deps(tests-${LIB} ${LIB})
generate_db_models(tests-${LIB} ${CMAKE_CURRENT_SOURCE_DIR}/tests/tests.tbl TestModels.h)
gtest_suite_end(tests-${LIB})

View File

@ -3,11 +3,9 @@ set(SRCS
Type.h
)
set(LIB poi)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES voxel network)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES voxel network)
gtest_suite_files(tests
gtest_suite_sources(tests
tests/PoiProviderTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -17,14 +17,11 @@ set(SRCS_SHADERS
shaders/shadowmap.vert shaders/shadowmap.frag
shaders/texture.vert shaders/texture.frag
)
#set_source_files_properties(${SRCS_SHADERS} PROPERTIES LANGUAGE C)
set(LIB render)
add_library(${LIB} ${SRCS} ${SRCS_SHADERS})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} ${SRCS_SHADERS} DEPENDENCIES video noise)
generate_shaders(${LIB} mesh shadowmap shadowmap_instanced shadowmap_render color color_instanced texture)
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES video noise)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
gtest_suite_files(tests
gtest_suite_sources(tests
tests/RenderShaderTest.cpp
)
gtest_suite_deps(tests ${LIB} render)

View File

@ -9,11 +9,9 @@ set(SRCS
)
set(LIB stock)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core attrib network cooldown commonlua)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core attrib network cooldown commonlua)
gtest_suite_files(tests
gtest_suite_sources(tests
tests/StockTest.cpp
tests/ShapeTest.cpp
tests/InventoryTest.cpp

View File

@ -3,9 +3,4 @@ set(SRCS
TestMeshApp.cpp TestMeshApp.h
TestAppMain.h
)
set(LIB testcore)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core frontend render video imgui)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
copy_data_files(${LIB})
add_dependencies(${LIB} copy-data-${LIB})
engine_add_module(TARGET testcore SRCS ${SRCS} DEPENDENCIES core frontend render video imgui)

View File

@ -6,7 +6,5 @@ set(SRCS
IMGUIAddons.h
)
set(LIB imgui)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core io render dearimgui)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core io render dearimgui)
target_include_directories(${LIB} PUBLIC .)

View File

@ -9,7 +9,7 @@ set(SRCS
private/nuklear.h
)
set(LIB nuklear)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core io render util commonlua)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
set(FILES
shared/font.ttf
)
engine_add_module(TARGET nuklear SRCS ${SRCS} FILES ${FILES} DEPENDENCIES core io render util commonlua)

View File

@ -1,3 +1,4 @@
set(LIB turbobadger)
set(SRCS
UIApp.cpp UIApp.h
TurboBadger.h
@ -9,12 +10,76 @@ set(SRCS
ui_renderer_gl.cpp ui_renderer_gl.h
ui_widgets.cpp ui_widgets.h
)
set(LIB turbobadger)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core io render util libturbobadger)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
set(FILES
shared/ui/font/font_14.png
shared/ui/font/font_28.png
shared/ui/font/font.tb.txt
shared/ui/skin/arrow_down.png
shared/ui/skin/arrow_left.png
shared/ui/skin/arrow_right.png
shared/ui/skin/arrow_up.png
shared/ui/skin/button_flat_outline.png
shared/ui/skin/button_flat_pressed.png
shared/ui/skin/button_grouped_x_first_down.png
shared/ui/skin/button_grouped_x_first_up.png
shared/ui/skin/button_grouped_x_last_down.png
shared/ui/skin/button_grouped_x_last_up.png
shared/ui/skin/button_grouped_x_middle_down.png
shared/ui/skin/button_grouped_x_middle_up.png
shared/ui/skin/button.png
shared/ui/skin/button_pressed.png
shared/ui/skin/checkbox_mark.png
shared/ui/skin/checkbox.png
shared/ui/skin/checkbox_pressed.png
shared/ui/skin/container.png
shared/ui/skin/editfield.png
shared/ui/skin/fadeout_x.png
shared/ui/skin/fadeout_y.png
shared/ui/skin/focus_r4.png
shared/ui/skin/focus_tabbutton_left.png
shared/ui/skin/focus_tabbutton_top.png
shared/ui/skin/item_hover.png
shared/ui/skin/item_selected.png
shared/ui/skin/item_separator_x.png
shared/ui/skin/item_separator_y.png
shared/ui/skin/progress_spinner_strip.png
shared/ui/skin/radio_mark.png
shared/ui/skin/radio.png
shared/ui/skin/radio_pressed.png
shared/ui/skin/remove.png
shared/ui/skin/resizer.png
shared/ui/skin/scroll_bg_x.png
shared/ui/skin/scroll_bg_y.png
shared/ui/skin/scroll_fg_x.png
shared/ui/skin/scroll_fg_y.png
shared/ui/skin/search.png
shared/ui/skin/section_container.png
shared/ui/skin/selection.png
shared/ui/skin/skin.tb.txt
shared/ui/skin/slider_bg_x.png
shared/ui/skin/slider_bg_y.png
shared/ui/skin/slider_handle.png
shared/ui/skin/tab_button_bottom_active.png
shared/ui/skin/tab_button_bottom_inactive.png
shared/ui/skin/tab_button_left_active.png
shared/ui/skin/tab_button_left_inactive.png
shared/ui/skin/tab_button_right_active.png
shared/ui/skin/tab_button_right_inactive.png
shared/ui/skin/tab_button_top_active.png
shared/ui/skin/tab_button_top_inactive.png
shared/ui/skin/toggle_section_icon_down.png
shared/ui/skin/toggle_section_icon_middle.png
shared/ui/skin/toggle_section_icon_up.png
shared/ui/skin/window_active.png
shared/ui/skin/window_close.png
shared/ui/skin/window_close_pressed.png
shared/ui/skin/window_mover_bg_tile.png
shared/ui/skin/window_mover_overlay.png
shared/ui/skin/window.png
)
engine_add_module(TARGET ${LIB} SRCS ${SRCS} FILES ${FILES} DEPENDENCIES core io render util libturbobadger)
gtest_suite_files(tests
gtest_suite_sources(tests
tests/ConsoleTest.cpp
tests/UITest.h
)

View File

@ -8,12 +8,9 @@ set(SRCS
IncludeUtil.h IncludeUtil.cpp
)
set(LIB util)
add_library(${LIB} ${SRCS})
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core math io)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES core math io)
gtest_suite_files(tests
gtest_suite_sources(tests
tests/KeybindingParserTest.cpp
tests/KeybindingHandlerTest.cpp
tests/EMailValidatorTest.cpp

View File

@ -45,9 +45,7 @@ set(SRCS_SHADERS
set(LIB video)
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL)
add_library(${LIB} ${SRCS} ${SRCS_SHADERS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core math image util assimp zlib)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} ${SRCS_SHADERS} DEPENDENCIES core math image util assimp zlib)
find_program(PYTHON3_EXECUTABLE NAMES python3)
add_custom_target(update-glbindings)
@ -59,7 +57,7 @@ if (PYTHON3_EXECUTABLE)
)
endif()
gtest_suite_files(tests
gtest_suite_sources(tests
tests/AbstractGLTest.h
tests/ShaderTest.cpp
tests/CameraTest.cpp

View File

@ -1,3 +1,4 @@
set(LIB voxel)
set(SRCS
BiomeLUAFunctions.h BiomeLUAFunctions.cpp
Biome.h Biome.cpp
@ -46,10 +47,12 @@ set(SRCS
polyvox/VolumeCropper.h
polyvox/VolumeVisitor.h
)
set(LIB voxel)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES core math collection noise zlib image assimp commonlua)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
set(FILES
shared/palette-nippon.lua
shared/palette-nippon.png
shared/biomes.lua
)
engine_add_module(TARGET ${LIB} SRCS ${SRCS} FILES ${FILES} DEPENDENCIES core math collection noise zlib image assimp commonlua)
set(MARCH native)
#set(MARCH generic)
# http://christian-seiler.de/projekte/fpmath/
@ -78,11 +81,13 @@ set(TEST_SRCS
tests/VolumeCropperTest.cpp
)
gtest_suite_files(tests ${TEST_SRCS})
gtest_suite_sources(tests ${TEST_SRCS})
gtest_suite_deps(tests ${LIB})
gtest_suite_files(tests ${FILES})
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
gtest_suite_files(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_files(tests-${LIB} ${FILES} shared/worldparams.lua)
gtest_suite_deps(tests-${LIB} ${LIB})
gtest_suite_end(tests-${LIB})
@ -90,5 +95,5 @@ set(BENCHMARK_SRCS
../core/benchmark/AbstractBenchmark.cpp
benchmarks/VoxelBenchmark.cpp
)
engine_add_executable(TARGET benchmarks-${LIB} SRCS ${BENCHMARK_SRCS} NOINSTALL)
engine_add_executable(TARGET benchmarks-${LIB} SRCS ${BENCHMARK_SRCS} FILES ${FILES} shared/worldparams.lua NOINSTALL)
engine_target_link_libraries(TARGET benchmarks-${LIB} DEPENDENCIES benchmark ${LIB})

View File

@ -1,8 +1,6 @@
set(LIB voxelfont)
set(SRCS
stb_truetype.h
VoxelFont.h VoxelFont.cpp
)
set(LIB voxelfont)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES voxel)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES voxel)

View File

@ -1,3 +1,4 @@
set(LIB voxelformat)
set(SRCS
VoxFileFormat.h VoxFileFormat.cpp
VoxFormat.h VoxFormat.cpp
@ -5,10 +6,7 @@ set(SRCS
QBFormat.h QBFormat.cpp
MeshExporter.h MeshExporter.cpp
)
set(LIB voxelformat)
add_library(${LIB} ${SRCS})
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES voxel assimp)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES voxel assimp)
set(TEST_SRCS
tests/AbstractVoxFormatTest.h tests/AbstractVoxFormatTest.cpp
@ -17,6 +15,6 @@ set(TEST_SRCS
tests/QBFormatTest.cpp
tests/MeshExporterTest.cpp
)
gtest_suite_files(tests ${TEST_SRCS})
gtest_suite_files(tests tests/qubicle.qb tests/magicavoxel.vox)
gtest_suite_sources(tests ${TEST_SRCS})
gtest_suite_deps(tests ${LIB})

View File

@ -1,3 +1,4 @@
set(LIB voxelrender)
set(SRCS
MapRenderer.cpp MapRenderer.h
PlantDistributor.cpp PlantDistributor.h
@ -11,14 +12,13 @@ set(SRCS_SHADERS
shaders/world_instanced.vert shaders/world_instanced.frag
shaders/world.vert shaders/world.frag
)
set(LIB voxelrender)
add_library(${LIB} ${SRCS} ${SRCS_SHADERS})
set(FILES
shared/worldparams.lua
)
engine_add_module(TARGET ${LIB} SRCS ${SRCS} ${SRCS_SHADERS} FILES ${FILES} DEPENDENCIES frontend render voxel)
generate_shaders(${LIB} world water world_instanced)
engine_target_link_libraries(TARGET ${LIB} DEPENDENCIES frontend render voxel)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
gtest_suite_files(tests
gtest_suite_sources(tests
tests/VoxelFrontendShaderTest.cpp
tests/MaterialTest.cpp
tests/WorldRendererTest.cpp

View File

@ -2,9 +2,11 @@ project(server)
set(SRCS
Server.cpp Server.h
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS})
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES backend)
set(LUA_SRCS
ai/blacksmith.lua
ai/rabbit.lua
ai/shared.lua
ai/wolf.lua
behaviourtrees.lua
attributes.lua
event/generic.lua
@ -12,4 +14,7 @@ set(LUA_SRCS
stock.lua
map/map001.lua
)
check_lua_files(${PROJECT_NAME} ${LUA_SRCS})
set(FILES)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} FILES ${FILES} LUA_SRCS ${LUA_SRCS})
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES backend)

View File

@ -0,0 +1,28 @@
function animalDefault(container)
container:absolute("SPEED", 1.5)
container:absolute("HEALTH", 100.0)
container:absolute("ATTACKRANGE", 0.0)
container:absolute("STRENGTH", 5.0)
container:absolute("VIEWDISTANCE", 50.0)
container:absolute("FIELDOFVIEW", 120.0)
end
function init()
local wolf = attrib.createContainer("ANIMAL_WOLF")
animalDefault(wolf)
wolf:absolute("VIEWDISTANCE", 500.0)
wolf:absolute("FIELDOFVIEW", 240.0)
wolf:absolute("ATTACKRANGE", 2.0)
wolf:absolute("SPEED", 1.7)
wolf:register()
local rabbit = attrib.createContainer("ANIMAL_RABBIT")
animalDefault(rabbit)
rabbit:absolute("FIELDOFVIEW", 240.0)
rabbit:register()
local player = attrib.createContainer("PLAYER")
player:absolute("SPEED", 1.0)
player:absolute("VIEWDISTANCE", 500.0)
player:register()
end

View File

@ -2,6 +2,8 @@ project(testluaui)
set(SRCS
TestLUAUI.h TestLUAUI.cpp
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} WINDOWED NOINSTALL)
set(LUA_SRCS
ui/${PROJECT_NAME}.lua
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} WINDOWED LUA_SRCS ${LUA_SRCS} NOINSTALL)
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES nuklear)
check_lua_files(${PROJECT_NAME} ui/${PROJECT_NAME}.lua)

View File

@ -2,5 +2,9 @@ project(testtexture)
set(SRCS
TestTexture.h TestTexture.cpp
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} WINDOWED NOINSTALL)
set(FILES
testtexture/texture.png
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} FILES ${FILES} WINDOWED NOINSTALL)
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES testcore)

View File

@ -5,5 +5,57 @@ set(SRCS
ResourceEditWindow.cpp ResourceEditWindow.h
TestTurbobadger.h TestTurbobadger.cpp
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} WINDOWED NOINSTALL)
set(FILES
testturbobadger/demo01/ui_resources/test_textwindow.tb.txt
testturbobadger/demo01/ui_resources/test_tabcontainer01.tb.txt
testturbobadger/demo01/ui_resources/test_scrollcontainer.tb.txt
testturbobadger/demo01/ui_resources/test_select_advanced.tb.txt
testturbobadger/demo01/ui_resources/test_layout02.tb.txt
testturbobadger/demo01/ui_resources/test_animations.tb.txt
testturbobadger/demo01/ui_resources/test_ui.tb.txt
testturbobadger/demo01/ui_resources/test_layout01.tb.txt
testturbobadger/demo01/ui_resources/test_connections.tb.txt
testturbobadger/demo01/ui_resources/test_list_item.tb.txt
testturbobadger/demo01/ui_resources/test_select.tb.txt
testturbobadger/demo01/ui_resources/test_radio_checkbox.tb.txt
testturbobadger/demo01/ui_resources/resource_edit_test.tb.txt
testturbobadger/demo01/ui_resources/test_toggle_containers.tb.txt
testturbobadger/demo01/ui_resources/test_image_widget.tb.txt
testturbobadger/demo01/ui_resources/resource_edit_window.tb.txt
testturbobadger/demo01/ui_resources/test_scroller_snap.tb.txt
testturbobadger/demo01/ui_resources/test_skin_conditions02.tb.txt
testturbobadger/demo01/ui_resources/test_skin_conditions01.tb.txt
testturbobadger/demo01/ui_resources/test_batching01.tb.txt
testturbobadger/demo01/ui_resources/test_layout03.tb.txt
testturbobadger/demo01/language/lng_en.tb.txt
testturbobadger/demo01/language/lng_sv.tb.txt
testturbobadger/demo01/images/image_3.png
testturbobadger/demo01/images/image_1.png
testturbobadger/demo01/images/image_6.png
testturbobadger/demo01/images/image_2.png
testturbobadger/demo01/images/image_8.png
testturbobadger/demo01/images/image_5.png
testturbobadger/demo01/images/image_7.png
testturbobadger/demo01/images/image_4.png
testturbobadger/demo01/images/image_9.png
testturbobadger/demo01/skin/star_gray.png
testturbobadger/demo01/skin/star_gold@192.png
testturbobadger/demo01/skin/star_gold@384.png
testturbobadger/demo01/skin/icon128.png
testturbobadger/demo01/skin/star_gold.png
testturbobadger/demo01/skin/star_gray@384.png
testturbobadger/demo01/skin/remove.png
testturbobadger/demo01/skin/special_button_pressed.png
testturbobadger/demo01/skin/special_button.png
testturbobadger/demo01/skin/icon16.png
testturbobadger/demo01/skin/skin.tb.txt
testturbobadger/demo01/skin/star_gold@288.png
testturbobadger/demo01/skin/image_frame.png
testturbobadger/demo01/skin/bg_tile.png
testturbobadger/demo01/skin/star_gray@288.png
testturbobadger/demo01/skin/icon48.png
testturbobadger/demo01/skin/focus_r8.png
testturbobadger/demo01/skin/star_gray@192.png
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} FILES ${FILES} WINDOWED NOINSTALL)
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES turbobadger)

Some files were not shown because too many files have changed in this diff Show More