From 6a3d93cb6e45f47a3c6c742777a14a6eac08990e Mon Sep 17 00:00:00 2001 From: spo Date: Thu, 26 May 2016 16:18:18 +0300 Subject: [PATCH] Improve CMakeLists.txt files for ModelHighAPI & ConstructionAPI. Improve ConstructionAPI/ConstructionAPI.i. --- src/ConstructionAPI/CMakeLists.txt | 2 ++ src/ConstructionAPI/ConstructionAPI.i | 2 ++ src/ModelHighAPI/CMakeLists.txt | 37 ++++++++++++++++----------- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/ConstructionAPI/CMakeLists.txt b/src/ConstructionAPI/CMakeLists.txt index ef8fcb5ea..cf04d02a5 100644 --- a/src/ConstructionAPI/CMakeLists.txt +++ b/src/ConstructionAPI/CMakeLists.txt @@ -21,6 +21,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/ModelHighAPI ) +#TODO(spo): is ${CAS_DEFINITIONS} necessary? ADD_DEFINITIONS(-DCONSTRUCTIONAPI_EXPORTS ${CAS_DEFINITIONS}) ADD_LIBRARY(ConstructionAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) TARGET_LINK_LIBRARIES(ConstructionAPI ${PROJECT_LIBRARIES}) @@ -32,6 +33,7 @@ INCLUDE(PythonAPI) SET_SOURCE_FILES_PROPERTIES(ConstructionAPI.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(ConstructionAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow") +#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ ? SET(SWIG_LINK_LIBRARIES ConstructionAPI ModelHighAPI diff --git a/src/ConstructionAPI/ConstructionAPI.i b/src/ConstructionAPI/ConstructionAPI.i index ed3c2172a..8ac763a3c 100644 --- a/src/ConstructionAPI/ConstructionAPI.i +++ b/src/ConstructionAPI/ConstructionAPI.i @@ -1,5 +1,7 @@ /* ConstructionAPI.i */ + %module ConstructionAPI + %{ #include "ConstructionAPI_swig.h" %} diff --git a/src/ModelHighAPI/CMakeLists.txt b/src/ModelHighAPI/CMakeLists.txt index c93441264..4402e74d9 100644 --- a/src/ModelHighAPI/CMakeLists.txt +++ b/src/ModelHighAPI/CMakeLists.txt @@ -1,9 +1,6 @@ ## Copyright (C) 2014-20xx CEA/DEN, EDF R&D -FIND_PACKAGE(SWIG REQUIRED) -INCLUDE(${SWIG_USE_FILE}) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE(UnitTest) +INCLUDE(Common) SET(PROJECT_HEADERS ModelHighAPI.h @@ -20,14 +17,28 @@ SET(PROJECT_LIBRARIES Config Events ) - -SET(CMAKE_SWIG_FLAGS -threads -Wall) -ADD_DEFINITIONS(-DModelHighAPI_EXPORTS) +ADD_DEFINITIONS(-DMODELHIGHAPI_EXPORTS) ADD_LIBRARY(ModelHighAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) +#TODO(spo): is it necessary? SET_TARGET_PROPERTIES(ModelHighAPI PROPERTIES LINKER_LANGUAGE CXX) TARGET_LINK_LIBRARIES(ModelHighAPI ${PROJECT_LIBRARIES}) +# SWIG wrapper + +INCLUDE(PythonAPI) + +#TODO(spo): is it necessary? +SET(CMAKE_SWIG_FLAGS -threads -Wall) + +SET_SOURCE_FILES_PROPERTIES(ModelHighAPI.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(ModelHighAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow") + +SET(SWIG_LINK_LIBRARIES + ModelHighAPI + ${PYTHON_LIBRARIES} + ) + INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/Events ${PROJECT_SOURCE_DIR}/src/ModelAPI @@ -35,18 +46,10 @@ INCLUDE_DIRECTORIES( # ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI ) -SET_SOURCE_FILES_PROPERTIES(ModelHighAPI.i PROPERTIES CPLUSPLUS ON) -SET_SOURCE_FILES_PROPERTIES(ModelHighAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow") - SET(SWIG_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/ModelHighAPI.py ) -SET(SWIG_LINK_LIBRARIES - ModelHighAPI - ${PYTHON_LIBRARIES} - ) - SWIG_ADD_MODULE(ModelHighAPI python ModelHighAPI.i ${PROJECT_HEADERS}) SWIG_LINK_LIBRARIES(ModelHighAPI ${SWIG_LINK_LIBRARIES}) @@ -58,6 +61,10 @@ INSTALL(TARGETS _ModelHighAPI DESTINATION ${SHAPER_INSTALL_SWIG}) INSTALL(TARGETS ModelHighAPI DESTINATION ${SHAPER_INSTALL_BIN}) INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG}) +# Tests + +INCLUDE(UnitTest) + ADD_UNIT_TESTS( TestDouble.py ) -- 2.39.2