Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the custom UI host #111

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include(cmake/CMakeInclude.txt)

option(ELEMENTS_BUILD_EXAMPLES "build Elements library examples" ON)
option(ELEMENTS_ENABLE_LTO "enable link time optimization for Elements targets" OFF)
set(ELEMENTS_HOST_UI_LIBRARY "" CACHE STRING "gtk, cocoa or win32")
set(ELEMENTS_HOST_UI_LIBRARY "" CACHE STRING "gtk, cocoa, win32 or custom")
option(ELEMENTS_HOST_ONLY_WIN7 "If host UI library is win32, reduce elements features to support Windows 7" OFF)

add_subdirectory(lib)
Expand Down
6 changes: 5 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ set(ELEMENTS_HEADERS
include/elements.hpp
)

if (APPLE)
if (ELEMENTS_HOST_UI_LIBRARY STREQUAL "custom")
set(ELEMENTS_HOST)
elseif (APPLE)
set(ELEMENTS_HOST
host/macos/app.mm
host/macos/base_view.mm
Expand Down Expand Up @@ -275,6 +277,8 @@ elseif(ELEMENTS_HOST_UI_LIBRARY STREQUAL "win32")
target_compile_definitions(elements PRIVATE ELEMENTS_HOST_ONLY_WIN7)
message(STATUS "Windows 7 compatibility enabled")
endif()
elseif(ELEMENTS_HOST_UI_LIBRARY STREQUAL "custom")
target_compile_definitions(elements PUBLIC ELEMENTS_HOST_UI_LIBRARY_CUSTOM)
else()
message(FATAL_ERROR "Invalid ELEMENTS_HOST_UI_LIBRARY=${ELEMENTS_HOST_UI_LIBRARY}. Set gtk, cocoa or win32.")
endif()
Expand Down
3 changes: 3 additions & 0 deletions lib/include/elements/base_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ namespace cycfi { namespace elements
#elif defined(ELEMENTS_HOST_UI_LIBRARY_WIN32)
using host_view_handle = HWND;
using host_window_handle = HWND;
#elif defined(ELEMENTS_HOST_UI_LIBRARY_CUSTOM)
using host_view_handle = void*;
using host_window_handle = void*;
#else
#error no ELEMENTS_HOST_UI_LIBRARY_* set
#endif
Expand Down