Skip to content

Commit

Permalink
Merge pull request #94 from learn-more/msvc_target_folder
Browse files Browse the repository at this point in the history
Move more targets to solution folders
  • Loading branch information
pthom authored Feb 8, 2024
2 parents 6a01ee9 + d767b5e commit 3f2b29e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
17 changes: 7 additions & 10 deletions hello_imgui_cmake/hello_imgui_build_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,7 @@ function(_him_do_build_imgui)
$<BUILD_INTERFACE:${HELLOIMGUI_IMGUI_SOURCE_DIR}/misc/freetype>
)
him_add_installable_dependency(imgui)
if (MSVC)
hello_imgui_msvc_target_set_folder(imgui ${HELLOIMGUI_SOLUTIONFOLDER}/external)
endif()
hello_imgui_msvc_target_set_folder(imgui ${HELLOIMGUI_SOLUTIONFOLDER}/external)
endfunction()

function(_him_add_freetype_to_imgui)
Expand Down Expand Up @@ -396,6 +394,7 @@ function(_him_add_freetype_to_imgui)
)
FetchContent_MakeAvailable(freetype)
set(freetype_linked_library freetype)
hello_imgui_msvc_target_set_folder(freetype ${HELLOIMGUI_SOLUTIONFOLDER}/external)

set(BUILD_SHARED_LIBS ${backup_shared_lib} CACHE BOOL "" FORCE)
else()
Expand Down Expand Up @@ -449,6 +448,7 @@ function(_him_add_freetype_to_imgui)
get_target_property(lunasvg_include_dirs lunasvg INTERFACE_INCLUDE_DIRECTORIES)

him_add_installable_dependency(lunasvg)
hello_imgui_msvc_target_set_folder(lunasvg ${HELLOIMGUI_SOLUTIONFOLDER}/external)
endif()
endif()

Expand Down Expand Up @@ -564,6 +564,7 @@ function(him_add_stb_image)
# Add stb for HelloImGui
set(stb_dir ${HELLOIMGUI_BASEPATH}/external/stb_hello_imgui)
add_library(stb_hello_imgui STATIC ${stb_dir}/stb_impl_hello_imgui.cpp)
hello_imgui_msvc_target_set_folder(stb_hello_imgui ${HELLOIMGUI_SOLUTIONFOLDER}/external)

if(Stb_FOUND)
message(STATUS "HelloImGui: using stb from find_package(Stb)")
Expand Down Expand Up @@ -646,10 +647,8 @@ function(him_add_windows_options)
endfunction()

function(_him_msvc_group_sources)
if (MSVC)
hello_imgui_msvc_target_group_sources(${HELLOIMGUI_TARGET})
hello_imgui_msvc_target_set_folder(${HELLOIMGUI_TARGET} ${HELLOIMGUI_SOLUTIONFOLDER})
endif()
hello_imgui_msvc_target_group_sources(${HELLOIMGUI_TARGET})
hello_imgui_msvc_target_set_folder(${HELLOIMGUI_TARGET} ${HELLOIMGUI_SOLUTIONFOLDER})
endfunction()

function(_him_win_add_auto_win_main)
Expand Down Expand Up @@ -776,9 +775,7 @@ function(_him_add_glad)
target_compile_definitions(glad PUBLIC GLAD_GLAPI_EXPORT PRIVATE GLAD_GLAPI_EXPORT_BUILD)
endif()

if (MSVC)
hello_imgui_msvc_target_set_folder(glad ${HELLOIMGUI_SOLUTIONFOLDER}/external/OpenGL_Loaders)
endif()
hello_imgui_msvc_target_set_folder(glad ${HELLOIMGUI_SOLUTIONFOLDER}/external/OpenGL_Loaders)
target_link_libraries(${HELLOIMGUI_TARGET} PUBLIC glad)

him_add_installable_dependency(glad)
Expand Down
3 changes: 3 additions & 0 deletions hello_imgui_cmake/msvc/msvc_target_group.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ if (MSVC)
endfunction()

else()
# Dummy functions so we don't have to call them conditionally
function(hello_imgui_msvc_target_group_sources target_name)
endfunction(hello_imgui_msvc_target_group_sources)
function(hello_imgui_msvc_target_set_folder target_name)
endfunction(hello_imgui_msvc_target_set_folder)
endif()

0 comments on commit 3f2b29e

Please sign in to comment.