Skip to content

Commit

Permalink
update BUILDING.md instructions
Browse files Browse the repository at this point in the history
Mobile Qt build is deprecated
add a script for Web build with WT
  • Loading branch information
pvn committed Mar 18, 2024
1 parent 63b8149 commit d3caaa5
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 124 deletions.
109 changes: 60 additions & 49 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,16 @@
- Simple-WebSocket-Server [https://gitlab.com/eidheim/Simple-WebSocket-Server]
- JSON Modern C++ [https://json.nlohmann.me/]

## For Web build
Nostr_client_relay allows to build Nostr clients and Nostr relays. It includes:

- Boost [https://www.boost.org/]
- Wt [https://www.webtoolkit.eu/wt]

## For GUI desktop build

- WxWidgets [https://www.wxwidgets.org/]

## For iOS

- Qt [https://www.qt.io/]

## Install dependencies
- a command line Nostr client, **Nostro**
- a command line Nostr relay, **Vostro**
- a native desktop client, **Gnostro** (for Mac, Linux, Windows)
- a web interface for a client, **Wostro**
- a native mobile client, **Mostro** (deprecated)

To install dependencies on Mac and Linux
:warning: All dependencies except boost (for web build) and wxWidgets (for desktop build) are included in the repository.
The minimal dependency needed is OpenSSL. To install dependencies on Mac and Linux

Mac

Expand All @@ -40,15 +34,16 @@ sudo apt-get install build-essential libgtk-3-dev
sudo apt-get install libssl-dev
```

# Building
on Windows , use the supplied script ext/openssl-3.0.5/build.bat

All dependencies except boost, wxWidgets and Qt are included in the repository. To clone a copy with Boost, do at a shell prompt

```
git clone --recurse-submodules https://github.com/pedro-vicente/nostr_client_relay
``` cmd
cd ext/openssl-3.0.5
build.bat
```

Or without Boost (Boost clone can be done later)
# Quick start

To clone a copy with basic build do at a shell prompt

```
git clone https://github.com/pedro-vicente/nostr_client_relay
Expand All @@ -71,48 +66,42 @@ cmake --build .
```

This builds the software on folder named 'build'. There you can find the executables and your code editor of choice
generated projects, like projects for Microsof Visual Studio (in Windows).

## :warning: Building dependency libraries

Dependencies boost, Wt, WxWidgets are needed for desktop and web build. Build with bash shell scripts
or use the supplied script

``` cmd
./build.boost.sh
./build.wt.sh
./build.widgets.sh
```

## Building for web

To enable web build, use

build.cmake.sh
```
cmake -DBUILD_WEB=ON

```
This builds the software on folder named 'build'. There you can find the executables and your code editor of choice
generated projects, like projects for Microsof Visual Studio (in Windows).

Use the bash script to build
Try

``` cmd
./build.desktop.sh
cd build
./examples
```

To clone Boost individually, do
To run the supplied Nostr command line API examples

```
git clone -b boost-1.82.0 --recursive --depth=1 https://github.com/boostorg/boost.git ext/boost_1_82_0
```
# Desktop build

## Building for desktop
For desktop, the additional library is needed

- WxWidgets [https://www.wxwidgets.org/]

To clone WxWidgets, do

```
git clone --recurse-submodules https://github.com/wxWidgets/wxWidgets.git ext/wxWidgets-3.2.2.1
```

build dependencies with the bash shell script

``` cmd
build.widgets.sh
```

To enable desktop build, use

```
Expand All @@ -126,17 +115,39 @@ or build with bash shell script
./build.desktop.sh
```

## Building for iOS
# Web build

To enable mobile build, use
Dependencies boost, Wt, are needed for web build.

- Boost [https://www.boost.org/]
- Wt [https://www.webtoolkit.eu/wt]

To enable web build, use

```
cmake -DBUILD_MOBILE=ON
cmake -DBUILD_WEB=ON
```
build dependencies with bash shell scripts

or build with bash shell script (requires a Qt cross compile iOS builds on MacOS)
``` cmd
./build.boost.sh
./build.wt.sh
```

Use the bash script to build

``` cmd
./build.mobile.sh
./build.web.sh
```

To clone Boost individually, do

```
git clone -b boost-1.82.0 --recursive --depth=1 https://github.com/boostorg/boost.git ext/boost_1_82_0
```





8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
## Nostr client and relay

Nostr client and relay is a [https://nostr.com/](https://nostr.com/) C++ engine that allows to build Nostr applications for command line, desktop or web.
Nostr client and relay is a [nostr](https://nostr.com/) C++ engine that allows to build Nostr applications for command line, desktop or web.

[https://github.com/pedro-vicente/nostr_client_relay](https://github.com/pedro-vicente/nostr_client_relay)

:warning: **ATTENTION DEVELOPERS** :warning:

See [BUILDING.md](./BUILDING.md) for source code build instructions. There are 3 non exclusive modes of build (command line, desktop and web). Default is command line only.

Nostr_client_relay allows to build Nostr clients and Nostr relays. It includes:

- a command line Nostr client, **Nostro**
- a command line Nostr relay, **Vostro**
- a web interface for a client, **Wostro**
- a native desktop client, **Gnostro** (for Mac, Linux, Windows)
- a native mobile client, **Mostro** (for iOS) :warning: Android coming soon :warning:
- a web interface for a client, **Wostro**
- a native mobile client, **Mostro** (deprecated)

## Nostro

Expand Down
32 changes: 9 additions & 23 deletions build.cmake.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
#!/bin/bash

if [[ "$OSTYPE" == "msys" ]]; then
dir=$PWD
fi

mkdir -p build
pushd build
if [[ "$OSTYPE" == "linux-gnu"* ]]; then

cmake .. -DWT_INCLUDE="$HOME/wt_install/include" -DWT_CONFIG_H="$HOME/wt_install/include" \
-DBUILD_WEB=OFF -DBUILD_DESKTOP=OFF -DBUILD_MOBILE=OFF

elif [[ "$OSTYPE" == "darwin"* ]]; then

cmake .. -DWT_INCLUDE="$HOME/wt_install/include" -DWT_CONFIG_H="$HOME/wt_install/include" \
-DBUILD_WEB=OFF -DBUILD_DESKTOP=OFF -DBUILD_MOBILE=OFF

elif [[ "$OSTYPE" == "msys" ]]; then

cmake .. --fresh -DBUILD_STATIC=OFF -DWT_INCLUDE="$dir/ext/wt-4.10.0/src" -DWT_CONFIG_H="$dir/ext/wt-4.10.0/build" \
-DBUILD_WEB=OFF -DBUILD_DESKTOP=OFF -DBUILD_MOBILE=OFF \
-DOPENSSL_ROOT_DIR="F:/nostr_client_relay/ext/openssl-3.0.5"
cmake ..
cmake --build .

if [[ "$OSTYPE" == "msys" ]]; then
pushd Debug
pwd
./examples.exe
popd
else
./examples
fi

sleep 3
cmake --build .

popd
pwd
exit

48 changes: 1 addition & 47 deletions build.desktop.sh
Original file line number Diff line number Diff line change
@@ -1,54 +1,8 @@
#!/bin/bash

opt=ON
if [[ "$OSTYPE" == "msys" ]]; then
dir=$PWD
fi

mkdir -p build
pushd build
if [[ "$OSTYPE" == "linux-gnu"* ]]; then

cmake .. -DWT_INCLUDE="$HOME/wt_install/include" -DWT_CONFIG_H="$HOME/wt_install/include" \
-DBUILD_WEB=$opt -DBUILD_DESKTOP=$opt -DBUILD_MOBILE=OFF

elif [[ "$OSTYPE" == "darwin"* ]]; then

cmake .. -DWT_INCLUDE="$HOME/wt_install/include" -DWT_CONFIG_H="$HOME/wt_install/include" \
-DBUILD_WEB=$opt -DBUILD_DESKTOP=$opt -DBUILD_MOBILE=OFF

elif [[ "$OSTYPE" == "msys" ]]; then

cmake .. --fresh -DBUILD_STATIC=OFF -DWT_INCLUDE="$dir/ext/wt-4.10.0/src" -DWT_CONFIG_H="$dir/ext/wt-4.10.0/build" \
-DBUILD_WEB=$opt -DBUILD_DESKTOP=$opt -DBUILD_MOBILE=OFF \
-DOPENSSL_ROOT_DIR="F:/nostr_client_relay/ext/openssl-3.0.5"
cmake .. -DBUILD_DESKTOP=ON
cmake --build .

fi

sleep 3
cmake --build .

popd
pwd

pushd build
pushd web

remote=$(git config --get remote.origin.url)
echo "remote repository: $remote"
sleep 2
echo "open browser http://localhost:8080"
if [ "$remote" == "https://github.com/pedro-vicente/nostr_client_relay.git" ]; then
export LD_LIBRARY_PATH="$HOME/github/nostr_client_relay/ext/boost_1_82_0/stage/lib":$LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH="$HOME/git/nostr_client_relay/ext/boost_1_82_0/stage/lib":$LD_LIBRARY_PATH
fi
if [[ "$OSTYPE" == "msys"* ]]; then
./Debug/wostro --http-address=0.0.0.0 --http-port=8080 --docroot=.
else
./wostro --http-address=0.0.0.0 --http-port=8080 --docroot=.
fi

exit

48 changes: 48 additions & 0 deletions build.web.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

if [[ "$OSTYPE" == "msys" ]]; then
dir=$PWD
fi

mkdir -p build
pushd build
if [[ "$OSTYPE" == "linux-gnu"* ]]; then

cmake .. -DBUILD_WEB=ON -DWT_INCLUDE="$HOME/wt_install/include" -DWT_CONFIG_H="$HOME/wt_install/include"

elif [[ "$OSTYPE" == "darwin"* ]]; then

cmake .. DBUILD_WEB=ON -DWT_INCLUDE="$HOME/wt_install/include" -DWT_CONFIG_H="$HOME/wt_install/include"

elif [[ "$OSTYPE" == "msys" ]]; then

cmake .. --fresh -DBUILD_WEB=ON -DWT_INCLUDE="$dir/ext/wt-4.10.0/src" -DWT_CONFIG_H="$dir/ext/wt-4.10.0/build"
cmake --build .

fi

cmake --build .

popd
pwd

pushd build
pushd web

remote=$(git config --get remote.origin.url)
echo "remote repository: $remote"
sleep 2
echo "open browser http://localhost:8080"
if [ "$remote" == "https://github.com/pedro-vicente/nostr_client_relay.git" ]; then
export LD_LIBRARY_PATH="$HOME/github/nostr_client_relay/ext/boost_1_82_0/stage/lib":$LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH="$HOME/git/nostr_client_relay/ext/boost_1_82_0/stage/lib":$LD_LIBRARY_PATH
fi
if [[ "$OSTYPE" == "msys"* ]]; then
./Debug/wostro --http-address=0.0.0.0 --http-port=8080 --docroot=.
else
./wostro --http-address=0.0.0.0 --http-port=8080 --docroot=.
fi

exit

0 comments on commit d3caaa5

Please sign in to comment.