From 1517aca3cb8d8d7e3f74388ba4a69f9c46f7470a Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 16 Jul 2013 06:32:20 +0000 Subject: [PATCH] Initial version --- CMake/CPPUnitTests.cmake | 14 +++++++++ CMake/CommonInstall.cmake | 2 ++ CMakeLists.txt | 26 +++++++++++++++ src/HYDROData/CMakeLists.txt | 61 ++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 CMake/CPPUnitTests.cmake create mode 100644 CMake/CommonInstall.cmake create mode 100644 CMakeLists.txt create mode 100644 src/HYDROData/CMakeLists.txt diff --git a/CMake/CPPUnitTests.cmake b/CMake/CPPUnitTests.cmake new file mode 100644 index 00000000..312ca8ba --- /dev/null +++ b/CMake/CPPUnitTests.cmake @@ -0,0 +1,14 @@ +include_directories( + ${CPPUNIT_INCLUDE_DIRS} +) +add_definitions(${CPPUNIT_DEFINITIONS}) + +add_executable(${TEST_EXE} ${TEST_HEADERS} ${TEST_SOURCES}) + +get_target_property(MyUnitTestTarget ${TEST_EXE} LOCATION) +# replace $(OutDir) in this path by "Debug" or "Release" because it is not recognized by CTest later +STRING(REGEX REPLACE "\\$\\(OutDir\\)" "${CMAKE_BUILD_TYPE}" MyUnitTestTarget_upd ${MyUnitTestTarget}) +enable_testing() + +add_test(${TEST_EXE} ${MyUnitTestTarget_upd}) + \ No newline at end of file diff --git a/CMake/CommonInstall.cmake b/CMake/CommonInstall.cmake new file mode 100644 index 00000000..7394c236 --- /dev/null +++ b/CMake/CommonInstall.cmake @@ -0,0 +1,2 @@ +install(TARGETS ${PROJECT_LIBRARIES} RUNTIME DESTINATION bin LIBRARY DESTINATION lib) +install(FILES ${PROJECT_HEADERS} DESTINATION include) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..e50f8bb6 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required (VERSION 2.6) + +project (HYDRO) + +SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL") +IF(EXISTS ${KERNEL_ROOT_DIR}) + INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake) +ELSE(EXISTS ${KERNEL_ROOT_DIR}) + MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR") +ENDIF(EXISTS ${KERNEL_ROOT_DIR}) + +SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI") +IF(EXISTS ${GUI_ROOT_DIR}) + INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindGUI.cmake) +ELSE(EXISTS ${GUI_ROOT_DIR}) + MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR") +ENDIF(EXISTS ${GUI_ROOT_DIR}) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${KERNEL_ROOT_DIR}/salome_adm/cmake_files ${GUI_ROOT_DIR}/adm_local/cmake_files) +find_package(SalomeQT4) +find_package(SalomeCAS) +find_package(SalomeCPPUNIT) + +add_subdirectory (src/HYDROData) + +enable_testing() diff --git a/src/HYDROData/CMakeLists.txt b/src/HYDROData/CMakeLists.txt new file mode 100644 index 00000000..8fb55d65 --- /dev/null +++ b/src/HYDROData/CMakeLists.txt @@ -0,0 +1,61 @@ +include(../../CMake/Common.cmake) + +set(PROJECT_HEADERS + HYDROData.h + HYDROData_Application.h + HYDROData_Document.h + HYDROData_Iterator.h + HYDROData_Object.h + HYDROData_Image.h +) + +set(PROJECT_SOURCES + HYDROData_Application.cxx + HYDROData_Document.cxx + HYDROData_Iterator.cxx + HYDROData_Object.cxx + HYDROData_Image.cxx +) + +add_definitions( + -DHYDRODATA_EXPORTS + ${CAS_DEFINITIONS} + ${QT_DEFINITIONS} +) + +include_directories( + ${CAS_INCLUDE_DIRS} + ${QT_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_library(HYDROData SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) +target_link_libraries(HYDROData ${CAS_OCAF}) + +set(PROJECT_LIBRARIES HYDROData) + +# tests +if(CPPUNIT_IS_OK) + + set(TEST_HEADERS + test_HYDROData_Document.h + test_HYDROData_Object.h + test_HYDROData_Iterator.h + test_HYDROData_Image.h + ) + + set(TEST_SOURCES + test_HYDROData_Main.cxx + test_HYDROData_Document.cxx + test_HYDROData_Object.cxx + test_HYDROData_Iterator.cxx + test_HYDROData_Image.cxx + ) + + set(TEST_EXE test_HYDROData) + include(../../CMake/CPPUnitTests.cmake) + target_link_libraries(test_HYDROData ${CAS_OCAF} ${QT_LIBRARIES} ${CPPUNIT_LIBS} HYDROData) + +endif(CPPUNIT_IS_OK) + +include(../../CMake/CommonInstall.cmake) -- 2.39.2