diff options
author | Josh Blum | 2013-07-31 19:43:16 -0700 |
---|---|---|
committer | Josh Blum | 2013-07-31 19:43:16 -0700 |
commit | 66e0614b1867045d5dc3bf7ba997b9ed79546adb (patch) | |
tree | c76b88e8966441bc3569dd9ea140600e2138c26c /cmake/Modules/GRASTool.in.cmake | |
parent | 20b413bce5c22bcc44bfc58105288df94a0a592d (diff) | |
download | sandhi-66e0614b1867045d5dc3bf7ba997b9ed79546adb.tar.gz sandhi-66e0614b1867045d5dc3bf7ba997b9ed79546adb.tar.bz2 sandhi-66e0614b1867045d5dc3bf7ba997b9ed79546adb.zip |
grextras: create test macro that works w/ tool
Diffstat (limited to 'cmake/Modules/GRASTool.in.cmake')
-rw-r--r-- | cmake/Modules/GRASTool.in.cmake | 103 |
1 files changed, 3 insertions, 100 deletions
diff --git a/cmake/Modules/GRASTool.in.cmake b/cmake/Modules/GRASTool.in.cmake index 502b271..9295839 100644 --- a/cmake/Modules/GRASTool.in.cmake +++ b/cmake/Modules/GRASTool.in.cmake @@ -5,16 +5,8 @@ set(__INCLUDED_GRAS_TOOL_CMAKE TRUE) include(GRASCommon) -######################################################################## -## Define GRAS_TOOL_PATH_SEP for utility purposes -######################################################################## -if(UNIX) - set(GRAS_TOOL_PATH_SEP ":") -elseif(WIN32) - set(GRAS_TOOL_PATH_SEP "\\;") -else() - set(GRAS_TOOL_PATH_SEP ":") -endif() +#reset global variable on include +set(GRAS_TOOL_MODULE_LOCATIONS "" CACHE INTERNAL "") ######################################################################## ## Set installation constants @@ -149,11 +141,7 @@ function(GRAS_TOOL) #export global variables for help locating build targets get_target_property(module_location ${GRAS_TOOL_TARGET} LOCATION) string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} module_location ${module_location}) - list(APPEND GRAS_TOOL_MODULE_LOCATIONS ${module_location}) - set(GRAS_TOOL_MODULE_LOCATIONS ${GRAS_TOOL_MODULE_LOCATIONS} CACHE INTERNAL "") - string(REPLACE ";" "${GRAS_TOOL_PATH_SEP}" GRAS_TOOL_MODULE_PATH "${GRAS_TOOL_MODULE_LOCATIONS}") - set(GRAS_TOOL_MODULE_PATH ${GRAS_TOOL_MODULE_PATH} CACHE INTERNAL "") - set(${GRAS_TOOL_TARGET}_LOCATION ${module_location} CACHE INTERNAL "") + set(GRAS_TOOL_MODULE_LOCATIONS "${GRAS_TOOL_MODULE_LOCATIONS};${module_location}" CACHE INTERNAL "") endif() #python module install @@ -175,88 +163,3 @@ function(GRAS_TOOL) endif() endfunction(GRAS_TOOL) - -######################################################################## -## GRAS_SWIG_TOOL cmake function - export new types for the loader -## -## Options: -## SOURCE - the swig .i file -## TARGET - target name for the build products -## DIRECTORY - name of installation directory or ${TARGET} -## COMPONENT - name of installation component or ${TARGET} -## -## External vars: -## GRAS_SWIG_TOOL_INCLUDES - list of additional include directories -## GRAS_SWIG_TOOL_LIBRARIES - list of additional libraries to link to -######################################################################## -function(GRAS_SWIG_TOOL) - - find_package(SWIG) - if(NOT SWIG_FOUND) - return() - endif() - - find_package(PythonLibs) - if(NOT PYTHONLIBS_FOUND) - return() - endif() - - include(CMakeParseArguments) - CMAKE_PARSE_ARGUMENTS(GRAS_SWIG_TOOL "" "SOURCE;TARGET;DIRECTORY;COMPONENT" "" ${ARGN}) - - #give an install directory if not specified - if(NOT GRAS_SWIG_TOOL_DIRECTORY) - set(GRAS_SWIG_TOOL_DIRECTORY ${GRAS_SWIG_TOOL_TARGET}) - endif() - - #give the target a component name if not specified - if(NOT GRAS_SWIG_TOOL_COMPONENT) - set(GRAS_SWIG_TOOL_COMPONENT ${GRAS_SWIG_TOOL_TARGET}) - endif() - - #development and framework directories - list(APPEND GRAS_SWIG_TOOL_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}) - list(APPEND GRAS_SWIG_TOOL_INCLUDES ${PMC_SWIG_INCLUDE_DIRS}) - list(APPEND GRAS_SWIG_TOOL_INCLUDES ${GRAS_SWIG_INCLUDE_DIRS}) - list(APPEND GRAS_SWIG_TOOL_LIBRARIES ${PMC_LIBRARIES}) - list(APPEND GRAS_SWIG_TOOL_LIBRARIES ${GRAS_LIBRARIES}) - - #and boost includes as well - include_directories(${Boost_INCLUDE_DIRS}) - - #setup python includes/libs - include_directories(${PYTHON_INCLUDE_PATH}) - include_directories(${PYTHON_INCLUDE_DIRS}) - list(APPEND GRAS_SWIG_TOOL_LIBRARIES ${PYTHON_LIBRARIES}) - - #include swig generation deps for compiling - include_directories(${GRAS_SWIG_TOOL_INCLUDES}) - - #set the C++ property on the swig .i file so it builds - set_source_files_properties(${GRAS_SWIG_TOOL_SOURCE} PROPERTIES CPLUSPLUS ON) - - #setup swig flags - foreach(inc ${GRAS_SWIG_TOOL_INCLUDES}) - list(APPEND CMAKE_SWIG_FLAGS "-I${inc}") - endforeach(inc) - set(CMAKE_SWIG_FLAGS -fvirtual -module ${GRAS_SWIG_TOOL_TARGET} ${CMAKE_SWIG_FLAGS}) - - #register swig build - include(UseSWIG) - SWIG_ADD_MODULE(${GRAS_SWIG_TOOL_TARGET} python ${GRAS_SWIG_TOOL_SOURCE}) - SWIG_LINK_LIBRARIES(${GRAS_SWIG_TOOL_TARGET} ${GRAS_SWIG_TOOL_LIBRARIES}) - - #install rules for generated module and py file - set(GRAS_TOOL_PYTHON_DIR lib@LIBSUFFIX@/gras/python/${GRAS_SWIG_TOOL_DIRECTORY}) - install( - TARGETS ${SWIG_MODULE_${GRAS_SWIG_TOOL_TARGET}_REAL_NAME} - DESTINATION ${GRAS_TOOL_PYTHON_DIR} - COMPONENT ${GRAS_SWIG_TOOL_COMPONENT} - ) - install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${GRAS_SWIG_TOOL_TARGET}.py - DESTINATION ${GRAS_TOOL_PYTHON_DIR} - COMPONENT ${GRAS_SWIG_TOOL_COMPONENT} - ) - -endfunction(GRAS_SWIG_TOOL) |