FIPS: removed fips - we are now cmake only

master
mgerhardy 2016-04-28 20:38:50 +02:00 committed by Martin Gerhardy
parent 0b02ea828e
commit 174120b3d3
68 changed files with 3886 additions and 1643 deletions

10
.gitignore vendored
View File

@ -1,5 +1,7 @@
#>fips
# this area is managed by fips, do not edit
.fips-*
*.pyc
#<fips
/build
/client
/server
/shapetool
/shadertool
/.project

View File

@ -1,33 +1,101 @@
cmake_minimum_required(VERSION 2.8)
get_filename_component(FIPS_ROOT_DIR "../fips" ABSOLUTE)
get_filename_component(ENGINE_ROOT_DIR "." ABSOLUTE)
include("${FIPS_ROOT_DIR}/cmake/fips.cmake")
include("${ENGINE_ROOT_DIR}/cmake/common.cmake")
include("${ENGINE_ROOT_DIR}/cmake/macros.cmake")
set(CMAKE_MODULE_PATH "${ENGINE_ROOT_DIR}/cmake")
include(CheckFunctionExists)
include(CheckLibraryExists)
cmake_minimum_required(VERSION 2.8.7)
project(engine)
set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Root dir")
set(SCRIPTS_CMAKE_DIR ${PROJECT_SOURCE_DIR}/cmake)
set(FIPS_EXCEPTIONS ON)
set(FIPS_UNITTESTS ON)
set(FIPS_RTTI ON)
set(TB_ENABLE_RTTI ON CACHE BOOL "Do not disable RTTI" FORCE)
option(TOOLS "Builds with tools" ON)
option(USE_CCACHE "Use ccache" ON)
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
# TODO: this is for the header only sauce lib
add_definitions("-Wall -Wextra -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-mismatched-tags")
if (NOT CMAKE_TOOLCHAIN_FILE)
if (WINDOWS)
include(${SCRIPTS_CMAKE_DIR}/toolchains/windows-toolchain.cmake)
elseif (DARWIN)
include(${SCRIPTS_CMAKE_DIR}/toolchains/darwin-toolchain.cmake)
else()
include(${SCRIPTS_CMAKE_DIR}/toolchains/linux-toolchain.cmake)
endif()
endif()
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Compile Type" FORCE)
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release MinSizeRel RelWithDebInfo)
if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(RELEASE False)
else()
set(RELEASE True)
endif()
message(STATUS "Place binaries in ${ROOT_DIR}")
# First for the generic no-config case (e.g. with mingw)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ROOT_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib)
# Second, for multi-config builds (e.g. msvc)
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${ROOT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib)
endforeach()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SCRIPTS_CMAKE_DIR})
set(CMAKE_VERBOSE_MAKEFILE ${VERBOSE})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (${CMAKE_EXTRA_GENERATOR} MATCHES "Eclipse CDT4")
message(STATUS "Generate eclipse projects")
set(CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES OFF)
set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT ON)
set(CMAKE_ECLIPSE_VERSION "4.3" CACHE STRING "Eclipse version")
set(CMAKE_CXX_COMPILER_ARG1 "-std=c++11" CACHE STRING "C++ version for Eclipse")
endif()
include(${SCRIPTS_CMAKE_DIR}/common.cmake)
include(${SCRIPTS_CMAKE_DIR}/macros.cmake)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(WINDOWS 1)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
set(LINUX 1)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(DARWIN 1)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LINUX 1)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
set(EMSCRIPTEN 1)
else()
message(WARNING "Unknown host system: ${CMAKE_SYSTEM_NAME}. Default to linux")
set(LINUX 1)
endif()
find_host_program(CCACHE "ccache")
if (CCACHE)
if (USE_CCACHE)
message(STATUS "Using ccache")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
endif()
else()
message(STATUS "ccache not found")
endif()
configure_file(${ROOT_DIR}/src/config.h.in ${CMAKE_BINARY_DIR}/config.h)
include_directories(${CMAKE_BINARY_DIR})
include_directories(src/modules)
include_directories(src/modules/ui)
fips_add_subdirectory(contrib/libs)
fips_setup(PROJECT engine)
gtest_suite_begin(tests TEMPLATE src/modules/core/tests/main.cpp.in)
fips_add_subdirectory(src)
gtest_suite_end(tests)
fips_finish()
add_subdirectory(contrib/libs)
copy_data_files(shared)
if (UNITTESTS)
enable_testing()
gtest_suite_begin(tests TEMPLATE src/modules/core/tests/main.cpp.in)
endif()
add_subdirectory(src)
if (UNITTESTS)
gtest_suite_end(tests)
endif()
copy_data_files(shared)

View File

@ -2,16 +2,15 @@ TARGET=
VERBOSE=
Q=@
LOCAL_CONFIG_DIR=~/.local/share/engine
BUILDDIR=build
all: run
.PHONY: build
build:
$(Q)./fips make
$(Q)mkdir -p $(BUILDDIR); cd $(BUILDDIR); cmake -G"Eclipse CDT4 - Unix Makefiles" ..; make
clean:
$(Q)./fips clean
$(Q)rm -f .fips-gen.py
$(Q)rm -f .fips-imports.cmake
$(Q)git clean -fdx .
clean-local-config:
$(Q)rm -r $(LOCAL_CONFIG_DIR)
@ -19,55 +18,26 @@ clean-local-config:
edit-local-config:
$(Q)$(EDITOR) $(LOCAL_CONFIG_DIR)/shapetool/shapetool.vars
eclipse:
$(Q)./fips set config linux-eclipse-debug
server: build
$(Q)./fips run server -- $(ARGS)
$(Q)./server $(ARGS)
client: build
$(Q)./fips run client -- $(ARGS)
$(Q)./client $(ARGS)
shapetool: build
$(Q)./fips run shapetool -- $(ARGS)
$(Q)./shapetool -set voxel-plainterrain false $(ARGS)
run: shapetool
runfast: build
$(Q)./fips run shapetool -- -set voxel-plainterrain true $(ARGS)
debugrunfast: build
$(Q)./fips gdb shapetool -- -set voxel-plainterrain true $(ARGS)
cubiquitytool: build
$(Q)./fips run cubiquitytool -- $(ARGS)
debugcubiquitytool: build
$(Q)./fips gdb cubiquitytool -- $(ARGS)
debugserver: build
$(Q)./fips gdb server -- $(ARGS)
debugclient: build
$(Q)./fips gdb client -- $(ARGS)
debugshapetool: build
$(Q)./fips gdb shapetool -- $(ARGS)
$(Q)./shapetool -set voxel-plainterrain true $(ARGS)
tests: build
$(Q)./fips run tests -- $(ARGS)
tests-list: build
$(Q)./fips run tests -- --gtest_list_tests $(ARGS)
tests-filter: build
$(Q)./fips run tests -- --gtest_filter=$(FILTER) $(ARGS)
$(Q)./tests -- $(ARGS)
remotery:
$(Q)xdg-open file://$(CURDIR)/tools/remotery/index.html
tags: forceme
.PHONY: tags
tags:
$(Q)ctags -R src
forceme:

View File

