2022-09-06 19:28:32 -04:00
|
|
|
# This build script is not meant for general use, it is for CI use only!
|
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(implot)
|
|
|
|
|
Support custom numeric types (#399)
* implot_items.cpp: support types customization
You can customize the supported types in two ways:
1. Define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES at compile time to add support for all known types.
2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double.
-DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(double)"
Details:
- `CALL_INSTANTIATE_FOR_NUMERIC_TYPES` will duplicate the template instantion code `INSTANTIATE_MACRO(T)` on supported types. It uses a trick to be able to loop on the type list `IMPLOT_NUMERIC_TYPES`
- `INSTANTIATE_MACRO` needs to be defined, then undefined before and after each template instantiation
* CI: link example app, with null backend
Github's CI will now compile ImGui, compile ImPlot, link and run an example application (with no backend).
It serves as a proof that an app can be built, linked, and run, with type customization.
- .github/example_implot.cpp is an example app built with Dear ImGui and ImPlot
This app uses implot and imgui, but does not output to any backend!
If `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` is active, it will test that `long double` is supported.
- Corrected arch matrix options:
32 bits or 64 bits for win and linux
x86_64 or arm64 for mac (32 bits is deprecated on macs, and will not link with recent XCode)
- Added `IMPLOT_NUMERIC_SETIMPLOT_NUMERIC_SET` as a switch to CMakeList
This switch is currently not used in CI, but can be used during development.
It could be later be used in the matrix options, at the cost of increasing the number of build
per workflow.
Note: support for MingW 32 bits was commented out. MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries. As a result, the windows matrix was spearated into Windows_MSVC and Windows_MingW
2022-09-13 21:39:29 -04:00
|
|
|
#
|
|
|
|
# Global options
|
|
|
|
#
|
|
|
|
|
2022-09-06 19:28:32 -04:00
|
|
|
# Same as Dear ImGui
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
|
Support custom numeric types (#399)
* implot_items.cpp: support types customization
You can customize the supported types in two ways:
1. Define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES at compile time to add support for all known types.
2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double.
-DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(double)"
Details:
- `CALL_INSTANTIATE_FOR_NUMERIC_TYPES` will duplicate the template instantion code `INSTANTIATE_MACRO(T)` on supported types. It uses a trick to be able to loop on the type list `IMPLOT_NUMERIC_TYPES`
- `INSTANTIATE_MACRO` needs to be defined, then undefined before and after each template instantiation
* CI: link example app, with null backend
Github's CI will now compile ImGui, compile ImPlot, link and run an example application (with no backend).
It serves as a proof that an app can be built, linked, and run, with type customization.
- .github/example_implot.cpp is an example app built with Dear ImGui and ImPlot
This app uses implot and imgui, but does not output to any backend!
If `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` is active, it will test that `long double` is supported.
- Corrected arch matrix options:
32 bits or 64 bits for win and linux
x86_64 or arm64 for mac (32 bits is deprecated on macs, and will not link with recent XCode)
- Added `IMPLOT_NUMERIC_SETIMPLOT_NUMERIC_SET` as a switch to CMakeList
This switch is currently not used in CI, but can be used during development.
It could be later be used in the matrix options, at the cost of increasing the number of build
per workflow.
Note: support for MingW 32 bits was commented out. MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries. As a result, the windows matrix was spearated into Windows_MSVC and Windows_MingW
2022-09-13 21:39:29 -04:00
|
|
|
# Arch option for linux
|
|
|
|
if (NOT APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" AND DEFINED GCC_ARCH)
|
|
|
|
if ("${GCC_ARCH}" MATCHES "Win32|x86|32")
|
|
|
|
add_compile_options(-m32)
|
|
|
|
add_link_options(-m32)
|
|
|
|
elseif ("${GCC_ARCH}" MATCHES "Win64|x64|64")
|
|
|
|
add_compile_options(-m64)
|
|
|
|
add_link_options(-m64)
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# Arch option for Mac: arm64 for M1 or x86_64 for intel (32 bits build are deprecated on Mac)
|
|
|
|
if(APPLE AND DEFINED OSX_ARCH)
|
|
|
|
if ("${OSX_ARCH}" MATCHES "x86_64")
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
|
|
|
elseif ("${OSX_ARCH}" MATCHES "arm64")
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unhandled OSX_ARCH=${OSX_ARCH}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#
|
|
|
|
# Dear ImGui library with no backend
|
|
|
|
#
|
|
|
|
|
|
|
|
set(imgui_sources
|
|
|
|
../imgui/imconfig.h
|
|
|
|
../imgui/imgui.cpp
|
|
|
|
../imgui/imgui.h
|
|
|
|
../imgui/imgui_demo.cpp
|
|
|
|
../imgui/imgui_draw.cpp
|
|
|
|
../imgui/imgui_internal.h
|
|
|
|
../imgui/imgui_tables.cpp
|
|
|
|
../imgui/imgui_widgets.cpp
|
|
|
|
../imgui/imstb_rectpack.h
|
|
|
|
../imgui/imstb_textedit.h
|
|
|
|
../imgui/imstb_truetype.h
|
|
|
|
)
|
|
|
|
add_library(imgui ${imgui_sources})
|
|
|
|
target_include_directories(imgui PUBLIC ../imgui)
|
|
|
|
|
|
|
|
#
|
|
|
|
# ImPlot library
|
|
|
|
#
|
|
|
|
|
2022-09-06 19:28:32 -04:00
|
|
|
file(GLOB SOURCE_CODE ../implot*.*)
|
|
|
|
add_library(implot STATIC ${SOURCE_CODE})
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(implot PRIVATE /W4 /WX)
|
|
|
|
else()
|
|
|
|
target_compile_options(implot PRIVATE -Wall -Werror -pedantic)
|
|
|
|
endif()
|
|
|
|
|
Support custom numeric types (#399)
* implot_items.cpp: support types customization
You can customize the supported types in two ways:
1. Define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES at compile time to add support for all known types.
2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double.
-DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(double)"
Details:
- `CALL_INSTANTIATE_FOR_NUMERIC_TYPES` will duplicate the template instantion code `INSTANTIATE_MACRO(T)` on supported types. It uses a trick to be able to loop on the type list `IMPLOT_NUMERIC_TYPES`
- `INSTANTIATE_MACRO` needs to be defined, then undefined before and after each template instantiation
* CI: link example app, with null backend
Github's CI will now compile ImGui, compile ImPlot, link and run an example application (with no backend).
It serves as a proof that an app can be built, linked, and run, with type customization.
- .github/example_implot.cpp is an example app built with Dear ImGui and ImPlot
This app uses implot and imgui, but does not output to any backend!
If `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` is active, it will test that `long double` is supported.
- Corrected arch matrix options:
32 bits or 64 bits for win and linux
x86_64 or arm64 for mac (32 bits is deprecated on macs, and will not link with recent XCode)
- Added `IMPLOT_NUMERIC_SETIMPLOT_NUMERIC_SET` as a switch to CMakeList
This switch is currently not used in CI, but can be used during development.
It could be later be used in the matrix options, at the cost of increasing the number of build
per workflow.
Note: support for MingW 32 bits was commented out. MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries. As a result, the windows matrix was spearated into Windows_MSVC and Windows_MingW
2022-09-13 21:39:29 -04:00
|
|
|
target_include_directories(implot PUBLIC ${CMAKE_CURRENT_LIST_DIR}/..)
|
|
|
|
target_link_libraries(implot PUBLIC imgui)
|
|
|
|
|
|
|
|
if (UNIX)
|
|
|
|
target_link_libraries(implot PUBLIC m stdc++)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Switch between several sets of numeric types (by adding `-DIMPLOT_NUMERIC_SET=default|custom|all`)
|
|
|
|
if (DEFINED IMPLOT_NUMERIC_SET)
|
|
|
|
if ("${IMPLOT_NUMERIC_SET}" STREQUAL "default")
|
|
|
|
message(STATUS "Compiling for default types")
|
|
|
|
elseif("${IMPLOT_NUMERIC_SET}" STREQUAL "custom")
|
|
|
|
message(STATUS "Compiling for custom types (float and double)")
|
|
|
|
target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=(float)(double)")
|
|
|
|
elseif("${IMPLOT_NUMERIC_SET}" STREQUAL "all")
|
|
|
|
message(STATUS "Compiling for all types")
|
|
|
|
target_compile_definitions(implot PRIVATE "IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES=1")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "unhandled IMPLOT_NUMERIC_SET=${IMPLOT_NUMERIC_SET}")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
# By default, the CI provides support for all known types
|
|
|
|
target_compile_definitions(implot PRIVATE IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES)
|
|
|
|
endif()
|
2022-09-06 19:28:32 -04:00
|
|
|
|
Support custom numeric types (#399)
* implot_items.cpp: support types customization
You can customize the supported types in two ways:
1. Define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES at compile time to add support for all known types.
2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double.
-DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(double)"
Details:
- `CALL_INSTANTIATE_FOR_NUMERIC_TYPES` will duplicate the template instantion code `INSTANTIATE_MACRO(T)` on supported types. It uses a trick to be able to loop on the type list `IMPLOT_NUMERIC_TYPES`
- `INSTANTIATE_MACRO` needs to be defined, then undefined before and after each template instantiation
* CI: link example app, with null backend
Github's CI will now compile ImGui, compile ImPlot, link and run an example application (with no backend).
It serves as a proof that an app can be built, linked, and run, with type customization.
- .github/example_implot.cpp is an example app built with Dear ImGui and ImPlot
This app uses implot and imgui, but does not output to any backend!
If `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` is active, it will test that `long double` is supported.
- Corrected arch matrix options:
32 bits or 64 bits for win and linux
x86_64 or arm64 for mac (32 bits is deprecated on macs, and will not link with recent XCode)
- Added `IMPLOT_NUMERIC_SETIMPLOT_NUMERIC_SET` as a switch to CMakeList
This switch is currently not used in CI, but can be used during development.
It could be later be used in the matrix options, at the cost of increasing the number of build
per workflow.
Note: support for MingW 32 bits was commented out. MingW on Github CI does not fully support 32 bits: link fails when it tries to link 64 bits system libraries. As a result, the windows matrix was spearated into Windows_MSVC and Windows_MingW
2022-09-13 21:39:29 -04:00
|
|
|
#
|
|
|
|
# implot example binary application (with no backend)
|
|
|
|
#
|
|
|
|
add_executable(example_implot example_implot.cpp)
|
|
|
|
target_link_libraries(example_implot PRIVATE implot)
|