Visit the code: github
I hate CMake when I learned to write my first C++ program. I hate Visual Studio and Xcode too. So I decided to use clang and CMake to build my C++ program. Clang is a good compiler, but CMake is terrible.
I found ninja when I searched new C++ build system. Ninja is a fast build system, but we should add every file by myself. So I decided to create a new language to transform the ninja file.
The first thing is define the group. The group likes a struct, you should add function in the group. The group will help you to manager the function. Writing function anywhere is not a good idea.
I decide to join Compiler Group, Files Group and Project Group firstly. Compiler Group will create the compiler infomation.
$string($compiler_path, "/bin/clang++")
@compiler(compiler_path)
language_version("c++23")
standard_library("libc++")
compiler_debug()
;
Files Group will search file in the program folder.
@files("source")
recursion_folder("src", ".cpp")
;
Project Group will add all Files Group and Library.
@project("pwmake", "binary")
source_files("source")
;
The binary mean build a binary execute file. It also support static(static library) and shared(dynamic library).
See other detail in the PWMake Documnet.
It's the first version about PWMake. Maybe It lost so many function and have so many bug. Looking forward to next stable version.If you have new idea or bug, make a issue in github.If you want to pull request, welcome to pull it.
Enjoy.
Top comments (1)
I hated CMake so much I once made a build system that generated build scripts using the C pre-processor. It used self generating script files in BAT or Bash or Powershell. You'd run the script for your compiler, like msvc.bat, passing your project file, which was similar to modern CMake but nicer and made of C Macros and #includes that pulled in other scripts. It pre-processed the file, which turned into more BAT or Bash or PS files which actually did the build. The thing generated huge script files but it actually worked, with full compiler and linker option settings, sensible default and everything. It built static and dynamic libs and exe's in 5 flavours of Debug/Release and optimisation and you could even target multiple platforms.
Because the build scripts were all written out. Every compiler command explicitly called with all the options, you could get reproducible builds by re-running them.
Just because you can doesn't mean you should but every step is a learning experience.