How to perform post build action in WDK? - build

I'm trying to make a test driver with WinDDK. The "build" command works well following the technical instruction. Now what I want to do is that I want "build" to copy the build out to a certain directory. I'm familiar with linux make, so I added:
install:
copy sys\i386\myddk.sys c:\
to the makefile. But it didn't work at all.
How to make changes in makefile or sources file to let build copy the build out to somewhere?

Related

Install eigen3.3.7 on MacOS

I am trying to build a program on MacOS and that program requires Eigen version <= 3.3.7 but mine has 3.3.8 with brew install eigen
I went to Eigen website but 3.3.7 source is no longer available anymore.
Any workaround?
Thanks a lot!
Updates: thanks a lot but I am still very confused with how to proceed. Below is the information of the installation details and directory info.
The directory of the program source code that I want to build look like:
program
cmake
Cmakelist.txt
build
the program has the following instructions:
Create the build directory in the source tree root
mkdir build
Configure cmake, from the build directory, passing the Shogun source root as an argument. It is recommended to use any of CMake GUIs (e.g. replace cmake .. with ccmake ..), in particular, if you feel unsure about possible parameters and configurations. Note that all cmake options read as -DOPTION=VALUE.
cd build
cmake [options] ..
Compile
make
Install (prepend sudo if installing system-wide), and you are done.
make install
Sometimes you might need to clean up your build (e.g. in case of some major changes). First, try
make clean
Then I have downloaded eigen3.3.7, where the INSTALL file is as following. How should I proceed?
Method 1. Installing without using CMake
****************************************
You can use right away the headers in the Eigen/ subdirectory. In order
to install, just copy this Eigen/ subdirectory to your favorite location.
If you also want the unsupported features, copy the unsupported/
subdirectory too.
Method 2. Installing using CMake
********************************
Let's call this directory 'source_dir' (where this INSTALL file is).
Before starting, create another directory which we will call 'build_dir'.
Do:
cd build_dir
cmake source_dir
make install
You can install Eigen 3.3.7 by compiling the source code(available here).

Makefile pass-through in a CMake project

I have a project which uses CMake. Most of the project builds with CMake, but there's one subdirectory with a complicated build procedure that doesn't work with CMake. For this one directory, we have a hand-written Makefile. To build this one special directory, we manually copy it over to the build directory and call make on it after we've called cmake && make to build the rest of the project.
What I want CMake to do is just copy over this one directory to the build directory as is, with its existing Makefile, without trying to generate a Makefile. Then when I call make on the top level build directory, it just invokes the hand-written Makefile for this one directory. Is this possible?
I short: Yes, this is possible.
Steps:
Copy the Directory
Add the Makefile as a build step using either add_custom_target or add_custom_command depending on the purpose of the makefile

Automate CMake build using C++ script

I would like to automate the build of CMake using an MSVC C++ script instead of using CMake-gui to generate the build or CMake terminal or using the CMake integrated on MSVC 2017 by right click on the CMakeLists.txt to build it manually. Assume we have a project (name it: initialize) that includes the CMakeLists.txt and initialize.cpp, so my question is how I can convert these commands into a C++ code, assume build_initialize.cpp:
mkdir build
cd build/
cmake ..
So, the requirement of this tiny C++ code is to
Set the path to this project
Create build folder
Run CMake
At the end if I execute build_initialize.exe, the job is just to build the initialize.cpp using CMake. The goal is to test if the build is success or not as a test case within another project that has several test cases.
You may ask, why I didnot include it to the top CMakelists.txt, and then build it from the beginning using CMake. If I am going to do that, I will get an executable file. As a result, by running the ctest of CMake, the initialize.exe will require a pace of hardware. This is not the goal. My goal is just to build it. If I run build_initialize.exe, just repeat the build using CMake without initialize.exe execution.
Sorry, it could be very simple, but I lack the good experience either in C++ or CMake. Two days have been lost without success.
Thanks to all of you for the comments. The answer has been given by #Fred. To run cmake from C++ script, simply the system() can be used such as: System(cmake -S path_to_src -B path_to_bld).
Useful link: https://faq.cprogramming.com/cgi-bin/smartfaq.cgi?id=1043284392&answer=1044654269

What is nmake equivalent of 'configure --prefix=DIR && make all install '?

I would like my nmake output to go to a particular directory.
The short bit is that there isn't such a thing as Make and configure do two different things. The configure is what creates a Makefile, and a Makefile is what actually contains the compiler commands to build the software. Together they create what is called a build system. To specify the target directory, you'll need to review what creates that makefile for you. However, if you do not generate a Makefile, it is likely that there is a variable which you can override with your target directory, something like:nmake DESTDIR="Path"
With your added comment regarding your file, if it's set-up like this project, then you'll can use nmake PREFIX="Path"

Can't run Makefile.am, what should I do?

I got a C project to compile and run in Linux. It is a very big project with many subdirectories. Inside the parent directory there are files Makefile.am and Makefile.in.
I tried running make -f Makefile.am, and got the following error:
make: Nothing to be done for `Makefile.am'.
What does it mean? How do I accomplish my task?
These files are used with the Autotools suite. Makefile.am files are compiled to Makefiles using automake.
Have a look to see if there is a configure script in the directory. If there is, then type:
./configure
If not, then run:
autoreconf
in the directory, which should create the configure script (you will need to have the Autotools suite installed to run this).
After that, you should have a configure script that you can run.
After the configure is complete, you should have a normal Makefile in the directory, and will be able to run
make
What has been left out:
Makefile.am are transformed to Makefile.in using automake.
Makefile.in are transformed to Makefile by running configure.
Neither of these (Makefile.{am,in}) are supposed to be used with make -f.
If the tarball already ships with configure, just run that and make. If it does not, run ./autogen.sh or bootstrap(*). If that does not exist, use autoreconf instead.
(*) autogen/bootstrap: A convenience script added by developers that should just call autoreconf. Unfortunately there are some people that eschew autoreconf and unnecessarily call all the lowlevel commands themselves.
To supplement what has already been said:
Search for a script called configure in the project directory. If it is there, building the project will be:
./configure
make
and optionally, to install:
sudo make install
or su -c "make install"
Even if there is no configure script. there might be one autogen.sh. Run this script to generate the configure script and do as above.
Makefile.am is probably to be used with automake.
try:
automake
you might also just want to try
make -f Makefile.in
Since this is the product of running automake