From cad21935d6157e91f26a427bc2b751ac780e494e Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Mon, 12 Sep 2011 10:53:18 +0200 Subject: [PATCH 1/4] Auto detect 3rd Party root for Windows --- CMakeLists.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 68d8e059..63384bf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,21 @@ option(JPEG_FACTORY "Enable JPEG-factory support" OFF) option(ENABLE_LIBSVN "Set to ON to build SimGear with libsvnclient support" ON) option(ENABLE_RTI "Set to ON to build SimGear with RTI support" OFF) -set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted") +if (MSVC) + GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH) + if (CMAKE_CL_64) + SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdparty.x64") + else (CMAKE_CL_64) + SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdparty") + endif (CMAKE_CL_64) + if (EXISTS ${TEST_3RDPARTY_DIR}) + set(MSVC_3RDPARTY_ROOT ${PARENT_DIR} CACHE PATH "Location where the third-party dependencies are extracted") + else (EXISTS ${TEST_3RDPARTY_DIR}) + set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted") + endif (EXISTS ${TEST_3RDPARTY_DIR}) +else (MSVC) + set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted") +endif (MSVC) if (MSVC AND MSVC_3RDPARTY_ROOT) message(STATUS "3rdparty files located in ${MSVC_3RDPARTY_ROOT}") @@ -62,6 +76,7 @@ if (MSVC AND MSVC_3RDPARTY_ROOT) set (CMAKE_LIBRARY_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/lib ) set (CMAKE_INCLUDE_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/include) set (BOOST_ROOT ${MSVC_3RDPARTY_ROOT}/boost_1_44_0) + message(STATUS "BOOST_ROOT is ${BOOST_ROOT}") set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include) set (ALUT_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include) set (OPENAL_LIBRARY_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib) From 919e01f26e7ecdfcc9d507e756c6de1c5d00b087 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Mon, 12 Sep 2011 10:54:03 +0200 Subject: [PATCH 2/4] Fix SVN detection for Windows --- CMakeModules/FindSvnClient.cmake | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeModules/FindSvnClient.cmake b/CMakeModules/FindSvnClient.cmake index f7d145ea..153a8101 100644 --- a/CMakeModules/FindSvnClient.cmake +++ b/CMakeModules/FindSvnClient.cmake @@ -22,7 +22,7 @@ else(HAVE_APR_CONFIG) message(STATUS "apr-1-config not found, implement manual search for APR") endif(HAVE_APR_CONFIG) -if(HAVE_APR_CONFIG) +if(HAVE_APR_CONFIG OR MSVC) find_path(LIBSVN_INCLUDE_DIR svn_client.h HINTS $ENV{LIBSVN_DIR} @@ -33,9 +33,15 @@ if(HAVE_APR_CONFIG) /opt ) - check_library_exists(svn_client-1 svn_client_checkout "" HAVE_LIB_SVNCLIENT) - check_library_exists(svn_subr-1 svn_cmdline_init "" HAVE_LIB_SVNSUBR) - check_library_exists(svn_ra-1 svn_ra_initialize "" HAVE_LIB_SVNRA) + if (MSVC) + check_library_exists(libsvn_client-1 svn_client_checkout "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib" HAVE_LIB_SVNCLIENT) + check_library_exists(libsvn_subr-1 svn_cmdline_init "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib" HAVE_LIB_SVNSUBR) + check_library_exists(libsvn_ra-1 svn_ra_initialize "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib" HAVE_LIB_SVNRA) + else (MSVC) + check_library_exists(svn_client-1 svn_client_checkout "" HAVE_LIB_SVNCLIENT) + check_library_exists(svn_subr-1 svn_cmdline_init "" HAVE_LIB_SVNSUBR) + check_library_exists(svn_ra-1 svn_ra_initialize "" HAVE_LIB_SVNRA) + endif (MSVC) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSVN DEFAULT_MSG @@ -47,5 +53,5 @@ if(HAVE_APR_CONFIG) if(LIBSVN_FOUND) set(LIBSVN_LIBRARIES "svn_client-1" "svn_subr-1" "svn_ra-1" ${APR_LIBS}) endif(LIBSVN_FOUND) -endif(HAVE_APR_CONFIG) +endif(HAVE_APR_CONFIG OR MSVC) From c37b9c95e69fb795a4e22b0ad5aece1bd3082c83 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Mon, 12 Sep 2011 12:17:06 +0200 Subject: [PATCH 3/4] Attempt to make FindSvnClient.cmake portable --- CMakeModules/FindSvnClient.cmake | 52 +++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/CMakeModules/FindSvnClient.cmake b/CMakeModules/FindSvnClient.cmake index 153a8101..f5b56774 100644 --- a/CMakeModules/FindSvnClient.cmake +++ b/CMakeModules/FindSvnClient.cmake @@ -3,6 +3,31 @@ include (CheckFunctionExists) include (CheckIncludeFile) +include (CheckLibraryExists) + +macro(find_static_component comp libs) + # account for alternative Windows svn distribution naming + if(MSVC) + set(compLib "lib${comp}") + else(MSVC) + set(compLib "${comp}") + endif(MSVC) + + string(TOUPPER "${comp}" compLibBase) + set( compLibName ${compLibBase}_LIBRARY ) + + FIND_LIBRARY(${compLibName} + NAMES ${compLib} + HINTS $ENV{PLIBDIR} + PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 + PATHS + /usr/local + /usr + /opt + ) + + list(APPEND ${libs} ${${compLibName}}) +endmacro() find_program(HAVE_APR_CONFIG apr-1-config) if(HAVE_APR_CONFIG) @@ -22,7 +47,7 @@ else(HAVE_APR_CONFIG) message(STATUS "apr-1-config not found, implement manual search for APR") endif(HAVE_APR_CONFIG) -if(HAVE_APR_CONFIG OR MSVC) +if(HAVE_APR_CONFIG OR MSVC) find_path(LIBSVN_INCLUDE_DIR svn_client.h HINTS $ENV{LIBSVN_DIR} @@ -32,26 +57,17 @@ if(HAVE_APR_CONFIG OR MSVC) /usr /opt ) - + + set(LIBSVN_LIBRARIES "") if (MSVC) - check_library_exists(libsvn_client-1 svn_client_checkout "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib" HAVE_LIB_SVNCLIENT) - check_library_exists(libsvn_subr-1 svn_cmdline_init "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib" HAVE_LIB_SVNSUBR) - check_library_exists(libsvn_ra-1 svn_ra_initialize "${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib" HAVE_LIB_SVNRA) + find_static_component("apr-1" LIBSVN_LIBRARIES) else (MSVC) - check_library_exists(svn_client-1 svn_client_checkout "" HAVE_LIB_SVNCLIENT) - check_library_exists(svn_subr-1 svn_cmdline_init "" HAVE_LIB_SVNSUBR) - check_library_exists(svn_ra-1 svn_ra_initialize "" HAVE_LIB_SVNRA) + list(APPEND LIBSVN_LIBRARIES APR_LIBS) endif (MSVC) + find_static_component("svn_client-1" LIBSVN_LIBRARIES) + find_static_component("svn_subr-1" LIBSVN_LIBRARIES) + find_static_component("svn_ra-1" LIBSVN_LIBRARIES) include(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSVN DEFAULT_MSG - HAVE_LIB_SVNSUBR - HAVE_LIB_SVNCLIENT - HAVE_LIB_SVNRA - LIBSVN_INCLUDE_DIR) - - if(LIBSVN_FOUND) - set(LIBSVN_LIBRARIES "svn_client-1" "svn_subr-1" "svn_ra-1" ${APR_LIBS}) - endif(LIBSVN_FOUND) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSVN DEFAULT_MSG LIBSVN_LIBRARIES LIBSVN_INCLUDE_DIR) endif(HAVE_APR_CONFIG OR MSVC) - From cb496379bc11349977e8a242741a9e25afd2942c Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Mon, 12 Sep 2011 12:20:03 +0200 Subject: [PATCH 4/4] Typo --- CMakeModules/FindSvnClient.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeModules/FindSvnClient.cmake b/CMakeModules/FindSvnClient.cmake index f5b56774..22ae0999 100644 --- a/CMakeModules/FindSvnClient.cmake +++ b/CMakeModules/FindSvnClient.cmake @@ -62,7 +62,7 @@ if(HAVE_APR_CONFIG OR MSVC) if (MSVC) find_static_component("apr-1" LIBSVN_LIBRARIES) else (MSVC) - list(APPEND LIBSVN_LIBRARIES APR_LIBS) + list(APPEND LIBSVN_LIBRARIES ${APR_LIBS}) endif (MSVC) find_static_component("svn_client-1" LIBSVN_LIBRARIES) find_static_component("svn_subr-1" LIBSVN_LIBRARIES)