Skip to content

Commit

Permalink
cmake: move cmake/ to imgui_bundle_cmake/internal/
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Jan 30, 2024
1 parent dedd358 commit 48c1d5d
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 24 deletions.
13 changes: 6 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ endif()
# -----------------------------------------------------------------------------
# the easiest way to build an app with imgui_bundle is to use
# imgui_bundle_add_app(my_app my_file.cpp)
set(IMGUIBUNDLE_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/imgui_bundle_cmake CACHE STRING "" FORCE)
list(APPEND CMAKE_MODULE_PATH "${IMGUIBUNDLE_CMAKE_PATH}")
set(IMGUI_BUNDLE_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/imgui_bundle_cmake CACHE STRING "" FORCE)
list(APPEND CMAKE_MODULE_PATH "${IMGUI_BUNDLE_CMAKE_PATH}")
include(imgui_bundle_add_app)
set(IMGUIBUNDLE_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "" FORCE)
set(IMGUI_BUNDLE_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "" FORCE)


# if building the python package, do some clenaup:
Expand Down Expand Up @@ -287,8 +287,7 @@ endif()

# Main
# ----------------------------------------------------------------------
include(cmake/dump_cmake_variables.cmake)
include(imgui_bundle_cmake/litgen_setup_module.cmake)
include(imgui_bundle_cmake/internal/litgen_setup_module.cmake)
set(CMAKE_CXX_STANDARD 17)

# if build python binding, add definitions and use SDL + GLFW
Expand Down Expand Up @@ -344,7 +343,7 @@ endif()
# find pybind11
# -----------------------------------------------------------------------------
if (IMGUI_BUNDLE_BUILD_PYTHON)
include(cmake/find_pybind11.cmake)
include(imgui_bundle_cmake/internal/find_pybind11.cmake)
find_pybind11() # provided by cmake/find_pybind11.cmake
endif()

Expand All @@ -369,7 +368,7 @@ add_subdirectory(external)
# Build python bindings
# -----------------------------------------------------------------------------
if (IMGUI_BUNDLE_BUILD_PYTHON)
include(cmake/add_imgui_bundle_bindings.cmake)
include(imgui_bundle_cmake/internal/add_imgui_bundle_bindings.cmake)
add_imgui_bundle_bindings()

if (IMGUI_BUNDLE_WITH_TEST_ENGINE)
Expand Down
4 changes: 2 additions & 2 deletions bindings/imgui_bundle/demos_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function(add_demo_cpp)
# add_demo_cpp(demo_name demo_file_1.cpp demo_file_2.cpp)
set(args ${ARGN})
list(GET args 0 demo_name)
set(demos_asset_folder ${IMGUIBUNDLE_PATH}/bindings/imgui_bundle/demos_assets)
set(demos_asset_folder ${IMGUI_BUNDLE_PATH}/bindings/imgui_bundle/demos_assets)
imgui_bundle_add_app(${args} ASSETS_LOCATION ${demos_asset_folder})
if(MSVC)
hello_imgui_msvc_target_set_folder(${demo_name} demos_cpp)
Expand Down Expand Up @@ -99,7 +99,7 @@ add_this_folder_as_demos_library()
if (EMSCRIPTEN)
set(demos_python_folder ${demos_cpp_folder}/../demos_python)

