-
Install prerequisites:
-
On Windows, Visual Studio 2019 is recommended. You can find installers of CMake and VS2019 online. Building with MinGW-w32 has not been thoroughly tested and can be tricky.
The best way to install other required packages is to use
vcpkg. You can install it following the instructions here.-
Install the following packages:
vcpkg install rapidjson:x64-windows vcpkg install uriparser:x64-windows vcpkg install catch2:x64-windows -
For the Python plugin, install Python and
pybind11. To installpybind11usingvcpkg:vcpkg install pybind11:x64-windowsIf CMake has trouble finding the python libraries, set the
PYTHONHOMEenvironment (or CMake) variable, or remove the line inCMakeLists.txtthat includesplugins/python_plugin_host_pybind11/to skip building the plugin. -
If you want to build codepad with Cairo support, also install:
vcpkg install fontconfig:x64-windows vcpkg install freetype:x64-windows vcpkg install harfbuzz:x64-windows vcpkg install pango:x64-windows vcpkg install cairo:x64-windowsThe Cairo renderer can suffer from poor compatibility and performance on Windows. Specify
-DCODEPAD_USE_CAIRO=Nowhile configuring to build without the Cairo backend.vcpkghas also updated the CMake interface of these packages a few times - make sure you have the latest version ofvcpkgand packages.
-
-
On Ubuntu, install CMake and g++11 (older versions of g++ will not work):
sudo apt install cmake sudo apt install g++-11The packages can be installed using
apt:sudo apt install rapidjson-dev sudo apt install catch2 sudo apt install libfontconfig1-dev sudo apt install libfreetype-dev sudo apt install libharfbuzz-dev sudo apt install libpango1.0-dev sudo apt install libcairo2-dev sudo apt install libgtk-3-dev sudo apt install liburiparser-devOlder versions of Ubuntu may hot have the
catch2package, in which case you can either download and configure it yourself or disable building the tests by removing theadd_subdirectorycommands inCMakeLists.txt. Note that some plugins have their own tests.For the Python plugin, install Python and
pybind11:sudo apt install python-dev sudo apt install pybind11-devNote that older versions of
pybind11may not be compatible with codepad, in which case the plugin will fail to build, but you should still be able to build and run the rest of the program without any problems.
-
-
Clone the repository and initialize submodules:
git clone https://github.com/lukedan/codepad.git git submodule update --init --recursive -
Generate and build:
mkdir build cd build cmake .. -DCODEPAD_USE_SKIA=No cmake --build . -j 8If you're building on Windows using
vcpkg, also specify-DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmakeon line 3. If you're buliding without Cairo, specify-DUSE_CAIRO=Noon line 3.
- Codepad uses configuration files in the
configfolder. Currently this dependency is hard-coded insrc/main.cpp, and theconfigfolder must be in the working directory of the executable. codepadloads plugins specified inconfig/settings.jsonthat are shared libraries, and due to how shared library loading works on different platforms, the system may fail to find the library files. Thus, you may need to manually modify the list items to match the relative paths of the library files in the build output folder. By default the plugin shared libraries are placed in the same folder as the executable.- You may need to change the rendering backend in
config/settings.jsontocairoon Linux.
Use doxygen and doxyfile in the root directory to build the documentation. Although many efforts have been made to keep the documentation correct and up-to-date, it may still contain outdated information and/or invalid references to identifiers.