Skip to content

Commit

Permalink
MMVII: add compilation targets "full" and "rebuild"
Browse files Browse the repository at this point in the history
  • Loading branch information
meynardc committed Jan 23, 2024
1 parent 5d14039 commit 2ac09b3
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 46 deletions.
22 changes: 5 additions & 17 deletions .github/workflows/build_mmvii.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@ jobs:
CXX: clang++-14
CC: clang-14

- name: Build MMVII first stage, build base code
run: cmake --build MMVII/build -j 4 -- -k

- name: Generate codes for Symbolic Derivatives
run: MMVII/bin/MMVII GenCodeSymDer

- name: Build MMVII second stage, build generated code
run: cmake --build MMVII/build -j 4 -- -k
- name: Build MMVII
run: cmake --build MMVII/build -j 4 --target full -- -k

- name: Run MMVII Tests
working-directory: ./MMVII/bin
Expand Down Expand Up @@ -83,16 +77,10 @@ jobs:
run: cmake --build build --config Release --target INSTALL -j 4

- name: Configure CMake for MMVII
run: cmake -S MMVII -B MMVII/build

- name: Build MMVII first stage, build base code
run: cmake --build MMVII/build --config Release -j 4

- name: Generate codes for Symbolic Derivatives
run: MMVII/bin/MMVII GenCodeSymDer
run: cmake -S MMVII -B MMVII/build

- name: Build MMVII second stage, build generated code
run: cmake --build MMVII/build --config Release -j 4
- name: Build MMVII
run: cmake --build MMVII/build --config Release -j 4 --target full

- name: Run MMVII Tests
working-directory: ./MMVII/bin
Expand Down
26 changes: 22 additions & 4 deletions MMVII/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,28 @@ else()
endif()

#######################################################
## target distclean : remove generated code
## Custom targets
#######################################################

## distclean : clean + remove generated source files for symbolic calculus
add_custom_target(distclean
${CMAKE_COMMAND} --build . --target clean
COMMAND ${CMAKE_COMMAND} -E rm -rf ${mmv2_gencode_dir}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --config $<CONFIG> --target clean
COMMAND ${CMAKE_COMMAND} -E rm -rf ${mmv2_gencode_dir}
VERBATIM)


## full : generate source files for symbolic calculus and recompile
add_custom_target(full
COMMAND ${CMAKE_COMMAND} -E rm -rf ${mmv2_gencode_dir}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --config $<CONFIG>
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/MMVII GenCodeSymDer
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --config $<CONFIG>
VERBATIM USES_TERMINAL)

## rebuild : distclean + full
add_custom_target(rebuild
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target distclean
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --config $<CONFIG>
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/MMVII GenCodeSymDer
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --config $<CONFIG>
VERBATIM USES_TERMINAL)

60 changes: 35 additions & 25 deletions MMVII/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,57 @@ Dependencies
- If using CLang version XX and want OpenMP: `sudo apt install libomp-XX-dev`


Compilation (short), replace N with the number of processor threads:
Compilation (short) :
--------------------
Compile MicMac V1

Compile MicMac V1, then (replace N with the number of processor threads) :

cd MMVII
(mkdir -p build)
mkdir -p build
cd build
cmake ..
make -j N (or make -j N VERBOSE=1 to see compile command line)
make -j N full (or make -j N full VERBOSE=1 to see compile command line)

On first compilation, generated code must be created:
Following compilations could be run just with:

make -j N
../bin/MMVII GenCodeSymDer
make -j N


Tests :

../bin/MMVII Bench 1


Clean :
Compilation targets :

make clean : delete build products
make distclean : delete build products and generated codes
rm -fr MMVII/build/* : reinitialize the build configuration
all|(none) : build MMVII
full : re-generate files for symbolic calculus and build MMVII
rebuild : distclean + full
clean : delete build products
distclean : delete build products and generated files for symbolic calculus

In case of SymDer-related compilation error, clear all generated code before compilation:
rm -fr MMVII/build/* : reinitialize the build configuration. cmake needs to be rerun after that

make distclean
make
../bin/MMVII GenCodeSymDer
make
In case of SymDer-related compilation error, re-generate files for symbolic calculus :

make full

Compilation (detail):
--------------------
- You can use `cmake -G Ninja ..` to use Ninja build system instead of the native one. (`sudo apt install ninja-build`)
- Use `cmake --build . -j 8` or `cmake --build . -j 8 -v` instead of make (works with all build systems)
- Use `cmake --build . --target clean` or `cmake --build . --target cleanall`
- Use `cmake --build . -j 8 [--target TARGET]` or `cmake --build . -j 8 -v [--target TARGET]` instead of make (works with all build systems)
- Use `cmake --build . --target clean` or `cmake --build . --target distclean`
- Use `ccmake ..` or `cmake-gui ..` to change config option:
- CMAKE_BUILD_TYPE:
. Debug : -g
. RelWithDebInfo : -O3 -g (default)
. Release : -O3 -DNDEBUG
- CMAKE_CXX_COMPILER (advanced mode : 't'):
. Allow to set compiler version and type (g++, clang)

- Debug : -g
- RelWithDebInfo : -O3 -g (default)
- Release : -O3 -DNDEBUG
- CMAKE_CXX_COMPILER (advanced mode : 't'):
- Allow to set compiler version and type (g++, clang)
- vMMVII_BUILD (see bellow):
- ON : enable compilation of vMMVII. Needs Qt >= 5.12.8
- OFF: disable compilation of vMMVII
- You may need to add 'CMAKE_PREFIX_PATH=<Qt dir>' on Windows (ex: c:\Qt\6.6.0\msvc2019_64)

Legacy :
--------
Expand Down Expand Up @@ -101,7 +106,7 @@ It is possible to have MMVII command completion for Linux bash
(Already installed by default on Ubuntu, just in case: sudo apt install bash-completion python3)

- Configuration:
- MMVII must be compiled
- MMVII must be (fully) compiled
- MMVII executable must be in your $PATH
- Add to your ${HOME}/.bashrc the following line:

Expand All @@ -115,7 +120,12 @@ There is a GUI tool that can help for writing MMVII command : vMMVII

It will be automatically compiled with MMVII if development package Qt5 (or Qt6) is installed (Ubuntu 22.04: `sudo apt install qtbase5-dev`)

Windows: You may have to add Qt installation path when running cmake configuration :

`cmake .. -D CMAKE_PREFIX_PATH=C:\Qt\6.6.0\msvc2019_64`

Usage: just type "vMMVII" in your working directory.

- Sorry, no documentation yet

- This tool is beta: some MMVII parameters may be misinterpreted or not have the good File Dialog helper.

0 comments on commit 2ac09b3

Please sign in to comment.