-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from NuiCpp/devel
Custom Scheme Handler Support
- Loading branch information
Showing
66 changed files
with
9,416 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(basic) | ||
add_subdirectory(basic) | ||
add_subdirectory(custom_schemes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
target_sources(basic-example PRIVATE main.cpp main_page.cpp) | ||
target_sources(${PROJECT_NAME} PRIVATE main.cpp main_page.cpp) | ||
|
||
target_include_directories(basic-example PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include) | ||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include) | ||
|
||
# Link frontend of nui inside of emscripten | ||
target_link_libraries(basic-example PRIVATE nui-frontend) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE nui-frontend) | ||
|
||
nui_prepare_emscripten_target( | ||
TARGET | ||
basic-example | ||
${PROJECT_NAME} | ||
PARCEL_ARGS | ||
PREJS | ||
${PREJS_FILE} | ||
EMSCRIPTEN_LINK_OPTIONS | ||
-sEXPORTED_FUNCTIONS=_frontendMain | ||
-O2 | ||
-sALLOW_MEMORY_GROWTH=1 | ||
-sALLOW_MEMORY_GROWTH=1 | ||
EMSCRIPTEN_COMPILE_OPTIONS | ||
-O3 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
build | ||
_build | ||
.vscode | ||
.vs | ||
.idea | ||
out | ||
CMakeSettings.json | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "@parcel/config-default", | ||
"reporters": [ | ||
"...", | ||
"parcel-reporter-static-files-copy" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cmake_minimum_required(VERSION 3.21) | ||
|
||
project(custom-schemes VERSION 0.1.0) | ||
|
||
include (${CMAKE_CURRENT_LIST_DIR}/_cmake/common_options.cmake) | ||
|
||
# Add executable (sources are added later, depending on frontend/backend) | ||
add_executable(custom-schemes) | ||
set_common_options(custom-schemes) | ||
|
||
set(PREJS_FILE ${CMAKE_CURRENT_LIST_DIR}/frontend/source/frontend/js/module.js) | ||
|
||
if (EMSCRIPTEN) | ||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/frontend/source/frontend) | ||
else() | ||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/backend/source/backend) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Boost Software License - Version 1.0 - August 17th, 2003 | ||
|
||
Permission is hereby granted, free of charge, to any person or organization | ||
obtaining a copy of the software and accompanying documentation covered by | ||
this license (the "Software") to use, reproduce, display, distribute, | ||
execute, and transmit the Software, and to prepare derivative works of the | ||
Software, and to permit third-parties to whom the Software is furnished to | ||
do so, all subject to the following: | ||
|
||
The copyright notices in the Software and this entire statement, including | ||
the above license grant, this restriction and the following disclaimer, | ||
must be included in all copies of the Software, in whole or in part, and | ||
all derivative works of the Software, unless such copies or derivative | ||
works are solely in the form of machine-executable object code generated by | ||
a source language processor. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT | ||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE | ||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# nui-template | ||
static/source/index.js contains a fetch onto custom schemes and a fetch to a mapped folder. | ||
|
||
And main.cpp defines some custom schemes and a mapped folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function(set_common_options TARGET) | ||
if (${MSVC}) | ||
set(WARNINGS -Wmost) | ||
else() | ||
set(WARNINGS -Wall -Wextra -Wpedantic) | ||
endif() | ||
set(COMMON_OPTIONS ${WARNINGS} -fexceptions -pedantic) | ||
set(DEBUG_OPTIONS -g ${COMMON_OPTIONS}) | ||
set(RELEASE_OPTIONS -O3 ${COMMON_OPTIONS}) | ||
target_compile_options(${TARGET} PUBLIC "$<$<CONFIG:DEBUG>:${DEBUG_OPTIONS}>") | ||
target_compile_options(${TARGET} PUBLIC "$<$<CONFIG:RELEASE>:${RELEASE_OPTIONS}>") | ||
endfunction() |
25 changes: 25 additions & 0 deletions
25
examples/custom_schemes/backend/source/backend/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
target_sources(${PROJECT_NAME} PRIVATE main.cpp) | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include) | ||
|
||
# Link backend of nui outside of emscripten | ||
target_link_libraries(${PROJECT_NAME} PRIVATE nui-backend) | ||
|
||
set_target_properties(${PROJECT_NAME} | ||
PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/examples/${PROJECT_NAME}" | ||
) | ||
|
||
# Creates a target that is compiled through emscripten. This target becomes the frontend part. | ||
nui_add_emscripten_target( | ||
TARGET | ||
${PROJECT_NAME} | ||
PREJS | ||
${PREJS_FILE} | ||
SOURCE_DIR | ||
${CMAKE_SOURCE_DIR} | ||
CMAKE_OPTIONS | ||
"-DNUI_BUILD_EXAMPLES=on" | ||
# I recommend to work with a release build by default because debug builds get big fast. | ||
"-DCMAKE_BUILD_TYPE=Release" | ||
) |
Oops, something went wrong.