set(imgui_demo_src_folder ${IMGUIBUNDLE_PATH}/external/imgui/imgui/)
set(imgui_demo_src_folder ${IMGUI_BUNDLE_PATH}/external/imgui/imgui/)
set(imgui_demo_tmp_folder ${CMAKE_CURRENT_BINARY_DIR}/tmp/imgui_demo_code)
file(COPY ${imgui_demo_src_folder}/imgui_demo.cpp DESTINATION ${imgui_demo_tmp_folder})
file(COPY ${imgui_demo_src_folder}/imgui_demo.py DESTINATION ${imgui_demo_tmp_folder})
Expand Down
4 changes: 2 additions & 2 deletions bindings/imgui_bundle/doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ set(input_doc_files
${CMAKE_CURRENT_LIST_DIR}/Readme_source_pypi.adoc
${CMAKE_CURRENT_LIST_DIR}/faq_source.adoc
)
file(GLOB output_html_files ${IMGUIBUNDLE_PATH}/docs/*.html)
file(GLOB output_html_files ${IMGUI_BUNDLE_PATH}/docs/*.html)

add_custom_command(
OUTPUT
${output_html_files}
${CMAKE_CURRENT_LIST_DIR}/Readme.adoc
${IMGUIBUNDLE_PATH}/bindings/imgui_bundle/Readme_pypi.md
${IMGUI_BUNDLE_PATH}/bindings/imgui_bundle/Readme_pypi.md
COMMAND /bin/bash ${CMAKE_CURRENT_LIST_DIR}/scripts/build_doc.sh
DEPENDS ${input_doc_files}
)
Expand Down
2 changes: 1 addition & 1 deletion devel_docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
file(GLOB input_docpart_files ${CMAKE_CURRENT_LIST_DIR}/devdoc_parts/*.adoc)
set(input_doc_files ${input_docpart_files} ${CMAKE_CURRENT_LIST_DIR}/index.adoc)
file(GLOB output_html_files ${IMGUIBUNDLE_PATH}/docs/devel_docs/*.html)
file(GLOB output_html_files ${IMGUI_BUNDLE_PATH}/docs/devel_docs/*.html)

add_custom_command(
OUTPUT ${output_html_files}
Expand Down
6 changes: 3 additions & 3 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include(../cmake/add_simple_library.cmake) # Tooling to build libraries and link them to imgui_bundle
include(../imgui_bundle_cmake/internal/add_simple_library.cmake) # Tooling to build libraries and link them to imgui_bundle

function(_target_force_include target include_file)
if (MSVC)
Expand All @@ -21,7 +21,7 @@ endif()
# Build ImGui & Hello ImGui
###############################################################################
# Build imgui + hello_imgui
include(../cmake/add_hello_imgui.cmake)
include(../imgui_bundle_cmake/internal/add_hello_imgui.cmake)
add_hello_imgui()
if (IMGUI_BUNDLE_BUILD_PYTHON)
target_compile_definitions(imgui PUBLIC IMGUI_BUNDLE_BUILD_PYTHON)
Expand Down Expand Up @@ -57,7 +57,7 @@ endif()
if(NOT IMGUI_BUNDLE_DISABLE_IMPLOT)
add_simple_external_library_with_sources(implot implot)
target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=(signed char)(unsigned char)(signed short)(unsigned short)(signed int)(unsigned int)(signed long)(unsigned long)(signed long long)(unsigned long long)(float)(double)(long double)")
_target_force_include(implot ${CMAKE_CURRENT_LIST_DIR}/../cmake/imgui_bundle_config.h)
_target_force_include(implot ${IMGUI_BUNDLE_CMAKE_PATH}/imgui_bundle_config.h)
lg_disable_warning_exception_in_destructor(implot)
target_compile_definitions(imgui_bundle INTERFACE IMGUI_BUNDLE_WITH_IMPLOT)
set(IMGUI_BUNDLE_WITH_IMPLOT ON CACHE INTERNAL "" FORCE)
Expand Down
2 changes: 1 addition & 1 deletion external/bindings_generation/autogenerate_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def write_cmake_all_pybind_files():
# autogenerated file! See autogenerate_all.py
#
set(external_dir ${IMGUIBUNDLE_PATH}/external)
set(external_dir ${IMGUI_BUNDLE_PATH}/external)
set(all_pybind_files
_FILELIST_
Expand Down
2 changes: 1 addition & 1 deletion external/bindings_generation/cpp/all_pybind_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# autogenerated file! See autogenerate_all.py
#

set(external_dir ${IMGUIBUNDLE_PATH}/external)
set(external_dir ${IMGUI_BUNDLE_PATH}/external)

set(all_pybind_files
${external_dir}/imgui/bindings/pybind_imgui_backends.cpp
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ function(_add_glfw_as_python_shared_library)
glfw_deploy_editable
ALL
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_FILE:glfw> ${IMGUIBUNDLE_PATH}/bindings/imgui_bundle/$<TARGET_FILE_NAME:glfw>
${CMAKE_COMMAND} -E copy $<TARGET_FILE:glfw> ${IMGUI_BUNDLE_PATH}/bindings/imgui_bundle/$<TARGET_FILE_NAME:glfw>
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_FILE:glfw> ${IMGUIBUNDLE_PATH}/bindings/imgui_bundle/libglfw.3.dylib
${CMAKE_COMMAND} -E copy $<TARGET_FILE:glfw> ${IMGUI_BUNDLE_PATH}/bindings/imgui_bundle/libglfw.3.dylib
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_FILE:glfw> ${IMGUIBUNDLE_PATH}/bindings/imgui_bundle/libglfw.3.so
${CMAKE_COMMAND} -E copy $<TARGET_FILE:glfw> ${IMGUI_BUNDLE_PATH}/bindings/imgui_bundle/libglfw.3.so
DEPENDS glfw
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function(add_imgui imgui_dir)
target_sources(imgui PRIVATE ${imgui_dir}/backends/imgui_impl_opengl2.cpp ${imgui_dir}/backends/imgui_impl_opengl2.h)
endif()
target_include_directories(imgui PUBLIC ${imgui_dir} ${imgui_dir}/..)
target_compile_definitions(imgui PUBLIC IMGUI_USER_CONFIG="${_THIS_MODULE_DIR}/imgui_bundle_config.h")
target_compile_definitions(imgui PUBLIC IMGUI_USER_CONFIG="${IMGUI_BUNDLE_CMAKE_PATH}/imgui_bundle_config.h")
lg_disable_warning_exception_in_destructor(imgui)
if(PROJECT_IS_TOP_LEVEL AND NOT SKBUILD)
install(TARGETS imgui DESTINATION ./lib/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endfunction()


function(add_imgui_bundle_bindings)
set(bindings_main_folder ${IMGUIBUNDLE_PATH}/external/bindings_generation/cpp/)
set(bindings_main_folder ${IMGUI_BUNDLE_PATH}/external/bindings_generation/cpp/)
include(${bindings_main_folder}/all_pybind_files.cmake)

#########################################################################
Expand All @@ -29,7 +29,7 @@ function(add_imgui_bundle_bindings)
pybind11_add_module(${python_native_module_name} ${python_module_sources})
target_compile_definitions(${python_native_module_name} PRIVATE VERSION_INFO=${PROJECT_VERSION})

litgen_setup_module(${bound_library} ${python_native_module_name} ${python_wrapper_module_name} ${IMGUIBUNDLE_PATH}/bindings)
litgen_setup_module(${bound_library} ${python_native_module_name} ${python_wrapper_module_name} ${IMGUI_BUNDLE_PATH}/bindings)

# add cvnp for immvision
if (IMGUI_BUNDLE_WITH_IMMVISION)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(IMGUIBUNDLE_EXTERNAL_PATH ${IMGUIBUNDLE_PATH}/external CACHE STRING "" FORCE)
set(IMGUIBUNDLE_EXTERNAL_PATH ${IMGUI_BUNDLE_PATH}/external CACHE STRING "" FORCE)


####################################################
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 48c1d5d

Please sign in to comment.