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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CMake/Target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ option(BUILD_TEST "Build unit tests" ON)
option(BUILD_SAMPLE "Build sample" ON)

set(API_HEADER_DIR ${CMAKE_BINARY_DIR}/Generated/Api CACHE PATH "" FORCE)
set(BASE_TARGETS_FOLDER "${ENGINE_SUB_PROJECT_NAME}" CACHE STRING "" FORCE)
set(SAMPLE_TARGETS_FOLDER "${BASE_TARGETS_FOLDER}/Sample" CACHE STRING "" FORCE)
set(AUX_TARGETS_FOLDER "${BASE_TARGETS_FOLDER}/Aux" CACHE STRING "" FORCE)

if (${BUILD_TEST})
enable_testing()
Expand Down Expand Up @@ -137,6 +140,7 @@ function(exp_add_resources_copy_command)
${copy_res_target_name}
${copy_commands}
)
set_target_properties(${copy_res_target_name} PROPERTIES FOLDER ${AUX_TARGETS_FOLDER})
add_dependencies(${arg_NAME} ${copy_res_target_name})
endfunction()

Expand Down Expand Up @@ -249,6 +253,7 @@ function(exp_add_mirror_info_source_generation_target)
${custom_target_name}
DEPENDS MirrorTool ${output_sources}
)
set_target_properties(${custom_target_name} PROPERTIES FOLDER ${AUX_TARGETS_FOLDER})
set(${arg_OUTPUT_SRC} ${output_sources} PARENT_SCOPE)
set(${arg_OUTPUT_TARGET_NAME} ${custom_target_name} PARENT_SCOPE)

Expand Down Expand Up @@ -289,6 +294,12 @@ function(exp_add_executable)
${arg_NAME}
PRIVATE ${arg_SRC} ${generated_src}
)
if (${arg_SAMPLE})
set_target_properties(${arg_NAME} PROPERTIES FOLDER ${SAMPLE_TARGETS_FOLDER})
else ()
set_target_properties(${arg_NAME} PROPERTIES FOLDER ${BASE_TARGETS_FOLDER})
endif ()

get_cmake_property(generated_is_multi_config GENERATOR_IS_MULTI_CONFIG)
if (${generated_is_multi_config})
set(runtime_output_dir ${CMAKE_BINARY_DIR}/Dist/$<CONFIG>/${SUB_PROJECT_NAME}/Binaries)
Expand Down Expand Up @@ -385,6 +396,8 @@ function(exp_add_library)
${arg_NAME}
${arg_TYPE}
)
set_target_properties(${arg_NAME} PROPERTIES FOLDER ${BASE_TARGETS_FOLDER})

target_sources(
${arg_NAME}
PRIVATE ${arg_SRC} ${generated_src}
Expand Down Expand Up @@ -553,6 +566,8 @@ function(exp_add_test)
endif()

add_executable(${arg_NAME})
set_target_properties(${arg_NAME} PROPERTIES FOLDER ${BASE_TARGETS_FOLDER})

target_sources(
${arg_NAME}
PRIVATE ${arg_SRC} ${generated_src}
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_SOURCE_DIR}/conan_provider.cmake CA
project(Explosion)

option(BUILD_EDITOR "Build Explosion editor" ON)
option(CI "Build in CI" OFF)

set(SUB_PROJECT_NAME "Engine" CACHE STRING "" FORCE)
set(ENGINE_SUB_PROJECT_NAME "Engine" CACHE STRING "" FORCE)
Expand Down
4 changes: 3 additions & 1 deletion Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ exp_add_mirror_info_source_generation_target(

file(GLOB_RECURSE SOURCES Src/*.cpp)
qt_add_executable(Editor ${platform_executable_hint} ${SOURCES} ${EDITOR_MIRROR_GENERATED_SRC})
set_target_properties(Editor PROPERTIES FOLDER ${BASE_TARGETS_FOLDER})

get_cmake_property(GENERATOR_IS_MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG)
if (${GENERATOR_IS_MULTI_CONFIG})
Expand Down Expand Up @@ -93,10 +94,10 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
)
endif ()

# TODO check is this need ?
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
foreach (rhi_dep_target ${RHI_DEP_TARGETS})
list(APPEND rhi_dep_target_copy_commands COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${rhi_dep_target}> $<TARGET_FILE_DIR:Editor>/../Frameworks/$<TARGET_FILE_NAME:${rhi_dep_target}>)
# TODO also copy runtime dep of runtime dep
endforeach ()

add_custom_command(
Expand Down Expand Up @@ -150,6 +151,7 @@ add_custom_target(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Web
VERBATIM
)
set_target_properties(Editor.Web PROPERTIES FOLDER ${AUX_TARGETS_FOLDER})
add_dependencies(Editor Editor.Web)

add_custom_command(
Expand Down