CMake: prefixing the options with SLS_

This commit is contained in:
maliakal_d 2019-02-08 16:02:05 +01:00
parent dccce9bf55
commit b89d56001e
7 changed files with 30 additions and 30 deletions

View File

@ -8,10 +8,10 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(SLS_MASTER_PROJECT ON) set(SLS_MASTER_PROJECT ON)
endif() endif()
option (USE_HDF5 "HDF5 File format" OFF) option (SLS_USE_HDF5 "HDF5 File format" OFF)
option (USE_TEXTCLIENT "Text Client" OFF) option (SLS_USE_TEXTCLIENT "Text Client" OFF)
option (USE_RECEIVER "Receiver" OFF) option (SLS_USE_RECEIVER "Receiver" OFF)
option (USE_GUI "GUI" OFF) option (SLS_USE_GUI "GUI" OFF)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# clang does not support -Wno-misleading-indentation # clang does not support -Wno-misleading-indentation
@ -29,9 +29,9 @@ find_package(CBF)
find_package(Doxygen) find_package(Doxygen)
# find_package(PNG REQUIRED) # find_package(PNG REQUIRED)
if (USE_HDF5) if (SLS_USE_HDF5)
find_package(HDF5 1.10 COMPONENTS CXX) find_package(HDF5 1.10 COMPONENTS CXX)
endif (USE_HDF5) endif (SLS_USE_HDF5)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@ -39,21 +39,21 @@ set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
if (USE_TEXTCLIENT) if (SLS_USE_TEXTCLIENT)
add_subdirectory(slsDetectorSoftware) add_subdirectory(slsDetectorSoftware)
endif (USE_TEXTCLIENT) endif (SLS_USE_TEXTCLIENT)
if (USE_RECEIVER) if (SLS_USE_RECEIVER)
add_subdirectory(slsReceiverSoftware) add_subdirectory(slsReceiverSoftware)
add_subdirectory(manual/manual-api) add_subdirectory(manual/manual-api)
endif (USE_RECEIVER) endif (SLS_USE_RECEIVER)
if (USE_GUI) if (SLS_USE_GUI)
if (QT4_FOUND AND QWT_FOUND) if (QT4_FOUND AND QWT_FOUND)
add_subdirectory(slsDetectorGui) add_subdirectory(slsDetectorGui)
endif() endif()
endif (USE_GUI) endif (SLS_USE_GUI)
if (SLS_MASTER_PROJECT) if (SLS_MASTER_PROJECT)
# Set targets export name (otherwise set by upstream project) # Set targets export name (otherwise set by upstream project)

View File

@ -75,13 +75,13 @@ Use cmake to create out-of-source builds, by creating a build folder parallel to
$ cd .. $ cd ..
$ mkdir slsDetectorPackage-build $ mkdir slsDetectorPackage-build
$ cd slsDetectorPackage-build $ cd slsDetectorPackage-build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=OFF $ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
$ make $ make
``` ```
Use the following as an example to compile statically and using specific hdf5 folder Use the following as an example to compile statically and using specific hdf5 folder
``` ```
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=ON $ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
``` ```
After compiling, the libraries and executables will be found at `bin` directory After compiling, the libraries and executables will be found at `bin` directory
``` ```

12
cmk.sh
View File

@ -116,20 +116,20 @@ done
if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
CMAKE_POST+=" -DUSE_TEXTCLIENT=ON -DUSE_RECEIVER=ON -DUSE_GUI=ON " CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=ON "
echo "Compile Option: TextClient, Receiver and GUI" echo "Compile Option: TextClient, Receiver and GUI"
else else
if [ $TEXTCLIENT -eq 1 ]; then if [ $TEXTCLIENT -eq 1 ]; then
CMAKE_POST+=" -DUSE_TEXTCLIENT=ON " CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON "
echo "Compile Option: TextClient" echo "Compile Option: TextClient"
fi fi
if [ $RECEIVER -eq 1 ]; then if [ $RECEIVER -eq 1 ]; then
CMAKE_POST+=" -DUSE_RECEIVER=ON " CMAKE_POST+=" -DSLS_USE_RECEIVER=ON "
echo "Compile Option: Receiver" echo "Compile Option: Receiver"
fi fi
if [ $GUI -eq 1 ]; then if [ $GUI -eq 1 ]; then
CMAKE_POST+=" -DUSE_GUI=ON " CMAKE_POST+=" -DSLS_USE_GUI=ON "
echo "Compile Option: GUI" echo "Compile Option: GUI"
fi fi
fi fi
@ -161,10 +161,10 @@ fi
#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+=" -DSLS_USE_HDF5=ON "
#normal mode rebuild #normal mode rebuild
else else
CMAKE_POST+=" -DUSE_HDF5=OFF " CMAKE_POST+=" -DSLS_USE_HDF5=OFF "
fi fi

View File

@ -33,7 +33,7 @@ source directory.
$ cd .. $ cd ..
$ mkdir slsDetectorPackage-build $ mkdir slsDetectorPackage-build
$ cd slsDetectorPackage-build $ cd slsDetectorPackage-build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=OFF $ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
$ make $ make
</PRE> </PRE>
@ -42,7 +42,7 @@ Use the following as an example to compile statically and using specific hdf5
folder folder
<PRE> <PRE>
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage $ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage
-DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=ON -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
</PRE> </PRE>
<P> <P>

View File

@ -369,7 +369,7 @@ source directory.
$ cd .. $ cd ..
$ mkdir slsDetectorPackage-build $ mkdir slsDetectorPackage-build
$ cd slsDetectorPackage-build $ cd slsDetectorPackage-build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=OFF $ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
$ make $ make
\end{verbatim} \end{verbatim}
@ -377,7 +377,7 @@ Use the following as an example to compile statically and using specific hdf5
folder folder
\begin{verbatim} \begin{verbatim}
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage $ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage
-DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=ON -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
\end{verbatim} \end{verbatim}
After compiling, the libraries and executables will be found at `bin` directory After compiling, the libraries and executables will be found at `bin` directory

View File

@ -4,11 +4,11 @@ cd build
cmake .. \ cmake .. \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \ -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DCMAKE_INSTALL_PREFIX=install \ -DCMAKE_INSTALL_PREFIX=install \
-DUSE_TEXTCLIENT=ON \ -DSLS_USE_TEXTCLIENT=ON \
-DUSE_RECEIVER=ON \ -DSLS_USE_RECEIVER=ON \
-DUSE_GUI=ON \ -DSLS_USE_GUI=ON \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DUSE_HDF5=OFF\ -DSLS_USE_HDF5=OFF\
cmake --build . -- -j10 cmake --build . -- -j10

View File

@ -18,7 +18,7 @@ set(SOURCES
# HDF5 # HDF5
if (USE_HDF5) if (SLS_USE_HDF5)
if (HDF5_FOUND) if (HDF5_FOUND)
include_directories( include_directories(
${HDF5_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS}
@ -30,7 +30,7 @@ if (USE_HDF5)
src/HDF5File.cpp src/HDF5File.cpp
) )
endif () endif ()
endif (USE_HDF5) endif (SLS_USE_HDF5)
add_definitions( add_definitions(