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

feat: update CMakeLists for Visual Studio #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@ if (MSVC)

# Use statically linked runtime
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)

# Make directory that 'Build' in Visual Studio would, so we can move BotConfig.txt
# Loop over, Release, Debug, MinSizeRel, RelWithDebInfo
list(APPEND BuildOutputList Release Debug MinSizeRel RelWithDebInfo)
foreach(output IN LISTS BuildOutputList)
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/build/bin/${output})

#Copy the example to build/bin/${output}
file(COPY_FILE ${CMAKE_SOURCE_DIR}/config/BotConfig.example.txt ${CMAKE_SOURCE_DIR}/build/bin/${output}/BotConfig.txt)

### TODO ###
# make symoblic link BotConfig.txt
# permissions error, doing this in Windows. Would need elevated permissions.
# this would also mean we are stuck with name BotConfig.example.txt
# confirmed works with elevated permissions.
# Verdict: Probably good to lose this approach.
#
# mklink ${CMAKE_SOURCE_DIR}/build/bin/${output}/BotConfig.txt ${CMAKE_SOURCE_DIR}/config/BotConfig.example.txt
endforeach()

# Set startup project so we don't have to in IDE
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT CommandCenter)

endif ()

list(APPEND CMAKE_MODULE_PATH thirdparty/cmake)
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ add_executable(CommandCenter ${BOT_SOURCES})
# Show more warnings at compiletime.
if (MSVC)
target_compile_options(CommandCenter PRIVATE /W4 /EHsc)

set_target_properties(CommandCenter PROPERTIES
VS_DEBUGGER_WORKING_DIRECTORY "$<TARGET_FILE_DIR:CommandCenter>"
VS_DEBUGGER_COMMAND "$<TARGET_FILE:CommandCenter>"
VS_DEBUGGER_COMMAND_ARGUMENTS "Ladder2019Season3/AcropolisLE.SC2Map"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, and this point is also confusing as we are in 2023 now and SC2AI ladder uses different maps. While it is ok to specify map from the past as an example of "start the bot" command in README, currently one should use modern maps.

In other words, for real bot development this setting does not make sense and should be changed.
And if we set here some up2date map, we have to update it each maps rotation (i.e. each new ladder season).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User can manually update these in the IDE. These are initially blank variables.
FullScreen
ProjectProperties
It's an initialization, not a permanent change.
An alternative to launching from the command line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that this alternative is invalid from the very beginning (which is ok for README as it contains examples) so one should figure out which values should be used instead in any case.

I believe all the defaults should contain working values or do not contains values at all. For the latter documentation should be added. The suggested approach does not provide working defaults.

)
else ()
target_compile_options(CommandCenter PRIVATE -Wall -Wextra)
endif ()
Expand Down