-
Notifications
You must be signed in to change notification settings - Fork 51
Update find mono scripts #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -32,10 +32,10 @@ IF EXIST ..\firebase-cpp-sdk ( | |
| SET CPP_DIR=-DFIREBASE_CPP_SDK_DIR^=../../firebase-cpp-sdk | ||
| ) | ||
|
|
||
| IF EXIST "C:\Program Files (x86)\Mono\bin" ( | ||
| SET MONO_DIR="C:/Program Files (x86)/Mono/bin" | ||
| IF EXIST "C:\Program Files\Mono\bin" ( | ||
| SET MONO_DIR="C:/Program Files/Mono/bin" | ||
| ) ELSE ( | ||
| ECHO ERROR: Cant find mono | ||
| ECHO ERROR: Cant find mono in program files | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
| EXIT /B -1 | ||
| ) | ||
|
|
||
|
|
||
This file contains hidden or 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,108 @@ | ||
| # Copyright 2021 Google | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Locates the Mono launcher and build tool. | ||
| # | ||
| # Optional variable arguments for this module: | ||
| # MONO_DIR: Variable to specify a search path for Mono. | ||
| # MONO_DISABLE_VISUAL_STUDIO_FALLBACK: Do not use Visual Studio's msbuild | ||
| # as a fallback on Windows when using the Visual Studio project generator. | ||
| # | ||
| # Cache variables set by this module: | ||
| # MONO_EXE: Location of the Mono interpreter executable. | ||
| # MONO_VERSION: Version of the detected Mono installation. | ||
| # MONO_CSHARP_BUILD_EXE: Location of the tool (e.g msbuild or xbuild) that | ||
| # can build .csproj projects. | ||
|
|
||
| # If MONO_DIR is specified, only search that path. | ||
| set(FIND_MONO_OPTIONS "") | ||
| if(EXISTS "${MONO_DIR}") | ||
| set(FIND_MONO_OPTIONS | ||
| PATHS | ||
| "${MONO_DIR}" | ||
| "${MONO_DIR}/lib/mono" | ||
| PATH_SUFFIXES | ||
| bin | ||
| NO_DEFAULT_PATH | ||
| ) | ||
| endif() | ||
|
|
||
| # Search for Mono tools. | ||
| find_program(MONO_EXE mono | ||
| ${FIND_MONO_OPTIONS} | ||
| ) | ||
| find_program(MONO_CSHARP_BUILD_EXE | ||
| NAMES | ||
| msbuild | ||
| xbuild | ||
| ${FIND_MONO_OPTIONS} | ||
| ) | ||
|
|
||
| if(CMAKE_HOST_WIN32 AND | ||
| NOT MONO_DISABLE_VISUAL_STUDIO_FALLBACK AND | ||
| EXISTS "${CMAKE_VS_MSBUILD_COMMAND}") | ||
| if(NOT MONO_CSHARP_BUILD_EXE) | ||
| # If Mono's build tool isn't found, fallback to Visual Studio. | ||
| message(STATUS "Mono installation not found, trying to fallback " | ||
| "to Visual Studio's msbuild ${CMAKE_VS_MSBUILD_COMMAND}." | ||
| ) | ||
| set(MONO_CSHARP_BUILD_EXE "${CMAKE_VS_MSBUILD_COMMAND}" | ||
| CACHE STRING "" FORCE | ||
| ) | ||
| endif() | ||
| if(NOT MONO_EXE) | ||
| # Just use cmake to launch the C# executable which should run on Windows if | ||
| # the .NET framework is installed. | ||
| # NOTE: This does not use cmd as CTest passes a path with / path separators | ||
| # to CreateProcess() causing cmd to fail to start. | ||
| set(MONO_EXE "${CMAKE_COMMAND};-E;env" CACHE STRING "" FORCE) | ||
| endif() | ||
| endif() | ||
|
|
||
| # If the mono executable is found, and retrieve the version. | ||
| if(MONO_EXE) | ||
| if(EXISTS "${MONO_EXE}") | ||
| execute_process( | ||
| COMMAND ${MONO_EXE} -V | ||
| OUTPUT_VARIABLE MONO_VERSION_STRING | ||
| RESULT_VARIABLE RESULT | ||
| ) | ||
| if(NOT ${RESULT} EQUAL "0") | ||
| message(FATAL_ERROR "${MONO_EXE} -V returned ${RESULT}.") | ||
| endif() | ||
| string(REGEX MATCH "([0-9]*)([.])([0-9]*)([.]*)([0-9]*)" | ||
| MONO_VERSION_MATCH "${MONO_VERSION_STRING}") | ||
| set(MONO_VERSION "${MONO_VERSION_MATCH}" CACHE STRING "Mono version.") | ||
| else() | ||
| set(MONO_VERSION "0.0.0" CACHE STRING "Mono version.") | ||
| endif() | ||
| endif() | ||
|
|
||
| if(NOT MONO_EXE OR NOT MONO_CSHARP_BUILD_EXE) | ||
| message(FATAL_ERROR "Cannot find mono and msbuild/xbuild executables.") | ||
| endif() | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args( | ||
| Mono | ||
| DEFAULT_MSG | ||
| MONO_EXE | ||
| MONO_CSHARP_BUILD_EXE | ||
| MONO_VERSION | ||
| ) | ||
| mark_as_advanced( | ||
| MONO_EXE | ||
| MONO_CSHARP_BUILD_EXE | ||
| MONO_VERSION | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are being more specific with the error here, as a user, it will be awesome to see something like this,
"Can't find mono in C:\Program Files (x86)".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried somehow the .bat file doesn't like it....