Skip to content
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
21 changes: 20 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
cmake_minimum_required(VERSION 3.10)

if(DEFINED CMAKE_TOOLCHAIN_FILE AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.14")
set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON CACHE BOOL "Install vcpkg runtime dependencies with executables")
endif()

project ( libcimbar )
enable_testing()

if (MSVC)
add_compile_options(/FI "iso646.h")
add_compile_options(/FI "iso646.h" /utf-8)
endif()

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
Expand Down Expand Up @@ -39,6 +43,16 @@ else() # if not wasm, go find opencv. 3 or 4 should both work
include_directories(${OpenCV_INCLUDE_DIRS})
endif()

if(MSVC)
find_package(glfw3 CONFIG REQUIRED)
find_package(unofficial-angle CONFIG REQUIRED)
set(PLATFORM_GL unofficial::angle::libGLESv2 unofficial::angle::libEGL)
get_target_property(ANGLE_EGL_RELEASE_DLL unofficial::angle::libEGL IMPORTED_LOCATION_RELEASE)
get_target_property(ANGLE_EGL_DEBUG_DLL unofficial::angle::libEGL IMPORTED_LOCATION_DEBUG)
else()
set(PLATFORM_GL GL)
endif()

if(DEFINED BUILD_PORTABLE_LINUX)
find_package(PkgConfig REQUIRED)
pkg_check_modules(OPENCV4 REQUIRED opencv4)
Expand Down Expand Up @@ -105,4 +119,9 @@ foreach(proj ${PROJECTS})
add_subdirectory(${proj} build/${proj})
endforeach()

if(MSVC)
install(FILES "${ANGLE_EGL_RELEASE_DLL}" DESTINATION bin CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
install(FILES "${ANGLE_EGL_DEBUG_DLL}" DESTINATION bin CONFIGURATIONS Debug)
endif()


12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ make install

By default, libcimbar will try to install build products under `./dist/bin/`.

### Windows (MSVC + vcpkg)

Install Visual Studio with the Desktop development with C++ workload, CMake 3.14 or newer, and [vcpkg](https://github.com/microsoft/vcpkg). Set `VCPKG_ROOT` to the vcpkg checkout, then configure and build from PowerShell:

```
cmake -S . -B build-windows -A x64 "-DCMAKE_TOOLCHAIN_FILE=$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --build build-windows --config Release --target cimbar_send cimbar_recv cimbar_recv2 --parallel
cmake --install build-windows --config Release
```

The included `vcpkg.json` installs OpenCV, GLFW, and ANGLE during configuration. The executables and their runtime DLLs are installed under `./dist/bin/`.

To build cimbar.js (what cimbar.org uses), see [WASM](WASM.md).

## Usage
Expand Down
12 changes: 7 additions & 5 deletions src/exe/cimbar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ target_link_libraries(cimbar
${CPPFILESYSTEM}
)

add_custom_command(
TARGET cimbar POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar> cimbar.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar>
)
if(NOT MSVC)
add_custom_command(
TARGET cimbar POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar> cimbar.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar>
)
endif()

install(
TARGETS cimbar
Expand Down
12 changes: 7 additions & 5 deletions src/exe/cimbar_extract/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ target_link_libraries(cimbar_extract
${OPENCV_LIBS}
)

add_custom_command(
TARGET cimbar_extract POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar_extract> cimbar_extract.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar_extract>
)
if(NOT MSVC)
add_custom_command(
TARGET cimbar_extract POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar_extract> cimbar_extract.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar_extract>
)
endif()

install(
TARGETS cimbar_extract
Expand Down
21 changes: 15 additions & 6 deletions src/exe/cimbar_recv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,26 @@ target_link_libraries(cimbar_recv
cimbar_js
extractor

GL
${PLATFORM_GL}
glfw
${OPENCV_LIBS}
opencv_videoio
)

add_custom_command(
TARGET cimbar_recv POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar_recv> cimbar_recv.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar_recv>
)
if(MSVC)
add_custom_command(
TARGET cimbar_recv POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:unofficial::angle::libEGL>
$<TARGET_FILE_DIR:cimbar_recv>
)
else()
add_custom_command(
TARGET cimbar_recv POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar_recv> cimbar_recv.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar_recv>
)
endif()

install(
TARGETS cimbar_recv
Expand Down
24 changes: 19 additions & 5 deletions src/exe/cimbar_recv2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,29 @@ target_link_libraries(cimbar_recv2
cimbar_js
extractor

GL
${PLATFORM_GL}
glfw
${OPENCV_LIBS}
opencv_videoio
)

add_custom_command(
TARGET cimbar_recv2 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar_recv2> cimbar_recv2.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar_recv2>
if(MSVC)
add_custom_command(
TARGET cimbar_recv2 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:unofficial::angle::libEGL>
$<TARGET_FILE_DIR:cimbar_recv2>
)
else()
add_custom_command(
TARGET cimbar_recv2 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar_recv2> cimbar_recv2.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar_recv2>
)
endif()

install(
TARGETS cimbar_recv2
DESTINATION bin
)

19 changes: 14 additions & 5 deletions src/exe/cimbar_send/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@ target_link_libraries(cimbar_send
cimbar_js
)

add_custom_command(
TARGET cimbar_send POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar_send> cimbar_send.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar_send>
)
if(MSVC)
add_custom_command(
TARGET cimbar_send POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:unofficial::angle::libEGL>
$<TARGET_FILE_DIR:cimbar_send>
)
else()
add_custom_command(
TARGET cimbar_send POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cimbar_send> cimbar_send.dbg
COMMAND ${CMAKE_STRIP} -g $<TARGET_FILE:cimbar_send>
)
endif()

install(
TARGETS cimbar_send
Expand Down
6 changes: 5 additions & 1 deletion src/lib/cimbar_js/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ else()
)
endif()

if(MSVC)
target_compile_definitions(cimbar_js PUBLIC CIMBAR_USE_ANGLE)
endif()

target_link_libraries(cimbar_js

cimb_translator
Expand Down Expand Up @@ -111,7 +115,7 @@ if(DEFINED USE_WASM)

else() # if no wasm, ignore all that and add in GLFW libraries
target_link_libraries(cimbar_js
GL
${PLATFORM_GL}
glfw
)
endif()
Expand Down
7 changes: 7 additions & 0 deletions src/lib/gui/window_glfw.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ class window_glfw
return;
}

#ifdef CIMBAR_USE_ANGLE
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
#endif

_w = glfwCreateWindow(width, height, title.c_str(), NULL, NULL);
if (!_w)
{
Expand Down
13 changes: 13 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "libcimbar",
"version-string": "0.6.7c",
"builtin-baseline": "ddd110b8a05cda14b8f1b0333a1d80c4fb6f16cd",
"dependencies": [
{
"name": "angle",
"platform": "windows & !mingw"
},
"glfw3",
"opencv4"
]
}