possible to make only certain components of system

This commit is contained in:
Dhanya Maliakal 2017-12-11 10:51:19 +01:00
parent e19d564364
commit 29d66e455d
2 changed files with 71 additions and 8 deletions

View File

@ -1,7 +1,12 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set (CALIBRATE OFF) set (CALIBRATE OFF)
option (USE_HDF5 "HDF5 File format" OFF) option (USE_HDF5 "HDF5 File format" OFF)
option (USE_TEXTCLIENT "Text Client" OFF)
option (USE_RECEIVER "Receiver" OFF)
option (USE_GUI "GUI" OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
find_package(Qt4) find_package(Qt4)
@ -17,11 +22,20 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH "$ORIGIN") set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
add_subdirectory(slsDetectorSoftware)
add_subdirectory(slsReceiverSoftware) if (USE_TEXTCLIENT)
if (QT4_FOUND AND QWT_FOUND) add_subdirectory(slsDetectorSoftware)
add_subdirectory(slsDetectorGui) endif (USE_TEXTCLIENT)
endif()
if (USE_RECEIVER)
add_subdirectory(slsReceiverSoftware)
endif (USE_RECEIVER)
if (USE_GUI)
if (QT4_FOUND AND QWT_FOUND)
add_subdirectory(slsDetectorGui)
endif()
endif (USE_GUI)
if (CALIBRATE) if (CALIBRATE)

55
cmk.sh
View File

@ -3,6 +3,10 @@ BUILDDIR="build"
HDF5DIR="/opt/hdf5v1.10.0" HDF5DIR="/opt/hdf5v1.10.0"
HDF5=0 HDF5=0
COMPILERTHREADS=0 COMPILERTHREADS=0
TEXTCLIENT=0
RECEIVER=0
GUI=0
CLEAN=0 CLEAN=0
REBUILD=0 REBUILD=0
@ -16,6 +20,9 @@ Usage: $0 [-c] [-b] [-h] [-d <HDF5 directory>] [-j]
-b: Builds/Rebuilds CMake files normal mode -b: Builds/Rebuilds CMake files normal mode
-h: Builds/Rebuilds Cmake files with HDF5 package -h: Builds/Rebuilds Cmake files with HDF5 package
-d: HDF5 Custom Directory -d: HDF5 Custom Directory
-t: Build/Rebuilds only text client
-r: Build/Rebuilds only receiver
-g: Build/Rebuilds only gui
-j: Number of threads to compile through -j: Number of threads to compile through
For only make: For only make:
@ -39,10 +46,14 @@ For using multiple cores to compile faster:
./cmk.sh -cj9 #with clean ./cmk.sh -cj9 #with clean
./cmk.sh -hj9 #with hdf5 ./cmk.sh -hj9 #with hdf5
./cmk.sh -j9 -h #with hdf ./cmk.sh -j9 -h #with hdf
For rebuilding only certain sections
./cmk.sh -tg #only text client and gui
./cmk.sh -r #only receiver
" ; exit 1; } " ; exit 1; }
while getopts ":bchd:j:" opt ; do while getopts ":bchd:j:trg" opt ; do
case $opt in case $opt in
b) b)
echo "Building of CMake files Required" echo "Building of CMake files Required"
@ -65,6 +76,21 @@ while getopts ":bchd:j:" opt ; do
echo "Number of compiler threads: $OPTARG" echo "Number of compiler threads: $OPTARG"
COMPILERTHREADS=$OPTARG COMPILERTHREADS=$OPTARG
;; ;;
t)
echo "Compiling Options: Text Client"
TEXTCLIENT=1
REBUILD=1
;;
r)
echo "Compiling Options: Receiver"
RECEIVER=1
REBUILD=1
;;
g)
echo "Compiling Options: GUI"
GUI=1
REBUILD=1
;;
\?) \?)
echo "Invalid option: -$OPTARG" echo "Invalid option: -$OPTARG"
usage usage
@ -83,6 +109,29 @@ done
if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
CMAKE_POST+=" -DUSE_TEXTCLIENT=ON -DUSE_RECEIVER=ON -DUSE_GUI=ON "
echo "Compile Option: TextClient, Receiver and GUI"
else
if [ $TEXTCLIENT -eq 1 ]; then
CMAKE_POST+=" -DUSE_TEXTCLIENT=ON "
echo "Compile Option: TextClient"
fi
if [ $RECEIVER -eq 1 ]; then
CMAKE_POST+=" -DUSE_RECEIVER=ON "
echo "Compile Option: Receiver"
fi
if [ $GUI -eq 1 ]; then
CMAKE_POST+=" -DUSE_GUI=ON "
echo "Compile Option: GUI"
fi
fi
#build dir doesnt exist #build dir doesnt exist
if [ ! -d "$BUILDDIR" ] ; then if [ ! -d "$BUILDDIR" ] ; then
echo "No Build Directory. Building of Cmake files required" echo "No Build Directory. Building of Cmake files required"
@ -101,10 +150,10 @@ CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
#hdf5 rebuild #hdf5 rebuild
if [ $HDF5 -eq 1 ]; then if [ $HDF5 -eq 1 ]; then
CMAKE_PRE+="HDF5_ROOT="$HDF5DIR CMAKE_PRE+="HDF5_ROOT="$HDF5DIR
CMAKE_POST+="-DUSE_HDF5=ON" CMAKE_POST+=" -DUSE_HDF5=ON "
#normal mode rebuild #normal mode rebuild
else else
CMAKE_POST+="-DUSE_HDF5=OFF " CMAKE_POST+=" -DUSE_HDF5=OFF "
fi fi