[PYTHON] About the contents of wscript when building a D language environment like that with Waf

waf is a build tool written in pytho. I tried to introduce it by creating a D language compilation environment automatically to some extent. Since it is written in python, you need an environment where python can run.

The environment with waf and .d code is as follows.

フォルダ環境

Ignore ~~ .sublime-project and ~~ .sublime-wokspace because they are project related files used in Sublime Text 2.

waf is the main body of the compilation tool. wscript describes the build rules. The import relations of .d files (excluding Phobos) are as follows

However, /src/unipa/courceinfo.d imports std.net.curl, so you have to refer to the curl library.

Now, let's take a look at the contents of wscript

wscript


import os.path

APPNAME='UNIPA_UFCS'
VERSION='1.0'

top='.'
out='./build'

def options(opt):
	opt.load('compiler_d')

def configure(conf):
	conf.load('compiler_d')

def build(bld):
	bld.add_post_fun(target_run)

	bld.program(
		source='./src/main.d ./src/unipa/webdata.d ./src/unipa/courceinfo.d',
		target=APPNAME,
		includes = './src/',
		libpath = '/dmd2/osx/lib',
		lib = 'curl'
		)

def target_run(ctx):
	ctx.exec_command(os.path.join(out, APPNAME) + '> result.txt')

APPNAME is the name of the executable file, VIRSION is the same, top is the folder with wscript, and out is the output destination of .o or the executable file. If you write options and configure as above, it will build the settings suitable for the D language development environment. easy. build is the build rule body, write the build rule in bld.program. It is written in various ways. Well, I think you can understand the meaning. For example, refer to the curl library with libpath and lib. If you put a function in the argument of bld.add_post_fun, it will execute the function you passed when the build was successful. target_run runs the executable file when the compilation is successful and outputs the output to result.txt.

Well, it looks like this.

After that, if you set the build on the Sublime Text 2 side, it will be a happier environment. It's coming again.

Recommended Posts

About the contents of wscript when building a D language environment like that with Waf
About the matter that torch summary can be really used when building a model with Pytorch
Recommendation of building a portable Python environment with conda
Precautions that must be understood when building a PYTHON environment
A Python script that compares the contents of two directories
When incrementing the value of a key that does not exist
Process the contents of the file in order with a shell script
The story of making a module that skips mail with python
[Python] A program that rotates the contents of the list to the left
Building a kubernetes environment with ansible 2
Building a virtual environment with Python 3
Building a kubernetes environment with ansible 1
A memo when creating an environment that can be debugged with Lambda @ Edge for the time being
Building a distributed environment with the Raspberry PI series (Part 1: Summary of availability of diskless clients by model)
A story that visualizes the present of Qiita with Qiita API + Elasticsearch + Kibana
Commands that were important when building the Laravel environment in the Apache environment (Note)
[Introduction to Python] How to sort the contents of a list efficiently with list sort
A note about the functions of the Linux standard library that handles time
[Pyenv] Building a python environment with ubuntu 16.04
Building a Python3 environment with Amazon Linux2
About the virtual environment of python version 3.7
Building a Python 3.6 environment with Windows + PowerShell
[AtCoder explanation] Control the A, B, (C), D problems of ABC165 with Python!
[AtCoder explanation] Control the A, B, C, D problems of ABC183 with Python!
Around the authentication of PyDrive2, a package that operates Google Drive with Python
The story of making a web application that records extensive reading with Django
[AtCoder explanation] Control the A, B, C, D problems of ABC181 with Python!
Build a C language development environment with a container
Note: Prepare the environment of CmdStanPy with docker
Prepare the execution environment of Python3 with Docker
Building a python environment with virtualenv and direnv
Building a Python environment with WLS2 + Anaconda + PyCharm
Solve A ~ D of yuki coder 247 with python
A note about the python version of python virtualenv
A memo when creating a python environment with miniconda
Think about building a Python 3 environment in a Mac environment
About the development contents of machine learning (Example)
Dump the contents of redis db with lua
Flow of creating a virtual environment with Anaconda
Create a table of contents with IPython notebook
It is a piggybacking story about the service that returns "Nyan" when you ping
I made a twitter app that decodes the characters of Pricone with heroku (failure)
Procedure when building Ubuntu as a virtual environment with Vagrant + Virtualbox for LPIC Level 1.
I tried to make something like a chatbot with the Seq2Seq model of TensorFlow
A story that failed when trying to remove the suffix from the string with rstrip
About the matter that the contents of Python print are not visible in docker logs
A story about improving the program for partial filling of 3D binarized image data
A script that combines margins when pasting a number of graphs on tiles with gnuplot
When reading a csv file with read_csv of pandas, the first column becomes index
I took a look at the contents of sklearn (scikit-learn) (1) ~ What about the implementation of CountVectorizer? ~
A memo of misunderstanding when trying to load the entire self-made module with Python3
I thought about why Python self is necessary with the feeling of a Python interpreter
Collect tweets about "Corona" with python and automatically detect words that became a hot topic due to the influence of "Corona"
A script that pings the registered server and sends an email with Gmail a certain number of times when it fails
Two solutions to the problem that it is hard to see the vector field when writing a vector field with quiver () of matplotlib pyplot