diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-12-20 21:34:09 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-12-20 21:34:09 (GMT) |
commit | 498f6f80e9ca01236ca1491596875ab7eb4cd8c3 (patch) | |
tree | e627ae19475bb93a98dfa50db1950f6e3403f569 /contrib/cmake/FindSWI.cmake | |
parent | d779abe6ff76a78f92d229fcf1f006f5cf1f9295 (diff) | |
download | uscxml-498f6f80e9ca01236ca1491596875ab7eb4cd8c3.zip uscxml-498f6f80e9ca01236ca1491596875ab7eb4cd8c3.tar.gz uscxml-498f6f80e9ca01236ca1491596875ab7eb4cd8c3.tar.bz2 |
Refactoring finished
Support datamodels, invokers and ioprocessors as plugins
Comply to HTTP1.1 by sending host header field
Started prolog datamodel
Diffstat (limited to 'contrib/cmake/FindSWI.cmake')
-rw-r--r-- | contrib/cmake/FindSWI.cmake | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/contrib/cmake/FindSWI.cmake b/contrib/cmake/FindSWI.cmake new file mode 100644 index 0000000..9fbdc77 --- /dev/null +++ b/contrib/cmake/FindSWI.cmake @@ -0,0 +1,86 @@ +set (SWI_SEARCH_PATHS $ENV{SWI_DIR}) +list (APPEND SWI_SEARCH_PATHS + ${CMAKE_FIND_ROOT_PATH} + "/usr/lib/swi-prolog/" + "/opt/local/" + "C:/Program Files (x86)/swipl" + "C:/Program Files/swipl" +) + +set(64BIT_HOST OFF) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(64BIT_HOST ON) +endif() + +set (SWI_HOME) +set (LOOP_DONE 0) +foreach(SWI_SEARCH_PATH ${SWI_SEARCH_PATHS}) + if(NOT LOOP_DONE) + file(GLOB SWI_VERSIONS ${SWI_SEARCH_PATH}/lib/swipl*) + if (SWI_VERSIONS) + set(LOOP_DONE 1) + list(SORT SWI_VERSIONS) + list(REVERSE SWI_VERSIONS) + list(GET SWI_VERSIONS 0 SWI_HOME) + endif() + endif() +endforeach() + +set (SWI_PLATFORM_PATH) +set (LOOP_DONE 0) +if (SWI_HOME) + + set(SWI_CPU_SUFFIX ${CMAKE_SYSTEM_PROCESSOR}) + if (APPLE) + if (64BIT_HOST) + set(SWI_CPU_SUFFIX "x86_64") + endif() + endif() + + file(GLOB SWI_PLATFORMS ${SWI_HOME}/lib/*) + foreach(SWI_PLATFORM ${SWI_PLATFORMS}) + STRING(REGEX REPLACE "${SWI_HOME}/lib/" "" REL_SWI_PLATFORM ${SWI_PLATFORM}) + if(NOT LOOP_DONE) + if (REL_SWI_PLATFORM MATCHES ".*${SWI_CPU_SUFFIX}.*") + set (SWI_PLATFORM_PATH ${SWI_PLATFORM}) + set(LOOP_DONE 1) + endif() + endif() + endforeach() +endif() + +#message(STATUS "SWI_PLATFORM_PATH: ${SWI_PLATFORM_PATH}, SWI_HOME: ${SWI_HOME}") + +if (SWI_PLATFORM_PATH) + FIND_PATH(SWI_INCLUDE_DIR SWI-Prolog.h + PATH_SUFFIXES include + PATHS ${SWI_HOME} + ) + + FIND_LIBRARY(SWI_LIBRARY_RELEASE + NAMES libswipl swipl + PATHS ${SWI_PLATFORM_PATH} + ) + + if (SWI_LIBRARY_RELEASE) + list(APPEND SWI_LIBRARY optimized ${SWI_LIBRARY_RELEASE}) + add_definitions("-DSWI_LIBRARY_PATH=\"${SWI_PLATFORM_PATH}\"") + endif() + + + FIND_LIBRARY(SWI_LIBRARY_DEBUG + NAMES libswipl_d swipl_d + PATHS ${SWI_PLATFORM_PATH} + ) + if (SWI_LIBRARY_DEBUG) + list(APPEND SWI_LIBRARY debug ${SWI_LIBRARY_DEBUG}) + elseif(UNIX) + list(APPEND SWI_LIBRARY debug ${SWI_LIBRARY_RELEASE}) + else() + message(FATAL_ERROR "Cannot find debug version of SWI") + endif() +endif() + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWI DEFAULT_MSG SWI_LIBRARY SWI_INCLUDE_DIR) +MARK_AS_ADVANCED(SWI_LIBRARY SWI_INCLUDE_DIR) |