Skip to content

Commit

Permalink
Improve installation to forcefully install pdb's for debugging.
Browse files Browse the repository at this point in the history
  • Loading branch information
giladreich committed Feb 19, 2019
1 parent 47755aa commit 85ebd63
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
1 change: 1 addition & 0 deletions CMakeImplFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
cmake_minimum_required(VERSION 3.6.0)


function(Init_Impl_Files HEADERS_CXX_IMPL_FILES SOURCES_CXX_IMPL_FILES)
if (IMGUI_IMPL_DX9)
message(STATUS "[INFO] Including Direct3D9 implementation files.")
Expand Down
57 changes: 43 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ project(imgui
DESCRIPTION "ImGui library."
)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<CONFIG>)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<CONFIG>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<CONFIG>)
set(CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/$<CONFIG>)

set(CMAKE_VERBOSE_MAKEFILE TRUE)

if (WIN32)
if (IMGUI_STATIC_LIBRARY)
message(STATUS "[INFO] Building library as static library.")
message(STATUS "[INFO] Building library as --> Static Library")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
else()
message(STATUS "[INFO] Building library as DLL.")
message(STATUS "[INFO] Building library as --> DLL")
set(BUILD_SHARED_LIBS ON)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
Expand All @@ -38,6 +39,7 @@ set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/imgui)
set(EXAMPLES_DIR ${SOURCE_DIR}/examples)
set(FONTS_DIR ${SOURCE_DIR}/misc/fonts)


##################################################################################################################
# Project Files
##################################################################################################################
Expand Down Expand Up @@ -108,15 +110,42 @@ target_include_directories(${PROJECT_NAME} PUBLIC
##################################################################################################################
# Target Install
##################################################################################################################
set (DISTRIBUTE_DIR ${CMAKE_BINARY_DIR}/dist)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${DISTRIBUTE_DIR}/bin
LIBRARY DESTINATION ${DISTRIBUTE_DIR}/lib
ARCHIVE DESTINATION ${DISTRIBUTE_DIR}/lib
set (DISTRIBUTE_DIR ${CMAKE_BINARY_DIR}/dist/$<CONFIG>)
install(
TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${DISTRIBUTE_DIR}/bin
LIBRARY DESTINATION ${DISTRIBUTE_DIR}/lib
ARCHIVE DESTINATION ${DISTRIBUTE_DIR}/lib
)
install(FILES ${HEADERS_CXX_FILES} ${HEADERS_CXX_IMPL_FILES}
DESTINATION ${DISTRIBUTE_DIR}/include
install(
FILES ${HEADERS_CXX_FILES} ${HEADERS_CXX_IMPL_FILES}
DESTINATION ${DISTRIBUTE_DIR}/include
)
install(FILES ${FONTS_FILES}
DESTINATION ${DISTRIBUTE_DIR}/misc/fonts
install(
FILES ${FONTS_FILES}
DESTINATION ${DISTRIBUTE_DIR}/misc/fonts
)

# Install PDB files for VS builds to enable debugging:
if (MSVC)
if (NOT IMGUI_STATIC_LIBRARY)
install(
FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
DESTINATION ${DISTRIBUTE_DIR}/lib
CONFIGURATIONS Debug OR RelWithDebInfo
COMPONENT libraries
OPTIONAL
)
else()
install(
FILES
$<$<CONFIG:Debug>:${CMAKE_BINARY_DIR}/bin/$<CONFIG>/${PROJECT_NAME}.pdb>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_BINARY_DIR}/${PROJECT_NAME}.dir/$<CONFIG>/${PROJECT_NAME}.pdb>
DESTINATION ${DISTRIBUTE_DIR}/lib
CONFIGURATIONS Debug OR RelWithDebInfo
COMPONENT libraries
OPTIONAL
)
endif()
endif()

5 changes: 3 additions & 2 deletions CMakeOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# ImGui Options
#
cmake_minimum_required(VERSION 3.6.0)

include(CMakeDependentOption)


Expand All @@ -13,7 +14,6 @@ option(IMGUI_STATIC_LIBRARY "Set to OFF to build as a DLL."
option(IMGUI_WITH_IMPL "Set to OFF to not include 'imgui_impl*' sources." ON)



##################################################################################################################
# Options Dependent
##################################################################################################################
Expand All @@ -32,4 +32,5 @@ cmake_dependent_option(IMGUI_IMPL_DX11
cmake_dependent_option(IMGUI_IMPL_DX12
"Set to ON to include implementation files." OFF
"IMGUI_WITH_IMPL" ON
)
)

0 comments on commit 85ebd63

Please sign in to comment.