From 3cfb5df8f3b0571a529d05e51218eb9f4fdc1930 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Thu, 12 May 2016 21:16:31 +0200 Subject: Compile all dependencies with position independent code --- CMakeLists.txt | 22 +++++++++------------- contrib/cmake/BuildLibCurl.cmake | 5 +++-- contrib/cmake/BuildLibEvent.cmake | 5 +---- contrib/cmake/BuildURIParser.cmake | 1 + contrib/cmake/BuildXercesC.cmake | 1 + src/uscxml/interpreter/InterpreterImpl.cpp | 1 + 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40fe134..9fd9c84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,8 @@ SET(USCXML_VERSION_MINOR "0") SET(USCXML_VERSION_PATCH "0") SET(USCXML_VERSION ${USCXML_VERSION_MAJOR}.${USCXML_VERSION_MINOR}.${USCXML_VERSION_PATCH}) +set(CMAKE_MACOSX_RPATH 1) + # where do libraries and binaries go set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -43,7 +45,7 @@ endif() # various options # OPTION(BUILD_MINIMAL "Build only features mandated by specification" OFF) -OPTION(BUILD_DM_ECMA "Build with ECMAScript datamodel" ON) +# OPTION(BUILD_DM_ECMA "Build with ECMAScript datamodel" ON) # OPTION(BUILD_DM_XPATH "Build with XPath datamodel" OFF) # OPTION(BUILD_DM_PROLOG "Build with Prolog datamodel" OFF) # OPTION(BUILD_DM_PROMELA "Build with Promela datamodel" OFF) @@ -139,7 +141,7 @@ endif() ################################ # Required - +set(USCXML_PREREQS) # CURL find_package(CURL) @@ -160,6 +162,7 @@ else() if (LIBCURL_BUILT) include_directories(${LIBCURL_INCLUDE_DIR}) list (APPEND USCXML_CORE_LIBS ${LIBCURL_LIBRARY}) + list (APPEND USCXML_PREREQS libcurl) set(CURL_HAS_SMTP ON) else() message(FATAL_ERROR "Could neither find nor build CURL") @@ -183,6 +186,7 @@ else() if (XercesC_BUILT) include_directories(${XercesC_INCLUDE_DIRS}) list (APPEND USCXML_CORE_LIBS ${XercesC_LIBRARIES}) + list (APPEND USCXML_PREREQS xerces-c) else() message(FATAL_ERROR "Could neither find nor build XercesC") endif() @@ -199,6 +203,7 @@ else() if (LIBEVENT_BUILT) include_directories(${LIBEVENT_INCLUDE_DIR}) list (APPEND USCXML_CORE_LIBS ${LIBEVENT_LIBRARIES}) + list (APPEND USCXML_PREREQS libevent) else() message(FATAL_ERROR "Could neither find nor build libevent") endif() @@ -215,6 +220,7 @@ message(STATUS "--> will download and compile") if (URIPARSER_BUILT) include_directories(${URIPARSER_INCLUDE_DIR}) list (APPEND USCXML_CORE_LIBS ${URIPARSER_LIBRARY}) + list (APPEND USCXML_PREREQS uriparser) else() message(FATAL_ERROR "Could not build uriparser") endif() @@ -247,16 +253,6 @@ if (LUA_FOUND) list (APPEND USCXML_OPT_LIBS ${LUA_LIBRARIES}) endif() - -# if(APPLE) -# find_library(APP_SERVICES_LIBRARY ApplicationServices) -# find_library(COREFOUNDATION_LIBRARY CoreFoundation) -# find_library(FOUNDATION_LIBRARY Foundation) -# list (APPEND USCXML_CORE_LIBS ${APP_SERVICES_LIBRARY}) -# list (APPEND USCXML_CORE_LIBS ${COREFOUNDATION_LIBRARY}) -# list (APPEND USCXML_CORE_LIBS ${FOUNDATION_LIBRARY}) -# endif() - add_subdirectory(src/uscxml) add_library(uscxml ${USCXML_FILES}) @@ -264,7 +260,7 @@ set_property(TARGET uscxml PROPERTY CXX_STANDARD 11) set_property(TARGET uscxml PROPERTY CXX_STANDARD_REQUIRED ON) set_property(TARGET uscxml PROPERTY SOVERSION ${USCXML_VERSION}) -add_dependencies(uscxml libevent xerces-c) +add_dependencies(uscxml ${USCXML_PREREQS}) target_link_libraries(uscxml ${USCXML_OPT_LIBS} ${USCXML_CORE_LIBS}) add_library(uscxml_transform ${USCXML_TRANSFORM_FILES}) diff --git a/contrib/cmake/BuildLibCurl.cmake b/contrib/cmake/BuildLibCurl.cmake index 2753ee6..8f0a030 100644 --- a/contrib/cmake/BuildLibCurl.cmake +++ b/contrib/cmake/BuildLibCurl.cmake @@ -10,6 +10,7 @@ if (UNIX) CONFIGURE_COMMAND "/configure" "--without-ssl" + "--enable-shared" "--prefix=" ) elseif (WIN32) @@ -64,9 +65,9 @@ endif() set(LIBCURL_INCLUDE_DIR ${CMAKE_BINARY_DIR}/deps/libcurl/include) if (APPLE) - set(LIBCURL_LIBRARY ${CMAKE_BINARY_DIR}/deps/libcurl/lib/libcurl.dylib) + set(LIBCURL_LIBRARY ${CMAKE_BINARY_DIR}/deps/libcurl/lib/libcurl.a) elseif(UNIX) - set(LIBCURL_LIBRARY ${CMAKE_BINARY_DIR}/deps/libcurl/lib/libcurl.so) + set(LIBCURL_LIBRARY ${CMAKE_BINARY_DIR}/deps/libcurl/lib/libcurl.a) elseif(WIN32) set(LIBCURL_LIBRARY ${CMAKE_BINARY_DIR}/deps/libcurl/lib/libcurl_a.lib) else() diff --git a/contrib/cmake/BuildLibEvent.cmake b/contrib/cmake/BuildLibEvent.cmake index d9bfa5d..98ea99e 100644 --- a/contrib/cmake/BuildLibEvent.cmake +++ b/contrib/cmake/BuildLibEvent.cmake @@ -9,10 +9,7 @@ if (UNIX) BUILD_IN_SOURCE 0 PREFIX ${CMAKE_BINARY_DIR}/deps/libevent CONFIGURE_COMMAND - "/configure" - "--enable-static" - "--disable-openssl" - "--prefix=" + CFLAGS=-fPIC /configure --enable-static --enable-shared --disable-openssl --prefix= ) elseif (WIN32) diff --git a/contrib/cmake/BuildURIParser.cmake b/contrib/cmake/BuildURIParser.cmake index c204eed..d48916d 100644 --- a/contrib/cmake/BuildURIParser.cmake +++ b/contrib/cmake/BuildURIParser.cmake @@ -6,6 +6,7 @@ if (UNIX) BUILD_IN_SOURCE 0 PREFIX ${CMAKE_BINARY_DIR}/deps/uriparser CONFIGURE_COMMAND + "CFLAGS=-fPIC" "/configure" "--disable-test" "--disable-doc" diff --git a/contrib/cmake/BuildXercesC.cmake b/contrib/cmake/BuildXercesC.cmake index a0d6bc9..0e3353c 100644 --- a/contrib/cmake/BuildXercesC.cmake +++ b/contrib/cmake/BuildXercesC.cmake @@ -11,6 +11,7 @@ if (UNIX) CONFIGURE_COMMAND "/configure" "--enable-static" + "--enable-shared" "--prefix=" ) elseif(WIN32) diff --git a/src/uscxml/interpreter/InterpreterImpl.cpp b/src/uscxml/interpreter/InterpreterImpl.cpp index ba75ab8..e61c4ab 100644 --- a/src/uscxml/interpreter/InterpreterImpl.cpp +++ b/src/uscxml/interpreter/InterpreterImpl.cpp @@ -80,6 +80,7 @@ InterpreterImpl::~InterpreterImpl() { _delayQueue.cancelAllDelayed(); if (_document) delete _document; + { std::lock_guard lock(_instanceMutex); _instances.erase(getSessionId()); -- cgit v0.12