Skip to content

Commit ce87f43

Browse files
committed
Installation: .sh files, CMake cache variables.
1 parent 71170dc commit ce87f43

File tree

6 files changed

+37
-36
lines changed

6 files changed

+37
-36
lines changed

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1313

1414
set(NWINDOWS_BUILD_DOCUMENTATION ON CACHE BOOL "Build the Vite Documentation website?")
1515
set(NWINDOWS_BUILD_EXAMPLES ON CACHE BOOL "Build the example projects?")
16-
# Set to ON if you wish to set compler options froma parent CMakeList.txt file.
17-
set(NWINDOWS_DEFAULT_COMPILER_OPTIONS OFF CACHE BOOL "Use default compiler options?")
16+
set(NWINDOWS_STRICT_COMPILER_OPTIONS ON CACHE BOOL "Use strict compiler warnings and errors?")
1817

1918
# Set version numbers in source files.
2019
configure_file(
@@ -35,7 +34,7 @@ configure_file(
3534

3635

3736

38-
if (NOT NWINDOWS_DEFAULT_COMPILER_OPTIONS)
37+
if (NWINDOWS_STRICT_COMPILER_OPTIONS)
3938

4039
set(CMAKE_CXX_STANDARD 20)
4140

build..sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/bash
2+
/usr/bin/cmake "$@" --build build --config RelWithDebInfo --target all

init.sh renamed to configure.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# Configure cmake build.
44
echo Configuring cmake build...
5-
mkdir build
5+
mkdir -p build
66
cd build
7-
cmake ..
7+
cmake .. "$@"
88
cd ..
99

docs/src/pages/InstallingNWindows.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ sudo apt-get install ./yourpackagename`} />
5656
<p>NWindows headers will be installed in the <M>/usr/include/NWindows</M> directory,
5757
and the <M>libnwindows.a</M> static library will be installed in the <M>/usr/lib</M> directory.</p>
5858

59-
<SectionHead text="Prerequisites"/>
59+
<SectionHead text="Build Prerequisites"/>
6060
<p>NWindows requires the following development tools to be installed.</p>
6161
<ul>
6262
<li>A reasonably modern compiler with support for C++20.</li>
@@ -165,6 +165,12 @@ git clone https://github.com/rerdavies/nwindows.git`
165165
./install.sh # Installs NWindows in /usr/local/include and /usr/local/lib`
166166
} />
167167
</li>
168+
<li>You can optionally build a debian package for NWindows using the following command:
169+
<Code style={{ marginTop: 16, marginBottom: 16 }} text={
170+
`./makePackage.sh`
171+
} />
172+
<p>The Debian package will be placed in the <M>./build</M> directory of the NWindows project.</p>
173+
</li>
168174
</ul>
169175
<SectionHead text="Building the Documentation" />
170176
<p>
@@ -181,7 +187,28 @@ git clone https://github.com/rerdavies/nwindows.git`
181187
<p>If you are using CMake, and building NWindows as a submodule, you can disable the documentation build by setting the <M>NWINDOWS_BUILD_DOCUMENTATION</M> variable to <M>OFF</M> in your top-level <M>CMakeLists.txt</M> file.</p>
182188
<Code text={`set(NWINDOWS_BUILD_DOCUMENTATION OFF)`} />
183189
</div>
190+
<SectionHead text="CMake Cache Variables" />
191+
<p>The CMake build for NWindows uses the following cache variables: </p>
192+
<Code text={`set(NWINDOWS_BUILD_DOCUMENTATION ON CACHE BOOL "Build the Vite Documentation website?")
193+
set(NWINDOWS_BUILD_EXAMPLES ON CACHE BOOL "Build the example projects?")
194+
set(NWINDOWS_STRICT_COMPILER_OPTIONS ON CACHE BOOL "Use strict compiler warnings and errors?")
195+
`} />
196+
<p>By default, NWindows builds with strict compiler options:</p>
197+
<Code text={`-Wall -Wextra -Wpedantic -Werror`} />
184198

199+
<p>Setting <M>NWINDOWS_STRICT_COMPILER_OPTIONS</M> to <M>OFF</M> will make Nwindows build without any of these
200+
options.</p>
201+
<p>If you are using NWindows as a git submodule, you can set these variables in your
202+
top-level <M>CMakeLists.txt</M> file to control the build of NWindows. For example, to disable building the documentation, add the following line to your top-level <M>CMakeLists.txt</M> file
203+
before adding the NWindows submodule directory:</p>
204+
<Code text={`set(NWINDOWS_BUILD_DOCUMENTATION OFF)`} />
205+
<p>If you are building NWindows as a standalone project, you can set these variables on the command line when
206+
running <M>cmake</M>. For example, to disable building the documentation, run the following command:</p>
207+
<Code text={`cmake -DNWINDOWS_BUILD_DOCUMENTATION=OFF ...`} />
208+
<p><M>./init.sh</M> will accept additional command-line arguments that are
209+
passed through to CMake, so you can run:</p>
210+
<Code text={`./init.sh -DNWINDOWS_BUILD_DOCUMENTATION=OFF`} />
211+
<p>Because settings are cached, you do not need to specify these settings again when you run <M>./build.sh</M>.</p>
185212

186213
</DocsPage>
187214
);