@ -1,8 +1,11 @@
SET(DEFAULT_LUA_EXECUTABLE lua lua5.2 lua5.3)
include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
set(DEFAULT_LUA_EXECUTABLE lua lua5.2 lua5.3)
macro(copy_data_files TARGET)
add_custom_target(copy-data-${TARGET} ALL
COMMAND cmake -E copy_directory "${FIPS_PROJECT_DIR}/data/${TARGET}/" ${FIPS_DEPLOY_DIR}/${CMAKE_PROJECT_NAME}/${FIPS_CONFIG}
COMMAND cmake -E copy_directory "${ROOT_DIR}/data/${TARGET}/" ${CMAKE_BINARY_DIR}
COMMENT "Copy ${TARGET} data files...")
endmacro()
@ -17,7 +20,7 @@ macro(check_lua_files TARGET)
${_file}
COMMAND ${LUA_EXECUTABLE} ${_file}
COMMENT "Validate ${_file}"
WORKING_DIRECTORY ${FIPS_PROJECT_DIR}/data/${TARGET}
WORKING_DIRECTORY ${ROOT_DIR}/data/${TARGET}
)
add_dependencies(${TARGET} ${_file})
endforeach()
@ -28,6 +31,16 @@ endmacro()
include(CheckCCompilerFlag)
check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11)
check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if (COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif (COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
# thread sanitizer doesn't work in combination with address and leak
set(CMAKE_REQUIRED_FLAGS "-Werror -fsanitize=thread")
check_c_compiler_flag("-fsanitize=thread" HAVE_FLAG_SANITIZE_THREAD)

View File

@ -1,9 +1,11 @@
set(GAME_BASE_DIR data)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(TOOLS_DIR ${FIPS_PROJECT_DIR}/tools/win32 CACHE STRING "" FORCE)
set(TOOLS_DIR ${ROOT_DIR}/tools/win32 CACHE STRING "" FORCE)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(TOOLS_DIR ${FIPS_PROJECT_DIR}/tools/osx CACHE STRING "" FORCE)
set(TOOLS_DIR ${ROOT_DIR}/tools//osx CACHE STRING "" FORCE)
else()
set(TOOLS_DIR ${FIPS_PROJECT_DIR}/tools/linux CACHE STRING "" FORCE)
set(TOOLS_DIR ${ROOT_DIR}/tools//linux CACHE STRING "" FORCE)
endif()
macro(var_global VARIABLES)
@ -13,22 +15,31 @@ macro(var_global VARIABLES)
endforeach()
endmacro()
# some cross compiling toolchains define this
if(NOT COMMAND find_host_program)
macro(find_host_program)
find_program(${ARGN})
endmacro()
endif()
macro(check_glsl_files TARGET)
set(files ${ARGV})
list(REMOVE_AT files 0)
find_program(GLSL_VALIDATOR_EXECUTABLE NAMES glslangValidator PATHS ${TOOLS_DIR})
if (GLSL_VALIDATOR_EXECUTABLE)
message("${GLSL_VALIDATOR_EXECUTABLE} found - executing in ${FIPS_PROJECT_DIR}/data/${TARGET}/shaders")
foreach(_file ${files})
add_custom_target(
${TARGET}_${_file}_shader_validation
COMMENT "Validate ${_file}"
COMMAND ${FIPS_DEPLOY_DIR}/${CMAKE_PROJECT_NAME}/${FIPS_CONFIG}/shadertool ${GLSL_VALIDATOR_EXECUTABLE} ${_file}
DEPENDS shadertool
WORKING_DIRECTORY ${FIPS_DEPLOY_DIR}/${CMAKE_PROJECT_NAME}/${FIPS_CONFIG}/shaders
)
add_dependencies(${TARGET} shadertool ${TARGET}_${_file}_shader_validation)
endforeach()
message("${GLSL_VALIDATOR_EXECUTABLE} found - executing in ${ROOT_DIR}/data/${TARGET}/shaders")
if (IS_DIRECTORY ${ROOT_DIR}/data/${TARGET}/shaders)
foreach(_file ${files})
add_custom_target(
${TARGET}_${_file}_shader_validation
COMMENT "Validate ${_file}"
COMMAND ${CMAKE_BINARY_DIR}/shadertool ${GLSL_VALIDATOR_EXECUTABLE} ${_file}
DEPENDS shadertool
WORKING_DIRECTORY ${ROOT_DIR}/data/${TARGET}/shaders
)
add_dependencies(${TARGET} shadertool ${TARGET}_${_file}_shader_validation)
endforeach()
endif()
else()
message(WARNING "No ${GLSL_VALIDATOR_EXECUTABLE} found at ${TOOLS_DIR}")
endif()
@ -162,7 +173,7 @@ macro(engine_add_library)
set_property(TARGET ${_ADDLIB_LIB} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${${PREFIX}_INCLUDE_DIRS})
endif()
else()
message(WARNING "Use the bundled lib ${_ADDLIB_LIB}")
message(STATUS "Use the bundled lib ${_ADDLIB_LIB}")
add_library(${_ADDLIB_LIB} STATIC ${_ADDLIB_SRCS})
target_include_directories(${_ADDLIB_LIB} ${_ADDLIB_PUBLICHEADER} ${PROJECT_SOURCE_DIR}/src/libs/${_ADDLIB_LIB})
set_target_properties(${_ADDLIB_LIB} PROPERTIES COMPILE_DEFINITIONS "${_ADDLIB_DEFINES}")
@ -178,66 +189,7 @@ endmacro()
# Macros for generating google unit tests.
#-------------------------------------------------------------------------------
set(FIPS_GOOGLETESTDIR ${CMAKE_CURRENT_LIST_DIR})
#-------------------------------------------------------------------------------
# gtest_begin(name)
# Begin defining a unit test.
#
macro(gtest_begin name)
set(options NO_TEMPLATE)
set(oneValueArgs TEMPLATE)
set(multiValueArgs)
cmake_parse_arguments(_gt "${options}" "${oneValueArgs}" "" ${ARGN})
if (_gt_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "gtest_begin(): called with invalid args '${_gt_UNPARSED_ARGUMENTS}'")
endif()
set(FipsAddFilesEnabled 1)
fips_reset(${CurTargetName}Test)
if (FIPS_OSX)
set(CurAppType "windowed")
else()
set(CurAppType "cmdline")
endif()
endmacro()
#-------------------------------------------------------------------------------
# gtest_end()
# End defining a unittest named 'name' from sources in 'dir'
#
macro(gtest_end)
if (FIPS_CMAKE_VERBOSE)
message("Unit Test: name=" ${CurTargetName})
endif()
# add googletest lib dependency
fips_deps(gtest)
if (NOT _gt_NO_TEMPLATE)
set(main_path ${CMAKE_CURRENT_BINARY_DIR}/${CurTargetName}_main.cpp)
if (_gt_TEMPLATE)
configure_file(${_gt_TEMPLATE} ${main_path})
else()
configure_file(${FIPS_GOOGLETESTDIR}/main.cpp.in ${main_path})
endif()
list(APPEND CurSources ${main_path})
endif()
# generate a command line app
fips_end_app()
set_target_properties(${CurTargetName} PROPERTIES FOLDER "tests")
# add as cmake unit test
add_test(NAME ${CurTargetName} COMMAND ${CurTargetName})
# if configured, start the app as post-build-step
if (FIPS_UNITTESTS_RUN_AFTER_BUILD)
add_custom_command (TARGET ${CurTargetName} POST_BUILD COMMAND ${CurTargetName})
endif()
set(FipsAddFilesEnabled 1)
endmacro()
set(GOOGLETESTDIR ${CMAKE_CURRENT_LIST_DIR})
#-------------------------------------------------------------------------------
# gtest_suite_begin(name)
@ -252,11 +204,6 @@ macro(gtest_suite_begin name)
if (${name}_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "gtest_suite_begin(): called with invalid args '${${name}_UNPARSED_ARGUMENTS}'")
endif()
if (FIPS_OSX)
set(${name}_CurAppType "windowed")
else()
set(${name}_CurAppType "cmdline")
endif()
set_property(GLOBAL PROPERTY ${name}_Sources "")
set_property(GLOBAL PROPERTY ${name}_Deps "")
endmacro()
@ -292,11 +239,7 @@ endmacro()
# End defining a unittest suite
#
macro(gtest_suite_end name)
if (FIPS_CMAKE_VERBOSE)
message("Unit Test: name=" ${name})
endif()
fips_begin_app(${name} ${${name}_CurAppType})
project(${name} cmdline)
get_property(srcs GLOBAL PROPERTY ${name}_Sources)
get_property(deps GLOBAL PROPERTY ${name}_Deps)
@ -310,23 +253,43 @@ macro(gtest_suite_end name)
list(APPEND srcs ${main_path})
endif()
fips_files(${srcs})
add_executable(${name} ${srcs})
# add googletest lib dependency
fips_deps(gtest ${deps})
target_link_libraries(${name} gtest ${deps})
# generate a command line app
fips_end_app()
set_target_properties(${name} PROPERTIES FOLDER "tests")
# silence some warnings
if(FIPS_LINUX)
set_target_properties(${name} PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
endif()
# add as cmake unit test
add_test(NAME ${name} COMMAND ${name})
# if configured, start the app as post-build-step
if (FIPS_UNITTESTS_RUN_AFTER_BUILD)
add_custom_command (TARGET ${name} POST_BUILD COMMAND ${name})
endif()
set(FipsAddFilesEnabled 1)
endmacro()
#
# set up the binary for the application. This will also set up platform specific stuff for you
#
# Example: engine_add_executable(TARGET SomeTargetName SRCS Source.cpp Main.cpp WINDOWED)
#
macro(engine_add_executable)
set(_OPTIONS_ARGS WINDOWED)
set(_ONE_VALUE_ARGS TARGET)
set(_MULTI_VALUE_ARGS SRCS)
cmake_parse_arguments(_EXE "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
if (_EXE_WINDOWED)
if (WINDOWS)
add_executable(${_EXE_TARGET} WIN32 ${_EXE_SRCS})
if (MSVC)
set_target_properties(${_EXE_TARGET} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
endif()
else()
add_executable(${_EXE_TARGET} ${_EXE_SRCS})
endif()
else()
add_executable(${_EXE_TARGET} ${_EXE_SRCS})
if (WINDOWS)
if (MSVC)
set_target_properties(${_EXE_TARGET} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
endif()
endif()
endif()
endmacro()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(CMAKE_XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS "NO")
set(CMAKE_XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI "NO")
set(CMAKE_C_FLAGS "-fstrict-aliasing -Wno-multichar -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-unused-volatile-lvalue -Wno-deprecated-writable-strings -Wno-unknown-warning-option")
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_C_FLAGS_DEBUG "-O0 -DDEBUG -g")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wnon-virtual-dtor")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_EXE_LINKER_FLAGS "-ObjC -dead_strip -lpthread")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")

View File

@ -0,0 +1,213 @@
# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
# files which are included with CMake 2.8.4
# It has been altered for iOS development
# Options:
#
# IOS_PLATFORM = OS (default) or SIMULATOR or SIMULATOR64
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
#
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
# If set manually, it will override the default location and force the user of a particular Developer Platform
#
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
# If set manually, this will force the use of a specific SDK version
# Macros:
#
# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE)
# A convenience macro for setting xcode specific properties on targets
# example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1")
#
# find_host_package (PROGRAM ARGS)
# A macro used to find executable programs on the host system, not within the iOS environment.
# Thanks to the android-cmake project for providing the command
set(CMAKE_MACOSX_BUNDLE YES)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
# Standard settings
set (CMAKE_SYSTEM_NAME Darwin)
set (CMAKE_SYSTEM_VERSION 1)
set (UNIX True)
set (APPLE True)
set (IOS True)
# Required as of cmake 2.8.10
set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE)
# Determine the cmake host system version so we know where to find the iOS SDKs
find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
if (CMAKE_UNAME)
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
endif (CMAKE_UNAME)
# Force the compilers to gcc for iOS
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(/usr/bin/gcc GNU)
CMAKE_FORCE_CXX_COMPILER(/usr/bin/g++ GNU)
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
# Skip the platform compiler checks for cross compiling
set (CMAKE_CROSSCOMPILING TRUE)
set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)
# All iOS/Darwin specific settings - some may be redundant
set (CMAKE_SHARED_LIBRARY_PREFIX "lib")
set (CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
set (CMAKE_SHARED_MODULE_PREFIX "lib")
set (CMAKE_SHARED_MODULE_SUFFIX ".so")
set (CMAKE_MODULE_EXISTS 1)
set (CMAKE_DL_LIBS "")
set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
# Hidden visibilty is required for cxx on iOS
set (CMAKE_C_FLAGS_INIT "")
set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden -isysroot ${CMAKE_OSX_SYSROOT}")
set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
set (CMAKE_PLATFORM_HAS_INSTALLNAME 1)
set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree
# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache
# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
# hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex
if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
# Setup iOS platform unless specified manually with IOS_PLATFORM
if (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
# Setup building for arm64 or not
if (NOT DEFINED BUILD_ARM64)
set (BUILD_ARM64 true)
endif (NOT DEFINED BUILD_ARM64)
set (BUILD_ARM64 ${BUILD_ARM64} CACHE STRING "Build arm64 arch or not")
# Check the platform selection and setup for developer root
if (${IOS_PLATFORM} STREQUAL "OS")
set (IOS_PLATFORM_LOCATION "iPhoneOS.platform")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
set (SIMULATOR true)
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR64")
set (SIMULATOR true)
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
else (${IOS_PLATFORM} STREQUAL "OS")
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif (${IOS_PLATFORM} STREQUAL "OS")
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
# Note Xcode 4.3 changed the installation location, choose the most recent one available
exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR)
set (XCODE_POST_43_ROOT "${CMAKE_XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
set (XCODE_PRE_43_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
if (EXISTS ${XCODE_POST_43_ROOT})
set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_POST_43_ROOT})
elseif(EXISTS ${XCODE_PRE_43_ROOT})
set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_PRE_43_ROOT})
endif (EXISTS ${XCODE_POST_43_ROOT})
endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT
if (NOT DEFINED CMAKE_IOS_SDK_ROOT)
file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*")
if (_CMAKE_IOS_SDKS)
list (SORT _CMAKE_IOS_SDKS)
list (REVERSE _CMAKE_IOS_SDKS)
list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)
else (_CMAKE_IOS_SDKS)
message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
endif (_CMAKE_IOS_SDKS)
message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
# Set the sysroot default to the most recent SDK
set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
# set the architecture for iOS
if ("${IOS_PLATFORM}" STREQUAL "OS")
set (IOS_ARCH armv7 armv7s arm64)
elseif ("${IOS_PLATFORM}" STREQUAL "SIMULATOR")
set (IOS_ARCH i386)
elseif ("${IOS_PLATFORM}" STREQUAL "SIMULATOR64")
set (IOS_ARCH x86_64)
endif ("${IOS_PLATFORM}" STREQUAL "OS")
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string "Build architecture for iOS")
# Set the find root to the iOS developer roots and to user defined paths
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root")
# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
# only search the iOS sdks, not the remainder of the host filesystem
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# This little macro lets you set any XCode specific property
macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
endmacro (set_xcode_property)
# This macro lets you find executable programs on the host system
macro (find_host_package)
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
set (IOS FALSE)
find_package(${ARGN})
set (IOS TRUE)
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endmacro (find_host_package)

View File

@ -0,0 +1,65 @@
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckCCompilerFlag)
include(CheckIncludeFiles)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
set(CMAKE_REQUIRED_FLAGS "-Werror -fsanitize=undefined")
check_c_compiler_flag("-faddress-sanitizer" HAVE_FLAG_SANITIZE_UNDEFINED)
set(CMAKE_REQUIRED_FLAGS "-Werror -fsanitize=address")
check_c_compiler_flag("-fsanitize=address" HAVE_FLAG_SANITIZE_ADDRESS)
unset(CMAKE_REQUIRED_FLAGS)
if (SANITIZER)
if (HAVE_FLAG_SANITIZE_UNDEFINED)
set(SANITIZE_FLAGS "${SANITIZE_FLAGS} -fsanitize=undefined")
endif()
if (HAVE_FLAG_SANITIZE_ADDRESS)
set(SANITIZE_FLAGS "${SANITIZE_FLAGS} -fsanitize=address")
endif()
endif()
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${SANITIZE_FLAGS}")
if (CMAKE_COMPILER_IS_GNUCXX)
check_function_exists(__atomic_fetch_add_4 HAVE___ATOMIC_FETCH_ADD_4)
if (NOT HAVE___ATOMIC_FETCH_ADD_4)
check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
if (HAVE_LIBATOMIC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -latomic")
endif()
endif()
endif()
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} ${CMAKE_DL_LIBS}")
check_include_files(execinfo.h HAVE_EXECINFO_H)
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses)
if (NOT CURSES_FOUND)
set(CURSES_LIBRARIES "")
endif()
set(HAVE_NCURSES_H ${CURSES_HAVE_NCURSES_H})
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCKGETTIME)
if (HAVE_CLOCKGETTIME)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lrt")
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lrt")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lrt")
else()
# might also be in libc
check_library_exists(c clock_gettime "time.h" HAVE_CLOCKGETTIME)
endif()
# TODO: fix most of these and activate them one by one
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wcast-align -Wpointer-arith -Wno-deprecated-declarations -Wno-long-long -Wno-non-virtual-dtor -Wno-cast-qual -Wno-multichar -Wno-shadow -Wno-sign-compare -Wno-unused-parameter -Wreturn-type -Wwrite-strings -Wno-variadic-macros -Wno-unknown-pragmas")
if (CMAKE_USE_PTHREADS_INIT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
endif()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE -D_FORTIFY_SOURCE=2 -DNDEBUG -fexpensive-optimizations -fomit-frame-pointer -O3")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -fno-omit-frame-pointer ${SANITIZE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_C_FLAGS_DEBUG}")

View File

@ -0,0 +1,14 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-qual -Wcast-align -Wpointer-arith -Wno-long-long -Wno-multichar -Wshadow -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wreturn-type -Wwrite-strings -Wno-variadic-macros -Wno-unknown-pragmas")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -DDEBUG -g")
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lppapi_gles2 -lppapi -lpthread")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lppapi_cpp ${CMAKE_C_STANDARD_LIBRARIES}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -Wnon-virtual-dtor")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_C_FLAGS_DEBUG}")

View File

@ -0,0 +1,30 @@
# see https://cmake.org/Wiki/CMake_Useful_Variables
# see https://cmake.org/Wiki/CMake_Cross_Compiling
if ("$ENV{MARVELL_SDK_PATH}" STREQUAL "")
message(FATAL_ERROR "You need to export the sdk path of your steamlink directory to the env var MARVELL_SDK_PATH")
endif()
set(MARVELL_SDK_PATH $ENV{MARVELL_SDK_PATH})
set(CMAKE_SYSROOT ${MARVELL_SDK_PATH}/rootfs)
set(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_CROSS_COMPILING ON) # Workaround for http://www.cmake.org/Bug/view.php?id=14075
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
set(STEAMLINK 1)
set(CMAKE_PREFIX_PATH ${MARVELL_SDK_PATH}/toolchain/bin)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_STRIP armv7a-cros-linux-gnueabi-strip)
set(CMAKE_AS armv7a-cros-linux-gnueabi-as)
set(CMAKE_C_COMPILER_INIT armv7a-cros-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER_INIT armv7a-cros-linux-gnueabi-g++)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
set(CMAKE_C_FLAGS_INIT "--sysroot=${CMAKE_SYSROOT} -marm -mfloat-abi=hard")
set(CMAKE_CXX_FLAGS_INIT "--sysroot=${CMAKE_SYSROOT} -marm -mfloat-abi=hard")
set(ENV{PKG_CONFIG_PATH} "")
set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_SYSROOT}/usr/lib/pkgconfig")
add_definitions(-DSTEAMLINK)

View File

@ -0,0 +1,35 @@
set(CMAKE_SYSTEM_NAME Windows)
if (MSYS OR MINGW)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-qual -Wcast-align -Wpointer-arith -Wshadow -Wall -Wextra -Wreturn-type -Wwrite-strings -Wno-unused-parameter -DWINVER=0x501")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ftree-vectorize -msse3 -DNDEBUG -D_FORTIFY_SOURCE=2")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -DDEBUG=1 -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -Wnon-virtual-dtor")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mwindows -static-libgcc -static-libstdc++")
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lmingw32 -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -lws2_32 -liphlpapi")
set(CMAKE_CXX_STANDARD_LIBRARIES ${CMAKE_CXX_STANDARD_LIBRARIES} ${CMAKE_C_STANDARD_LIBRARIES})
elseif (MSVC)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} kernel32.lib user32.lib gdi32.lib winspool.lib winmm.lib imm32.lib version.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib dbghelp.lib wsock32.lib ws2_32.lib iphlpapi.lib rpcrt4.lib wininet.lib")
set(CMAKE_CXX_STANDARD_LIBRARIES ${CMAKE_CXX_STANDARD_LIBRARIES} ${CMAKE_C_STANDARD_LIBRARIES})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /TC /errorReport:queue /DWIN32")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Zi /Od /Oy- /MTd /D_DEBUG /DDEBUG=1")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Ox /MT /DNDEBUG ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP /TP /DWIN32")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zi /Od /Oy- /MTd /D_DEBUG /DDEBUG=1")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox /MT /DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO /STACK:5000000")
if (CMAKE_CL_64)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /machine:x64")
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /machine:x86")
endif()
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG")
endif()

View File

@ -1,10 +1,9 @@
fips_ide_group(Libs)
fips_add_subdirectory(glm)
fips_add_subdirectory(zlib)
fips_add_subdirectory(libenet)
fips_add_subdirectory(lua53)
fips_add_subdirectory(flatbuffers)
fips_add_subdirectory(sauce)
fips_add_subdirectory(turbobadger)
fips_add_subdirectory(gtest)
fips_add_subdirectory(sdl2)
add_subdirectory(glm)
add_subdirectory(zlib)
add_subdirectory(libenet)
add_subdirectory(lua53)
add_subdirectory(flatbuffers)
add_subdirectory(sauce)
add_subdirectory(turbobadger)
add_subdirectory(gtest)
add_subdirectory(sdl2)

View File

@ -8,4 +8,5 @@ engine_add_library(
)
if (NOT SAUCE_FOUND)
target_include_directories(sauce PUBLIC .)
# target_compile_options(sauce PUBLIC "-Wno-deprecated-declarations -Wno-shadow")
endif()

View File

@ -1,42 +1,11 @@
/* sauce/config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* define if the compiler supports basic C++11 syntax */
#undef HAVE_CXX11
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
@ -65,8 +34,5 @@
your system. */
#undef PTHREAD_CREATE_JOINABLE
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION

View File

@ -135,7 +135,6 @@ public:
template<typename Dependency>
void inject(typename i::Key<Dependency>::Ptr & injected, std::string const name = unnamed()) {
typedef typename i::Key<Dependency>::Ptr Ptr;
typedef typename i::Key<Dependency>::Normalized Normalized;
sauce::auto_ptr<i::Lock> lock = acquireLock();

File diff suppressed because it is too large Load Diff

View File

@ -89,15 +89,22 @@ $var As = [[$for j, [[A$j]]]]
$var as = [[$for j, [[a$j]]]]
$var Passed_passed = [[$if i == 0 [[Passed]] $else [[Passed passed]]]]
// $i
/* *INDENT-OFF* */
template<typename Parameters, typename Return_$comma_typename_As>
class ApplyFunction<Parameters, Return_(*)($As)> {
public:
typedef Return_ Return;
typedef Return_ Return;[[$for j [[
typedef typename Parameters::template Parameter<A$j, $j> P$j;
]]]]
typedef Return_ (* Signature)($As);
typedef Return_ (* Function)([[$for j, [[
typename Parameters::template Parameter<A$j, $j>::Type
typename P$j::Type
]]]]);
private:
@ -113,16 +120,18 @@ public:
template<typename Passed>
Return apply($Passed_passed) {
return function([[$for j, [[
[[$for j [[
typename P$j::Type const & a$j(P$j().template yield<Passed>(passed));
(typename Parameters::template Parameter<A$j, $j>()).template yield<Passed>(passed)
]]]]);
]]]]
return function($as);
}
template<typename Passed>
void observe($Passed_passed) {
[[$for j [[
(typename Parameters::template Parameter<A$j, $j>()).template observe<Passed>(passed);
P$j().template observe<Passed>(passed);
]]]]
}
@ -132,11 +141,15 @@ public:
/* *INDENT-OFF* */
template<typename Parameters$comma_typename_As>
class ApplyVoidFunction<Parameters, void(*)($As)> {
public:
public:[[$for j [[
typedef typename Parameters::template Parameter<A$j, $j> P$j;
]]]]
typedef void (* Signature)($As);
typedef void (* Function)([[$for j, [[
typename Parameters::template Parameter<A$j, $j>::Type
typename P$j::Type
]]]]);
private:
@ -152,10 +165,12 @@ public:
template<typename Passed>
void apply($Passed_passed) {
function([[$for j, [[
[[$for j [[
typename P$j::Type const & a$j(P$j().template yield<Passed>(passed));
(typename Parameters::template Parameter<A$j, $j>()).template yield<Passed>(passed)
]]]]);
]]]]
function($as);
}
};
/* *INDENT-ON* */
@ -165,11 +180,15 @@ template<typename Parameters, typename Return_, typename Receiver_$comma_typenam
class ApplyMethod<Parameters, Return_(Receiver_::*)($As)> {
public:
typedef Return_ Return;
typedef Receiver_ Receiver;
typedef Receiver_ Receiver;[[$for j [[
typedef typename Parameters::template Parameter<A$j, $j> P$j;
]]]]
typedef Return_ (Receiver_::* Signature)($As);
typedef Return_ (Receiver_::* Method)([[$for j, [[
typename Parameters::template Parameter<A$j, $j>::Type
typename P$j::Type
]]]]);
private:
@ -185,16 +204,18 @@ public:
template<typename Passed>
Return apply(Receiver & receiver, $Passed_passed) {
return (receiver.*method)([[$for j, [[
[[$for j [[
typename P$j::Type const & a$j(P$j().template yield<Passed>(passed));
(typename Parameters::template Parameter<A$j, $j>()).template yield<Passed>(passed)
]]]]);
]]]]
return (receiver.*method)($as);
}
template<typename Passed>
void observe($Passed_passed) {
[[$for j [[
(typename Parameters::template Parameter<A$j, $j>()).template observe<Passed>(passed);
P$j().template observe<Passed>(passed);
]]]]
}
@ -204,7 +225,11 @@ public:
/* *INDENT-OFF* */
template<typename Parameters, typename Allocator_, typename Constructed_$comma_typename_As>
class ApplyConstructor<Parameters, Constructed_($As), Allocator_> {
typedef Constructed_ (Constructor)($As);
typedef Constructed_ (Constructor)($As);[[$for j [[
typedef typename Parameters::template Parameter<A$j, $j> P$j;
]]]]
typedef typename Allocator_::template rebind<Constructed_>::other Allocator;
Allocator allocator;
@ -222,16 +247,18 @@ public:
template<typename Passed>
Constructed * apply($Passed_passed) {
return new(allocator.allocate(1)) Constructed([[$for j, [[
[[$for j [[
typename P$j::Type const & a$j(P$j().template yield<Passed>(passed));
(typename Parameters::template Parameter<A$j, $j>()).template yield<Passed>(passed)
]]]]);
]]]]
return new(allocator.allocate(1)) Constructed($as);
}
template<typename Passed>
void observe($Passed_passed) {
[[$for j [[
(typename Parameters::template Parameter<A$j, $j>()).template observe<Passed>(passed);
P$j().template observe<Passed>(passed);
]]]]
}

View File

@ -46,12 +46,12 @@ public:
/**
* An injection that provides Providers for an already-bound dependency.
*/
template<typename Dependency, typename Name>
class ImplicitProviderBinding: public Binding<Named<Provider<Dependency>, Name>, NoScope> {
template<typename BoundDependency, typename Name>
class ImplicitProviderBinding: public Binding<Named<Provider<BoundDependency>, Name>, NoScope> {
typedef typename Key<Dependency>::Normalized Normalized;
typedef typename Key<BoundDependency>::Normalized Normalized;
typedef typename ResolvedBinding<Normalized>::BindingPtr ProvidedBindingPtr;
typedef Named<Provider<Dependency>, Name> ProviderDependency;
typedef Named<Provider<BoundDependency>, Name> ProviderDependency;
typedef typename Key<ProviderDependency>::Ptr ProviderPtr;
ProvidedBindingPtr providedBinding;
@ -63,11 +63,10 @@ public:
typedef typename ResolvedBinding<ProviderDependency>::BindingPtr BindingPtr;
ImplicitProviderBinding(ProvidedBindingPtr providedBinding):
Binding<Named<Provider<Dependency>, Name>, NoScope>(),
providedBinding(providedBinding) {}
void inject(ProviderPtr & injected, BindingPtr, InjectorPtr injector) const {
injected.reset(new ImplicitProvider<Dependency, Name>(providedBinding, injector));
injected.reset(new ImplicitProvider<BoundDependency, Name>(providedBinding, injector));
}
};

View File

@ -32,7 +32,7 @@ class MethodBinding: public Binding<Dependency, NoScope> {
}
};
friend class MethodBindingFriend;
friend struct MethodBindingFriend;
struct InjectParameters {
struct Passed {

View File

@ -37,7 +37,7 @@ class NewBinding: public Binding<Dependency, Scope> {
}
};
friend class NewBindingFriend;
friend struct NewBindingFriend;
struct InjectParameters {
struct Passed {

View File

@ -43,7 +43,7 @@ public:
/**
* Set the dynamic name of this binding.
*/
virtual void setName(std::string) = 0;
virtual void setName(std::string const) = 0;
/**
* The NamedTypeId of the (hidden) provided interface.

View File

@ -17,45 +17,31 @@ namespace internal {
* to an Injector. They are values (not types) with a total ordering. This
* allows us to do arbitrary binding resolution, but only at runtime.
*
* Concretely, they are function pointers: the total ordering is that of the
* Concretely, they are pointers: the total ordering is that of the
* address space. No RTTI (i.e. typeid) is used.
*/
typedef void (*TypeSignature)();
/**
* The template that generates TypeSignatures.
*/
template<typename Type>
void TypeSignatureFactory() {}
/**
* A TypeSignature equipped with specific helper methods dealing in the hidden type.
*/
class TypeId {
TypeSignature signature;
TypeId():
signature(NULL) {}
void const * id;
protected:
explicit TypeId(TypeSignature const & signature):
signature(signature) {}
explicit TypeId(void const * id):
id(id) {}
public:
virtual ~TypeId() {}
bool operator==(TypeId const & id) const {
return signature == id.signature;
bool operator==(TypeId const & typeId) const {
return id == typeId.id;
}
bool operator!=(TypeId const & id) const {
return signature != id.signature;
bool operator!=(TypeId const & typeId) const {
return id != typeId.id;
}
bool operator<(TypeId const & id) const {
return signature < id.signature;
bool operator<(TypeId const & typeId) const {
return id < typeId.id;
}
/**
@ -76,8 +62,8 @@ template<typename Type>
class ResolvedTypeId: public TypeId {
friend TypeId typeIdOf<Type>();
ResolvedTypeId():
TypeId(&TypeSignatureFactory<Type>) {}
explicit ResolvedTypeId(void const * id):
TypeId(id) {}
public:
@ -91,7 +77,8 @@ public:
*/
template<typename Type>
TypeId typeIdOf() {
return ResolvedTypeId<Type>();
static char idLocation = 0;
return ResolvedTypeId<Type>(&idLocation);
}
/**

View File

@ -1,4 +1,24 @@
find_package(SDL2)
set(SDL2_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
# General source files
file(GLOB SOURCE_FILES
${SDL2_SOURCE_DIR}/src/*.c
${SDL2_SOURCE_DIR}/src/atomic/*.c
${SDL2_SOURCE_DIR}/src/audio/*.c
${SDL2_SOURCE_DIR}/src/cpuinfo/*.c
${SDL2_SOURCE_DIR}/src/dynapi/*.c
${SDL2_SOURCE_DIR}/src/events/*.c
${SDL2_SOURCE_DIR}/src/file/*.c
${SDL2_SOURCE_DIR}/src/libm/*.c
${SDL2_SOURCE_DIR}/src/render/*.c
${SDL2_SOURCE_DIR}/src/render/*/*.c
${SDL2_SOURCE_DIR}/src/stdlib/*.c
${SDL2_SOURCE_DIR}/src/thread/*.c
${SDL2_SOURCE_DIR}/src/timer/*.c
${SDL2_SOURCE_DIR}/src/video/*.c)
if (NOT SDL2_FOUND)
include(CheckFunctionExists)
include(CheckLibraryExists)
@ -299,22 +319,6 @@ set(SDL_STATIC ON CACHE BOOL "Build a static version of the library")
dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF)
# General source files
file(GLOB SOURCE_FILES
${SDL2_SOURCE_DIR}/src/*.c
${SDL2_SOURCE_DIR}/src/atomic/*.c
${SDL2_SOURCE_DIR}/src/audio/*.c
${SDL2_SOURCE_DIR}/src/cpuinfo/*.c
${SDL2_SOURCE_DIR}/src/dynapi/*.c
${SDL2_SOURCE_DIR}/src/events/*.c
${SDL2_SOURCE_DIR}/src/file/*.c
${SDL2_SOURCE_DIR}/src/libm/*.c
${SDL2_SOURCE_DIR}/src/render/*.c
${SDL2_SOURCE_DIR}/src/render/*/*.c
${SDL2_SOURCE_DIR}/src/stdlib/*.c
${SDL2_SOURCE_DIR}/src/thread/*.c
${SDL2_SOURCE_DIR}/src/timer/*.c
${SDL2_SOURCE_DIR}/src/video/*.c)
if(ASSERTIONS STREQUAL "auto")
@ -1472,6 +1476,8 @@ else()
set(DEFINES "")
endif()
endif(NOT SDL2_FOUND)
engine_add_library(
LIB sdl2
SRCS ${SOURCE_FILES} ${SDLMAIN_SOURCES} ${PLATFORM_SRCS}

View File

@ -1,162 +1,143 @@
fips_begin_module(turbobadger)
fips_dir(tb/animation)
fips_files(
tb_animation_utils.h
tb_animation.cpp
tb_widget_animation.h
tb_animation.h
tb_widget_animation.cpp
)
fips_dir(tb/utf8)
fips_files(
utf8.cpp
utf8.h
)
fips_dir(tb/renderers)
fips_files(
tb_renderer_gl.cpp
tb_renderer_batcher.cpp
tb_renderer_gl.h
tb_renderer_batcher.h
)
fips_dir(tb/thirdparty)
fips_files(
stb_image.h
stb_truetype.h
)
fips_dir(tb/parser)
fips_files(
tb_parser.h
tb_parser.cpp
)
fips_dir(tb/image)
fips_files(
tb_image_manager.cpp
tb_image_widget.cpp
tb_image_widget.h
tb_image_manager.h
)
fips_dir(tb)
fips_files(
tb_addon.cpp
tb_bitmap_fragment.cpp
tb_clipboard_dummy.cpp
tb_clipboard_glfw.cpp
tb_clipboard_win.cpp
tb_color.cpp
tb_core.cpp
tb_debug.cpp
tb_dimension.cpp
tb_editfield.cpp
tb_file_posix.cpp
tb_font_renderer.cpp
tb_font_renderer_freetype.cpp
tb_font_renderer_stb.cpp
tb_font_renderer_tbbf.cpp
tb_geometry.cpp
tb_hash.cpp
tb_hashtable.cpp
tb_id.cpp
tb_image_loader_stb.cpp
tb_inline_select.cpp
tb_language.cpp
tb_layout.cpp
tb_linklist.cpp
tb_list.cpp
tb_menu_window.cpp
tb_message_window.cpp
tb_msg.cpp
tb_node_ref_tree.cpp
tb_node_tree.cpp
tb_object.cpp
tb_popup_window.cpp
tb_renderer.cpp
tb_scroll_container.cpp
tb_scroller.cpp
tb_select.cpp
tb_select_item.cpp
tb_skin.cpp
tb_skin_util.cpp
tb_str.cpp
tb_style_edit.cpp
tb_style_edit_content.cpp
tb_system_android.cpp
tb_system_linux.cpp
tb_system_win.cpp
tb_tab_container.cpp
tb_tempbuffer.cpp
tb_toggle_container.cpp
tb_value.cpp
tb_widget_skin_condition_context.cpp
tb_widget_value.cpp
tb_widgets.cpp
tb_widgets_common.cpp
tb_widgets_listener.cpp
tb_widgets_reader.cpp
tb_window.cpp
tb_addon.h
tb_bitmap_fragment.h
tb_color.h
tb_config.h
tb_core.h
tb_debug.h
tb_dimension.h
tb_editfield.h
tb_font_desc.h
tb_font_renderer.h
tb_geometry.h
tb_hash.h
tb_hashtable.h
tb_id.h
tb_inline_select.h
tb_language.h
tb_layout.h
tb_linklist.h
tb_list.h
tb_menu_window.h
tb_message_window.h
tb_msg.h
tb_node_ref_tree.h
tb_node_tree.h
tb_object.h
tb_popup_window.h
tb_renderer.h
tb_scroll_container.h
tb_scroller.h
tb_select.h
tb_select_item.h
tb_skin.h
tb_skin_util.h
tb_sort.h
tb_str.h
tb_style_edit.h
tb_style_edit_content.h
tb_system.h
tb_tab_container.h
tb_tempbuffer.h
tb_toggle_container.h
tb_types.h
tb_value.h
tb_widget_skin_condition_context.h
tb_widget_value.h
tb_widgets.h
tb_widgets_common.h
tb_widgets_listener.h
tb_widgets_reader.h
tb_window.h
)
fips_end_module()
set(SRCS
tb/animation/tb_animation_utils.h
tb/animation/tb_animation.cpp
tb/animation/tb_widget_animation.h
tb/animation/tb_animation.h
tb/animation/tb_widget_animation.cpp
tb/utf8/utf8.cpp
tb/utf8/utf8.h
tb/renderers/tb_renderer_gl.cpp
tb/renderers/tb_renderer_batcher.cpp
tb/renderers/tb_renderer_gl.h
tb/renderers/tb_renderer_batcher.h
tb/thirdparty/stb_image.h
tb/thirdparty/stb_truetype.h
tb/parser/tb_parser.h
tb/parser/tb_parser.cpp
tb/image/tb_image_manager.cpp
tb/image/tb_image_widget.cpp
tb/image/tb_image_widget.h
tb/image/tb_image_manager.h
tb/tb_addon.cpp
tb/tb_bitmap_fragment.cpp
tb/tb_clipboard_dummy.cpp
tb/tb_clipboard_glfw.cpp
tb/tb_clipboard_win.cpp
tb/tb_color.cpp
tb/tb_core.cpp
tb/tb_debug.cpp
tb/tb_dimension.cpp
tb/tb_editfield.cpp
tb/tb_file_posix.cpp
tb/tb_font_renderer.cpp
tb/tb_font_renderer_freetype.cpp
tb/tb_font_renderer_stb.cpp
tb/tb_font_renderer_tbbf.cpp
tb/tb_geometry.cpp
tb/tb_hash.cpp
tb/tb_hashtable.cpp
tb/tb_id.cpp
tb/tb_image_loader_stb.cpp
tb/tb_inline_select.cpp
tb/tb_language.cpp
tb/tb_layout.cpp
tb/tb_linklist.cpp
tb/tb_list.cpp
tb/tb_menu_window.cpp
tb/tb_message_window.cpp
tb/tb_msg.cpp
tb/tb_node_ref_tree.cpp
tb/tb_node_tree.cpp
tb/tb_object.cpp
tb/tb_popup_window.cpp
tb/tb_renderer.cpp
tb/tb_scroll_container.cpp
tb/tb_scroller.cpp
tb/tb_select.cpp
tb/tb_select_item.cpp
tb/tb_skin.cpp
tb/tb_skin_util.cpp
tb/tb_str.cpp
tb/tb_style_edit.cpp
tb/tb_style_edit_content.cpp
tb/tb_system_android.cpp
tb/tb_system_linux.cpp
tb/tb_system_win.cpp
tb/tb_tab_container.cpp
tb/tb_tempbuffer.cpp
tb/tb_toggle_container.cpp
tb/tb_value.cpp
tb/tb_widget_skin_condition_context.cpp
tb/tb_widget_value.cpp
tb/tb_widgets.cpp
tb/tb_widgets_common.cpp
tb/tb_widgets_listener.cpp
tb/tb_widgets_reader.cpp
tb/tb_window.cpp
tb/tb_addon.h
tb/tb_bitmap_fragment.h
tb/tb_color.h
tb/tb_config.h
tb/tb_core.h
tb/tb_debug.h
tb/tb_dimension.h
tb/tb_editfield.h
tb/tb_font_desc.h
tb/tb_font_renderer.h
tb/tb_geometry.h
tb/tb_hash.h
tb/tb_hashtable.h
tb/tb_id.h
tb/tb_inline_select.h
tb/tb_language.h
tb/tb_layout.h
tb/tb_linklist.h
tb/tb_list.h
tb/tb_menu_window.h
tb/tb_message_window.h
tb/tb_msg.h
tb/tb_node_ref_tree.h
tb/tb_node_tree.h
tb/tb_object.h
tb/tb_popup_window.h
tb/tb_renderer.h
tb/tb_scroll_container.h
tb/tb_scroller.h
tb/tb_select.h
tb/tb_select_item.h
tb/tb_skin.h
tb/tb_skin_util.h
tb/tb_sort.h
tb/tb_str.h
tb/tb_style_edit.h
tb/tb_style_edit_content.h
tb/tb_system.h
tb/tb_tab_container.h
tb/tb_tempbuffer.h
tb/tb_toggle_container.h
tb/tb_types.h
tb/tb_value.h
tb/tb_widget_skin_condition_context.h
tb/tb_widget_value.h
tb/tb_widgets.h
tb/tb_widgets_common.h
tb/tb_widgets_listener.h
tb/tb_widgets_reader.h
tb/tb_window.h
)
engine_add_library(
LIB turbobadger
SRCS ${SRCS}
GCCCFLAGS "-Wno-shadow -Wno-unused-but-set-variable -Wno-maybe-uninitialized -Wno-array-bounds")
target_include_directories(turbobadger PUBLIC tb)
if (FIPS_WINDOWS)
add_definitions(-DGLFW_EXPOSE_NATIVE_WIN32)
add_definitions(-DGLFW_EXPOSE_NATIVE_WGL)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(-DTB_USE_CURRENT_DIRECTORY)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(-DTB_USE_CURRENT_DIRECTORY)
elseif (FIPS_LINUX)
elseif (FIPS_MACOS)
add_definitions(-DMACOSX)
add_definitions(-Dnullptr=0)
add_definitions(-DTB_USE_CURRENT_DIRECTORY)
add_definitions(-DMACOSX)
add_definitions(-Dnullptr=0)
add_definitions(-DTB_USE_CURRENT_DIRECTORY)
endif()

17
fips
View File

@ -1,17 +0,0 @@
#!/usr/bin/env python
"""fips main entry"""
import os
import sys
import subprocess
proj_path = os.path.dirname(os.path.abspath(__file__))
fips_path = os.path.dirname(proj_path) + '/fips'
if not os.path.isdir(fips_path) :
print("\033[93m=== cloning fips build system to '{}':\033[0m".format(fips_path))
subprocess.call(['git', 'clone', 'https://github.com/floooh/fips.git', fips_path])
sys.path.insert(0,fips_path)
try :
from mod import fips
except ImportError :
print("\033[91m[ERROR]\033[0m failed to initialize fips build system in '{}'".format(proj_path))
sys.exit(10)
fips.run(fips_path, proj_path, sys.argv)

View File

@ -1,47 +0,0 @@
"""
Compiles the fbs files into *.h files
"""
Version = None
import os
import shutil
import platform
import genutil
import subprocess
from mod import log
#-------------------------------------------------------------------------------
def get_flatc_path() :
path = os.path.dirname(os.path.abspath(__file__))
if platform.system() == 'Windows' :
path += '/../tools/win32/'
elif platform.system() == 'Darwin' :
path += '/../tools/osx/'
elif platform.system() == 'Linux' :
path += '/../tools/linux/'
else :
error("Unknown host system {}".format(platform.system()))
return path + 'flatc'
#-------------------------------------------------------------------------------
def run_flatc(input_file, out_hdr) :
cmd = [
get_flatc_path(),
'-c',
'--gen-includes',
'-o', os.path.dirname(input_file),
input_file
]
subprocess.call(cmd)
shutil.move(os.path.splitext(input_file)[0] + "_generated.h", out_hdr)
#-------------------------------------------------------------------------------
def generate(input_file, out_src, out_hdr) :
"""
:param input_file: flatbuffers fbs file
:param out_src: must be None
:param out_hdr: path for output header files
"""
if genutil.isDirty(Version, [input_file], [out_hdr]) :
flatc_path = get_flatc_path()
run_flatc(input_file, out_hdr)

View File

@ -1,4 +0,0 @@
exports:
header-dirs:
- src/modules
- src/modules/ui

View File

@ -1,5 +1,7 @@
fips_add_subdirectory(modules)
fips_add_subdirectory(client)
fips_add_subdirectory(server)
fips_add_subdirectory(rcon)
fips_add_subdirectory(tools)
add_subdirectory(modules)
add_subdirectory(client)
add_subdirectory(server)
#add_subdirectory(rcon)
if (TOOLS)
add_subdirectory(tools)
endif()

View File

@ -1,32 +1,22 @@
fips_begin_app(client windowed)
fips_files(
Client.h Client.cpp
)
fips_dir(sauce)
fips_files(
ClientModule.h
ClientInjector.h
)
fips_dir(network)
fips_files(
AuthFailedHandler.h
ClientNetworkModule.h
NpcSpawnHandler.h
SeedHandler.cpp SeedHandler.h
UserSpawnHandler.h
EntityUpdateHandler.h
EntityRemoveHandler.h
)
fips_dir(ui)
fips_files(
LoginWindow.h
HudWindow.h
AuthFailedWindow.h
DisconnectWindow.h
)
fips_deps(frontend util)
copy_data_files(client)
fips_end_app()
check_glsl_files(client world mesh ui)
project(client)
set(SRCS
Client.h Client.cpp
sauce/ClientModule.h
sauce/ClientInjector.h
network/AuthFailedHandler.h
network/ClientNetworkModule.h
network/NpcSpawnHandler.h
network/SeedHandler.cpp
network/SeedHandler.h
network/UserSpawnHandler.h
network/EntityUpdateHandler.h
network/EntityRemoveHandler.h
ui/LoginWindow.h
ui/HudWindow.h
ui/AuthFailedWindow.h
ui/DisconnectWindow.h
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} WINDOWED)
target_link_libraries(${PROJECT_NAME} frontend util)
check_glsl_files(${PROJECT_NAME} world mesh ui)
copy_data_files(${PROJECT_NAME})

View File

@ -1,5 +1,5 @@
#include "Client.h"
#include "network/messages/ClientMessages.h"
#include "network/messages/ClientMessages_generated.h"
#include "ui/LoginWindow.h"
#include "ui/DisconnectWindow.h"
#include "ui/AuthFailedWindow.h"

View File

@ -3,7 +3,7 @@
#include <cstdlib>
#include <SDL.h>
#include "network/messages/ServerMessages.h"
#include "network/messages/ServerMessages_generated.h"
#include "frontend/WorldShader.h"
#include "frontend/MeshShader.h"
#include "frontend/ClientEntity.h"

View File

@ -2,7 +2,7 @@
#include "../Client.h"
#include "network/NetworkModule.h"
#include "network/messages/ServerMessages.h"
#include "network/messages/ServerMessages_generated.h"
#include "SeedHandler.h"
#include "AuthFailedHandler.h"
#include "EntityRemoveHandler.h"

View File

@ -2,8 +2,8 @@
#include "network/Network.h"
#include "network/IMsgProtocolHandler.h"
#include "network/messages/ServerMessages.h"
#include "network/messages/ClientMessages.h"
#include "network/messages/ServerMessages_generated.h"
#include "network/messages/ClientMessages_generated.h"
#include "../Client.h"
template<class MSGTYPE>

View File

@ -1,7 +1,7 @@
#include "SeedHandler.h"
#include "core/App.h"
#include "core/Var.h"
#include "network/messages/ServerMessages.h"
#include "network/messages/ServerMessages_generated.h"
#include "voxel/WorldEvents.h"
void SeedHandler::execute(ENetPeer* peer, const void* raw) {

0
src/config.h.in Normal file
View File

View File

@ -1,17 +1,16 @@
fips_ide_group(Modules)
fips_add_subdirectory(core)
fips_add_subdirectory(io)
fips_add_subdirectory(video)
fips_add_subdirectory(ui)
fips_add_subdirectory(network)
fips_add_subdirectory(image)
fips_add_subdirectory(noise)
fips_add_subdirectory(voxel)
fips_add_subdirectory(util)
fips_add_subdirectory(attrib)
fips_add_subdirectory(cooldown)
fips_add_subdirectory(ai)
fips_add_subdirectory(backend)
fips_add_subdirectory(frontend)
fips_add_subdirectory(commonlua)
fips_add_subdirectory(persistence)
add_subdirectory(core)
add_subdirectory(io)
add_subdirectory(video)
add_subdirectory(ui)
add_subdirectory(network)
add_subdirectory(image)
add_subdirectory(noise)
add_subdirectory(voxel)
add_subdirectory(util)
add_subdirectory(attrib)
add_subdirectory(cooldown)
add_subdirectory(ai)
add_subdirectory(backend)
add_subdirectory(frontend)
add_subdirectory(commonlua)
add_subdirectory(persistence)

View File

@ -1,140 +1,108 @@
fips_begin_module(ai)
fips_files(
AI.cpp AI.h
AIRegistry.cpp AIRegistry.h
IAIFactory.h
ICharacter.h
SimpleAI.h
)
fips_dir(group)
fips_files(
GroupMgr.cpp GroupMgr.h
)
fips_dir(server)
fips_files(
AIUpdateNodeMessage.h
AIAddNodeMessage.h
AIDeleteNodeMessage.h
AIChangeMessage.h
AICharacterDetailsMessage.h
AICharacterStaticMessage.h
AINamesMessage.h
AIPauseMessage.h
AISelectMessage.h
AIStateMessage.h
AIStepMessage.h
AIStubTypes.h
ChangeHandler.cpp ChangeHandler.h
IProtocolHandler.h
IProtocolMessage.h
Network.cpp Network.h
PauseHandler.cpp PauseHandler.h
ProtocolHandlerRegistry.h
ProtocolMessageFactory.cpp ProtocolMessageFactory.h
ResetHandler.cpp ResetHandler.h
SelectHandler.cpp SelectHandler.h
Server.cpp Server.h
StepHandler.cpp StepHandler.h
UpdateNodeHandler.cpp UpdateNodeHandler.h
DeleteNodeHandler.cpp DeleteNodeHandler.h
AddNodeHandler.cpp AddNodeHandler.h
)
fips_dir(zone)
fips_files(
Zone.cpp Zone.h
)
fips_dir(filter)
fips_files(
IFilter.h
SelectEmpty.cpp SelectEmpty.h
SelectGroupLeader.cpp SelectGroupLeader.h
SelectGroupMembers.cpp SelectGroupMembers.h
SelectHighestAggro.cpp SelectHighestAggro.h
SelectZone.cpp SelectZone.h
)
fips_dir(tree)
fips_files(
Fail.cpp Fail.h
Idle.cpp Idle.h
Invert.cpp Invert.h
ITask.cpp ITask.h
ITimedNode.cpp ITimedNode.h
Limit.cpp Limit.h
Parallel.cpp Parallel.h
Print.cpp Print.h
PrioritySelector.cpp PrioritySelector.h
ProbabilitySelector.cpp ProbabilitySelector.h
RandomSelector.cpp RandomSelector.h
Selector.h
Sequence.cpp Sequence.h
Steer.cpp Steer.h
Succeed.cpp Succeed.h
TreeNode.cpp TreeNode.h
TreeNodeParser.cpp TreeNodeParser.h
)
fips_dir(tree/loaders)
fips_files(
ITreeLoader.h
)
fips_dir(tree/loaders/lua)
fips_files(
LUACondition.h
LUA.cpp LUA.h
LUAFunctions.h
LUANode.cpp LUANode.h
LUATree.cpp LUATree.h
LUATreeLoader.cpp LUATreeLoader.h
LUACondition.h
)
fips_dir(conditions)
fips_files(
And.cpp And.h
ConditionParser.cpp ConditionParser.h
False.cpp False.h
Filter.cpp Filter.h
HasEnemies.cpp HasEnemies.h
ICondition.cpp ICondition.h
IsCloseToGroup.cpp IsCloseToGroup.h
IsGroupLeader.cpp IsGroupLeader.h
IsInGroup.cpp IsInGroup.h
Not.cpp Not.h
Or.cpp Or.h
True.cpp True.h
)
fips_dir(common)
fips_files(
IFactoryRegistry.h
IParser.h
IPrintable.h
Math.h
MemoryAllocator.h
MoveVector.h
NonCopyable.h
Random.h
String.h
Thread.h
ThreadPool.h
ThreadScheduler.h
Types.h
)
fips_dir(movement)
fips_files(
GroupFlee.h
GroupSeek.h
SelectionFlee.h
SelectionSeek.h
Steering.cpp Steering.h
TargetFlee.h
TargetSeek.h
Wander.h
WeightedSteering.h
)
fips_dir(aggro)
fips_files(
AggroMgr.cpp AggroMgr.h
Entry.h
)
fips_deps(lua53)
fips_end_module()
target_include_directories(ai PUBLIC .)
target_compile_definitions(ai PRIVATE -DAI_EXCEPTIONS=0)
set(SRCS
AI.cpp AI.h
AIRegistry.cpp AIRegistry.h
IAIFactory.h
ICharacter.h
SimpleAI.h
group/GroupMgr.cpp group/GroupMgr.h
server/AIUpdateNodeMessage.h
server/AIAddNodeMessage.h
server/AIDeleteNodeMessage.h
server/AIChangeMessage.h
server/AICharacterDetailsMessage.h
server/AICharacterStaticMessage.h
server/AINamesMessage.h
server/AIPauseMessage.h
server/AISelectMessage.h
server/AIStateMessage.h
server/AIStepMessage.h
server/AIStubTypes.h
server/ChangeHandler.cpp server/ChangeHandler.h
server/IProtocolHandler.h
server/IProtocolMessage.h
server/Network.cpp server/Network.h
server/PauseHandler.cpp server/PauseHandler.h
server/ProtocolHandlerRegistry.h
server/ProtocolMessageFactory.cpp server/ProtocolMessageFactory.h
server/ResetHandler.cpp server/ResetHandler.h
server/SelectHandler.cpp server/SelectHandler.h
server/Server.cpp server/Server.h
server/StepHandler.cpp server/StepHandler.h
server/UpdateNodeHandler.cpp server/UpdateNodeHandler.h
server/DeleteNodeHandler.cpp server/DeleteNodeHandler.h
server/AddNodeHandler.cpp server/AddNodeHandler.h
zone/Zone.cpp zone/Zone.h
filter/IFilter.h
filter/SelectEmpty.cpp filter/SelectEmpty.h
filter/SelectGroupLeader.cpp filter/SelectGroupLeader.h
filter/SelectGroupMembers.cpp filter/SelectGroupMembers.h
filter/SelectHighestAggro.cpp filter/SelectHighestAggro.h
filter/SelectZone.cpp filter/SelectZone.h
tree/Fail.cpp tree/Fail.h
tree/Idle.cpp tree/Idle.h
tree/Invert.cpp tree/Invert.h
tree/ITask.cpp tree/ITask.h
tree/ITimedNode.cpp tree/ITimedNode.h
tree/Limit.cpp tree/Limit.h
tree/Parallel.cpp tree/Parallel.h
tree/Print.cpp tree/Print.h
tree/PrioritySelector.cpp tree/PrioritySelector.h
tree/ProbabilitySelector.cpp tree/ProbabilitySelector.h
tree/RandomSelector.cpp tree/RandomSelector.h
tree/Selector.h
tree/Sequence.cpp tree/Sequence.h
tree/Steer.cpp tree/Steer.h
tree/Succeed.cpp tree/Succeed.h
tree/TreeNode.cpp tree/TreeNode.h
tree/TreeNodeParser.cpp tree/TreeNodeParser.h
tree/loaders/ITreeLoader.h
tree/loaders/lua/LUACondition.h
tree/loaders/lua/LUA.cpp tree/loaders/lua/LUA.h
tree/loaders/lua/LUAFunctions.h
tree/loaders/lua/LUANode.cpp tree/loaders/lua/LUANode.h
tree/loaders/lua/LUATree.cpp tree/loaders/lua/LUATree.h
tree/loaders/lua/LUATreeLoader.cpp tree/loaders/lua/LUATreeLoader.h
tree/loaders/lua/LUACondition.h
conditions/And.cpp conditions/And.h
conditions/ConditionParser.cpp conditions/ConditionParser.h
conditions/False.cpp conditions/False.h
conditions/Filter.cpp conditions/Filter.h
conditions/HasEnemies.cpp conditions/HasEnemies.h
conditions/ICondition.cpp conditions/ICondition.h
conditions/IsCloseToGroup.cpp conditions/IsCloseToGroup.h
conditions/IsGroupLeader.cpp conditions/IsGroupLeader.h
conditions/IsInGroup.cpp conditions/IsInGroup.h
conditions/Not.cpp conditions/Not.h
conditions/Or.cpp conditions/Or.h
conditions/True.cpp conditions/True.h
common/IFactoryRegistry.h
common/IParser.h
common/IPrintable.h
common/Math.h
common/MemoryAllocator.h
common/MoveVector.h
common/NonCopyable.h
common/Random.h
common/String.h
common/Thread.h
common/ThreadPool.h
common/ThreadScheduler.h
common/Types.h
movement/GroupFlee.h
movement/GroupSeek.h
movement/SelectionFlee.h
movement/SelectionSeek.h
movement/Steering.cpp movement/Steering.h
movement/TargetFlee.h
movement/TargetSeek.h
movement/Wander.h
movement/WeightedSteering.h
aggro/AggroMgr.cpp aggro/AggroMgr.h
aggro/Entry.h
)
set(LIB ai)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} lua53)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
target_include_directories(${LIB} PUBLIC .)
target_compile_definitions(${LIB} PRIVATE -DAI_EXCEPTIONS=0)

View File

@ -1,12 +1,15 @@
fips_begin_module(attrib)
fips_files(
Attributes.h Attributes.cpp
Types.h
Container.h Container.cpp
ContainerProvider.h ContainerProvider.cpp
)
fips_deps(core commonlua)
fips_end_module()
set(SRCS
Attributes.h Attributes.cpp
Types.h
Container.h Container.cpp
ContainerProvider.h ContainerProvider.cpp
)
set(LIB attrib)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} core commonlua)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
gtest_suite_files(tests tests/AttributesTest.cpp)
gtest_suite_deps(tests attrib)
gtest_suite_files(tests
tests/AttributesTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -1,80 +1,48 @@
fips_begin_module(backend)
fips_dir(spawn)
fips_files(
SpawnMgr.cpp SpawnMgr.h
)
set(SRCS
spawn/SpawnMgr.cpp spawn/SpawnMgr.h
loop/ServerLoop.cpp loop/ServerLoop.h
entity/ai/AICharacter.cpp entity/ai/AICharacter.h
entity/ai/AIRegistry.cpp entity/ai/AIRegistry.h
entity/ai/AILoader.h
network/UserConnectHandler.cpp network/UserConnectHandler.h
network/UserDisconnectHandler.h
network/AttackHandler.h
network/ServerNetworkModule.h
network/MoveHandler.h
network/IUserProtocolHandler.h
entity/ai/condition/IsCloseToSelection.h
entity/ai/condition/IsSelectionAlive.h
entity/ai/condition/IsOnCooldown.h
entity/ai/action/Task.h
entity/ai/action/GoHome.h
entity/ai/action/Spawn.h
entity/ai/action/Die.h
entity/ai/action/SetPointOfInterest.h
entity/ai/action/AttackOnSelection.h
entity/ai/action/TriggerCooldown.cpp entity/ai/action/TriggerCooldown.h
entity/ai/action/TriggerCooldownOnSelection.cpp entity/ai/action/TriggerCooldownOnSelection.h
entity/ai/filter/SelectPrey.cpp entity/ai/filter/SelectPrey.h
entity/ai/filter/SelectVisible.cpp entity/ai/filter/SelectVisible.h
entity/ai/filter/SelectIncreasePartner.cpp entity/ai/filter/SelectIncreasePartner.h
entity/ai/filter/SelectNpcsOfTypes.h
storage/UserStore.cpp storage/UserStore.h
storage/Persister.cpp storage/Persister.h
storage/StoreCmd.cpp storage/StoreCmd.h
poi/PoiProvider.cpp poi/PoiProvider.h
entity/Npc.cpp entity/Npc.h
entity/User.cpp entity/User.h
entity/EntityId.h
entity/EntityStorage.cpp entity/EntityStorage.h
entity/Entity.cpp entity/Entity.h
)
set(LIB backend)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} network io core util voxel attrib cooldown persistence ai)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
fips_dir(loop)
fips_files(
ServerLoop.cpp ServerLoop.h
)
fips_dir(entity/ai)
fips_files(
AICharacter.cpp AICharacter.h
AIRegistry.cpp AIRegistry.h
AILoader.h
)
fips_dir(network)
fips_files(
UserConnectHandler.cpp UserConnectHandler.h
UserDisconnectHandler.h
AttackHandler.h
ServerNetworkModule.h
MoveHandler.h
IUserProtocolHandler.h
)
fips_dir(entity/ai/condition)
fips_files(
IsCloseToSelection.h
IsSelectionAlive.h
IsOnCooldown.h
)
fips_dir(entity/ai/action)
fips_files(
Task.h
GoHome.h
Spawn.h
Die.h
SetPointOfInterest.h
AttackOnSelection.h
TriggerCooldown.cpp TriggerCooldown.h
TriggerCooldownOnSelection.cpp TriggerCooldownOnSelection.h
)
fips_dir(entity/ai/filter)
fips_files(
SelectPrey.cpp SelectPrey.h
SelectVisible.cpp SelectVisible.h
SelectIncreasePartner.cpp SelectIncreasePartner.h
SelectNpcsOfTypes.h
)
fips_dir(storage)
fips_files(
UserStore.cpp UserStore.h
Persister.cpp Persister.h
StoreCmd.cpp StoreCmd.h
)
fips_dir(poi)
fips_files(
PoiProvider.cpp PoiProvider.h
)
fips_dir(entity)
fips_files(
Npc.cpp Npc.h
User.cpp User.h
EntityId.h
EntityStorage.cpp EntityStorage.h
Entity.cpp Entity.h
)
fips_deps(network io core util voxel attrib cooldown persistence ai)
fips_end_module()
gtest_suite_files(tests tests/SpawnMgrTest.cpp tests/PoiProviderTest.cpp tests/PersisterTest.cpp)
gtest_suite_deps(tests backend)
gtest_suite_files(tests
tests/SpawnMgrTest.cpp
tests/PoiProviderTest.cpp
tests/PersisterTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -50,7 +50,7 @@ UserPtr EntityStorage::login(ENetPeer* peer, const std::string& email, const std
auto i = _users.find(id);
if (i == _users.end()) {
static const std::string name = "NONAME";
UserPtr u(new User(peer, id, name, _messageSender, _world, _timeProvider, _containerProvider, _poiProvider));
const UserPtr& u = std::make_shared<User>(peer, id, name, _messageSender, _world, _timeProvider, _containerProvider, _poiProvider);
registerUser(u);
return u;
}

View File

@ -2,8 +2,8 @@
#include "network/IMsgProtocolHandler.h"
#include "backend/entity/User.h"
#include "network/messages/ServerMessages.h"
#include "network/messages/ClientMessages.h"
#include "network/messages/ServerMessages_generated.h"
#include "network/messages/ClientMessages_generated.h"
using namespace network::messages::server;
using namespace network::messages::client;

View File

@ -1,7 +1,7 @@
#pragma once
#include "network/NetworkModule.h"
#include "network/messages/ClientMessages.h"
#include "network/messages/ClientMessages_generated.h"
#include "UserConnectHandler.h"
#include "UserDisconnectHandler.h"

View File

@ -1,6 +1,6 @@
#include "UserConnectHandler.h"
#include "network/messages/ClientMessages.h"
#include "network/messages/ServerMessages.h"
#include "network/messages/ClientMessages_generated.h"
#include "network/messages/ServerMessages_generated.h"
#include "backend/entity/User.h"
#include "core/Var.h"

View File

@ -73,7 +73,7 @@ int SpawnMgr::spawn(ai::Zone& zone, network::messages::NpcType type, int amount,
return 0;
}
for (int x = 0; x < amount; ++x) {
NpcPtr npc(new Npc(type, _entityStorage, behaviour, _world, _messageSender, _timeProvider, _containerProvider, _poiProvider));
const NpcPtr& npc = std::make_shared<Npc>(type, _entityStorage, behaviour, _world, _messageSender, _timeProvider, _containerProvider, _poiProvider);
npc->init(pos);
// now let it tick
zone.addAI(npc->ai());

View File

@ -6,7 +6,7 @@
#include "backend/entity/EntityStorage.h"
#include "backend/entity/ai/AILoader.h"
#include "backend/poi/PoiProvider.h"
#include "network/messages/ServerMessages.h"
#include "network/messages/ServerMessages_generated.h"
namespace backend {

View File

@ -1,9 +1,12 @@
fips_begin_module(commonlua)
fips_files(
LUA.h LUA.cpp
)
fips_deps(core lua53)
fips_end_module()
set(SRCS
LUA.h LUA.cpp
)
set(LIB commonlua)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} core lua53)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
gtest_suite_files(tests tests/LUATest.cpp)
gtest_suite_deps(tests commonlua)
gtest_suite_files(tests
tests/LUATest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -1,11 +1,14 @@
fips_begin_module(cooldown)
fips_files(
CooldownMgr.h CooldownMgr.cpp
CooldownType.h
CooldownTriggerState.h
)
fips_deps(core)
fips_end_module()
set(SRCS
CooldownMgr.h CooldownMgr.cpp
CooldownType.h
CooldownTriggerState.h
)
set(LIB cooldown)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} core)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
gtest_suite_files(tests tests/CooldownMgrTest.cpp)
gtest_suite_deps(tests cooldown)
gtest_suite_files(tests
tests/CooldownMgrTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -1,31 +1,43 @@
fips_begin_module(core)
fips_files(
Rect.h
App.cpp App.h
ByteStream.cpp ByteStream.h
Common.h
Command.h Command.cpp
EventBus.h
IFactoryRegistry.h
NonCopyable.h
String.cpp String.h
Input.h
QuadTree.h
Singleton.h
Set.h
Random.cpp Random.h
Log.cpp Log.h
Var.cpp Var.h
Remotery.c Remotery.h
Trace.cpp Trace.h
Process.cpp Process.h
ThreadPool.h
Tokenizer.h
TimeProvider.h TimeProvider.cpp
)
fips_deps(io glm ${CMAKE_DL_LIBS} sauce)
fips_end_module()
set_target_properties(core PROPERTIES COMPILE_FLAGS "-DRMT_ENABLED=1")
set(SRCS
Rect.h
App.cpp App.h
ByteStream.cpp ByteStream.h
Common.h
Command.h Command.cpp
EventBus.h
IFactoryRegistry.h
NonCopyable.h
String.cpp String.h
Input.h
QuadTree.h
Singleton.h
Set.h
Random.cpp Random.h
Log.cpp Log.h
Var.cpp Var.h
Remotery.c Remotery.h
Trace.cpp Trace.h
Process.cpp Process.h
ThreadPool.h
Tokenizer.h
TimeProvider.h TimeProvider.cpp
)
set(LIB core)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} io glm ${CMAKE_DL_LIBS} sauce)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
set_target_properties(${LIB} PROPERTIES COMPILE_FLAGS "-DRMT_ENABLED=1")
gtest_suite_files(tests tests/AbstractTest.cpp tests/RectTest.cpp tests/ByteStreamTest.cpp tests/ThreadPoolTest.cpp tests/EventBusTest.cpp tests/QuadTreeTest.cpp tests/VarTest.cpp tests/CommandTest.cpp tests/SetTest.cpp tests/TokenizerTest.cpp)
gtest_suite_deps(tests core)
gtest_suite_files(tests
tests/AbstractTest.cpp
tests/RectTest.cpp
tests/ByteStreamTest.cpp
tests/ThreadPoolTest.cpp
tests/EventBusTest.cpp
tests/QuadTreeTest.cpp
tests/VarTest.cpp
tests/CommandTest.cpp
tests/SetTest.cpp
tests/TokenizerTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -35,7 +35,7 @@ public:
#if RWLOCKDEBUG > 0
auto end = std::chrono::system_clock::now();
std::chrono::duration<double> diff = end - start;
core_assert_msg(diff.count() < RWLOCKDEBUG, "%s is blocked longer than %ims", _name.c_str(), RWLOCKDEBUG);
core_assert_msg(diff.count() < RWLOCKDEBUG, "%s is blocked longer than %lims", _name.c_str(), RWLOCKDEBUG);
#endif
}
++_readers;
@ -61,7 +61,7 @@ public:
#if RWLOCKDEBUG > 0
auto end = std::chrono::system_clock::now();
std::chrono::duration<double> diff = end - start;
core_assert_msg(diff.count() < RWLOCKDEBUG, "%s is blocked longer than %ims", _name.c_str(), RWLOCKDEBUG);
core_assert_msg(diff.count() < RWLOCKDEBUG, "%s is blocked longer than %lims", _name.c_str(), RWLOCKDEBUG);
#endif
}
while (_readers > 0) {
@ -69,7 +69,7 @@ public:
#if RWLOCKDEBUG > 0
auto end = std::chrono::system_clock::now();
std::chrono::duration<double> diff = end - start;
core_assert_msg(diff.count() < RWLOCKDEBUG, "%s is blocked longer than %ims", _name.c_str(), RWLOCKDEBUG);
core_assert_msg(diff.count() < RWLOCKDEBUG, "%s is blocked longer than %lims", _name.c_str(), RWLOCKDEBUG);
#endif
}
core_assert_msg(_recursive == 0, "Invalid state for unlocking a write lock of %s", _name.c_str());

View File

@ -1,13 +1,14 @@
fips_begin_module(frontend)
fips_files(
ClientEntity.h ClientEntity.cpp
ClientEntityId.h
Movement.h
MeshShader.h MeshShader.cpp
WorldRenderer.h WorldRenderer.cpp
WorldShader.h WorldShader.cpp
TerrainShader.h TerrainShader.cpp
ColoredCubesShader.h ColoredCubesShader.cpp
)
fips_deps(ui network voxel cooldown)
fips_end_module()
set(SRCS
ClientEntity.h ClientEntity.cpp
ClientEntityId.h
Movement.h
MeshShader.h MeshShader.cpp
WorldRenderer.h WorldRenderer.cpp
WorldShader.h WorldShader.cpp
TerrainShader.h TerrainShader.cpp
ColoredCubesShader.h ColoredCubesShader.cpp
)
set(LIB frontend)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} ui network voxel cooldown)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})

View File

@ -1,6 +1,7 @@
fips_begin_module(image)
fips_files(
Image.cpp Image.h
)
fips_deps(core io)
fips_end_module()
set(SRCS
Image.cpp Image.h
)
set(LIB image)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} core io)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})

View File

@ -1,9 +1,10 @@
fips_begin_module(io)
fips_files(
EventHandler.cpp EventHandler.h IEventObserver.h
Filesystem.cpp Filesystem.h
File.cpp File.h
IOResource.h
)
fips_deps(sdl2 sauce)
fips_end_module()
set(SRCS
EventHandler.cpp EventHandler.h IEventObserver.h
Filesystem.cpp Filesystem.h
File.cpp File.h
IOResource.h
)
set(LIB io)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} sdl2 sauce)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})

View File

@ -1,14 +1,33 @@
fips_begin_module(network)
fips_files(
IProtocolHandler.h
IMsgProtocolHandler.h
Network.cpp Network.h
MessageSender.h MessageSender.cpp
NetworkEvents.h
ProtocolHandlerRegistry.h
macro(network_generate HEADER OUTDIR DEFINITION)
add_custom_command(
OUTPUT ${OUTDIR}/${HEADER}
COMMAND ${TOOLS_DIR}/flatc -c --gen-includes -o ${OUTDIR} definitions/${DEFINITION}
DEPENDS definitions/${DEFINITION}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating source code for ${DEFINITION}"
)
fips_deps(core enet flatbuffers)
fips_generate(TYPE FlatC FROM definitions/Shared.fbs HEADER ../messages/Shared_generated.h)
fips_generate(TYPE FlatC FROM definitions/ClientMessages.fbs HEADER ../messages/ClientMessages.h)
fips_generate(TYPE FlatC FROM definitions/ServerMessages.fbs HEADER ../messages/ServerMessages.h)
fips_end_module()
endmacro()
set(SRCS
IProtocolHandler.h
IMsgProtocolHandler.h
Network.cpp Network.h
MessageSender.h MessageSender.cpp
NetworkEvents.h
ProtocolHandlerRegistry.h
)
set(LIB network)
add_library(${LIB} ${SRCS})
add_custom_target(GenerateNetworkMessages
DEPENDS messages/Shared_generated.h messages/ClientMessages_generated.h messages/ServerMessages_generated.h
COMMENT "Generate network messages"
)
network_generate(Shared_generated.h messages Shared.fbs)
network_generate(ClientMessages_generated.h messages ClientMessages.fbs)
network_generate(ServerMessages_generated.h messages ServerMessages.fbs)
target_link_libraries(${LIB} core enet flatbuffers)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
add_dependencies(${LIB} GenerateNetworkMessages)

View File

@ -1,8 +1,8 @@
#pragma once
#include "Network.h"
#include "messages/ServerMessages.h"
#include "messages/ClientMessages.h"
#include "messages/ServerMessages_generated.h"
#include "messages/ClientMessages_generated.h"
#include <memory>
using namespace network::messages::server;

View File

@ -2,8 +2,8 @@
#include "IProtocolHandler.h"
#include "ProtocolHandlerRegistry.h"
#include "NetworkEvents.h"
#include "network/messages/ClientMessages.h"
#include "network/messages/ServerMessages.h"
#include "network/messages/ClientMessages_generated.h"
#include "network/messages/ServerMessages_generated.h"
#include "core/Trace.h"
#include "core/Log.h"

View File

@ -11,6 +11,7 @@ namespace network {
namespace messages {
struct Vec3;
struct Vec2;
struct IVec2;
} // namespace messages
} // namespace network

View File

@ -1,9 +1,12 @@
fips_begin_module(noise)
fips_files(
SimplexNoise.h SimplexNoise.cpp
)
fips_deps(core)
fips_end_module()
set(SRCS
SimplexNoise.h SimplexNoise.cpp
)
set(LIB noise)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} core)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
gtest_suite_files(tests tests/SimplexNoiseTest.cpp)
gtest_suite_deps(tests core image noise)
gtest_suite_files(tests
tests/SimplexNoiseTest.cpp
)
gtest_suite_deps(tests ${LIB} image)

View File

@ -1,11 +1,12 @@
fips_begin_module(persistence)
fips_files(
Connection.cpp Connection.h
Store.cpp Store.h
PeristenceModel.cpp PeristenceModel.h
)
fips_deps(core)
fips_end_module()
set(SRCS
Connection.cpp Connection.h
Store.cpp Store.h
PeristenceModel.cpp PeristenceModel.h
)
set(LIB persistence)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} core)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
set(PostgreSQL_ADDITIONAL_VERSIONS "9.3" "9.4.1")
set(PostgreSQL_ADDITIONAL_SEARCH_PATHS "/usr/include/postgresql/9.3/server" "/usr/include/postgresql/9.4/server")
@ -13,5 +14,7 @@ find_package(PostgreSQL REQUIRED)
target_link_libraries(persistence ${PostgreSQL_LIBRARIES})
target_include_directories(persistence PUBLIC ${PostgreSQL_INCLUDE_DIRS})
gtest_suite_files(tests tests/StoreTest.cpp)
gtest_suite_deps(tests persistence)
gtest_suite_files(tests
tests/StoreTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -1,13 +1,16 @@
fips_begin_module(ui)
fips_files(
UIApp.cpp UIApp.h
TurboBadger.h
Window.cpp Window.h
KeybindingParser.h
ui_renderer_gl.cpp ui_renderer_gl.h
)
fips_deps(core io video turbobadger)
fips_end_module()
set(SRCS
UIApp.cpp UIApp.h
TurboBadger.h
Window.cpp Window.h
KeybindingParser.h
ui_renderer_gl.cpp ui_renderer_gl.h
)
set(LIB ui)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} core io video turbobadger)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
gtest_suite_files(tests tests/KeybindingParserTest.cpp)
gtest_suite_deps(tests ui)
gtest_suite_files(tests
tests/KeybindingParserTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -1,8 +1,9 @@
fips_begin_module(util)
fips_files(
Velocity.h
IProgressMonitor.h
PosLerp.h
Dummy.cpp
)
fips_end_module()
set(SRCS
Velocity.h
IProgressMonitor.h
PosLerp.h
Dummy.cpp
)
set(LIB util)
add_library(${LIB} ${SRCS})
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})

View File

@ -1,23 +1,22 @@
fips_begin_module(video)
fips_files(
WindowedApp.cpp WindowedApp.h
GLFunc.cpp GLFunc.h
VertexBuffer.cpp VertexBuffer.h
FrameBuffer.cpp FrameBuffer.h
GBuffer.cpp GBuffer.h
Shader.cpp Shader.h
Camera.cpp Camera.h
GLMeshData.h
GLDebug.h
Cubemap.cpp Cubemap.h
Texture.cpp Texture.h
Color.cpp Color.h
Mesh.cpp Mesh.h
MeshPool.cpp MeshPool.h
)
fips_deps(core image io assimp sdl2)
fips_end_module()
set(SRCS
WindowedApp.cpp WindowedApp.h
GLFunc.cpp GLFunc.h
VertexBuffer.cpp VertexBuffer.h
FrameBuffer.cpp FrameBuffer.h
GBuffer.cpp GBuffer.h
Shader.cpp Shader.h
Camera.cpp Camera.h
GLMeshData.h
GLDebug.h
Cubemap.cpp Cubemap.h
Texture.cpp Texture.h
Color.cpp Color.h
Mesh.cpp Mesh.h
MeshPool.cpp MeshPool.h
)
set(LIB video)
find_package(OpenGL REQUIRED)
target_link_libraries(video ${OPENGL_LIBRARIES})
target_include_directories(video PUBLIC ${OPENGL_INCLUDE_DIRS})
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} core image assimp zlib ${OPENGL_LIBRARIES})
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
target_include_directories(${LIB} PUBLIC ${OPENGL_INCLUDE_DIRS})

View File

@ -1,38 +1,37 @@
fips_begin_module(voxel)
fips_files(
BiomManager.h
LodCreator.h
Spiral.h
Voxel.h
World.cpp World.h
WorldPersister.h WorldPersister.cpp
WorldEvents.h
)
fips_dir(generator)
fips_files(
CloudGenerator.h CloudGenerator.cpp
ShapeGenerator.h ShapeGenerator.cpp
TreeGenerator.h TreeGenerator.cpp
WorldGenerator.h WorldGenerator.cpp
)
fips_dir(polyvox)
fips_files(
Array.h
AStarPathfinder.h
AStarPathfinderImpl.h
CubicSurfaceExtractor.h
Mesh.h Mesh.cpp
Morton.h
PagedVolume.h PagedVolume.cpp
RawVolume.h RawVolume.cpp
Raycast.h
Region.h
Utility.h
Vertex.h
Voxel.h
)
fips_deps(core io noise zlib)
fips_end_module()
set(SRCS
BiomManager.h
LodCreator.h
Spiral.h
Voxel.h
World.cpp World.h
WorldPersister.h WorldPersister.cpp
WorldEvents.h
generator/CloudGenerator.h generator/CloudGenerator.cpp
generator/ShapeGenerator.h generator/ShapeGenerator.cpp
generator/TreeGenerator.h generator/TreeGenerator.cpp
generator/WorldGenerator.h generator/WorldGenerator.cpp
polyvox/Array.h
polyvox/AStarPathfinder.h
polyvox/AStarPathfinderImpl.h
polyvox/CubicSurfaceExtractor.h
polyvox/Mesh.h polyvox/Mesh.cpp
polyvox/Morton.h
polyvox/PagedVolume.h polyvox/PagedVolume.cpp
polyvox/RawVolume.h polyvox/RawVolume.cpp
polyvox/Raycast.h
polyvox/Region.h
polyvox/Utility.h
polyvox/Vertex.h
polyvox/Voxel.h
)
set(LIB voxel)
add_library(${LIB} ${SRCS})
target_link_libraries(${LIB} core noise zlib)
set_target_properties(${LIB} PROPERTIES FOLDER ${LIB})
gtest_suite_files(tests tests/AbstractVoxelTest.h tests/WorldTest.cpp tests/WorldPersisterTest.cpp)
gtest_suite_deps(tests voxel)
gtest_suite_files(tests
tests/AbstractVoxelTest.h
tests/WorldTest.cpp
tests/WorldPersisterTest.cpp
)
gtest_suite_deps(tests ${LIB})

View File

@ -1,16 +1,11 @@
fips_begin_app(server cmdline)
fips_files(
Server.cpp Server.h
)
fips_dir(sauce)
fips_files(
ServerModule.h
ServerInjector.h
)
fips_deps(backend)
copy_data_files(server)
fips_end_app()
project(server)
set(SRCS
Server.cpp Server.h
sauce/ServerModule.h
sauce/ServerInjector.h
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS})
target_link_libraries(${PROJECT_NAME} backend)
copy_data_files(${PROJECT_NAME})
check_lua_files(server behaviourtrees.lua)
check_lua_files(server attributes.lua)

View File

@ -1,2 +1,2 @@
fips_add_subdirectory(shadertool)
fips_add_subdirectory(shapetool)
add_subdirectory(shadertool)
add_subdirectory(shapetool)

View File

@ -1,12 +1,8 @@
fips_begin_app(shadertool cmdline)
fips_files(
ShaderTool.h ShaderTool.cpp
)
fips_dir(sauce)
fips_files(
ShaderToolModule.h
ShaderToolInjector.h
)
fips_deps(core video)
fips_end_app()
project(shadertool)
set(SRCS
ShaderTool.h ShaderTool.cpp
sauce/ShaderToolModule.h
sauce/ShaderToolInjector.h
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS})
target_link_libraries(${PROJECT_NAME} core video)

View File

@ -1,18 +1,10 @@
fips_begin_app(shapetool windowed)
fips_files(
ShapeTool.h ShapeTool.cpp
)
fips_dir(sauce)
fips_files(
ShapeToolModule.h
ShapeToolInjector.h
)
fips_dir(ui)
fips_files(
WorldParametersWindow.h
)
fips_deps(util frontend commonlua)
copy_data_files(shapetool)
fips_end_app()
project(shapetool)
set(SRCS
ShapeTool.h ShapeTool.cpp
sauce/ShapeToolModule.h
sauce/ShapeToolInjector.h
ui/WorldParametersWindow.h
)
engine_add_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} WINDOWED)
target_link_libraries(${PROJECT_NAME} frontend util commonlua)
copy_data_files(${PROJECT_NAME})