aybe/DearImGui

CMakeLists.txt

aybe opened this issue · 0 comments

aybe commented

This works for Windows, other platforms should be addressed:

cmake_minimum_required(VERSION 3.11)

project(imgui.NET.Native VERSION 1.88)

set (CMAKE_CXX_STANDARD 11)

set (CMAKE_CXX_STANDARD_REQUIRED true)

# imgui

add_library(imgui SHARED
    imgui/imgui/imgui.cpp
    imgui/imgui/imgui_draw.cpp
    imgui/imgui/imgui_demo.cpp
    imgui/imgui/imgui_widgets.cpp
    imgui/imgui/imgui_tables.cpp
)

target_compile_definitions(imgui
    PUBLIC
        IMGUI_DISABLE_OBSOLETE_FUNCTIONS
        IMGUI_DISABLE_OBSOLETE_KEYIO
)

if (WIN32)
    target_compile_definitions(imgui
        PUBLIC
            IMGUI_API=__declspec\(dllexport\)
    )
else()
    message(FATAL_ERROR "Not implemented")
endif()

# implot

add_library(implot SHARED
    implot/implot/implot.cpp
    implot/implot/implot_demo.cpp
    implot/implot/implot_items.cpp
)

target_include_directories(implot PUBLIC imgui/imgui)

target_compile_definitions(implot
    PUBLIC
        IMPLOT_DISABLE_OBSOLETE_FUNCTIONS
)

target_link_libraries(implot PUBLIC imgui)

if (WIN32)
    target_compile_definitions(implot
        PRIVATE
            IMGUI_API=__declspec\(dllimport\)
            IMPLOT_API=__declspec\(dllexport\)
    )
else()
    message(FATAL_ERROR "Not implemented")
endif()