mk.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

todo.txt

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,8 @@ Blog examples:
33

44
int button
55
lost_mouse_capture
6+
7+
set(NWINDOWS_DEFAULT_COMPILER_OPTIONS OFF CACHE BOOL "Use default compiler options?")
8+
set(NWINDOWS_STRICT_COMPILER_OPTIONS ON CACHE BOOL "Use strict compiler warnings and errors?")
69

710

8-
usr/bin/c++ -O2 -g -DNDEBUG examples/context_edit/CMakeFiles/context_edit.dir/context_edit.cpp.o
9-
-o examples/context_edit/context_edit
10-
src/libnwindows.a -lpanelw -lncursesw && :
11-
12-
/usr/bin/c++ -O2 -g -DNDEBUG
13-
examples/nwindows_test/CMakeFiles/nwindows_test.dir/test_main.cpp.o
14-
examples/nwindows_test/CMakeFiles/nwindows_test.dir/box_test_window.cpp.o
15-
examples/nwindows_test/CMakeFiles/nwindows_test.dir/menu_test_window.cpp.o
16-
examples/nwindows_test/CMakeFiles/nwindows_test.dir/unicode_test_window.cpp.o
17-
examples/nwindows_test/CMakeFiles/nwindows_test.dir/edit_text_test_window.cpp.o
18-
examples/nwindows_test/CMakeFiles/nwindows_test.dir/error_test_window.cpp.o
19-
examples/nwindows_test/CMakeFiles/nwindows_test.dir/rendering_test_window.cpp.o
20-
-o examples/nwindows_test/nwindows_test
21-
22-
src/libnwindows.a -lpanelw -lncursesw
23-
24-
25-
[build] /usr/bin/ld: examples/nwindows_test/CMakeFiles/nwindows_test.dir/box_test_window.cpp.o: in function
26-
`nwindows::NRadioGroupElement::create(nwindows::NOrientation, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int)'
27-
:
28-
[build] /home/robin/src/nwindows/src/include/NWindows/NWindows.hpp:1171:(.text._ZN8nwindows18NRadioGroupElement6createENS_12NOrientationERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEi[_ZN8nwindows18NRadioGroupElement6createENS_12NOrientationERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EEi]+0x83):
29-
undefined reference to `nwindows::NRadioGroupElement::NRadioGroupElement(
30-
nwindows::NOrientation, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
31-
[build] /usr/bin/ld: examples/nwindows_test/CMakeFiles/nwindows_test.dir/menu_test_window.cpp.o: in function `menu_test_window(std::shared_ptr<nwindows::NWindow>)::{lambda(nwindows::NMouseButton, nwindows::NClickedEventArgs&)#1}::operator()(nwindows::NMouseButton, nwindows::NClickedEventArgs&) const [clone .isra.0]':
32-
33-
34-
nwindows::NRadioGroupElement::NRadioGroupElement(nwindows::NOrientation, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
35-
nwindows::NRadioGroupElement::NRadioGroupElement(nwindows::NOrientation, std::__debug::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)

0 commit comments

Comments
 (0)