Skip to content

Commit e22b0ac

Browse files
author
pvn
committed
build examples (Windows only at this time)
1 parent 54347f0 commit e22b0ac

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,35 @@ install(EXPORT webui
8686
NAMESPACE webui::
8787
DESTINATION share/webui
8888
)
89+
90+
91+
#//////////////////////////
92+
# Build examples
93+
#//////////////////////////
94+
95+
message(STATUS "Source directory is " ${CMAKE_SOURCE_DIR})
96+
message(STATUS "Build directory is " ${CMAKE_BINARY_DIR})
97+
98+
if (MSVC)
99+
include_directories(${CMAKE_SOURCE_DIR}/include)
100+
elseif(APPLE)
101+
elseif(LINUX)
102+
endif()
103+
104+
add_executable(minimal ${CMAKE_SOURCE_DIR}/examples/C++/minimal/main.cpp)
105+
add_executable(call_js_from_cpp ${CMAKE_SOURCE_DIR}/examples/C++/call_js_from_cpp/main.cpp)
106+
add_executable(call_js_from_c ${CMAKE_SOURCE_DIR}/examples/C/call_js_from_c/main.c)
107+
108+
target_link_libraries(minimal webui)
109+
target_link_libraries(call_js_from_cpp webui)
110+
target_link_libraries(call_js_from_c webui)
111+
112+
if (MSVC)
113+
set_target_properties(minimal PROPERTIES LINK_FLAGS "/SubSystem:\"Windows\"" VS_DPI_AWARE "ON")
114+
set_target_properties(call_js_from_cpp PROPERTIES LINK_FLAGS "/SubSystem:\"Windows\"" VS_DPI_AWARE "ON")
115+
set_target_properties(call_js_from_c PROPERTIES LINK_FLAGS "/SubSystem:\"Windows\"" VS_DPI_AWARE "ON")
116+
endif()
117+
118+
if (MSVC)
119+
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT call_js_from_cpp)
120+
endif()

build.cmake.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
mkdir -p build
3+
4+
# webui-2.5.0, examples
5+
pushd build
6+
cmake .. --fresh
7+
cmake --build . --config Debug
8+
popd
9+

0 commit comments

Comments
 (0)