Changeset 50 in pacpusframework
- Timestamp:
- Jan 9, 2013, 9:06:15 AM (12 years ago)
- Location:
- trunk/cmake
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cmake/FindPacpus.cmake
r9 r50 11 11 12 12 # Check PACPUS_ROOT 13 if 14 if(NOT ENV{PACPUS_ROOT} STREQUAL "")15 set(PACPUS_ROOT $ENV{PACPUS_ROOT})16 message(STATUS "Detected PACPUS_ROOT, set to '${PACPUS_ROOT}'")17 endif()13 if(NOT PACPUS_ROOT) 14 if(NOT ENV{PACPUS_ROOT} STREQUAL "") 15 set(PACPUS_ROOT $ENV{PACPUS_ROOT}) 16 message(STATUS "Detected PACPUS_ROOT, set to '${PACPUS_ROOT}'") 17 endif() 18 18 endif() 19 19 … … 30 30 # Locate the include files 31 31 find_path( 32 PACPUS_INCLUDE_DIR33 NAMES34 "Pacpus"35 HINTS36 ${PACPUS_INCLUDE_HINT}37 DOC38 "The Pacpus include directory"32 PACPUS_INCLUDE_DIR 33 NAMES 34 "Pacpus" 35 HINTS 36 ${PACPUS_INCLUDE_HINT} 37 DOC 38 "The Pacpus include directory" 39 39 ) 40 40 41 41 # List of required modules 42 42 set(PACPUS_MODULES "FileLib" "PacpusLib" "PacpusTools" "dbiteplayerlib") 43 if 44 list(APPEND PACPUS_MODULES "ROAD_TIME")43 if(WIN32) 44 list(APPEND PACPUS_MODULES "ROAD_TIME") 45 45 endif() 46 46 … … 50 50 # Check the presence of each module 51 51 foreach(module ${PACPUS_MODULES}) 52 find_library(53 PACPUS_${module}_LIB54 NAMES55 ${module}56 HINTS57 ${PACPUS_LIBRARY_HINT}58 )59 find_library(60 PACPUS_${module}_LIBD61 NAMES62 ${module}_d63 HINTS64 ${PACPUS_LIBRARY_HINT}65 )52 find_library( 53 PACPUS_${module}_LIB 54 NAMES 55 ${module} 56 HINTS 57 ${PACPUS_LIBRARY_HINT} 58 ) 59 find_library( 60 PACPUS_${module}_LIBD 61 NAMES 62 ${module}_d 63 HINTS 64 ${PACPUS_LIBRARY_HINT} 65 ) 66 66 67 if(PACPUS_${module}_LIB AND PACPUS_${module}_LIBD)68 list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB})69 list(APPEND PACPUS_LIBRARIES debug ${PACPUS_${module}_LIBD})70 else()71 set(MODULE_MISSING TRUE)72 endif()67 if(PACPUS_${module}_LIB AND PACPUS_${module}_LIBD) 68 list(APPEND PACPUS_LIBRARIES optimized ${PACPUS_${module}_LIB}) 69 list(APPEND PACPUS_LIBRARIES debug ${PACPUS_${module}_LIBD}) 70 else() 71 set(MODULE_MISSING TRUE) 72 endif() 73 73 endforeach() 74 74 75 75 if(NOT MODULE_MISSING AND PACPUS_INCLUDE_DIR) 76 set(PACPUS_FOUND TRUE)76 set(PACPUS_FOUND TRUE) 77 77 else() 78 set(PACPUS_FOUND FALSE)78 set(PACPUS_FOUND FALSE) 79 79 endif() -
trunk/cmake/Findlog4cxx.cmake
r8 r50 12 12 ################################################################################ 13 13 14 INCLUDE(FindPackageHandleStandardArgs)14 include(FindPackageHandleStandardArgs) 15 15 16 16 # See if LOG4CXX_ROOT is not already set in CMake 17 IF(NOT LOG4CXX_ROOT)17 if(NOT LOG4CXX_ROOT) 18 18 # See if LOG4CXX_ROOT is set in process environment 19 IF( NOT $ENV{LOG4CXX_ROOT} STREQUAL "" )20 SET 21 MESSAGE 22 ENDIF()23 ENDIF()19 if( NOT $ENV{LOG4CXX_ROOT} STREQUAL "" ) 20 SET(LOG4CXX_ROOT "$ENV{LOG4CXX_ROOT}") 21 MESSAGE(STATUS "Detected LOG4CXX_ROOT set to '${LOG4CXX_ROOT}'") 22 endif() 23 endif() 24 24 25 SET(LOG4CXX_INC_LIST26 "/usr/include"27 "/usr/local/include"25 set(LOG4CXX_INC_LIST 26 "/usr/include" 27 "/usr/local/include" 28 28 ) 29 29 30 SET(LOG4CXX_LIB_LIST31 "/usr/lib"32 "/usr/local/lib"30 set(LOG4CXX_LIB_LIST 31 "/usr/lib" 32 "/usr/local/lib" 33 33 ) 34 34 35 35 # If LOG4CXX_ROOT is available, set up our hints 36 IF(LOG4CXX_ROOT)36 if(LOG4CXX_ROOT) 37 37 # Includes 38 LIST(APPEND LOG4CXX_INC_LIST38 list(APPEND LOG4CXX_INC_LIST 39 39 "${LOG4CXX_ROOT}/include" 40 40 "${LOG4CXX_ROOT}" 41 41 ) 42 42 43 # Libraries (win32)44 IF(MSVC)45 # Visual Studio 200846 IF(MSVC9)47 LIST(APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib/msvc2008")48 ENDIF()49 # Visual Studio 201050 IF(MSVC10)51 LIST(APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib/msvc2010")52 ENDIF()53 ENDIF()43 # Libraries win32 44 if(MSVC) 45 # Visual Studio 2008 46 if(MSVC9) 47 list(APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib/msvc2008") 48 endif() 49 # Visual Studio 2010 50 if(MSVC10) 51 list(APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib/msvc2010") 52 endif() 53 endif() 54 54 55 # Libraries (all)56 LIST(APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib")57 ENDIF()55 # Libraries all 56 list(APPEND LOG4CXX_LIB_LIST "${LOG4CXX_ROOT}/lib") 57 endif() 58 58 59 59 # Find headers 60 FIND_PATH(61 LOG4CXX_INCLUDE_DIR62 NAMES63 log4cxx/log4cxx.h64 HINTS65 ${LOG4CXX_INC_LIST}60 find_path( 61 LOG4CXX_INCLUDE_DIR 62 NAMES 63 log4cxx/log4cxx.h 64 HINTS 65 ${LOG4CXX_INC_LIST} 66 66 ) 67 67 68 68 # Find release library 69 FIND_LIBRARY(70 LOG4CXX_LIBRARY71 NAMES72 log4cxx73 HINTS74 ${LOG4CXX_LIB_LIST}69 find_library( 70 LOG4CXX_LIBRARY 71 NAMES 72 log4cxx 73 HINTS 74 ${LOG4CXX_LIB_LIST} 75 75 ) 76 76 77 77 # Find debug library, if on UNIX this is the same as release 78 IF(WIN32)79 FIND_LIBRARY(LOG4CXXD_LIBRARY NAMES log4cxx_d HINTS ${LOG4CXX_LIB_LIST})80 ELSE()81 SET(LOG4CXXD_LIBRARY ${LOG4CXX_LIBRARY})82 ENDIF()78 if(WIN32) 79 find_library(LOG4CXXD_LIBRARY NAMES log4cxx_d HINTS ${LOG4CXX_LIB_LIST}) 80 else() 81 set(LOG4CXXD_LIBRARY ${LOG4CXX_LIBRARY}) 82 endif() 83 83 84 84 # Set LOG4CXX_FOUND honoring the QUIET and REQUIRED arguments … … 86 86 87 87 # Output variables 88 SET(LOG4CXX_LIBRARIES "")89 IF(LOG4CXX_FOUND)90 # Include dirs91 SET(LOG4CXX_INCLUDE_DIRS ${LOG4CXX_INCLUDE_DIR})88 set(LOG4CXX_LIBRARIES "") 89 if(LOG4CXX_FOUND) 90 # Include dirs 91 set(LOG4CXX_INCLUDE_DIRS ${LOG4CXX_INCLUDE_DIR}) 92 92 93 # Release Libraries 94 IF (LOG4CXX_LIBRARY) 95 LIST(APPEND LOG4CXX_LIBRARIES optimized ${LOG4CXX_LIBRARY}) 96 ENDIF () 97 98 # Debug Libraries 99 IF(LOG4CXXD_LIBRARY) 100 LIST(APPEND LOG4CXX_LIBRARIES debug ${LOG4CXXD_LIBRARY}) 101 ENDIF() 93 # Release Libraries 94 if(LOG4CXX_LIBRARY) 95 LIST(APPEND LOG4CXX_LIBRARIES optimized ${LOG4CXX_LIBRARY}) 96 endif() 102 97 103 # Link dirs 104 GET_FILENAME_COMPONENT (LOG4CXX_LIBRARY_DIRS ${LOG4CXX_LIBRARY} PATH) 105 ENDIF () 98 # Debug Libraries 99 if(LOG4CXXD_LIBRARY) 100 LIST(APPEND LOG4CXX_LIBRARIES debug ${LOG4CXXD_LIBRARY}) 101 endif() 102 103 # Link dirs 104 get_filename_component(LOG4CXX_LIBRARY_DIRS ${LOG4CXX_LIBRARY} PATH) 105 endif() 106 106 107 107 # Advanced options for not cluttering the cmake UIs 108 MARK_AS_ADVANCED(LOG4CXX_INCLUDE_DIR LOG4CXX_LIBRARY)108 mark_as_advanced(LOG4CXX_INCLUDE_DIR LOG4CXX_LIBRARY) -
trunk/cmake/PacpusConfiguration.cmake
r26 r50 11 11 # Build-specific configuration 12 12 # ======================================== 13 if 14 set(PACPUS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Installation directory for the library")15 set(PACPUS_INSTALL_3RD FALSE CACHE BOOL "Installation of the 3rd party")13 if(IS_BUILDING_PACPUS) 14 set(PACPUS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH "Installation directory for the library") 15 set(PACPUS_INSTALL_3RD FALSE CACHE BOOL "Installation of the 3rd party") 16 16 endif() 17 17 … … 21 21 set(PACPUS_USE_LOG TRUE CACHE BOOL "Logging using log4cxx, the library is required") 22 22 set(PACPUS_INSTALL_3RD FALSE CACHE BOOL "Installation of the 3rd party") 23 set(PACPUS_BUILD_DOC FALSE CACHE BOOL "Whether build the documentation (require Doxygen)")23 set(PACPUS_BUILD_DOC FALSE CACHE BOOL "Whether build the documentation - requires Doxygen") -
trunk/cmake/PacpusDependencies.cmake
r38 r50 31 31 # log4cxx 32 32 # ======================================== 33 if 34 find_package(log4cxx REQUIRED)33 if(PACPUS_USE_LOG) 34 find_package(log4cxx REQUIRED) 35 35 36 list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ")37 list(APPEND PACPUS_DEPENDENCIES_INC ${LOG4CXX_INCLUDE_DIRS})38 list(APPEND PACPUS_DEPENDENCIES_LIB ${LOG4CXX_LIBRARIES})36 list(APPEND PACPUS_DEFINITIONS " -DPACPUS_USE_LOG ") 37 list(APPEND PACPUS_DEPENDENCIES_INC ${LOG4CXX_INCLUDE_DIRS}) 38 list(APPEND PACPUS_DEPENDENCIES_LIB ${LOG4CXX_LIBRARIES}) 39 39 40 # If needed, install the dll of log4cxx41 if(WIN32 AND MSVC AND IS_BUILDING_PACPUS)42 pacpus_get_msvc(MSVC_VERSION)43 pacpus_purge_backslash(LOG4CXX_ROOT)40 # If needed, install the dll of log4cxx 41 if(WIN32 AND MSVC AND IS_BUILDING_PACPUS) 42 pacpus_get_msvc(MSVC_VERSION) 43 pacpus_purge_backslash(LOG4CXX_ROOT) 44 44 45 install(46 FILES47 ${LOG4CXX_ROOT}/bin/${MSVC_VERSION}/log4cxx.dll48 ${LOG4CXX_ROOT}/bin/${MSVC_VERSION}/log4cxx_d.dll49 DESTINATION50 ${PACPUS_INSTALL_DIR}/bin51 )52 endif()45 install( 46 FILES 47 ${LOG4CXX_ROOT}/bin/${MSVC_VERSION}/log4cxx.dll 48 ${LOG4CXX_ROOT}/bin/${MSVC_VERSION}/log4cxx_d.dll 49 DESTINATION 50 ${PACPUS_INSTALL_DIR}/bin 51 ) 52 endif() 53 53 endif() 54 54 … … 56 56 # Doxygen 57 57 # ======================================== 58 if 59 find_package(Doxygen)60 if(NOT DOXYGEN_FOUND)61 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly")62 endif()58 if(PACPUS_BUILD_DOC) 59 find_package(Doxygen) 60 if(NOT DOXYGEN_FOUND) 61 message(FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly") 62 endif() 63 63 endif() -
trunk/cmake/PacpusInstall.cmake
r29 r50 12 12 # ======================================== 13 13 install( 14 DIRECTORY15 ${PACPUS_CMAKE_DIR}16 DESTINATION17 ${PACPUS_INSTALL_DIR}14 DIRECTORY 15 ${PACPUS_CMAKE_DIR} 16 DESTINATION 17 ${PACPUS_INSTALL_DIR} 18 18 ) 19 19 … … 22 22 # ======================================== 23 23 install( 24 DIRECTORY25 ${PACPUS_INCLUDE_DIR}26 DESTINATION27 ${PACPUS_INSTALL_DIR}/include24 DIRECTORY 25 ${PACPUS_INCLUDE_DIR} 26 DESTINATION 27 ${PACPUS_INSTALL_DIR}/include 28 28 ) 29 29 … … 31 31 # Installation of the 3rd party 32 32 # ======================================== 33 if 34 install(33 if(PACPUS_INSTALL_3RD) 34 install( 35 35 DIRECTORY 36 ${PACPUS_3RD_PARTY_DIR}36 ${PACPUS_3RD_PARTY_DIR} 37 37 DESTINATION 38 ${PACPUS_INSTALL_DIR}39 )38 ${PACPUS_INSTALL_DIR} 39 ) 40 40 endif() 41 41 … … 43 43 # Installation of the documentation 44 44 # ======================================== 45 if 46 install(47 DIRECTORY48 ${CMAKE_BINARY_DIR}/doc/html49 DESTINATION50 ${PACPUS_INSTALL_DIR}/doc51 )45 if(PACPUS_BUILD_DOC) 46 install( 47 DIRECTORY 48 ${CMAKE_BINARY_DIR}/doc/html 49 DESTINATION 50 ${PACPUS_INSTALL_DIR}/doc 51 ) 52 52 endif() -
trunk/cmake/PacpusPlatforms.cmake
r3 r50 11 11 # GCC-Based compilers 12 12 # ======================================== 13 if 14 pacpus_info("The libraries will be compiled with -fPIC")15 list(APPEND PACPUS_DEFINITIONS " -fPIC ")13 if("${CMAKE_CXX_COMPILER}" MATCHES "gcc|icc|clang") 14 pacpus_info("The libraries will be compiled with -fPIC") 15 list(APPEND PACPUS_DEFINITIONS " -fPIC ") 16 16 endif() -
trunk/cmake/PacpusUtilities.cmake
r40 r50 79 79 # ======================================== 80 80 macro(pacpus_purge_backslash var) 81 string(REGEX REPLACE "\\\\" "/" ${var} "${${var}}")81 string(REGEX REPLACE "\\\\" "/" ${var} "${${var}}") 82 82 endmacro() 83 83 … … 86 86 # ======================================== 87 87 macro(pacpus_get_msvc output) 88 # By default, unknown89 set(${output} "unknown")90 if(MSVC9)91 set(${output} "msvc2008")92 elseif(MSVC10)93 set(${output} "msvc2010")94 else(MSVC11)95 set(${output} "msvc2012")96 endif()88 # By default, unknown 89 set(${output} "unknown") 90 if(MSVC9) 91 set(${output} "msvc2008") 92 elseif(MSVC10) 93 set(${output} "msvc2010") 94 else(MSVC11) 95 set(${output} "msvc2012") 96 endif() 97 97 endmacro() 98 98 … … 101 101 # ======================================== 102 102 function(pacpus_output_status msg) 103 message(STATUS "${msg}")104 string(REPLACE "\\" "\\\\" msg "${msg}")105 string(REPLACE "\"" "\\\"" msg "${msg}")103 message(STATUS "${msg}") 104 string(REPLACE "\\" "\\\\" msg "${msg}") 105 string(REPLACE "\"" "\\\"" msg "${msg}") 106 106 endfunction() 107 107 … … 110 110 # ======================================== 111 111 function(pacpus_info text) 112 set(status_cond) 113 set(status_then) 114 set(status_else) 115 116 set(status_current_name "cond") 117 foreach(arg ${ARGN}) 118 if(arg STREQUAL "THEN") 119 set(status_current_name "then") 120 elseif(arg STREQUAL "ELSE") 121 set(status_current_name "else") 112 set(status_cond) 113 set(status_then) 114 set(status_else) 115 116 set(status_current_name "cond") 117 foreach(arg ${ARGN}) 118 if(arg STREQUAL "THEN") 119 set(status_current_name "then") 120 elseif(arg STREQUAL "ELSE") 121 set(status_current_name "else") 122 else() 123 list(APPEND status_${status_current_name} ${arg}) 124 endif() 125 endforeach() 126 127 if(DEFINED status_cond) 128 set(status_placeholder_length 32) 129 string(RANDOM LENGTH ${status_placeholder_length} ALPHABET " " status_placeholder) 130 string(LENGTH "${text}" status_text_length) 131 if(status_text_length LESS status_placeholder_length) 132 string(SUBSTRING "${text}${status_placeholder}" 0 ${status_placeholder_length} status_text) 133 elseif(DEFINED status_then OR DEFINED status_else) 134 pacpus_output_status("${text}") 135 set(status_text "${status_placeholder}") 136 else() 137 set(status_text "${text}") 138 endif() 139 140 if(DEFINED status_then OR DEFINED status_else) 141 if(${status_cond}) 142 string(REPLACE ";" " " status_then "${status_then}") 143 string(REGEX REPLACE "^[ \t]+" "" status_then "${status_then}") 144 pacpus_output_status("${status_text} ${status_then}") 145 else() 146 string(REPLACE ";" " " status_else "${status_else}") 147 string(REGEX REPLACE "^[ \t]+" "" status_else "${status_else}") 148 pacpus_output_status("${status_text} ${status_else}") 149 endif() 150 else() 151 string(REPLACE ";" " " status_cond "${status_cond}") 152 string(REGEX REPLACE "^[ \t]+" "" status_cond "${status_cond}") 153 pacpus_output_status("${status_text} ${status_cond}") 154 endif() 122 155 else() 123 list(APPEND status_${status_current_name} ${arg})156 pacpus_output_status("${text}") 124 157 endif() 125 endforeach()126 127 if(DEFINED status_cond)128 set(status_placeholder_length 32)129 string(RANDOM LENGTH ${status_placeholder_length} ALPHABET " " status_placeholder)130 string(LENGTH "${text}" status_text_length)131 if(status_text_length LESS status_placeholder_length)132 string(SUBSTRING "${text}${status_placeholder}" 0 ${status_placeholder_length} status_text)133 elseif(DEFINED status_then OR DEFINED status_else)134 pacpus_output_status("${text}")135 set(status_text "${status_placeholder}")136 else()137 set(status_text "${text}")138 endif()139 140 if(DEFINED status_then OR DEFINED status_else)141 if(${status_cond})142 string(REPLACE ";" " " status_then "${status_then}")143 string(REGEX REPLACE "^[ \t]+" "" status_then "${status_then}")144 pacpus_output_status("${status_text} ${status_then}")145 else()146 string(REPLACE ";" " " status_else "${status_else}")147 string(REGEX REPLACE "^[ \t]+" "" status_else "${status_else}")148 pacpus_output_status("${status_text} ${status_else}")149 endif()150 else()151 string(REPLACE ";" " " status_cond "${status_cond}")152 string(REGEX REPLACE "^[ \t]+" "" status_cond "${status_cond}")153 pacpus_output_status("${status_text} ${status_cond}")154 endif()155 else()156 pacpus_output_status("${text}")157 endif()158 158 endfunction() 159 159
Note:
See TracChangeset
for help on using the changeset viewer.