Skip to content

Commit 6a43b29

Browse files
Merge pull request #410 from FlyAndNotDown/master
2 parents 958d7b7 + d0fb32f commit 6a43b29

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

CMake/Target.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ option(BUILD_TEST "Build unit tests" ON)
22
option(BUILD_SAMPLE "Build sample" ON)
33

44
set(API_HEADER_DIR ${CMAKE_BINARY_DIR}/Generated/Api CACHE PATH "" FORCE)
5+
set(BASE_TARGETS_FOLDER "${ENGINE_SUB_PROJECT_NAME}" CACHE STRING "" FORCE)
6+
set(SAMPLE_TARGETS_FOLDER "${BASE_TARGETS_FOLDER}/Sample" CACHE STRING "" FORCE)
7+
set(AUX_TARGETS_FOLDER "${BASE_TARGETS_FOLDER}/Aux" CACHE STRING "" FORCE)
58

69
if (${BUILD_TEST})
710
enable_testing()
@@ -137,6 +140,7 @@ function(exp_add_resources_copy_command)
137140
${copy_res_target_name}
138141
${copy_commands}
139142
)
143+
set_target_properties(${copy_res_target_name} PROPERTIES FOLDER ${AUX_TARGETS_FOLDER})
140144
add_dependencies(${arg_NAME} ${copy_res_target_name})
141145
endfunction()
142146

@@ -249,6 +253,7 @@ function(exp_add_mirror_info_source_generation_target)
249253
${custom_target_name}
250254
DEPENDS MirrorTool ${output_sources}
251255
)
256+
set_target_properties(${custom_target_name} PROPERTIES FOLDER ${AUX_TARGETS_FOLDER})
252257
set(${arg_OUTPUT_SRC} ${output_sources} PARENT_SCOPE)
253258
set(${arg_OUTPUT_TARGET_NAME} ${custom_target_name} PARENT_SCOPE)
254259
@@ -289,6 +294,12 @@ function(exp_add_executable)
289294
${arg_NAME}
290295
PRIVATE ${arg_SRC} ${generated_src}
291296
)
297+
if (${arg_SAMPLE})
298+
set_target_properties(${arg_NAME} PROPERTIES FOLDER ${SAMPLE_TARGETS_FOLDER})
299+
else ()
300+
set_target_properties(${arg_NAME} PROPERTIES FOLDER ${BASE_TARGETS_FOLDER})
301+
endif ()
302+
292303
get_cmake_property(generated_is_multi_config GENERATOR_IS_MULTI_CONFIG)
293304
if (${generated_is_multi_config})
294305
set(runtime_output_dir ${CMAKE_BINARY_DIR}/Dist/$<CONFIG>/${SUB_PROJECT_NAME}/Binaries)
@@ -385,6 +396,8 @@ function(exp_add_library)
385396
${arg_NAME}
386397
${arg_TYPE}
387398
)
399+
set_target_properties(${arg_NAME} PROPERTIES FOLDER ${BASE_TARGETS_FOLDER})
400+
388401
target_sources(
389402
${arg_NAME}
390403
PRIVATE ${arg_SRC} ${generated_src}
@@ -553,6 +566,8 @@ function(exp_add_test)
553566
endif()
554567
555568
add_executable(${arg_NAME})
569+
set_target_properties(${arg_NAME} PROPERTIES FOLDER ${BASE_TARGETS_FOLDER})
570+
556571
target_sources(
557572
${arg_NAME}
558573
PRIVATE ${arg_SRC} ${generated_src}

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_SOURCE_DIR}/conan_provider.cmake CA
66
project(Explosion)
77

88
option(BUILD_EDITOR "Build Explosion editor" ON)
9-
option(CI "Build in CI" OFF)
109

1110
set(SUB_PROJECT_NAME "Engine" CACHE STRING "" FORCE)
1211
set(ENGINE_SUB_PROJECT_NAME "Engine" CACHE STRING "" FORCE)

Editor/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ exp_add_mirror_info_source_generation_target(
3434

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

3839
get_cmake_property(GENERATOR_IS_MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG)
3940
if (${GENERATOR_IS_MULTI_CONFIG})
@@ -93,10 +94,10 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
9394
)
9495
endif ()
9596

97+
# TODO check is this need ?
9698
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
9799
foreach (rhi_dep_target ${RHI_DEP_TARGETS})
98100
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}>)
99-
# TODO also copy runtime dep of runtime dep
100101
endforeach ()
101102

102103
add_custom_command(
@@ -150,6 +151,7 @@ add_custom_target(
150151
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Web
151152
VERBATIM
152153
)
154+
set_target_properties(Editor.Web PROPERTIES FOLDER ${AUX_TARGETS_FOLDER})
153155
add_dependencies(Editor Editor.Web)
154156

155157
add_custom_command(

0 commit comments

Comments
 (0)