diff options
author | Dave Hiller <daveh@lindenlab.com> | 2008-07-31 12:15:15 +0000 |
---|---|---|
committer | Dave Hiller <daveh@lindenlab.com> | 2008-07-31 12:15:15 +0000 |
commit | 9a7d68cfce5f71cf9d89536431d72941dc369749 (patch) | |
tree | f7e0ce093abef0fcc7737cac63bc2a8dbf11b729 /indra/cmake | |
parent | f0f2a416911ba8de9ac1e08cd90720c0d789bb2e (diff) |
svn merge -r93014:93396 svn+ssh://svn.lindenlab.com/svn/linden/branches/mono-r93014-qar633 dataserver-is-deprecated
Diffstat (limited to 'indra/cmake')
-rw-r--r-- | indra/cmake/CMakeLists.txt | 3 | ||||
-rw-r--r-- | indra/cmake/CSharpMacros.cmake | 142 | ||||
-rw-r--r-- | indra/cmake/CopyBackToSource.cmake | 16 | ||||
-rw-r--r-- | indra/cmake/FindMono.cmake | 68 | ||||
-rw-r--r-- | indra/cmake/LScript.cmake | 7 | ||||
-rw-r--r-- | indra/cmake/MonoDeps.cmake | 48 | ||||
-rw-r--r-- | indra/cmake/MonoEmbed.cmake | 57 |
7 files changed, 339 insertions, 2 deletions
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 22f6c5bd42..27ba04558e 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -17,6 +17,7 @@ set(cmake_SOURCE_FILES CURL.cmake CMakeCopyIfDifferent.cmake CopyWinLibs.cmake + CSharpMacros.cmake DirectX.cmake ELFIO.cmake EXPAT.cmake @@ -25,6 +26,7 @@ set(cmake_SOURCE_FILES FindCARes.cmake FindELFIO.cmake FindGooglePerfTools.cmake + FindMono.cmake FindMySQL.cmake FindOpenJPEG.cmake FindXmlRpcEpi.cmake @@ -55,6 +57,7 @@ set(cmake_SOURCE_FILES LLXML.cmake LScript.cmake Linking.cmake + MonoEmbed.cmake Mozlib.cmake MySQL.cmake NDOF.cmake diff --git a/indra/cmake/CSharpMacros.cmake b/indra/cmake/CSharpMacros.cmake new file mode 100644 index 0000000000..a4dd815043 --- /dev/null +++ b/indra/cmake/CSharpMacros.cmake @@ -0,0 +1,142 @@ +# - This is a support module for easy Mono/C# handling with CMake +# It defines the following macros: +# +# ADD_CS_LIBRARY (<target> <source>) +# ADD_CS_EXECUTABLE (<target> <source>) +# INSTALL_GAC (<target>) +# +# Note that the order of the arguments is important. +# +# You can optionally set the variable CS_FLAGS to tell the macros whether +# to pass additional flags to the compiler. This is particularly useful to +# set assembly references, unsafe code, etc... These flags are always reset +# after the target was added so you don't have to care about that. +# +# copyright (c) 2007 Arno Rehn arno@arnorehn.de +# +# Redistribution and use is allowed according to the terms of the GPL license. + + +# ----- support macros ----- +MACRO(GET_CS_LIBRARY_TARGET_DIR) + IF (NOT LIBRARY_OUTPUT_PATH) + SET(CS_LIBRARY_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR}) + ELSE (NOT LIBRARY_OUTPUT_PATH) + SET(CS_LIBRARY_TARGET_DIR ${LIBRARY_OUTPUT_PATH}) + ENDIF (NOT LIBRARY_OUTPUT_PATH) +ENDMACRO(GET_CS_LIBRARY_TARGET_DIR) + +MACRO(GET_CS_EXECUTABLE_TARGET_DIR) + IF (NOT EXECUTABLE_OUTPUT_PATH) + SET(CS_EXECUTABLE_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR}) + ELSE (NOT EXECUTABLE_OUTPUT_PATH) + SET(CS_EXECUTABLE_TARGET_DIR ${EXECUTABLE_OUTPUT_PATH}) + ENDIF (NOT EXECUTABLE_OUTPUT_PATH) +ENDMACRO(GET_CS_EXECUTABLE_TARGET_DIR) + +MACRO(MAKE_PROPER_FILE_LIST) + FOREACH(file ${ARGN}) + # first assume it's a relative path + FILE(GLOB globbed ${CMAKE_CURRENT_SOURCE_DIR}/${file}) + IF(globbed) + FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${file} native) + ELSE(globbed) + FILE(TO_NATIVE_PATH ${file} native) + ENDIF(globbed) + SET(proper_file_list ${proper_file_list} ${native}) + SET(native "") + ENDFOREACH(file) +ENDMACRO(MAKE_PROPER_FILE_LIST) +# ----- end support macros ----- + +MACRO(ADD_CS_LIBRARY target) + GET_CS_LIBRARY_TARGET_DIR() + + SET(target_DLL "${CS_LIBRARY_TARGET_DIR}/${target}.dll") + MAKE_PROPER_FILE_LIST(${ARGN}) + FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_DLL}) + + SET(target_KEY "${CMAKE_CURRENT_SOURCE_DIR}/${target}.key") + SET(target_CS_FLAGS "${CS_FLAGS}") + IF(${target}_CS_FLAGS) + LIST(APPEND target_CS_FLAGS ${${target}_CS_FLAGS}) + ENDIF(${target}_CS_FLAGS) + IF(EXISTS ${target_KEY}) + LIST(APPEND target_CS_FLAGS -keyfile:${target_KEY}) + ENDIF(EXISTS ${target_KEY}) + + FOREACH(ref ${${target}_REFS}) + SET(ref_DLL ${CMAKE_CURRENT_BINARY_DIR}/${ref}.dll) + IF(EXISTS ${ref_DLL}) + LIST(APPEND target_CS_FLAGS -r:${ref_DLL}) + ELSE(EXISTS ${ref_DLL}) + LIST(APPEND target_CS_FLAGS -r:${ref}) + ENDIF(EXISTS ${ref_DLL}) + ENDFOREACH(ref ${${target}_REFS}) + + ADD_CUSTOM_COMMAND (OUTPUT ${target_DLL} + COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_DLL} -target:library ${proper_file_list} + MAIN_DEPENDENCY ${proper_file_list} + DEPENDS ${ARGN} + COMMENT "Building ${relative_path}") + ADD_CUSTOM_TARGET (${target} ALL DEPENDS ${target_DLL}) + + FOREACH(ref ${${target}_REFS}) + GET_TARGET_PROPERTY(is_target ${ref} TYPE) + IF(is_target) + ADD_DEPENDENCIES(${target} ${ref}) + ENDIF(is_target) + ENDFOREACH(ref ${${target}_REFS}) + + SET(relative_path "") + SET(proper_file_list "") +ENDMACRO(ADD_CS_LIBRARY) + +MACRO(ADD_CS_EXECUTABLE target) + GET_CS_EXECUTABLE_TARGET_DIR() + + # Seems like cmake doesn't like the ".exe" ending for custom commands. + # If we call it ${target}.exe, 'make' will later complain about a missing rule. + # Create a fake target instead. + SET(target_EXE "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe") + SET(target_TOUCH "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe-built") + GET_DIRECTORY_PROPERTY(clean ADDITIONAL_MAKE_CLEAN_FILES) + LIST(APPEND clean ${target}.exe) + SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${clean}") + MAKE_PROPER_FILE_LIST(${ARGN}) + FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_EXE}) + SET(target_CS_FLAGS "${CS_FLAGS}") + + FOREACH(ref ${${target}_REFS}) + SET(ref_DLL ${CMAKE_CURRENT_SOURCE_DIR}/${ref}.dll) + IF(EXISTS ${ref_DLL}) + LIST(APPEND target_CS_FLAGS -r:${ref_DLL}) + ELSE(EXISTS ${ref_DLL}) + LIST(APPEND target_CS_FLAGS -r:${ref}) + ENDIF(EXISTS ${ref_DLL}) + ENDFOREACH(ref ${${target}_REFS}) + + ADD_CUSTOM_COMMAND (OUTPUT "${target_TOUCH}" + COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_EXE} ${proper_file_list} + COMMAND ${CMAKE_COMMAND} -E touch ${target_TOUCH} + MAIN_DEPENDENCY ${ARGN} + DEPENDS ${ARGN} + COMMENT "Building ${relative_path}") + ADD_CUSTOM_TARGET ("${target}" ALL DEPENDS "${target_TOUCH}") + + FOREACH(ref ${${target}_REFS}) + GET_TARGET_PROPERTY(is_target ${ref} TYPE) + IF(is_target) + ADD_DEPENDENCIES(${target} ${ref}) + ENDIF(is_target) + ENDFOREACH(ref ${${target}_REFS}) + + SET(relative_path "") + SET(proper_file_list "") +ENDMACRO(ADD_CS_EXECUTABLE) + +MACRO(INSTALL_GAC target) + GET_CS_LIBRARY_TARGET_DIR() + + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${GACUTIL_EXECUTABLE} -i ${CS_LIBRARY_TARGET_DIR}/${target}.dll -package 2.0)") +ENDMACRO(INSTALL_GAC target) diff --git a/indra/cmake/CopyBackToSource.cmake b/indra/cmake/CopyBackToSource.cmake new file mode 100644 index 0000000000..d217df9aec --- /dev/null +++ b/indra/cmake/CopyBackToSource.cmake @@ -0,0 +1,16 @@ +# -*- cmake -*- +# Copies a binary back to the source directory + +MACRO(COPY_BACK_TO_SOURCE target) + GET_TARGET_PROPERTY(FROM ${target} LOCATION) + SET(TO ${CMAKE_CURRENT_SOURCE_DIR}) + #MESSAGE("TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO}") + ADD_CUSTOM_COMMAND( + TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO} + DEPENDS ${FROM} + COMMENT "Copying ${target} to ${CMAKE_CURRENT_BINARY_DIR}" + ) +ENDMACRO(COPY_BACK_TO_SOURCE) + + diff --git a/indra/cmake/FindMono.cmake b/indra/cmake/FindMono.cmake new file mode 100644 index 0000000000..f0a0705481 --- /dev/null +++ b/indra/cmake/FindMono.cmake @@ -0,0 +1,68 @@ +# - Try to find the mono, mcs, gmcs and gacutil +# +# defines +# +# MONO_FOUND - system has mono, mcs, gmcs and gacutil +# MONO_PATH - where to find 'mono' +# MCS_PATH - where to find 'mcs' +# GMCS_PATH - where to find 'gmcs' +# GACUTIL_PATH - where to find 'gacutil' +# +# copyright (c) 2007 Arno Rehn arno@arnorehn.de +# +# Redistribution and use is allowed according to the terms of the GPL license. +# Removed the check for gmcs + +FIND_PROGRAM (MONO_EXECUTABLE mono + "C:/Program Files/Mono-1.9.1/bin" + "C:/Program Files/Mono-1.2.6/bin" + /bin + /usr/bin + /usr/local/bin +) +FIND_PROGRAM (MCS_EXECUTABLE mcs + "C:/Program Files/Mono-1.9.1/bin" + "C:/Program Files/Mono-1.2.6/bin" + /bin + /usr/bin + /usr/local/bin +) +FIND_PROGRAM (GMCS_EXECUTABLE gmcs + "C:/Program Files/Mono-1.9.1/bin" + "C:/Program Files/Mono-1.2.6/bin" + /bin + /usr/bin + /usr/local/bin +) +FIND_PROGRAM (GACUTIL_EXECUTABLE gacutil + "C:/Program Files/Mono-1.9.1/bin" + "C:/Program Files/Mono-1.2.6/bin" + /bin + /usr/bin + /usr/local/bin +) +FIND_PROGRAM (ILASM_EXECUTABLE + ilasm + NO_DEFAULT_PATH + PATHS "C:/Program Files/Mono-1.9.1/bin" "C:/Apps/Mono-1.2.6/bin" "C:/Program Files/Mono-1.2.6/bin" /bin /usr/bin /usr/local/bin +) + +SET (MONO_FOUND FALSE) + +IF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE) + SET (MONO_FOUND TRUE) +ENDIF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE) + +IF (MONO_FOUND) + IF (NOT Mono_FIND_QUIETLY) + MESSAGE(STATUS "Found mono: ${MONO_EXECUTABLE}") + MESSAGE(STATUS "Found mcs: ${MCS_EXECUTABLE}") + MESSAGE(STATUS "Found gacutil: ${GACUTIL_EXECUTABLE}") + ENDIF (NOT Mono_FIND_QUIETLY) +ELSE (MONO_FOUND) + IF (Mono_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find one or more of the following programs: mono, mcs, gacutil") + ENDIF (Mono_FIND_REQUIRED) +ENDIF (MONO_FOUND) + +MARK_AS_ADVANCED(MONO_EXECUTABLE MCS_EXECUTABLE GACUTIL_EXECUTABLE) diff --git a/indra/cmake/LScript.cmake b/indra/cmake/LScript.cmake index 227e4aaeda..86bfcb7440 100644 --- a/indra/cmake/LScript.cmake +++ b/indra/cmake/LScript.cmake @@ -3,11 +3,14 @@ set(LSCRIPT_INCLUDE_DIRS ${LIBS_OPEN_DIR}/lscript ${LIBS_OPEN_DIR}/lscript/lscript_compile - ${LIBS_OPEN_DIR}/lscript/lscript_execute + ${LIBS_OPEN_DIR}/lscript/lscript_execute + ${LIBS_OPEN_DIR}/lscript/lscript_execute_mono ) set(LSCRIPT_LIBRARIES lscript_compile - lscript_execute + lscript_execute lscript_library ) + +set(LSCRIPT_EXECUTE_MONO_LIBRARIES lscript_execute_mono)
\ No newline at end of file diff --git a/indra/cmake/MonoDeps.cmake b/indra/cmake/MonoDeps.cmake new file mode 100644 index 0000000000..52d5491563 --- /dev/null +++ b/indra/cmake/MonoDeps.cmake @@ -0,0 +1,48 @@ +# -*- cmake -*- + +set(MONO_PREBUILT_LIBRARIES_DIR ${LIBS_PREBUILT_DIR}/mono/1.0) + +set(MONO_PREBUILT_LIBRARIES + Iesi.Collections.dll + Iesi.Collections.pdb + Mono.CompilerServices.SymbolWriter.dll + Mono.PEToolkit.dll + Mono.PEToolkit.pdb + Mono.Security.dll + PEAPI.dll + RAIL.dll + RAIL.pdb + ) + + set(MONO_CORE_LIBRARIES + System.dll + System.Xml.dll + mscorlib.dll) + +if(WINDOWS) + set(MONO_DEPENDENCIES + DomainCreator + DomainRegister + LslLibrary + LslUserScript + Script + ScriptTypes + TestFormat + UserScript + UThread + UThreadInjector + ) +else(WINDOWS) + set(MONO_DEPENDENCIES + DomainCreator_POST_BUILD + DomainRegister_POST_BUILD + LslLibrary_POST_BUILD + LslUserScript_POST_BUILD + Script_POST_BUILD + ScriptTypes_POST_BUILD + TestFormat_POST_BUILD + UserScript_POST_BUILD + UThread_POST_BUILD + UThreadInjector_POST_BUILD + ) +endif(WINDOWS) diff --git a/indra/cmake/MonoEmbed.cmake b/indra/cmake/MonoEmbed.cmake new file mode 100644 index 0000000000..a310cd9bac --- /dev/null +++ b/indra/cmake/MonoEmbed.cmake @@ -0,0 +1,57 @@ +# -*- cmake -*- + +include(Prebuilt) +use_prebuilt_binary(libmono) + +SET(GLIB_2_0 glib-2.0) + +if (WINDOWS) + SET(MONO_LIB mono) +else (WINDOWS) + SET(MONO_LIB mono) + SET(M_LIBRARIES m) + SET(GTHREAD_2_0 gthread-2.0) +endif(WINDOWS) + + +IF (DARWIN) + + FIND_LIBRARY(MONO_LIBRARY NAMES Mono) + # Find_file doesnt work as expected. Hardcode relative to Mono.framework. + #FIND_FILE(GLIB_CONFIG glibconfig.h ${MONO_LIBRARY}) + #FIND_FILE(MONO_GLIB_LIBRARY glib.h ${MONO_LIBRARY}) + SET(MONO_GLIB_LIBRARY ${MONO_LIBRARY}/Headers/glib-2.0/) + SET(GLIB_CONFIG ${MONO_LIBRARY}/Libraries/glib-2.0/include/) + SET(MONO_LIB_DIRECTORY ${MONO_LIBRARY}/Libraries) + + IF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG) + MESSAGE("-- Found Mono for embedding") + INCLUDE_DIRECTORIES(${MONO_GLIB_LIBRARY} ${GLIB_CONFIG}) + LINK_DIRECTORIES(${MONO_LIB_DIRECTORY}) + ELSE (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG) + MESSAGE("-- Mono not found for embedding") + MESSAGE(${MONO_LIBRARY}) + MESSAGE(${MONO_GLIB_LIBRARY}) + MESSAGE(${GLIB_CONFIG}) + ENDIF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG) + +ELSE (DARWIN) + + SET(MONO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include) + SET(GLIB_2_0_PLATFORM_INCLUDE_DIR + ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0) + SET(GLIB_2_0_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/glib-2.0) + + INCLUDE_DIRECTORIES( + ${MONO_INCLUDE_DIR} + ${GLIB_2_0_PLATFORM_INCLUDE_DIR} + ${GLIB_2_0_INCLUDE_DIR}) + +ENDIF (DARWIN) + +SET(MONO_LIBRARIES + ${MONO_LIB} + ${M_LIBRARIES} + ${GLIB_2_0} + ${GTHREAD_2_0} +) |