Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from besser82/ruby22-rbconfig
Version 1.1.0 * Add Mono / CSharp * Replace deprecated Config: with RbConfig: for Ruby 2.2
- Loading branch information
Showing
9 changed files
with
271 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
SET(VERSION_MAJOR "1") | ||
SET(VERSION_MINOR "0") | ||
SET(VERSION_PATCH "6") | ||
SET(VERSION_MINOR "1") | ||
SET(VERSION_PATCH "0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
# | ||
# A CMake Module for finding Mono. | ||
# | ||
# The following variables are set: | ||
# CSHARP_MONO_FOUND | ||
# CSHARP_MONO_COMPILER_${version} eg. "CSHARP_MONO_COMPILER_2.10.2" | ||
# CSHARP_MONO_INTERPRETOR_${version} eg. "CSHARP_MONO_INTERPRETOR_2.10.2" | ||
# CSHARP_MONO_VERSION eg. "2.10.2" | ||
# CSHARP_MONO_VERSIONS eg. "2.10.2, 2.6.7" | ||
# | ||
# Additional references can be found here: | ||
# http://www.mono-project.com/Main_Page | ||
# http://www.mono-project.com/CSharp_Compiler | ||
# http://mono-project.com/FAQ:_Technical (How can I tell where the Mono runtime is installed) | ||
# | ||
# This file is based on the work of GDCM: | ||
# http://gdcm.svn.sf.net/viewvc/gdcm/trunk/CMake/FindMono.cmake | ||
# Copyright (c) 2006-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com> | ||
# | ||
|
||
set( csharp_mono_valid 1 ) | ||
if( DEFINED CSHARP_MONO_FOUND ) | ||
# The Mono compiler has already been found | ||
# It may have been reset by the user, verify it is correct | ||
if( NOT DEFINED CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION} ) | ||
set( csharp_mono_version_user ${CSHARP_MONO_VERSION} ) | ||
set( csharp_mono_valid 0 ) | ||
set( CSHARP_MONO_FOUND 0 ) | ||
set( CSHARP_MONO_VERSION "CSHARP_MONO_VERSION-NOTVALID" CACHE STRING "C# Mono compiler version, choices: ${CSHARP_MONO_VERSIONS}" FORCE ) | ||
message( FATAL_ERROR "The C# Mono version '${csharp_mono_version_user}' is not valid. Please enter one of the following: ${CSHARP_MONO_VERSIONS}" ) | ||
endif( NOT DEFINED CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION} ) | ||
endif( DEFINED CSHARP_MONO_FOUND ) | ||
|
||
unset( CSHARP_MONO_VERSIONS CACHE ) # Clear versions | ||
if( WIN32 ) | ||
# Search for Mono on Win32 systems | ||
# See http://mono-project.com/OldReleases and http://www.go-mono.com/mono-downloads/download.html | ||
set( csharp_mono_bin_dirs ) | ||
set( csharp_mono_search_hints | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.11.2;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.9;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.8;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.7;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.6;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.5;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.4;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.3;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.2;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10.1;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.10;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.8;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6.7;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6.4;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6.3;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6.1;SdkInstallRoot]/bin" | ||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono\\2.6;SdkInstallRoot]/bin" | ||
) | ||
foreach( csharp_mono_search_hint ${csharp_mono_search_hints} ) | ||
get_filename_component( csharp_mono_bin_dir "${csharp_mono_search_hint}" ABSOLUTE ) | ||
if ( EXISTS "${csharp_mono_bin_dir}" ) | ||
set( csharp_mono_bin_dirs ${csharp_mono_bin_dirs} ${csharp_mono_bin_dir} ) | ||
endif ( EXISTS "${csharp_mono_bin_dir}" ) | ||
endforeach( csharp_mono_search_hint ) | ||
# TODO: Use HKLM_LOCAL_MACHINE\Software\Novell\Mono\DefaultCLR to specify default version | ||
# get_filename_component( test "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Novell\\Mono;DefaultCLR]" NAME ) | ||
|
||
foreach ( csharp_mono_bin_dir ${csharp_mono_bin_dirs} ) | ||
string( REPLACE "\\" "/" csharp_mono_bin_dir ${csharp_mono_bin_dir} ) | ||
if (EXISTS "${csharp_mono_bin_dir}/dmcs.bat") | ||
set( csharp_mono_executable "${csharp_mono_bin_dir}/dmcs.bat") | ||
elseif (EXISTS "${csharp_mono_bin_dir}/gmcs.bat") | ||
set( csharp_mono_executable "${csharp_mono_bin_dir}/gmcs.bat") | ||
elseif (EXISTS "${csharp_mono_bin_dir}/mcs.bat") | ||
set( csharp_mono_executable "${csharp_mono_bin_dir}/mcs.bat") | ||
endif (EXISTS "${csharp_mono_bin_dir}/dmcs.bat") | ||
|
||
if( csharp_mono_valid ) | ||
# Extract version number (eg. 2.10.2) | ||
string(REGEX MATCH "([0-9]*)([.])([0-9]*)([.]*)([0-9]*)" csharp_mono_version_temp ${csharp_mono_bin_dir}) | ||
set( CSHARP_MONO_VERSION ${csharp_mono_version_temp} CACHE STRING "C# Mono compiler version" ) | ||
mark_as_advanced( CSHARP_MONO_VERSION ) | ||
|
||
# Add variable holding executable | ||
set( CSHARP_MONO_COMPILER_${csharp_mono_version_temp} ${csharp_mono_executable} CACHE STRING "C# Mono compiler ${csharp_mono_version_temp}" FORCE ) | ||
mark_as_advanced( CSHARP_MONO_COMPILER_${csharp_mono_version_temp} ) | ||
|
||
# Set interpreter | ||
if (EXISTS "${csharp_mono_bin_dir}/mono.exe") | ||
set( CSHARP_MONO_INTERPRETER_${csharp_mono_version_temp} "${csharp_mono_bin_dir}/mono.exe" CACHE STRING "C# Mono interpreter ${csharp_mono_version_temp}" FORCE ) | ||
mark_as_advanced( CSHARP_MONO_INTERPRETER_${csharp_mono_version_temp} ) | ||
endif (EXISTS "${csharp_mono_bin_dir}/mono.exe") | ||
endif( csharp_mono_valid ) | ||
|
||
# Create a list of supported compiler versions | ||
if( NOT DEFINED CSHARP_MONO_VERSIONS ) | ||
set( CSHARP_MONO_VERSIONS "${csharp_mono_version_temp}" CACHE STRING "Available C# Mono compiler versions" FORCE ) | ||
else( NOT DEFINED CSHARP_MONO_VERSIONS ) | ||
set( CSHARP_MONO_VERSIONS "${CSHARP_MONO_VERSIONS}, ${csharp_mono_version_temp}" CACHE STRING "Available C# Mono versions" FORCE ) | ||
endif( NOT DEFINED CSHARP_MONO_VERSIONS ) | ||
mark_as_advanced( CSHARP_MONO_VERSIONS ) | ||
|
||
# We found at least one Mono compiler version | ||
set( CSHARP_MONO_FOUND 1 CACHE INTERNAL "Boolean indicating if C# Mono was found" ) | ||
endforeach( csharp_mono_bin_dir ) | ||
|
||
else( UNIX ) | ||
# Search for Mono on non-Win32 systems | ||
set( chsarp_mono_names "mcs" "mcs.exe" "dmcs" "dmcs.exe" "smcs" "smcs.exe" "gmcs" "gmcs.exe" ) | ||
set( | ||
csharp_mono_paths | ||
"/usr/bin/" | ||
"/usr/local/bin/" | ||
"/usr/lib/mono/2.0" | ||
"/opt/novell/mono/bin" | ||
) | ||
find_program( | ||
csharp_mono_compiler # variable is added to the cache, we removed it below | ||
NAMES ${chsarp_mono_names} | ||
PATHS ${csharp_mono_paths} | ||
) | ||
|
||
if( EXISTS ${csharp_mono_compiler} ) | ||
# Determine version | ||
find_program( | ||
csharp_mono_interpreter # variable is added to the cache, we removed it below | ||
NAMES mono | ||
PATHS ${csharp_mono_paths} | ||
) | ||
if ( EXISTS ${csharp_mono_interpreter} ) | ||
execute_process( | ||
COMMAND ${csharp_mono_interpreter} -V | ||
OUTPUT_VARIABLE csharp_mono_version_string | ||
) | ||
string( REGEX MATCH "([0-9]*)([.])([0-9]*)([.]*)([0-9]*)" csharp_mono_version_temp ${csharp_mono_version_string} ) | ||
set( CSHARP_MONO_INTERPRETER_${CSHARP_MONO_VERSION} ${csharp_mono_interpreter} CACHE STRING "C# Mono interpreter ${csharp_mono_version_temp}" FORCE ) | ||
mark_as_advanced( CSHARP_MONO_INTERPRETER_${CSHARP_MONO_VERSION} ) | ||
endif ( EXISTS ${csharp_mono_interpreter} ) | ||
unset( csharp_mono_interpreter CACHE ) | ||
|
||
# We found Mono compiler | ||
set( CSHARP_MONO_VERSION ${csharp_mono_version_temp} CACHE STRING "C# Mono compiler version" ) | ||
mark_as_advanced( CSHARP_MONO_VERSION ) | ||
set( CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION} ${csharp_mono_compiler} CACHE STRING "C# Mono compiler ${CSHARP_MONO_VERSION}" FORCE ) | ||
mark_as_advanced( CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION} ) | ||
set( CSHARP_MONO_VERSIONS ${CSHARP_MONO_VERSION} CACHE STRING "Available C# Mono compiler versions" FORCE ) | ||
mark_as_advanced( CSHARP_MONO_VERSIONS ) | ||
set( CSHARP_MONO_FOUND 1 CACHE INTERNAL "Boolean indicating if C# Mono was found" ) | ||
endif( EXISTS ${csharp_mono_compiler} ) | ||
|
||
# Remove temp variable from cache | ||
unset( csharp_mono_compiler CACHE ) | ||
|
||
endif( WIN32 ) | ||
|
||
if( CSHARP_MONO_FOUND ) | ||
# Report the found versions | ||
message( STATUS "Found the following C# Mono versions: ${CSHARP_MONO_VERSIONS}" ) | ||
endif( CSHARP_MONO_FOUND ) | ||
|
||
# Set USE_FILE | ||
get_filename_component( current_list_path ${CMAKE_CURRENT_LIST_FILE} PATH ) | ||
set( Mono_USE_FILE ${current_list_path}/UseMono.cmake ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# | ||
# cmake description for libyui CSharp bindings | ||
# | ||
# !!Attn!!: This creates two files | ||
# 1. yui.so | ||
# 2. yui.dll | ||
# and the .dll file gets imported. See bindings/csharp/tests. | ||
# | ||
|
||
IF (NOT MONO_LIBRARIES) | ||
SET (MONO_LIBRARIES "/usr/lib/mono") | ||
ENDIF (NOT MONO_LIBRARIES) | ||
|
||
# SWIG_OUPUT is per-target | ||
SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/yui_csharp.cxx" ) | ||
|
||
|
||
ADD_CUSTOM_COMMAND ( | ||
OUTPUT ${SWIG_OUTPUT} | ||
COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for CSharp ..." | ||
COMMAND ${SWIG_EXECUTABLE} -c++ -csharp -features autodoc -o ${SWIG_OUTPUT} -I${LIBYUI_INCLUDE_DIR} ${SWIG_INPUT} | ||
COMMAND ${CMAKE_COMMAND} -E echo "Done." | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i | ||
) | ||
|
||
SET(yui_csharp_SRCS ${SWIG_OUTPUT} ) | ||
|
||
ADD_LIBRARY( yui_csharp SHARED ${yui_csharp_SRCS} ) | ||
# name it 'yui' ==> i.e. yui.so | ||
# and don't prefix with 'lib' | ||
SET_TARGET_PROPERTIES( yui_csharp PROPERTIES PREFIX "" OUTPUT_NAME "yui") | ||
|
||
TARGET_LINK_LIBRARIES( yui_csharp ${LIBYUI_LIBRARY} ) | ||
|
||
ADD_CUSTOM_COMMAND( | ||
TARGET yui_csharp POST_BUILD | ||
COMMAND "${CSHARP_MONO_COMPILER_${CSHARP_MONO_VERSION}}" /t:library *.cs /out:yui.dll | ||
COMMENT "Creating yui.dll" | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
|
||
INSTALL(TARGETS yui_csharp LIBRARY DESTINATION "${MONO_LIBRARIES}/yui") | ||
|
||
INSTALL( | ||
FILES ${CMAKE_CURRENT_BINARY_DIR}/yui.dll | ||
DESTINATION "${MONO_LIBRARIES}/yui" | ||
COMPONENT csharp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters