CMAKE: fixed build system issues
when building with GAMES disabled the voxelworldrenderer couldn't resolve the frontend module removed our own unity build implementation - cmake has its own now fixed warnings regarding the module name for the sdl2_mixer lib removed vogl integration converted macros into functions to reduce side effectsmaster
parent
4abdfaa2c8
commit
b88943c387
|
@ -15,7 +15,6 @@ option(VOXCONVERT "Builds voxconvert (needs TOOLS to be active)" ON)
|
|||
option(MAPVIEW "Builds mapview (needs TOOLS to be active)" ON)
|
||||
option(AIDEBUG "Builds aidebug (needs TOOLS to be active)" ON)
|
||||
|
||||
option(DISABLE_UNITY "Disable the fast unity build" ON)
|
||||
option(USE_CCACHE "Use ccache" ON)
|
||||
option(USE_GPROF "Use gprof - will become slow" OFF)
|
||||
option(USE_GCOV "Use gcov - will become slow" OFF)
|
||||
|
@ -58,7 +57,6 @@ endif()
|
|||
|
||||
include(${SCRIPTS_CMAKE_DIR}/common.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/util.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/genunity.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/genshader.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/gencomputeshader.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/gendbmodel.cmake)
|
||||
|
@ -66,7 +64,6 @@ include(${SCRIPTS_CMAKE_DIR}/genprotocol.cmake)
|
|||
include(${SCRIPTS_CMAKE_DIR}/externallib.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/valgrind.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/perf.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/vogl.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/debug.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/googletest.cmake)
|
||||
include(${SCRIPTS_CMAKE_DIR}/manifests.cmake)
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
file(WRITE ${UNITY_SRC}.in "")
|
||||
foreach(SRC ${SRCS})
|
||||
get_filename_component(extension ${SRC} EXT)
|
||||
if (NOT "${extension}" STREQUAL ".cpp")
|
||||
continue()
|
||||
endif()
|
||||
if (IS_ABSOLUTE ${SRC})
|
||||
file(APPEND ${UNITY_SRC}.in "#include \"${SRC}\"\n")
|
||||
else()
|
||||
file(APPEND ${UNITY_SRC}.in "#include \"${DIR}/${SRC}\"\n")
|
||||
endif()
|
||||
endforeach()
|
||||
configure_file(${UNITY_SRC}.in ${UNITY_SRC})
|
||||
|
|
@ -10,7 +10,7 @@ else()
|
|||
endif()
|
||||
set_property(CACHE DEBUGGER PROPERTY STRINGS gdb lldb)
|
||||
|
||||
macro(engine_add_debuggger TARGET)
|
||||
function(engine_add_debuggger TARGET)
|
||||
if (${DEBUGGER} MATCHES "gdb")
|
||||
add_custom_target(${TARGET}-debug)
|
||||
add_custom_command(TARGET ${TARGET}-debug
|
||||
|
@ -30,4 +30,4 @@ macro(engine_add_debuggger TARGET)
|
|||
DEPENDS ${TARGET}
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -13,7 +13,7 @@ set(DOCKERCOMPOSE_EXECUTABLE "docker-compose" CACHE STRING "The docker-compose c
|
|||
#
|
||||
# The DOCKER_IMAGE_NAME_TAG variable that is set here, must be in sync with the kubernetes manifests
|
||||
#
|
||||
macro(engine_docker NAME)
|
||||
function(engine_docker NAME)
|
||||
if (NOT MSVC)
|
||||
set(DOCKERFILE_SRC)
|
||||
set(DOCKERCOMPOSEFILE_SRC)
|
||||
|
@ -109,4 +109,4 @@ macro(engine_docker NAME)
|
|||
|
||||
endif()
|
||||
endif(NOT MSVC)
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
set(LIBS_DIR ${PROJECT_SOURCE_DIR}/contrib/libs)
|
||||
|
||||
macro(var_global VARIABLES)
|
||||
foreach(VAR ${VARIABLES})
|
||||
function(var_global)
|
||||
foreach(VAR ${ARGN})
|
||||
set(${VAR} ${${VAR}} CACHE STRING "" FORCE)
|
||||
mark_as_advanced(${VAR})
|
||||
endforeach()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# macro for the FindLibName.cmake files.
|
||||
#
|
||||
# parameters:
|
||||
# LIB: the library we are trying to find
|
||||
# HEADER: the header we are trying to find
|
||||
# HEADERS: the header we are trying to find
|
||||
# SUFFIX: suffix for the include dir
|
||||
# VERSION: the operator and version that is given to the pkg-config call (e.g. ">=1.0")
|
||||
# (this only works for pkg-config)
|
||||
#
|
||||
# Example: engine_find(SDL2_image SDL_image.h SDL2 "")
|
||||
#
|
||||
macro(engine_find LIB HEADER SUFFIX VERSION)
|
||||
function(engine_find LIB HEADERS SUFFIX VERSION)
|
||||
string(TOUPPER ${LIB} PREFIX)
|
||||
if (DEFINED ${PREFIX}_FOUND)
|
||||
return()
|
||||
|
@ -53,7 +53,7 @@ macro(engine_find LIB HEADER SUFFIX VERSION)
|
|||
endif()
|
||||
if (NOT ${PREFIX}_FOUND)
|
||||
find_path(${PREFIX}_INCLUDE_DIRS
|
||||
NAMES ${HEADER}
|
||||
NAMES ${HEADERS}
|
||||
HINTS ENV ${PREFIX}DIR
|
||||
PATH_SUFFIXES include include/${SUFFIX} ${SUFFIX}
|
||||
PATHS
|
||||
|
@ -81,9 +81,9 @@ macro(engine_find LIB HEADER SUFFIX VERSION)
|
|||
unset(PREFIX)
|
||||
unset(_SEARCH_PATHS)
|
||||
unset(_PROCESSOR_ARCH)
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
||||
macro(engine_find_header_only LIB HEADER SUFFIX VERSION)
|
||||
function(engine_find_header_only LIB HEADER SUFFIX VERSION)
|
||||
string(TOUPPER ${LIB} PREFIX)
|
||||
set(_SEARCH_PATHS
|
||||
~/Library/Frameworks
|
||||
|
@ -115,7 +115,7 @@ macro(engine_find_header_only LIB HEADER SUFFIX VERSION)
|
|||
var_global(${PREFIX}_INCLUDE_DIRS ${PREFIX}_FOUND)
|
||||
unset(PREFIX)
|
||||
unset(_SEARCH_PATHS)
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Add external dependency. It will trigger a find_package and use the system wide install if found
|
||||
|
@ -126,8 +126,8 @@ endmacro()
|
|||
# SRCS: the list of source files for the bundled lib
|
||||
# DEFINES: a list of defines (without -D or /D)
|
||||
#
|
||||
macro(engine_add_library)
|
||||
set(_OPTIONS_ARGS UNITY)
|
||||
function(engine_add_library)
|
||||
set(_OPTIONS_ARGS)
|
||||
set(_ONE_VALUE_ARGS LIB PACKAGE PUBLICHEADER)
|
||||
set(_MULTI_VALUE_ARGS SRCS DEFINES)
|
||||
|
||||
|
@ -190,35 +190,11 @@ macro(engine_add_library)
|
|||
endif()
|
||||
else()
|
||||
message(STATUS "Use the bundled lib ${_ADDLIB_LIB}")
|
||||
if (_ADDLIB_UNITY AND NOT DISABLE_UNITY)
|
||||
set(UNITY_SRC_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_ADDLIB_LIB}_unity.cpp)
|
||||
file(WRITE ${UNITY_SRC_CPP}.in "/** autogenerated */\n")
|
||||
set(UNITY_SRC_C ${CMAKE_CURRENT_BINARY_DIR}/${_ADDLIB_LIB}_unity.c)
|
||||
file(WRITE ${UNITY_SRC_C}.in "/** autogenerated */\n")
|
||||
set(unity_srcs)
|
||||
list(APPEND unity_srcs ${UNITY_SRC_CPP} ${UNITY_SRC_C})
|
||||
foreach(SRC ${_ADDLIB_SRCS})
|
||||
get_filename_component(extension ${SRC} EXT)
|
||||
if ("${extension}" STREQUAL ".cpp")
|
||||
file(APPEND ${UNITY_SRC_CPP}.in "#include \"${SRC}\"\n")
|
||||
continue()
|
||||
endif()
|
||||
if ("${extension}" STREQUAL ".c")
|
||||
file(APPEND ${UNITY_SRC_C}.in "#include \"${SRC}\"\n")
|
||||
continue()
|
||||
endif()
|
||||
list(APPEND unity_srcs ${SRC})
|
||||
endforeach()
|
||||
configure_file(${UNITY_SRC_CPP}.in ${UNITY_SRC_CPP})
|
||||
configure_file(${UNITY_SRC_C}.in ${UNITY_SRC_C})
|
||||
add_library(${_ADDLIB_LIB} STATIC ${unity_srcs})
|
||||
else()
|
||||
add_library(${_ADDLIB_LIB} STATIC ${_ADDLIB_SRCS})
|
||||
endif()
|
||||
add_library(${_ADDLIB_LIB} STATIC ${_ADDLIB_SRCS})
|
||||
add_library(${PKG_PREFIX}::${PKG_PREFIX} ALIAS ${_ADDLIB_LIB})
|
||||
target_compile_options(${_ADDLIB_LIB} PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Wno-undef>)
|
||||
target_include_directories(${_ADDLIB_LIB} ${_ADDLIB_PUBLICHEADER} ${LIBS_DIR}/${_ADDLIB_LIB})
|
||||
set_target_properties(${_ADDLIB_LIB} PROPERTIES COMPILE_DEFINITIONS "${_ADDLIB_DEFINES}")
|
||||
set_target_properties(${_ADDLIB_LIB} PROPERTIES FOLDER ${_ADDLIB_LIB})
|
||||
endif()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
macro(generate_compute_shaders TARGET)
|
||||
function(generate_compute_shaders TARGET)
|
||||
set(files ${ARGV})
|
||||
list(REMOVE_AT files 0)
|
||||
set(GEN_DIR ${GENERATE_DIR}/compute-shaders/${TARGET}/)
|
||||
|
@ -73,4 +73,4 @@ macro(generate_compute_shaders TARGET)
|
|||
add_dependencies(${TARGET} GenerateComputeShaderHeader${TARGET} UpdateComputeShaders${TARGET})
|
||||
add_dependencies(GenerateComputeShaderHeader${TARGET} GenerateComputeShaderBindings${TARGET})
|
||||
add_dependencies(codegen GenerateComputeShaderHeader${TARGET} UpdateComputeShaders${TARGET})
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
macro(generate_db_models TARGET INPUT OUTPUT)
|
||||
function(generate_db_models TARGET INPUT OUTPUT)
|
||||
set(GEN_DIR ${GENERATE_DIR}/dbmodels/${TARGET}/)
|
||||
file(MAKE_DIRECTORY ${GEN_DIR})
|
||||
target_include_directories(${TARGET} PUBLIC ${GEN_DIR})
|
||||
|
@ -28,4 +28,4 @@ macro(generate_db_models TARGET INPUT OUTPUT)
|
|||
engine_mark_as_generated(${GEN_DIR}${OUTPUT})
|
||||
add_dependencies(${TARGET} GenerateDatabaseModelBindings${TARGET})
|
||||
add_dependencies(codegen GenerateDatabaseModelBindings${TARGET})
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
macro(protocol_include_dir TARGET DEPENDENCY)
|
||||
function(protocol_include_dir TARGET DEPENDENCY)
|
||||
set(GEN_DIR ${GENERATE_DIR}/protocol/${DEPENDENCY}/)
|
||||
target_include_directories(${TARGET} PUBLIC ${GEN_DIR})
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
||||
macro(generate_protocol TARGET)
|
||||
function(generate_protocol TARGET)
|
||||
set(files ${ARGV})
|
||||
list(REMOVE_AT files 0)
|
||||
set(GEN_DIR ${GENERATE_DIR}/protocol/${TARGET}/)
|
||||
|
@ -43,4 +43,4 @@ macro(generate_protocol TARGET)
|
|||
)
|
||||
add_dependencies(${TARGET} GenerateNetworkMessages${TARGET})
|
||||
add_dependencies(codegen GenerateNetworkMessages${TARGET})
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -22,14 +22,13 @@ function(read_shader_includes shaderpath include_dirs includes_list_out)
|
|||
set(${includes_list_out} ${_local_list} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
macro(shader_include_dir TARGET DEPENDENCY)
|
||||
function(shader_include_dir TARGET DEPENDENCY)
|
||||
set(GEN_DIR ${GENERATE_DIR}/shaders/${DEPENDENCY}/)
|
||||
target_include_directories(${TARGET} PUBLIC ${GEN_DIR})
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
||||
macro(generate_shaders TARGET)
|
||||
set(files ${ARGV})
|
||||
list(REMOVE_AT files 0)
|
||||
function(generate_shaders TARGET)
|
||||
set(files ${ARGN})
|
||||
set(GEN_DIR ${GENERATE_DIR}/shaders/${TARGET}/)
|
||||
set(_template_header ${ROOT_DIR}/src/tools/shadertool/ShaderTemplate.h.in)
|
||||
set(_template_cpp ${ROOT_DIR}/src/tools/shadertool/ShaderTemplate.cpp.in)
|
||||
|
@ -137,11 +136,10 @@ macro(generate_shaders TARGET)
|
|||
COMMENT "Generate shader bindings for ${TARGET} in ${GEN_DIR}"
|
||||
)
|
||||
engine_mark_as_generated(${_headers} ${_shaderconstantheaderpath} ${_sources} ${_shadersheader})
|
||||
generate_unity_sources(SOURCES TARGET ${TARGET} SRCS ${_sources} UNITY_SRC "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_shaders_unity.cpp")
|
||||
target_sources(${TARGET} PRIVATE ${_headers} ${_constantsheaders} ${_shadersheader})
|
||||
target_sources(${TARGET} PRIVATE ${_sources} ${_headers} ${_constantsheaders} ${_shadersheader})
|
||||
|
||||
add_custom_target(GenerateShaderHeader${TARGET} ${CMAKE_COMMAND} -D SRC=${_shadersheader}.in -D DST=${_shadersheader} -P ${CMAKE_BINARY_DIR}/UpdateShaderFile${TARGET}.cmake)
|
||||
add_dependencies(${TARGET} GenerateShaderHeader${TARGET} UpdateShaders${TARGET})
|
||||
add_dependencies(GenerateShaderHeader${TARGET} GenerateShaderBindings${TARGET})
|
||||
add_dependencies(codegen GenerateShaderHeader${TARGET} UpdateShaders${TARGET})
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
macro(generate_unity_sources)
|
||||
set(_OPTIONS_ARGS SOURCES EXECUTABLE LIBRARY WINDOWED)
|
||||
set(_ONE_VALUE_ARGS TARGET UNITY_SRC)
|
||||
set(_MULTI_VALUE_ARGS SRCS)
|
||||
|
||||
cmake_parse_arguments(_UNITY "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
|
||||
|
||||
if (NOT _UNITY_TARGET)
|
||||
message(FATAL_ERROR "generate_unity_sources requires the TARGET argument")
|
||||
endif()
|
||||
if (NOT _UNITY_SRCS)
|
||||
message(FATAL_ERROR "generate_unity_sources requires the SRCS argument")
|
||||
endif()
|
||||
if (NOT _UNITY_UNITY_SRC)
|
||||
set(_UNITY_UNITY_SRC "${CMAKE_CURRENT_BINARY_DIR}/${_UNITY_TARGET}_unity.cpp")
|
||||
endif()
|
||||
|
||||
set(TARGET ${_UNITY_TARGET})
|
||||
set(UNITY_SRC ${_UNITY_UNITY_SRC})
|
||||
set(SRCS ${_UNITY_SRCS})
|
||||
|
||||
get_property(TARGET_NOUNITY GLOBAL PROPERTY ${TARGET}_NOUNITY)
|
||||
if (TARGET_NOUNITY OR DISABLE_UNITY)
|
||||
if (_UNITY_SOURCES)
|
||||
target_sources(${TARGET} PRIVATE ${SRCS})
|
||||
elseif (_UNITY_EXECUTABLE)
|
||||
if (_UNITY_WINDOWED)
|
||||
if (WINDOWS)
|
||||
add_executable(${TARGET} WIN32 ${SRCS})
|
||||
if (USE_MSVC)
|
||||
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
add_executable(${TARGET} MACOSX_BUNDLE ${SRCS})
|
||||
else()
|
||||
add_executable(${TARGET} ${SRCS})
|
||||
endif()
|
||||
else()
|
||||
add_executable(${TARGET} ${SRCS})
|
||||
if (WINDOWS)
|
||||
if (USE_MSVC)
|
||||
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
elseif (_UNITY_LIBRARY)
|
||||
add_library(${TARGET} ${SRCS})
|
||||
endif()
|
||||
else()
|
||||
set(unity_srcs)
|
||||
list(APPEND unity_srcs ${UNITY_SRC})
|
||||
add_custom_command(
|
||||
OUTPUT ${UNITY_SRC}
|
||||
COMMAND ${CMAKE_COMMAND} -D "SRCS=\"${SRCS}\"" -D UNITY_SRC="${UNITY_SRC}" -D DIR="${CMAKE_CURRENT_SOURCE_DIR}" -P "${ROOT_DIR}/cmake/GenerateUnity.cmake"
|
||||
DEPENDS ${SRCS}
|
||||
COMMENT "Generate unity sources for ${TARGET}"
|
||||
)
|
||||
engine_mark_as_generated(${UNITY_SRC} ${UNITY_SRC}.in)
|
||||
if (MSVC)
|
||||
set_source_files_properties(${UNITY_SRC} PROPERTIES COMPILE_FLAGS "/bigobj")
|
||||
endif()
|
||||
foreach(SRC ${SRCS})
|
||||
get_filename_component(extension ${SRC} EXT)
|
||||
if (NOT "${extension}" STREQUAL ".cpp")
|
||||
list(APPEND unity_srcs ${SRC})
|
||||
continue()
|
||||
endif()
|
||||
endforeach()
|
||||
if (_UNITY_SOURCES)
|
||||
target_sources(${TARGET} PRIVATE ${unity_srcs})
|
||||
elseif (_UNITY_EXECUTABLE)
|
||||
if (_UNITY_WINDOWED)
|
||||
if (WINDOWS)
|
||||
add_executable(${TARGET} WIN32 ${unity_srcs})
|
||||
if (USE_MSVC)
|
||||
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
|
||||
endif()
|
||||
else()
|
||||
add_executable(${TARGET} ${unity_srcs})
|
||||
endif()
|
||||
else()
|
||||
add_executable(${TARGET} ${unity_srcs})
|
||||
if (WINDOWS)
|
||||
if (USE_MSVC)
|
||||
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
elseif (_UNITY_LIBRARY)
|
||||
add_library(${TARGET} ${unity_srcs})
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
|
@ -11,7 +11,7 @@ find_package(GTest)
|
|||
# gtest_suite_begin(name)
|
||||
# Begin defining a unit test suite.
|
||||
#
|
||||
macro(gtest_suite_begin name)
|
||||
function(gtest_suite_begin name)
|
||||
if (UNITTESTS)
|
||||
set(options NO_TEMPLATE)
|
||||
set(oneValueArgs TEMPLATE)
|
||||
|
@ -46,9 +46,9 @@ macro(gtest_suite_begin name)
|
|||
target_link_libraries(${name} gtest)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
||||
macro(gtest_suite_sources name)
|
||||
function(gtest_suite_sources name)
|
||||
if (UNITTESTS)
|
||||
set(ARG_LIST ${ARGV})
|
||||
list(REMOVE_AT ARG_LIST 0)
|
||||
|
@ -58,9 +58,9 @@ macro(gtest_suite_sources name)
|
|||
endforeach()
|
||||
set_property(GLOBAL PROPERTY ${name}_Sources ${list})
|
||||
endif()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
||||
macro(gtest_suite_files name)
|
||||
function(gtest_suite_files name)
|
||||
if (UNITTESTS)
|
||||
set(ARG_LIST ${ARGV})
|
||||
list(REMOVE_AT ARG_LIST 0)
|
||||
|
@ -70,9 +70,9 @@ macro(gtest_suite_files name)
|
|||
endforeach()
|
||||
set_property(GLOBAL PROPERTY ${name}_Files ${list})
|
||||
endif()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
||||
macro(gtest_suite_deps name)
|
||||
function(gtest_suite_deps name)
|
||||
if (UNITTESTS)
|
||||
set(ARG_LIST ${ARGV})
|
||||
list(REMOVE_AT ARG_LIST 0)
|
||||
|
@ -80,14 +80,14 @@ macro(gtest_suite_deps name)
|
|||
list(APPEND list ${ARG_LIST})
|
||||
set_property(GLOBAL PROPERTY ${name}_Deps ${list})
|
||||
endif()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
||||
macro(gtest_suite_end name)
|
||||
function(gtest_suite_end name)
|
||||
if (UNITTESTS)
|
||||
project(${name})
|
||||
get_property(srcs GLOBAL PROPERTY ${name}_Sources)
|
||||
get_property(deps GLOBAL PROPERTY ${name}_Deps)
|
||||
generate_unity_sources(SOURCES TARGET ${name} SRCS ${srcs})
|
||||
target_sources(${name} PRIVATE ${srcs})
|
||||
set_target_properties(${name} PROPERTIES OUTPUT_NAME "${CMAKE_PROJECT_NAME}-${name}")
|
||||
set_target_properties(${name} PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${name}"
|
||||
|
@ -129,4 +129,4 @@ macro(gtest_suite_end name)
|
|||
engine_add_valgrind(${name})
|
||||
engine_add_perf(${name})
|
||||
endif()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
macro(check_lua_files TARGET)
|
||||
set(files ${ARGV})
|
||||
list(REMOVE_AT files 0)
|
||||
function(check_lua_files TARGET)
|
||||
set(files ${ARGN})
|
||||
find_program(LUAC_EXECUTABLE NAMES ${DEFAULT_LUAC_EXECUTABLE})
|
||||
set(ADDITIONAL_DEPENDENCIES)
|
||||
if (LUAC_EXECUTABLE)
|
||||
|
@ -22,4 +21,4 @@ macro(check_lua_files TARGET)
|
|||
add_custom_target(${TARGET}-${_outfile} DEPENDS ${_outfile})
|
||||
add_dependencies(${TARGET} ${TARGET}-${_outfile})
|
||||
endforeach()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -55,10 +55,25 @@ function(engine_add_executable)
|
|||
|
||||
set(${_EXE_TARGET}_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "${_EXE_TARGET} source directory")
|
||||
if (_EXE_WINDOWED)
|
||||
generate_unity_sources(WINDOWED EXECUTABLE TARGET ${_EXE_TARGET} SRCS ${_EXE_SRCS})
|
||||
if (WINDOWS)
|
||||
add_executable(${_EXE_TARGET} WIN32 ${_EXE_SRCS})
|
||||
if (USE_MSVC)
|
||||
set_target_properties(${_EXE_TARGET} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
add_executable(${_EXE_TARGET} MACOSX_BUNDLE ${_EXE_SRCS})
|
||||
else()
|
||||
add_executable(${_EXE_TARGET} ${_EXE_SRCS})
|
||||
endif()
|
||||
else()
|
||||
generate_unity_sources(EXECUTABLE TARGET ${_EXE_TARGET} SRCS ${_EXE_SRCS})
|
||||
add_executable(${_EXE_TARGET} ${_EXE_SRCS})
|
||||
if (WINDOWS)
|
||||
if (USE_MSVC)
|
||||
set_target_properties(${_EXE_TARGET} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
|
||||
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}"
|
||||
|
@ -221,9 +236,6 @@ function(engine_add_executable)
|
|||
engine_add_debuggger(${_EXE_TARGET})
|
||||
engine_add_valgrind(${_EXE_TARGET})
|
||||
engine_add_perf(${_EXE_TARGET})
|
||||
if (_EXE_WINDOWED)
|
||||
engina_add_vogl(${_EXE_TARGET})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
|
@ -255,7 +267,7 @@ function(engine_add_module)
|
|||
cmake_parse_arguments(_LIB "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN})
|
||||
|
||||
set(${_LIB_TARGET}_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "${_LIB_TARGET} module source directory")
|
||||
generate_unity_sources(LIBRARY TARGET ${_LIB_TARGET} SRCS ${_LIB_SRCS})
|
||||
add_library(${_LIB_TARGET} ${_LIB_SRCS})
|
||||
|
||||
if (_LIB_LUA_SRCS)
|
||||
check_lua_files(${_LIB_TARGET} ${_LIB_LUA_SRCS})
|
||||
|
@ -287,7 +299,7 @@ function(engine_install_deps TARGET)
|
|||
get_property(INSTALL_DATA GLOBAL PROPERTY ${TARGET}_INSTALL)
|
||||
set(INSTALL_FILES)
|
||||
|
||||
set(DEPS ${ARGV})
|
||||
set(DEPS ${ARGN})
|
||||
list(APPEND DEPS ${TARGET})
|
||||
if (WIN32)
|
||||
set(INSTALL_DATA_DIR ".")
|
||||
|
@ -325,15 +337,17 @@ function(engine_install_deps TARGET)
|
|||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(engine_resolve_deps_recursive TARGET)
|
||||
macro(engine_resolve_deps_recursive TARGET OUT)
|
||||
set(RECURSIVE_DEPENDENCIES ${${OUT}})
|
||||
get_property(DEP_DEPENDENCIES GLOBAL PROPERTY ${TARGET}_DEPENDENCIES)
|
||||
foreach (dep ${DEP_DEPENDENCIES})
|
||||
list(FIND RECURSIVE_DEPENDENCIES ${dep} already_visited)
|
||||
if (${already_visited} EQUAL -1)
|
||||
list(APPEND RECURSIVE_DEPENDENCIES ${dep})
|
||||
engine_resolve_deps_recursive(${dep})
|
||||
engine_resolve_deps_recursive(${dep} RECURSIVE_DEPENDENCIES)
|
||||
endif()
|
||||
endforeach()
|
||||
set(${OUT} ${RECURSIVE_DEPENDENCIES})
|
||||
endmacro()
|
||||
|
||||
#
|
||||
|
@ -353,7 +367,7 @@ function(engine_target_link_libraries)
|
|||
get_property(EXECUTABLE GLOBAL PROPERTY ${_LIBS_TARGET}_EXECUTABLE)
|
||||
if (EXECUTABLE)
|
||||
set(RECURSIVE_DEPENDENCIES)
|
||||
engine_resolve_deps_recursive(${_LIBS_TARGET})
|
||||
engine_resolve_deps_recursive(${_LIBS_TARGET} RECURSIVE_DEPENDENCIES)
|
||||
engine_install_deps(${_LIBS_TARGET} ${RECURSIVE_DEPENDENCIES})
|
||||
endif()
|
||||
endfunction()
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#
|
||||
# The DOCKER_IMAGE_NAME_TAG variable that is set here, must be in sync with the docker target
|
||||
#
|
||||
macro(engine_manifests NAME)
|
||||
function(engine_manifests NAME)
|
||||
if (DOCKER_REGISTRY)
|
||||
set(DOCKER_IMAGE_NAME_TAG "${DOCKER_REGISTRY}/${NAME}:${ROOT_PROJECT_VERSION}")
|
||||
else()
|
||||
|
@ -18,4 +18,4 @@ macro(engine_manifests NAME)
|
|||
get_filename_component(FILENAME ${FILEPATH} NAME_WE)
|
||||
configure_file(${FILEPATH} ${CMAKE_CURRENT_BINARY_DIR}/deployment/${FILENAME}.yaml)
|
||||
endforeach()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
macro(engine_add_perf TARGET)
|
||||
function(engine_add_perf TARGET)
|
||||
find_program(PERF_EXECUTABLE NAMES perf)
|
||||
if (PERF_EXECUTABLE)
|
||||
add_custom_target(${TARGET}-perf)
|
||||
|
@ -11,4 +11,4 @@ macro(engine_add_perf TARGET)
|
|||
DEPENDS ${TARGET}
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -21,12 +21,12 @@ endfunction()
|
|||
|
||||
# some cross compiling toolchains define this
|
||||
if(NOT COMMAND find_host_program)
|
||||
macro(find_host_program)
|
||||
function(find_host_program)
|
||||
find_program(${ARGN})
|
||||
endmacro()
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
macro(convert_to_camel_case IN OUT)
|
||||
function(convert_to_camel_case IN OUT)
|
||||
string(REPLACE "-" "_" _list ${IN})
|
||||
string(REPLACE "_" ";" _list ${_list})
|
||||
set(_final "")
|
||||
|
@ -43,10 +43,10 @@ macro(convert_to_camel_case IN OUT)
|
|||
string(SUBSTRING ${IN} 1 -1 _remaining)
|
||||
set(_final "${_final}${_first_letter}${_remaining}")
|
||||
endif()
|
||||
set(${OUT} ${_final})
|
||||
endmacro()
|
||||
set(${OUT} ${_final} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
macro(engine_mark_as_generated)
|
||||
function(engine_mark_as_generated)
|
||||
set_source_files_properties(${ARGN} PROPERTIES GENERATED TRUE)
|
||||
#set_source_files_properties(${ARGN} PROPERTIES LANGUAGE CXX)
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
macro(engine_add_valgrind TARGET)
|
||||
function(engine_add_valgrind TARGET)
|
||||
find_program(VALGRIND_EXECUTABLE NAMES valgrind)
|
||||
if (VALGRIND_EXECUTABLE)
|
||||
add_custom_target(${TARGET}-memcheckxml)
|
||||
|
@ -40,4 +40,4 @@ macro(engine_add_valgrind TARGET)
|
|||
DEPENDS ${TARGET}
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
endfunction()
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
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"
|
||||
USES_TERMINAL
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${TARGET}
|
||||
DEPENDS ${TARGET}
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
|
@ -52,7 +52,7 @@ set(COMPILER_SRCS
|
|||
compiler/reflection.cpp
|
||||
compiler/util.cpp
|
||||
)
|
||||
set_property(GLOBAL PROPERTY flatc_NOUNITY True)
|
||||
engine_add_build_executable(TARGET flatc SRCS ${COMPILER_SRCS} NOINSTALL)
|
||||
set_target_properties(flatc PROPERTIES UNITY_BUILD FALSE)
|
||||
target_link_libraries(flatc flatbuffers)
|
||||
target_include_directories(flatc PRIVATE compiler/)
|
||||
|
|
|
@ -13,7 +13,6 @@ set(SRCS
|
|||
engine_add_library(
|
||||
LIB libenet
|
||||
SRCS ${SRCS}
|
||||
UNITY
|
||||
)
|
||||
|
||||
if (NOT LIBENET_FOUND)
|
||||
|
|
|
@ -36,7 +36,7 @@ set(SRCS
|
|||
libvorbis-1.3.6/lib/floor0.c
|
||||
libvorbis-1.3.6/lib/floor1.c
|
||||
)
|
||||
set(LIB sdl2_mixer)
|
||||
set(LIB SDL2_mixer)
|
||||
|
||||
engine_add_library(
|
||||
LIB ${LIB}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
vengi (0.0.18.0-1) UNRELEASED; urgency=low
|
||||
|
||||
* renamed the github project to **vengi** - the url changed to
|
||||
https://github.com/mgerhardy/vengi
|
||||
|
||||
* General:
|
||||
* Removed own cmake unity-build implementation
|
||||
|
||||
-- Martin Gerhardy <martin.gerhardy@gmail.com> Sun, 23 Jan 2022 12:28:01 +0100
|
||||
|
||||
|
|
|
@ -10,6 +10,12 @@ Known [issues](https://github.com/mgerhardy/vengi/issues?q=is%3Aissue+is%3Aopen+
|
|||
|
||||
## 0.0.18 (2022-XX-XX)
|
||||
|
||||
> renamed the github project to **vengi** - the url changed to [https://github.com/mgerhardy/vengi](https://github.com/mgerhardy/vengi).
|
||||
|
||||
General:
|
||||
|
||||
- Removed own cmake unity-build implementation
|
||||
|
||||
## 0.0.17 (2022-01-23)
|
||||
|
||||
General:
|
||||
|
|
|
@ -43,10 +43,12 @@ add_subdirectory(poi)
|
|||
add_subdirectory(shared)
|
||||
add_subdirectory(animation)
|
||||
add_subdirectory(voxelrender)
|
||||
add_subdirectory(voxelworldrender)
|
||||
add_subdirectory(rma)
|
||||
add_subdirectory(testcore)
|
||||
if (GAMES OR MAPVIEW)
|
||||
add_subdirectory(frontend)
|
||||
add_subdirectory(voxelworldrender)
|
||||
endif()
|
||||
if (GAMES)
|
||||
add_subdirectory(backend)
|
||||
add_subdirectory(frontend)
|
||||
endif()
|
||||
|
|
|
@ -6,13 +6,12 @@ set(SRCS
|
|||
|
||||
set(LIB app)
|
||||
|
||||
if (WINDOWS)
|
||||
# All this windows.h insanities ... giving up on this module
|
||||
set_property(GLOBAL PROPERTY ${LIB}_NOUNITY TRUE)
|
||||
endif()
|
||||
|
||||
set(LIBS metric command)
|
||||
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES ${LIBS})
|
||||
if (WINDOWS)
|
||||
# All this windows.h insanities ... giving up on this module
|
||||
set_target_properties(${LIB} PROPERTIES UNITY_BUILD FALSE)
|
||||
endif()
|
||||
|
||||
set(TEST_MODULE_SRCS
|
||||
tests/AbstractTest.cpp
|
||||
|
|
|
@ -2,4 +2,4 @@ set(SRCS
|
|||
SoundManager.h SoundManager.cpp
|
||||
)
|
||||
set(LIB audio)
|
||||
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES io sdl2_mixer)
|
||||
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES io SDL2_mixer)
|
||||
|
|
|
@ -68,10 +68,6 @@ endif()
|
|||
|
||||
set(LIB core)
|
||||
|
||||
if (WINDOWS)
|
||||
# All this windows.h insanities ... giving up on this module
|
||||
set_property(GLOBAL PROPERTY ${LIB}_NOUNITY TRUE)
|
||||
endif()
|
||||
|
||||
set(LIBS sdl2 glm ${CMAKE_DL_LIBS})
|
||||
|
||||
|
@ -84,6 +80,11 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tracy/TracyClient.cpp)
|
|||
target_compile_definitions(${LIB} PUBLIC TRACY_ENABLE TRACY_ON_DEMAND)
|
||||
endif()
|
||||
|
||||
if (WINDOWS)
|
||||
# All this windows.h insanities ... giving up on this module
|
||||
set_target_properties(${LIB} PROPERTIES UNITY_BUILD FALSE)
|
||||
endif()
|
||||
|
||||
if (USE_STACKTRACES)
|
||||
target_compile_definitions(${LIB} PRIVATE HAVE_BACKWARD)
|
||||
endif()
|
||||
|
|
|
@ -54,3 +54,4 @@ imgui_build_font(ArimoRegular Arimo-Regular.ttf)
|
|||
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES render app)
|
||||
target_compile_definitions(${LIB} PUBLIC -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_DISABLE_OBSOLETE_KEYIO)
|
||||
target_include_directories(${LIB} PUBLIC . ${GEN_DIR} dearimgui)
|
||||
set_target_properties(${LIB} PROPERTIES UNITY_BUILD OFF)
|
||||
|
|
|
@ -14,3 +14,4 @@ set(FILES
|
|||
shared/font.ttf
|
||||
)
|
||||
engine_add_module(TARGET nuklear SRCS ${SRCS} FILES ${FILES} DEPENDENCIES app voxelrender)
|
||||
set_target_properties(nuklear PROPERTIES UNITY_BUILD OFF)
|
||||
|
|
|
@ -62,6 +62,7 @@ engine_add_module(TARGET ${LIB} SRCS ${SRCS} ${SRCS_SHADERS} FILES ${FILES} DEPE
|
|||
if (APPLE)
|
||||
target_link_libraries(${LIB} PRIVATE "-framework OpenGL")
|
||||
endif()
|
||||
set_target_properties(${LIB} PROPERTIES UNITY_BUILD OFF)
|
||||
|
||||
find_program(PYTHON3_EXECUTABLE NAMES python3)
|
||||
add_custom_target(update-videobindings)
|
||||
|
|
|
@ -12,10 +12,8 @@ set(SRCS
|
|||
ShaderTool.h ShaderTool.cpp
|
||||
${SHARED_SRCS}
|
||||
)
|
||||
if (MSVC)
|
||||
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_NOUNITY TRUE)
|
||||
endif()
|
||||
engine_add_build_executable(TARGET ${PROJECT_NAME} SRCS ${SRCS} NOINSTALL)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD FALSE)
|
||||
add_dependencies(${PROJECT_NAME} glslangValidator)
|
||||
engine_target_link_libraries(TARGET ${PROJECT_NAME} DEPENDENCIES app video simplecpp)
|
||||
|
||||
|
|
Loading…
Reference in New Issue