Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .das_module
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ def initialize(project_path : string) {
if (das_is_dll_build()) {
register_dynamic_module("{project_path}/dasModuleImplot.shared_module", "Module_dasIMPLOT")
}
register_native_path("imgui", "imgui_implot_boost", "{project_path}/daslib/implot_boost.das")
register_native_path("imgui", "imgui_implot_boost_v2", "{project_path}/daslib/implot_boost_v2.das")
register_native_path("imgui", "imgui_implot_app", "{project_path}/daslib/implot_app.das")
register_native_path("imgui", "imgui_implot_playwright", "{project_path}/daslib/implot_playwright.das")
register_native_path("imgui", "imgui_implot_boost", "{project_path}/daslib/imgui_implot_boost.das")
register_native_path("imgui", "imgui_implot_boost_v2", "{project_path}/daslib/imgui_implot_boost_v2.das")
register_native_path("imgui", "imgui_implot_app", "{project_path}/daslib/imgui_implot_app.das")
register_native_path("imgui", "imgui_implot_playwright", "{project_path}/daslib/imgui_implot_playwright.das")
// theme wrapper module is registered here when added.
}
72 changes: 66 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
cmake_minimum_required(VERSION 3.16)
project(dasImguiImplot CXX C)
# dasImguiImplot builds two ways from a single CMakeLists:
# - included from a daslang superbuild (the ADD_MODULE_* macros exist): the module
# links statically into the host app via the convention path (dasImgui provides
# imgui headers + the libDasModuleImgui target) -- how an embedding app and the
# fat-man static-link example consume it.
# - configured directly (top-level project, DASLANG_DIR set): the standalone
# .shared_module build CI, the daspkg index, and -load_module consumers run on.
IF(NOT COMMAND ADD_MODULE_CPP)
cmake_minimum_required(VERSION 3.16)
project(dasImguiImplot CXX C)
ENDIF()

# DASLANG_DIR must point to the daslang SDK root
if(NOT DEFINED DASLANG_DIR)
message(FATAL_ERROR "DASLANG_DIR must be set to the daslang SDK root")
endif()
IF((NOT DAS_IMPLOT_INCLUDED) AND ((NOT ${DAS_IMPLOT_DISABLED}) OR (NOT DEFINED DAS_IMPLOT_DISABLED)))
SET(DAS_IMPLOT_INCLUDED TRUE)
MESSAGE(STATUS "dasImguiImplot module included.")

SET(DAS_IMPLOT_DIR ${CMAKE_CURRENT_LIST_DIR})

IF(COMMAND ADD_MODULE_CPP)
# superbuild: dasImgui's CMakeLists (included earlier -- the modules glob is
# alphabetical) already set imgui_INCLUDE_DIR and created libDasModuleImgui
IF(NOT DEFINED imgui_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "dasImguiImplot superbuild: dasImgui must be included first (imgui_INCLUDE_DIR unset)")
ENDIF()
SET(DAS_IMGUI_DIR ${CMAKE_CURRENT_LIST_DIR}/../dasImgui)
Comment on lines +22 to +25
ELSE()
# DASLANG_DIR must point to the daslang SDK root
if(NOT DEFINED DASLANG_DIR)
message(FATAL_ERROR "DASLANG_DIR must be set to the daslang SDK root")
endif()

# Locate dasImgui (sibling module under same modules/ parent)
get_filename_component(MODULES_DIR "${DAS_IMPLOT_DIR}" DIRECTORY)
SET(DAS_IMGUI_DIR "${MODULES_DIR}/dasImgui")
Expand All @@ -29,6 +50,7 @@ if(WIN32)
message(FATAL_ERROR "dasModuleImgui.lib not found at ${DAS_IMGUI_DIR}/. Build dasImgui first.")
endif()
endif()
ENDIF()

# ImPlot v0.16 (vendored, patched for imgui 1.90.6 compatibility)
SET(IMPLOT_INCLUDE_DIR ${DAS_IMPLOT_DIR}/implot)
Expand All @@ -51,6 +73,41 @@ SET(DAS_IMPLOT_BIND_SRC
${DAS_IMPLOT_FUNC_SRC}
)


IF(COMMAND ADD_MODULE_CPP)
# ===== daslang superbuild: static-embed =====
# `require imgui/<name>` -> modules/dasImguiImplot/daslib/<name>.das; the glob IS the
# .das_module register_native_path list (file stem == module name throughout).
ADD_MODULE_CPP(dasIMPLOT)
FILE(GLOB _dasImguiImplot_das_files "${DAS_IMPLOT_DIR}/daslib/*.das")
FOREACH(_f ${_dasImguiImplot_das_files})
GET_FILENAME_COMPONENT(_n "${_f}" NAME_WE)
ADD_MODULE_DAS(imgui daslib ${_n})
ENDFOREACH()

IF(EMSCRIPTEN)
ADD_DAS_STATIC_MODULE_LIB(libDasModuleImplot ${DAS_IMPLOT_BIND_SRC} ${DAS_IMPLOT_SRC})
SET(_dasImguiImplot_targets libDasModuleImplot)
ELSE()
ADD_MODULE_LIB(libDasModuleImplot dasModuleImplot ${DAS_IMPLOT_BIND_SRC} ${DAS_IMPLOT_SRC})
SET(_dasImguiImplot_targets libDasModuleImplot dasModuleImplot)
ENDIF()
FOREACH(_t ${_dasImguiImplot_targets})
TARGET_INCLUDE_DIRECTORIES(${_t} PRIVATE
${imgui_INCLUDE_DIR}
${IMPLOT_INCLUDE_DIR}
${DAS_IMGUI_DIR}/src
${DAS_IMPLOT_DIR}/src
)
TARGET_COMPILE_DEFINITIONS(${_t} PRIVATE IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1)
SETUP_CPP11(${_t})
ENDFOREACH()
# imgui core symbols come from dasImgui's libs
TARGET_LINK_LIBRARIES(libDasModuleImplot PUBLIC libDasModuleImgui)
IF(NOT EMSCRIPTEN)
TARGET_LINK_LIBRARIES(dasModuleImplot PUBLIC dasModuleImgui)
ENDIF()
ELSE()
IF(WIN32)
SET(IMGUI_IMPORT_ATTR "__declspec\(dllimport\)")
ELSE()
Expand Down Expand Up @@ -123,3 +180,6 @@ set_target_properties(dasModuleImplot PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${DAS_IMPLOT_DIR}"
LIBRARY_OUTPUT_DIRECTORY "${DAS_IMPLOT_DIR}"
)
ENDIF() # superbuild / standalone

ENDIF() # DAS_IMPLOT_INCLUDED guard
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading