From 00721bacfb0181d6a424167bfa4d1ad16f877f57 Mon Sep 17 00:00:00 2001 From: Lars Bahren <bahren@astron.nl> Date: Mon, 16 Jun 2008 08:23:34 +0000 Subject: [PATCH] Bug 1199: Initial commit of experimental CMake infrastructure for configuration and build. --- .gitattributes | 14 +++ CMakeLists.txt | 136 +++++++++++++++++++++ LCS/ACC/ACCbin/CMakeLists.txt | 6 + LCS/ACC/ACCbin/src/CMakeLists.txt | 17 +++ LCS/ACC/CMakeLists.txt | 8 ++ LCS/Blob/CMakeLists.txt | 14 +++ LCS/Blob/src/CMakeLists.txt | 34 ++++++ LCS/Blob/test/CMakeLists.txt | 18 +++ LCS/CMakeLists.txt | 145 +++++++++++++++++++++++ LCS/Common/CMakeLists.txt | 14 +++ LCS/Common/include/Common/CMakeLists.txt | 6 + LCS/Common/src/CMakeLists.txt | 13 ++ LCS/Common/test/CMakeLists.txt | 28 +++++ LCS/Math/CMakeLists.txt | 7 ++ LCS/Math/src/CMakeLists.txt | 5 + 15 files changed, 465 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 LCS/ACC/ACCbin/CMakeLists.txt create mode 100644 LCS/ACC/ACCbin/src/CMakeLists.txt create mode 100644 LCS/ACC/CMakeLists.txt create mode 100644 LCS/Blob/CMakeLists.txt create mode 100644 LCS/Blob/src/CMakeLists.txt create mode 100644 LCS/Blob/test/CMakeLists.txt create mode 100644 LCS/CMakeLists.txt create mode 100644 LCS/Common/CMakeLists.txt create mode 100644 LCS/Common/include/Common/CMakeLists.txt create mode 100644 LCS/Common/src/CMakeLists.txt create mode 100644 LCS/Common/test/CMakeLists.txt create mode 100644 LCS/Math/CMakeLists.txt create mode 100644 LCS/Math/src/CMakeLists.txt diff --git a/.gitattributes b/.gitattributes index c64b5fc0f61..22eff106e94 100644 --- a/.gitattributes +++ b/.gitattributes @@ -199,6 +199,7 @@ CEP/Demo/Platform/RadioDemo/src/sound-recorder/#Makefile# -text CEP/Tools/PerfTest/AsyncTest/src/Simulate.clog -text svneol=unset#unset CEP/Tools/PerfTest/InOutTest/src/Simulate.clog -text svneol=unset#unset CEP/Tools/PerfTest/P2Perf/src/Simulate.clog -text svneol=unset#unset +/CMakeLists.txt -text Demo/CEP/TFlopCorrelator/TFC_GUI/make_jar.sh -text svneol=native#application/octet-stream Demo/CEP/TFlopCorrelator/TFC_GUI/plot1.png -text Demo/CEP/TFlopCorrelator/TFC_GUI/plot2.png -text @@ -289,15 +290,28 @@ JAVA/LofarUtils/src/com/toedter/components/images/JSpinFieldMono16.gif -text JAVA/LofarUtils/src/com/toedter/components/images/JSpinFieldMono32.gif -text JAVA/MAC/jRSP/.cvsignore -text JAVA/MAC/jRSP/nbproject/.cvsignore -text +LCS/ACC/ACCbin/CMakeLists.txt -text +LCS/ACC/ACCbin/src/CMakeLists.txt -text +LCS/ACC/CMakeLists.txt -text LCS/AMC/AMCImpl/src/AMCServer.cc -text LCS/AMC/amc_main_classes.png -text LCS/AMC/amc_package.png -text +LCS/Blob/CMakeLists.txt -text +LCS/Blob/src/CMakeLists.txt -text +LCS/Blob/test/CMakeLists.txt -text LCS/Blob/test/tBlobField.in_be -text svneol=unset#unset LCS/Blob/test/tBlobField.in_le -text svneol=unset#unset LCS/Blob/test/tBlobStream.in_be -text svneol=unset#unset LCS/Blob/test/tBlobStream.in_le -text svneol=unset#unset +LCS/CMakeLists.txt -text +LCS/Common/CMakeLists.txt -text +LCS/Common/include/Common/CMakeLists.txt -text +LCS/Common/src/CMakeLists.txt -text LCS/Common/src/Common-Model.cat -text +LCS/Common/test/CMakeLists.txt -text LCS/LACE/bootstrap -text +LCS/Math/CMakeLists.txt -text +LCS/Math/src/CMakeLists.txt -text MAC/APL/APLCommon/Makefile.am -text svneol=native#application/octet-stream MAC/APL/APLCommon/bootstrap -text svneol=native#application/octet-stream MAC/APL/APLCommon/configure.in -text svneol=native#application/octet-stream diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000000..eeadcb26d14 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,136 @@ + +## ------------------------------------------------------------------------------ +## Project characteristics + +project (LOFAR) + +cmake_minimum_required (VERSION 2.5) + +## ------------------------------------------------------------------------------ +## Set CMAKE_MODULE_PATH to load custom CMake modules + +find_path (USG_ROOT cmake/CMakeSettings.cmake + PATHS + ${LOFAR_SOURCE_DIR} + ${LOFAR_SOURCE_DIR}/.. + ${LOFAR_SOURCE_DIR}/../.. + ${LOFAR_SOURCE_DIR}/../../.. + $ENV{LOFARSOFT} + ) + +if (USG_ROOT) + include (${USG_ROOT}/cmake/CMakeSettings.cmake) +else (USG_ROOT) + message (FATAL_ERROR "Unable to locate additional CMake scripts!") +endif (USG_ROOT) + +## ------------------------------------------------------------------------------ +## Additional CMake modules + +include (CheckIncludeFiles) +include (CheckLibraryExists) +#include (CheckFunctionExists) +include (CheckTypeSize) +include (CTest) +enable_testing() + +## ------------------------------------------------------------------------------ +## Check system libraries + +check_include_files (sys/socket.h HAVE_SYS_SOCKET_H ) +check_include_files (sys/types.h HAVE_SYS_TYPES_H ) +check_include_files (unistd.h HAVE_UNISTD_H ) +check_include_files (stdarg.h HAVE_STDARG_H ) +check_include_files (time.h HAVE_TIME_H ) +check_include_files (stdio.h HAVE_STDIO_H ) +check_include_files (netinet/in.h HAVE_NETINET_IN_H ) + +if (HAVE_SYS_TYPES_H) + check_type_size ("uint" HAVE_UINT) + if (HAVE_UINT) + add_definitions (-DHAVE_UINT) + endif (HAVE_UINT) + ## + check_type_size ("long" HAVE_LONG) + if (HAVE_LONG) + add_definitions (-DHAVE_LONG) + endif (HAVE_LONG) + ## + check_type_size ("long long" HAVE_LONGLONG) + if (HAVE_LONGLONG) + add_definitions (-DHAVE_LONGLONG) + endif (HAVE_LONGLONG) + ## + check_type_size ("ushort" HAVE_USHORT) + if (HAVE_USHORT) + add_definitions (-DHAVE_USHORT) + endif (HAVE_USHORT) +else (HAVE_SYS_TYPES_H) + message (STATUS "Unable to find sys/types.h") +endif (HAVE_SYS_TYPES_H) + +## ------------------------------------------------------------------------------ +## Check for required tools + +find_program ( bison_bin bison ) +find_program ( flex_bin flex ) +find_program ( yacc_bin yacc ) + +## ------------------------------------------------------------------------------ +## Search for external libraries + +## Boost++ + +include (FindBoost) + +if (BOOST_INCLUDES) + include_directories (${BOOST_INCLUDES}) + add_definitions (-DHAVE_BOOST) +endif (BOOST_INCLUDES) + +## casacore + +include (FindCASACORE) + +if (CASACORE_INCLUDES) + include_directories (${CASACORE_INCLUDES}) + add_definitions (-DHAVE_AIPSPP) +endif (CASACORE_INCLUDES) + + +## Commonly used configuration files + +set (LOFAR_config ${LOFAR_BINARY_DIR}/lofar_config.h) + +file (WRITE ${LOFAR_config} "/* lofar_config.h -- Generated by CMake. */\n\n") + +include_directories (${LOFAR_BINARY_DIR}) + +## ------------------------------------------------------------------------------ +## Module header files + +include_directories ( + ${LOFAR_SOURCE_DIR}/LCS/Blob/include + ${LOFAR_SOURCE_DIR}/LCS/Common/include + ${LOFAR_SOURCE_DIR}/LCS/ACC/ALC/include + ${LOFAR_SOURCE_DIR}/LCS/ACC/APS/include + ${LOFAR_SOURCE_DIR}/LCS/ACC/PLC/include + ${LOFAR_SOURCE_DIR}/LCS/Transport/include + ) + +## ------------------------------------------------------------------------------ +## Directories to be included in the build + +add_subdirectory (Appl) +add_subdirectory (LCS) +add_subdirectory (CEP) + +## ============================================================================== +## +## Feedback on configuration settings +## +## ============================================================================== + +message (STATUS "Flex = ${flex_bin}") +message (STATUS "Bison = ${bison_bin}") +message (STATUS "Yacc = ${yacc_bin}") diff --git a/LCS/ACC/ACCbin/CMakeLists.txt b/LCS/ACC/ACCbin/CMakeLists.txt new file mode 100644 index 00000000000..35b2288677e --- /dev/null +++ b/LCS/ACC/ACCbin/CMakeLists.txt @@ -0,0 +1,6 @@ + +## ------------------------------------------------------------------------------ +## Directories to be included in the build + +add_subdirectory (src) +add_subdirectory (test) diff --git a/LCS/ACC/ACCbin/src/CMakeLists.txt b/LCS/ACC/ACCbin/src/CMakeLists.txt new file mode 100644 index 00000000000..7055b453f72 --- /dev/null +++ b/LCS/ACC/ACCbin/src/CMakeLists.txt @@ -0,0 +1,17 @@ + +add_executable (ApplController + ACCmdImpl.cc + ACDaemonComm.cc + APAdmin.cc + APAdminPool.cc + CmdStack.cc + ItemList.cc + ProcRule.cc + ProcRuler.cc + PR_Shell.cc + PR_MPI.cc + PR_BGL.cc + StateEngine.cc + ApplController.cc + ApplControllerMain.cc +) \ No newline at end of file diff --git a/LCS/ACC/CMakeLists.txt b/LCS/ACC/CMakeLists.txt new file mode 100644 index 00000000000..47f69c8a86b --- /dev/null +++ b/LCS/ACC/CMakeLists.txt @@ -0,0 +1,8 @@ + +## ------------------------------------------------------------------------------ +## Directories to be included in the build + +add_subdirectory (ACCbin) +add_subdirectory (ALC) +add_subdirectory (APS) +add_subdirectory (PLC) diff --git a/LCS/Blob/CMakeLists.txt b/LCS/Blob/CMakeLists.txt new file mode 100644 index 00000000000..200b7566598 --- /dev/null +++ b/LCS/Blob/CMakeLists.txt @@ -0,0 +1,14 @@ + +## ------------------------------------------------------------------------------ +## Project characteristics + +project (Blob) + +cmake_minimum_required (VERSION 2.5) + +## ------------------------------------------------------------------------------ +## Directories to be included in the build + +add_subdirectory (include) +add_subdirectory (src) +add_subdirectory (test) diff --git a/LCS/Blob/src/CMakeLists.txt b/LCS/Blob/src/CMakeLists.txt new file mode 100644 index 00000000000..bab67e561f7 --- /dev/null +++ b/LCS/Blob/src/CMakeLists.txt @@ -0,0 +1,34 @@ + +make_package_version (${LCS_SOURCE_DIR}/Blob/src TRUE TRUE) + +## ------------------------------------------------------------------------------ +## Process input files for Flex and Bison + +if (yacc_bin) + execute_process ( + WORKING_DIRECTORY ${LCS_SOURCE_DIR}/Blob/src + COMMAND yacc -p KeyParse -o KeyParse.h KeyParse.yy + TIMEOUT 20 + ERROR_VARIABLE yacc_error + OUTPUT_QUIET + ) +endif (yacc_bin) + +## ------------------------------------------------------------------------------ +## Build the library + +file (GLOB libblob_SOURCES *.cc Net/*.cc) + +add_library (blob ${libblob_SOURCES}) + +target_link_libraries (blob ${CASA_LIBRARIES}) + +## ------------------------------------------------------------------------------ +## Installation + +install ( + TARGETS blob + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) + diff --git a/LCS/Blob/test/CMakeLists.txt b/LCS/Blob/test/CMakeLists.txt new file mode 100644 index 00000000000..c7fe28c79e6 --- /dev/null +++ b/LCS/Blob/test/CMakeLists.txt @@ -0,0 +1,18 @@ + +foreach (LCS_Blob_test + tBlobString + tBlobStream + tBlobArray + tBlobSTL + tBlobCasa + tBlobField + tBlobAipsIO + tKeyValueMap + ) + ## compiler instructions + add_executable (${LCS_Blob_test} ${LCS_Blob_test}.cc) + ## linker instructions + target_link_libraries (${LCS_Blob_test} blob common) + ## testing instructions + add_test (${LCS_Blob_test} ${LCS_Blob_test}) +endforeach (LCS_Blob_test) \ No newline at end of file diff --git a/LCS/CMakeLists.txt b/LCS/CMakeLists.txt new file mode 100644 index 00000000000..da4723e971e --- /dev/null +++ b/LCS/CMakeLists.txt @@ -0,0 +1,145 @@ + +## ------------------------------------------------------------------------------ +## Project characteristics + +project (LCS) + +cmake_minimum_required (VERSION 2.5) + +## ------------------------------------------------------------------------------ +## Set CMAKE_MODULE_PATH to load custom CMake modules + +find_path (USG_ROOT cmake/CMakeSettings.cmake + PATHS + ${LCS_SOURCE_DIR} + ${LCS_SOURCE_DIR}/.. + ${LCS_SOURCE_DIR}/../.. + ${LCS_SOURCE_DIR}/../../.. + $ENV{LOFARSOFT} + ) + +if (USG_ROOT) + include (${USG_ROOT}/cmake/CMakeSettings.cmake) +else (USG_ROOT) + message (FATAL_ERROR "Unable to locate additional CMake scripts!") +endif (USG_ROOT) + +## ------------------------------------------------------------------------------ +## Additional CMake modules + +include (CheckIncludeFiles) +include (CheckLibraryExists) +include (CheckTypeSize) +include (CTest) +enable_testing() + +## Custom modules + +include (MakePackageVersion) + +## ------------------------------------------------------------------------------ +## Check system libraries + +check_include_files (sys/socket.h HAVE_SYS_SOCKET_H ) +check_include_files (sys/types.h HAVE_SYS_TYPES_H ) +check_include_files (unistd.h HAVE_UNISTD_H ) +check_include_files (stdarg.h HAVE_STDARG_H ) +check_include_files (time.h HAVE_TIME_H ) +check_include_files (stdio.h HAVE_STDIO_H ) +check_include_files (netinet/in.h HAVE_NETINET_IN_H ) + +if (HAVE_SYS_TYPES_H) + check_type_size ("uint" HAVE_UINT) + if (HAVE_UINT) + add_definitions (-DHAVE_UINT) + endif (HAVE_UINT) + ## + check_type_size ("long" HAVE_LONG) + if (HAVE_LONG) + add_definitions (-DHAVE_LONG) + endif (HAVE_LONG) + ## + check_type_size ("long long" HAVE_LONGLONG) + if (HAVE_LONGLONG) + add_definitions (-DHAVE_LONGLONG) + endif (HAVE_LONGLONG) + ## + check_type_size ("ushort" HAVE_USHORT) + if (HAVE_USHORT) + add_definitions (-DHAVE_USHORT) + endif (HAVE_USHORT) +else (HAVE_SYS_TYPES_H) + message (STATUS "Unable to find sys/types.h") +endif (HAVE_SYS_TYPES_H) + +## ------------------------------------------------------------------------------ +## Check for required tools + +find_program ( bison_bin bison ) +find_program ( flex_bin flex ) +find_program ( yacc_bin yacc ) + +## ------------------------------------------------------------------------------ +## Search for external libraries + +## Boost++ + +include (FindBoost) + +if (BOOST_INCLUDES) + include_directories (${BOOST_INCLUDES}) + add_definitions (-DHAVE_BOOST) +endif (BOOST_INCLUDES) + +## casacore + +include (FindCASACORE) + +if (CASACORE_INCLUDES) + include_directories (${CASACORE_INCLUDES}) + add_definitions (-DHAVE_AIPSPP) +endif (CASACORE_INCLUDES) + + +## Commonly used configuration files + +set (LCS_config ${LCS_BINARY_DIR}/lofar_config.h) + +file (WRITE ${LCS_config} "/* lofar_config.h -- Generated by CMake. */\n\n") + +include_directories (${LCS_BINARY_DIR}) + +## ------------------------------------------------------------------------------ +## Module header files + +include_directories ( + ${LCS_SOURCE_DIR}/Blob/include + ${LCS_SOURCE_DIR}/Common/include + ${LCS_SOURCE_DIR}/ACC/ALC/include + ${LCS_SOURCE_DIR}/ACC/APS/include + ${LCS_SOURCE_DIR}/ACC/PLC/include + ${LCS_SOURCE_DIR}/Transport/include + ) + +## ------------------------------------------------------------------------------ +## Directories to be included in the build + +#add_subdirectory (ACC) +add_subdirectory (AMC) +add_subdirectory (Blob) +add_subdirectory (Common) +add_subdirectory (LACE) +#add_subdirectory (Math) +add_subdirectory (Tools) +add_subdirectory (Transport) + + +## ============================================================================== +## +## Feedback on configuration settings +## +## ============================================================================== + +message (STATUS "Flex = ${flex_bin}") +message (STATUS "Bison = ${bison_bin}") +message (STATUS "Yacc = ${yacc_bin}") diff --git a/LCS/Common/CMakeLists.txt b/LCS/Common/CMakeLists.txt new file mode 100644 index 00000000000..ccffe04c17c --- /dev/null +++ b/LCS/Common/CMakeLists.txt @@ -0,0 +1,14 @@ + +## ------------------------------------------------------------------------------ +## Project characteristics + +project (Common) + +cmake_minimum_required (VERSION 2.5) + +## ------------------------------------------------------------------------------ +## Directories to be included in the build + +add_subdirectory (include) +add_subdirectory (src) +add_subdirectory (test) diff --git a/LCS/Common/include/Common/CMakeLists.txt b/LCS/Common/include/Common/CMakeLists.txt new file mode 100644 index 00000000000..8fbcfc14b47 --- /dev/null +++ b/LCS/Common/include/Common/CMakeLists.txt @@ -0,0 +1,6 @@ + +file (GLOB libcommon_HEADERS *.h) + +install (FILES ${libcommon_HEADERS} + DESTINATION include/Common + ) diff --git a/LCS/Common/src/CMakeLists.txt b/LCS/Common/src/CMakeLists.txt new file mode 100644 index 00000000000..55ba02734c2 --- /dev/null +++ b/LCS/Common/src/CMakeLists.txt @@ -0,0 +1,13 @@ + +make_package_version (${LCS_SOURCE_DIR}/Common/src TRUE TRUE) + +file (GLOB libcommon_SOURCES *.cc Net/*.cc) + +add_library (common ${libcommon_SOURCES}) + +install ( + TARGETS common + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) + diff --git a/LCS/Common/test/CMakeLists.txt b/LCS/Common/test/CMakeLists.txt new file mode 100644 index 00000000000..c1b494da6fc --- /dev/null +++ b/LCS/Common/test/CMakeLists.txt @@ -0,0 +1,28 @@ + +foreach (LCS_Common_test + testLogger + tAllocator + tDataConvert + tFileLocator + tStringUtil + tStreamUtil + tHexdump + testSocket + tComplex + tProcess + tRunOnNode + tTimer + tNumeric + tSingleton +# tObjectFactory + tSystemUtil + tSaxpy + tPrettyUnits + ) + ## compiler instructions + add_executable (${LCS_Common_test} ${LCS_Common_test}.cc) + ## linker instructions + target_link_libraries (${LCS_Common_test} common) + ## testing instructions + add_test (${LCS_Common_test} ${LCS_Common_test}) +endforeach (LCS_Common_test) \ No newline at end of file diff --git a/LCS/Math/CMakeLists.txt b/LCS/Math/CMakeLists.txt new file mode 100644 index 00000000000..8e39cf40f83 --- /dev/null +++ b/LCS/Math/CMakeLists.txt @@ -0,0 +1,7 @@ + +## ------------------------------------------------------------------------------ +## Directories to be included in the build + +add_subdirectory (include) +add_subdirectory (src) +add_subdirectory (test) diff --git a/LCS/Math/src/CMakeLists.txt b/LCS/Math/src/CMakeLists.txt new file mode 100644 index 00000000000..d0a777e14d4 --- /dev/null +++ b/LCS/Math/src/CMakeLists.txt @@ -0,0 +1,5 @@ + +file (GLOB libcommon_SOURCES *.cc Net/*.cc) + +add_library (common ${libcommon_SOURCES}) + -- GitLab