Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
vkedwardli committed Jan 11, 2025
1 parent 4c46495 commit b27c6d9
Showing 1 changed file with 41 additions and 11 deletions.
52 changes: 41 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,6 @@ if(USE_VULKAN)
option(ENABLE_PCH "Enables Precompiled header" OFF)
add_subdirectory(core/deps/glslang EXCLUDE_FROM_ALL)
if(MSVC)
get_property(all_targets GLOBAL PROPERTY TARGETS)
message(STATUS "Available targets:")
foreach(target IN LISTS all_targets)
message(STATUS " - ${target}")
endforeach()
set_property(TARGET glslang-default-resource-limits PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# set_property(TARGET MachineIndependent PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# set_property(TARGET GenericCodeGen PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
Expand Down Expand Up @@ -702,7 +697,7 @@ target_sources(${PROJECT_NAME} PRIVATE

add_subdirectory(core/deps/nowide EXCLUDE_FROM_ALL)
if(MSVC)
set_property(TARGET nowide::nowide PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# set_property(TARGET nowide::nowide PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE nowide::nowide)

Expand Down Expand Up @@ -2301,8 +2296,43 @@ if(${CMAKE_GENERATOR} MATCHES "^Xcode.*|^Visual Studio.*")
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SRC_FILES})
endif()

get_property(all_targets GLOBAL PROPERTY TARGETS)
message(STATUS "Available targets:")
foreach(target IN LISTS all_targets)
message(STATUS " - ${target}")
endforeach()
#
# Get all directories below the specified root directory.
# _result : The variable in which to store the resulting directory list
# _root : The root directory, from which to start.
#
macro(get_directories _result _root)
file(GLOB_RECURSE dirs RELATIVE ${_root} LIST_DIRECTORIES ON ${_root}/*)
foreach(dir ${dirs})
if(IS_DIRECTORY ${dir})
list(APPEND ${_result} ${dir})
endif()
endforeach()
endmacro()

#
# Get all targets defined at the specified directory (level).
# _result : The variable in which to store the resulting list of targets.
# _dir : The directory to query for targets.
#
macro(get_targets_by_directory _result _dir)
get_property(_target DIRECTORY ${_dir} PROPERTY BUILDSYSTEM_TARGETS)
set(_result ${_target})
endmacro()

#
# Get all targets defined below the specified root directory.
# _result : The variable in which to store the resulting list of targets.
# _root_dir : The root project root directory
#
macro(get_all_targets _result _root_dir)
get_directories(_all_directories ${_root_dir})
foreach(_dir ${_all_directories})
get_targets_by_directory(_target ${_dir})
if(_target)
list(APPEND ${_result} ${_target})
endif()
endforeach()
endmacro()

get_all_targets(ALL_TARGETS ${CMAKE_CURRENT_LIST_DIR})

0 comments on commit b27c6d9

Please sign in to comment.