[asterisk-scf-commits] asterisk-scf/release/cmake.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Aug 18 13:13:32 CDT 2010


branch "master" has been updated
       via  ea57b072d8f90982c9a97466dd5ec572cb9613df (commit)
      from  6f939932a3c35300208434795e42f5edae14e259 (commit)

Summary of changes:
 modules/pjproject.cmake |   90 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)
 create mode 100644 modules/pjproject.cmake


- Log -----------------------------------------------------------------
commit ea57b072d8f90982c9a97466dd5ec572cb9613df
Author: Joshua Colp <jcolp at digium.com>
Date:   Wed Aug 18 15:25:57 2010 -0300

    Move pjproject.cmake logic out into the main cmake repo.

diff --git a/modules/pjproject.cmake b/modules/pjproject.cmake
new file mode 100644
index 0000000..93a2aa7
--- /dev/null
+++ b/modules/pjproject.cmake
@@ -0,0 +1,90 @@
+# We require threads for our usage of pjproject. Their build system will take care of finding stuff so it can build, but we need to find
+# out about threads for when we do our linking.
+find_package(Threads)
+
+# These are global targets which exist for all pjproject components, they are used for initial running of configure plus cleanup
+add_custom_command(OUTPUT "${CMAKE_SOURCE_DIR}/pjproject/build.mak" COMMAND "./configure" "--disable-sound" "--disable-ssl" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Configuring pjproject")
+add_custom_command(OUTPUT "${CMAKE_SOURCE_DIR}/pjproject/pjlib/include/pj/config_site.h" COMMAND "make" "dep" "TARGET_NAME=asteriskscf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Dependency generating pjproject" DEPENDS "${CMAKE_SOURCE_DIR}/pjproject/build.mak")
+add_custom_target(pjproject-clean COMMAND "make" "clean" "TARGET_NAME=asteriskscf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Cleaning pjproject")
+add_custom_target(pjproject-distclean COMMAND "make" "distclean" "TARGET_NAME=asteriskscf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Deep cleaning pjproject")
+
+# Function which adds build targets for the following supported pjproject components: pjlib, pjlib-util, pjnath, pjmedia, pjsip.
+function(pjproject_build PJPROJECT_COMPONENT)
+  if (UNIX)
+    add_custom_target("pjproject-${PJPROJECT_COMPONENT}" COMMAND "make" "TARGET_NAME=asteriskscf" "DIRS=${PJPROJECT_COMPONENT}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Building pjproject-${PJPROJECT_COMPONENT}" DEPENDS "${CMAKE_SOURCE_DIR}/pjproject/pjlib/include/pj/config_site.h")
+    add_dependencies("pjproject-${PJPROJECT_COMPONENT}" "pjproject-pjlib")
+  elseif (MSVC80 OR MSVC90)
+    if (${PJPROJECT_COMPONENT} STREQUAL "pjlib-util")
+      include_external_msproject(pjlib_util "${CMAKE_SOURCE_DIR}/pjproject/pjlib-util/build/pjlib_util.vcproj")
+    elseif (${PJPROJECT_COMPONENT} STREQUAL "pjsip")
+      include_external_msproject(pjsip_core "${CMAKE_SOURCE_DIR}/pjproject/pjsip/build/pjsip_core.vcproj")
+      include_external_msproject(pjsip_simple "${CMAKE_SOURCE_DIR}/pjproject/pjsip/build/pjsip_simple.vcproj")
+      include_external_msproject(pjsip_ua "${CMAKE_SOURCE_DIR}/pjproject/pjsip/build/pjsip_ua.vcproj")
+      include_external_msproject(pjsua_lib "${CMAKE_SOURCE_DIR}/pjproject/pjsip/build/pjsua_lib.vcproj")
+    elseif (${PJPROJECT_COMPONENT} STREQUAL "pjmedia")
+      include_external_msproject(pjmedia "${CMAKE_SOURCE_DIR}/pjproject/pjmedia/build/pjmedia.vcproj")
+      include_external_msproject(pjmedia_audiodev "${CMAKE_SOURCE_DIR}/pjproject/pjmedia/build/pjmedia_audiodev.vcproj")
+      include_external_msproject(srtp "${CMAKE_SOURCE_DIR}/pjproject/third_party/build/srtp/libsrtp.vcproj")
+    else()
+      include_external_msproject(${PJPROJECT_COMPONENT} "${CMAKE_SOURCE_DIR}/pjproject/${PJPROJECT_COMPONENT}/build/${PJPROJECT_COMPONENT}.vcproj")
+    endif()
+  else()
+    message(STATUS "Unfortunately you are building on a platform which does not support automatic pjproject building. You will have to build pjproject manually.")
+  endif()
+  if (${PJPROJECT_COMPONENT} STREQUAL "pjmedia")
+    link_directories("${CMAKE_SOURCE_DIR}/pjproject/third_party/lib")
+  endif()
+  include_directories("${CMAKE_SOURCE_DIR}/pjproject/${PJPROJECT_COMPONENT}/include")
+  link_directories("${CMAKE_SOURCE_DIR}/pjproject/${PJPROJECT_COMPONENT}/lib")
+endfunction()
+
+# Function which links a component against a pjproject component
+function(pjproject_link COMPONENT PJPROJECT_COMPONENT)
+  if (UNIX)
+    add_dependencies(${COMPONENT} "pjproject-${PJPROJECT_COMPONENT}")
+    target_link_libraries(${COMPONENT} ${CMAKE_THREAD_LIBS_INIT})
+    if (${PJPROJECT_COMPONENT} STREQUAL "pjsip")
+      target_link_libraries(${COMPONENT} "pjsip-asteriskscf")
+      target_link_libraries(${COMPONENT} "pjsip-simple-asteriskscf")
+      target_link_libraries(${COMPONENT} "pjsip-ua-asteriskscf")
+      target_link_libraries(${COMPONENT} "pjsua-asteriskscf")
+    elseif (${PJPROJECT_COMPONENT} STREQUAL "pjlib")
+      target_link_libraries(${COMPONENT} "pj-asteriskscf")
+    elseif (${PJPROJECT_COMPONENT} STREQUAL "pjmedia")
+      target_link_libraries(${COMPONENT} "pjmedia-asteriskscf")
+      target_link_libraries(${COMPONENT} "pjmedia-codec-asteriskscf")
+      target_link_libraries(${COMPONENT} "pjsdp-asteriskscf")
+      target_link_libraries(${COMPONENT} "pjmedia-audiodev-asteriskscf")
+      target_link_libraries(${COMPONENT} "srtp-asteriskscf")
+    else()
+      target_link_libraries(${COMPONENT} "${PJPROJECT_COMPONENT}-asteriskscf")
+    endif()
+  elseif (MSVC80 OR MSVC90)
+    if (${PJPROJECT_COMPONENT} STREQUAL "pjsip")
+    elseif (${PJPROJECT_COMPONENT} STREQUAL "pjlib-util")
+      if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
+	target_link_libraries(${COMPONENT} debug "pjlib-util-i386-Win32-vc8-Debug") 
+	target_link_libraries(${COMPONENT} optimized "pjlib-util-i386-Win32-vc8-Release")
+      endif()
+    elseif (${PJPROJECT_COMPONENT} STREQUAL "pjmedia")
+      if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
+	target_link_libraries(${COMPONENT} debug "pjmedia-i386-Win32-vc8-Debug") 
+	target_link_libraries(${COMPONENT} optimized "pjmedia-i386-Win32-vc8-Release")
+	target_link_libraries(${COMPONENT} debug "pjmedia-audiodev-i386-Win32-vc8-Debug") 
+	target_link_libraries(${COMPONENT} optimized "pjmedia-audiodev-i386-Win32-vc8-Release")
+	target_link_libraries(${COMPONENT} debug "libsrtp-i386-Win32-vc8-Debug") 
+	target_link_libraries(${COMPONENT} optimized "libsrtp-i386-Win32-vc8-Release")
+      endif()
+    else()
+      if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
+	if (${PJPROJECT_COMPONENT} STREQUAL "pjlib")
+	  # pjlib has the additional requirement of winsock2
+	  target_link_libraries(${COMPONENT} "ws2_32")
+	endif()
+	target_link_libraries(${COMPONENT} debug "${PJPROJECT_COMPONENT}-i386-Win32-vc8-Debug") 
+	target_link_libraries(${COMPONENT} optimized "${PJPROJECT_COMPONENT}-i386-Win32-vc8-Release")
+      endif()
+    endif()
+  endif()
+endfunction()
+

-----------------------------------------------------------------------


-- 
asterisk-scf/release/cmake.git



More information about the asterisk-scf-commits mailing list