Skip to content
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

Cmake + default presets that work with Visual Studio #75

Merged
merged 3 commits into from
Jan 15, 2023
Merged

Cmake + default presets that work with Visual Studio #75

merged 3 commits into from
Jan 15, 2023

Conversation

CptMoore
Copy link
Contributor

@CptMoore CptMoore commented Jan 14, 2023

Based on the PR from Marco
This adds a preset settings file so you dont have to manually configure cmake to work with Visual Studio from the get go.
image

Otherwise, without the preset settings, you would get the wrong configuration by default and need to configure cmake in visual studio toget all the options you want.
image

@CptMoore
Copy link
Contributor Author

CptMoore commented Jan 14, 2023

Marco has his own settings file, so he doesnt want a settings file like this to be the default (.gitignore)
So I'm searching for a solution so this settings file is either automatically copied to the right place if nothing exists, or the user will be informed if his setup is wrong and needs to fix it manually (copying the file yourself)

Update
VS can be tricked into copying a file if its missing (message an error and it will reload) but CLion wants a preset before even touching cmake anyway.
So we keep a default preset to make it easy for people to start. If someone wants a light weight build, they need to use CMakeUserPresets.json with a different naming scheme.
We hope CMake and IDE supports gets better in the next couple of releases, but since the end of 2022 there were still open tickets about improving cmake presets, we should not be too eager.

Note
If people have performance issues due to the default containing all variants,
or if people often accidentily commit a modified version of the settings file,
this should be re-evaluated.

Tried to stay as close as possible to ja2_2019.sln

On Visual Studio 2022 just Project -> CMake Settings for Ja2, add
the x86 configurations you want and press F7.

Below shows how the -DLanguages -DApplications switches work, If you don't
set them, the CMakeCache.txt of them will be set to ENGLISH and JA2,
respectively:

cmake [...] // nothing set, configure just JA2_ENGLISH.exe by default
cmake [...] -DApplications="JA2UB" // configures just Unfinished Business
cmake [...] build -DApplications="JA2UB;JA2UBMAPEDITOR" // Unfinished Business and UB Map Editor
cmake [...] build -DApplications="JA2UB;JA2MAPEDITOR;ALL" // ALL is in the list, configures every application
cmake [...] build -DApplications="JA2MAPEDITOR;DeathStranding" // fatal error: DeathStranding not an application

cmake [...] -DLanguages="GERMAN" // configures just German targets
cmake [...] build -DLanguages="GERMAN;ENGLISH" // German and English
cmake [...] build -DLanguages="GERMAN;ENGLISH;ALL" // ALL is in the list, configures every language
cmake [...] build -DLanguages="ENGLISH;ESPERANTO" // fatal error: ESPERANTO not supported
@majcosta
Copy link
Contributor

Can we drop the original commit from the PR? I've pushed an update to it and now they're out of sync. Thanks.

@kitty624 kitty624 merged commit bcdd447 into 1dot13:master Jan 15, 2023
@CptMoore CptMoore deleted the cmake_default_presets branch January 15, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants