|
@@ -33,6 +33,8 @@ set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR})
|
|
|
|
|
|
set(NICE_SOURCEFILES_FIND_GLOBALLYRECURSIVE ON CACHE STRING "Scan a sublibraries directory for source files instead of using an explicit src file list")
|
|
|
|
|
|
+set(external_deps "")
|
|
|
+
|
|
|
NICE_OPTION(WITH_MEX "Build with MEX support" OFF)
|
|
|
if(WITH_MEX)
|
|
|
set(MATLAB_DEFAULT_ROOT "/home/matlab/8.2/academic")
|
|
@@ -77,6 +79,7 @@ if(WITH_MEX)
|
|
|
SET(MEX_ENDING ".mexa64")
|
|
|
ADD_DEFINITIONS("-DNICE_USELIB_MEX")
|
|
|
MESSAGE(STATUS "Found mex libraries at ${MEX_LIBRARIES}")
|
|
|
+ set(external_deps ${external_deps} "MEX")
|
|
|
endif()
|
|
|
|
|
|
NICE_OPTION(WITH_BOOST "Build with Boost support" OFF)
|
|
@@ -89,6 +92,7 @@ if(WITH_BOOST)
|
|
|
ADD_DEFINITIONS( "-DNICE_BOOST_FOUND" )
|
|
|
ADD_DEFINITIONS( "-DNICE_USELIB_BOOST" )
|
|
|
ENDIF()
|
|
|
+ set(external_deps ${external_deps} "BOOST")
|
|
|
endif()
|
|
|
|
|
|
FIND_PACKAGE(CppUnit)
|
|
@@ -101,6 +105,7 @@ else()
|
|
|
#set(CPPUNIT_INCLUDE_DIR "/usr/include/") #can be found in /usr/include/cppunit
|
|
|
# ADD_DEFINITIONS( "-DNICE_USELIB_CPPUNIT" )
|
|
|
message(STATUS "CppUnit not found")
|
|
|
+ set(external_deps ${external_deps} "BOOST")
|
|
|
ENDIF()
|
|
|
|
|
|
NICE_OPTION(WITH_DBV_LIBRARIES "Build with DBV extern librares" OFF)
|
|
@@ -122,6 +127,7 @@ if(WITH_DBV_LIBRARIES)
|
|
|
ADD_DEFINITIONS( "-lpthread" )
|
|
|
INCLUDE_DIRECTORIES(${IPP_INCLUDE_DIRS})
|
|
|
|
|
|
+ set(external_deps ${external_deps} "IPP")
|
|
|
else()
|
|
|
message(STATUS "IPP library not found")
|
|
|
endif()
|
|
@@ -136,6 +142,7 @@ if(WITH_DBV_LIBRARIES)
|
|
|
INCLUDE_DIRECTORIES(${LINAL_INCLUDE_DIR})
|
|
|
#message(STATUS "linal link libs: ${LINAL_LIBRARIES}")
|
|
|
message(STATUS "Using LinAl include dir: ${LINAL_INCLUDE_DIR}")
|
|
|
+ set(external_deps ${external_deps} "LINAL")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
@@ -152,6 +159,7 @@ if(WITH_OPENMP)
|
|
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
|
|
ADD_DEFINITIONS( "-DNICE_USELIB_OPENMP")
|
|
|
+ set (external_deps ${external_deps} "OPENMP")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
@@ -161,6 +169,7 @@ if(WITH_PNG)
|
|
|
if (PNG_FOUND)
|
|
|
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIRS})
|
|
|
ADD_DEFINITIONS( "-DNICE_USELIB_PNG")
|
|
|
+ set (external_deps ${external_deps} "PNG")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
@@ -175,6 +184,7 @@ if(WITH_MATIO)
|
|
|
message(STATUS "Matio-dir: ${MATIO_INCLUDE_DIRS}")
|
|
|
ADD_DEFINITIONS( "-DNICE_USELIB_MATIO")
|
|
|
INCLUDE_DIRECTORIES(${MATIO_INCLUDE_DIRS})
|
|
|
+ set (external_deps ${external_deps} "MATIO")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
@@ -200,6 +210,8 @@ if(WITH_QT)
|
|
|
INCLUDE(${QT_USE_FILE})
|
|
|
ADD_DEFINITIONS(${QT_DEFINITIONS})
|
|
|
ADD_DEFINITIONS( "-DNICE_USELIB_QT")
|
|
|
+ set(external_deps ${external_deps} "QT4")
|
|
|
+ set(external_deps ${external_deps} "QT4_XML")
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
@@ -288,6 +300,80 @@ foreach(_curSubdir ${__listSubDirs})
|
|
|
endif()
|
|
|
endforeach()
|
|
|
|
|
|
+set(internal_deps "")
|
|
|
+
|
|
|
+
|
|
|
+foreach(_curSubLib ${__listSubLibs})
|
|
|
+ nice_get_real_path(__modpath "${NICE_CURR_DIR}/${_curSubLib}")
|
|
|
+ message(STATUS "Scanning ${__modpath}...")
|
|
|
+ SUBDIRREC(__depDirs "${__modpath}")
|
|
|
+ foreach(__depDir ${__depDirs})
|
|
|
+ #message(STATUS "Adding (${_curSubLib}) ${__depDir} to list...")
|
|
|
+ set(internal_deps ${internal_deps} ${_curSubLib}/${__depDir})
|
|
|
+ endforeach()
|
|
|
+ set(internal_deps ${internal_deps} ${_curSubLib})
|
|
|
+endforeach()
|
|
|
+
|
|
|
+set(update_dependencies ON)
|
|
|
+
|
|
|
+while(update_dependencies)
|
|
|
+ message(STATUS "updating dependencies...")
|
|
|
+ set(update_dependencies OFF)
|
|
|
+ set(remove_these "")
|
|
|
+ foreach(_curDep ${internal_deps})
|
|
|
+ nice_get_real_path(_curDepPath ${NICE_CURR_DIR}/${_curDep})
|
|
|
+ if(EXISTS ${_curDepPath}/libdepend.inc)
|
|
|
+ #message(STATUS "Reading dependencies for ${_curDep}...")
|
|
|
+ file(STRINGS ${_curDepPath}/libdepend.inc _dependencies REGEX "^[$][(]call( )+PKG_DEPEND_INT,")
|
|
|
+ file(STRINGS ${_curDepPath}/libdepend.inc _extdependencies REGEX "^[$][(]call( )+PKG_DEPEND_EXT,")
|
|
|
+ #message(STATUS "Deps: ${_dependencies}")
|
|
|
+ #message(STATUS "Deps: ${_extdependencies}")
|
|
|
+
|
|
|
+ list(LENGTH _dependencies _depCount)
|
|
|
+ if(${_depCount} GREATER 0)
|
|
|
+ foreach(_innerDep ${_dependencies})
|
|
|
+ string(REGEX REPLACE "^[$][(]call( )+PKG_DEPEND_INT,(.*)[)].*$" "\\2" _innerDepName "${_innerDep}")
|
|
|
+ string(REGEX REPLACE "(.*)/$" "\\1" _innerDepName ${_innerDepName})
|
|
|
+ #message(STATUS "Inner dep: ${_innerDepName} (command: ${_innerDep})")
|
|
|
+ list(FIND internal_deps "${_innerDepName}" _innerDepFound)
|
|
|
+ if(${_innerDepFound} LESS 0)
|
|
|
+ message(STATUS "Removing ${_curDep} from build because ${_innerDepName} is missing")
|
|
|
+ set(remove_these ${remove_these} ${_curDep})
|
|
|
+ set(update_dependencies ON)
|
|
|
+ endif()
|
|
|
+ endforeach()
|
|
|
+ endif()
|
|
|
+
|
|
|
+ list(LENGTH _extdependencies _extdepCount)
|
|
|
+ if(${_depCount} GREATER 0)
|
|
|
+ foreach(_extDep ${_extdependencies})
|
|
|
+ string(REGEX REPLACE "^[$][(]call( )+PKG_DEPEND_EXT,(.*)[)].*$" "\\2" _extDepName "${_extDep}")
|
|
|
+ string(REGEX REPLACE "(.*)/$" "\\1" _extDepName ${_extDepName})
|
|
|
+ #message(STATUS "External dep: ${_extDepName} (command: ${_extDep})")
|
|
|
+ list(FIND external_deps "${_extDepName}" _extDepFound)
|
|
|
+ if(${_extDepFound} LESS 0)
|
|
|
+ message(STATUS "Removing ${_curDep} from build because ${_extDepName} (external) is missing")
|
|
|
+ set(remove_these ${remove_these} ${_curDep})
|
|
|
+ set(update_dependencies ON)
|
|
|
+ endif()
|
|
|
+ endforeach()
|
|
|
+ endif()
|
|
|
+
|
|
|
+ endif()
|
|
|
+ endforeach()
|
|
|
+ foreach(_toRemove ${remove_these})
|
|
|
+ message(STATUS "Checking subdirectories for ${_toRemove}")
|
|
|
+ foreach(_checkDep ${internal_deps})
|
|
|
+ if(${_checkDep} MATCHES "^${_toRemove}.*$")
|
|
|
+ message(STATUS "Removing ${_checkDep}...")
|
|
|
+ LIST(REMOVE_ITEM internal_deps ${_checkDep})
|
|
|
+ endif()
|
|
|
+ endforeach()
|
|
|
+ endforeach()
|
|
|
+endwhile()
|
|
|
+
|
|
|
+message(STATUS "Done.")
|
|
|
+message(STATUS "${internal_deps}")
|
|
|
foreach(_curSublib ${__listSubLibs})
|
|
|
if(BUILD_LIB_${_curSublib})
|
|
|
nice_get_real_path(__modpath "${NICE_CURR_DIR}/${_curSublib}/")
|