File tree Expand file tree Collapse file tree 9 files changed +184
-327
lines changed Expand file tree Collapse file tree 9 files changed +184
-327
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ template <typename T> constexpr VariableType get_type() {
5151 return VariableType::Float32;
5252 else if constexpr (sizeof (T) == 8 )
5353 return VariableType::Float64;
54+ } else {
55+ return VariableType::Invalid;
5456 }
55-
56- return VariableType::Invalid;
5757}
5858
5959// / Return the size in bytes associated with a specific variable type
Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ class Color : public Vector4f {
339339 * \param alpha
340340 * The alpha component of the color, will be divided by ``255.0``.
341341 */
342- Color (size_t intensity, int alpha)
342+ Color (int intensity, int alpha)
343343 : Color(Vector3i(intensity), alpha) { }
344344
345345 /* *
Original file line number Diff line number Diff line change 1+ if (NOT NANOGUI_BUILD_SHARED)
2+ # Need PIC code in libnanogui & GLFW even when compiled as a static library
3+ set_target_properties (nanogui PROPERTIES POSITION_INDEPENDENT_CODE ON )
4+
5+ if (NANOGUI_BUILD_GLFW)
6+ set_target_properties (glfw_objects PROPERTIES POSITION_INDEPENDENT_CODE ON )
7+ endif ()
8+ endif ()
9+
10+ if (NANOGUI_BUILD_PYTHON AND (APPLE OR CMAKE_SYSTEM MATCHES "Linux" ))
11+ # Include coroutine support for running the mainloop in detached mode
12+ add_definitions (-DCORO_SJLJ)
13+ include_directories (../ext /coro)
14+ set (NANOGUI_PYTHON_EXTRA ../ext /coro/coro.c)
15+ endif ()
16+
17+ add_definitions (-DNANOGUI_PYTHON)
18+
19+ pybind11_add_module(nanogui-python MODULE THIN_LTO OPT_SIZE
20+ main.cpp
21+ glfw.cpp
22+ icons.cpp
23+ color.cpp
24+ widget.cpp
25+ layout.cpp
26+ basics.cpp
27+ button.cpp
28+ tabs.cpp
29+ textbox.cpp
30+ textarea.cpp
31+ theme.cpp
32+ formhelper.cpp
33+ misc.cpp
34+ canvas.cpp
35+ nanovg.cpp
36+ render.cpp
37+ vector.cpp
38+ python.h
39+ py_doc.h
40+ ${NANOGUI_PYTHON_EXTRA} )
41+
42+ set_target_properties (nanogui-python PROPERTIES OUTPUT_NAME nanogui)
43+ target_link_libraries (nanogui-python PRIVATE nanogui)
44+
45+ if (CMAKE_COMPILER_IS_GNUCC)
46+ # Quench warnings on GCC
47+ target_compile_options (nanogui-python PRIVATE -Wno-unused-variable )
48+ endif ()
49+
50+ if (NANOGUI_INSTALL)
51+ install (TARGETS nanogui-python
52+ LIBRARY DESTINATION lib
53+ ARCHIVE DESTINATION lib)
54+ endif ()
Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ static py::array texture_download(Texture &texture) {
7171 case Texture::ComponentFormat::Int32: dtype_name = " i4" ; break ;
7272 case Texture::ComponentFormat::Float16: dtype_name = " f2" ; break ;
7373 case Texture::ComponentFormat::Float32: dtype_name = " f4" ; break ;
74+ default :
75+ throw std::runtime_error (" Invalid component format" );
7476 }
7577
7678 py::array result (
Original file line number Diff line number Diff line change 66#if defined(__clang__)
77# pragma clang diagnostic push
88# pragma clang diagnostic ignored "-Wself-assign-overloaded"
9+ # pragma clang diagnostic ignored "-Wunused-lambda-capture"
910#endif
1011
1112template <typename Array>
Original file line number Diff line number Diff line change 4141
4242#define STB_IMAGE_STATIC
4343#define STB_IMAGE_IMPLEMENTATION
44+ #if defined(_MSC_VER)
45+ # pragma warning (disable: 4505) // don't warn about dead code in stb_image.h
46+ #elif defined(__GNUC__)
47+ # pragma GCC diagnostic ignored "-Wunused-function"
48+ #endif
4449#include < stb_image.h>
4550
4651using namespace nanogui ;
You can’t perform that action at this time.
0 commit comments