serene/README.org

107 lines
4.0 KiB
Org Mode
Raw Normal View History

* Serene lang
2021-04-13 10:39:13 +01:00
** Setup development environment
2020-07-23 21:53:42 +01:00
Setup the githook and install dependencies using the following commands:
2021-04-13 10:39:13 +01:00
#+BEGIN_SRC bash
./builder setup
#+END_SRC
*** Dependencies
You would need the following dependencies to start get started with *Serene* development
- LLVM (LLVM Instructions coming up.)
2021-04-13 10:39:13 +01:00
- cmake
- ninja
- doxygen (If you want to build the docs as well)
- Valgrind
- CCache (If you want faster builds specially with the LLVM)
** LLVM Installation
*Important Note*: We're trying to keep Serene up to date with the LLVM release cycle till we get
to our first release. So we use the development version of the LLVM. Currently we are using
=aff028f7d8322c625422febd3d8b9794746cdc5b= commit as our reference.
2021-04-13 10:39:13 +01:00
MLIR is a part of the [[https://llvm.org][LLVM]] project and in order to build it we need to build the LLVM itself as well.
Here is a quick guide to build the latest version of the LLVM and MLIR.
#+BEGIN_SRC bash
## YES we're using the development version of MLIR
git clone https://github.com/llvm/llvm-project.git
mkdir llvm-project/build
cd llvm-project/build
cmake -G Ninja ../llvm \
-DCMAKE_INSTALL_PREFIX=/your/target/path \
-DLLVM_PARALLEL_COMPILE_JOBS=7 \
-DLLVM_PARALLEL_LINK_JOBS=1 \
-DLLVM_BUILD_EXAMPLES=ON \
-DLLVM_TARGETS_TO_BUILD="X86" \
2021-04-13 10:39:13 +01:00
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_CCACHE_BUILD=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DLLVM_ENABLE_PROJECTS='clang;lldb;lld;mlir;clang-tools-extra;compiler-rt' \
-DCMAKE_C_COMPILER=clang \ # If you have clang installed already
-DCMAKE_CXX_COMPILER=clang++ \ # If you have clang installed already
2021-04-13 10:39:13 +01:00
-DLLVM_ENABLE_LLD=ON
cmake --build .
2021-04-13 10:39:13 +01:00
cmake --build . --target check-mlir
cmake -DCMAKE_INSTALL_PREFIX=/your/target/location -P cmake_install.cmake
#+END_SRC
You need to have =clang= and =lld= installed to compile the LLVM with the above command. Also if you
are not using =ccache= just remove the option related to it from the above command.
2020-07-23 21:53:42 +01:00
*** Emacs
2021-04-13 10:39:13 +01:00
If you're using Emacs as your development environment just install =clangd= and =lsp=.
** Heads up for devs
While you're working on *Serene* be mindful of:
- In =DEBUG= mode we dynamically link against =libsan= due to the fact that we build the =libserene=
as a shared lib by default. This means we need to =LD_PRELOAD= the =libclang_rt= before we run
any executable. If you're using the =builder= script you're all set otherwise you can run an
executable like:
#+BEGIN_SRC bash
LD_PRELOAD=$(clang -print-file-name=libclang_rt.asan-x86_64.so) /path/to/executable
#+END_SRC
2021-04-13 10:39:13 +01:00
* How to build
In order to build for development (Debug mode) just use =./builder build= to setup the build and build
the project once and then you can just use =./builder compile= to build the changed files only.
Check out the =builder= script for more subcommands and details.
2021-04-30 16:07:28 +01:00
* Cheatsheets
- [[https://github.com/muqsitnawaz/modern-cpp-cheatsheet][Modern C++ Cheatsheet]]
2021-10-12 20:51:03 +01:00
* License
2022-02-08 17:56:15 +00:00
Copyright (c) 2019-2022 Sameer Rahmani <lxsameer@gnu.org>
2021-10-12 20:51:03 +01:00
*Serene* is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
2021-04-13 10:39:13 +01:00
* Get Help
If you need help or you just want to hangout, you can find us at:
2021-12-17 15:11:32 +00:00
- *IRC*: *#serene-lang* on the libera chat server
2021-04-13 10:39:13 +01:00
- *Matrix Network*: https://matrix.to/#/#serene:matrix.org?via=matrix.org&via=gitter.im
- *MailingList*: https://www.freelists.org/list/serene