From ea0262ee8acd37701b50321fb4e008dfbbaaa5b2 Mon Sep 17 00:00:00 2001 From: Nicholas Rader Date: Sat, 28 Oct 2023 16:03:55 -0600 Subject: [PATCH] feat: update CMakeLists for Visual Studio ? ??? To show up in Solution Explorer, needs to also be in BotSources??? --- CMakeLists.txt | 8 ++++++++ cc.bat | 9 +++++++++ src/CMakeLists.txt | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 cc.bat diff --git a/CMakeLists.txt b/CMakeLists.txt index c30b639..ab0d9fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,14 @@ if (MSVC) # Use statically linked runtime set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) + + # Make directory that 'Build' in Visual Studio would, so we can move BotConfig.txt + file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/build/bin/Debug) + file(COPY_FILE ${CMAKE_SOURCE_DIR}/bin/BotConfig.txt ${CMAKE_SOURCE_DIR}/build/bin/Debug/BotConfig.txt) + + # 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) diff --git a/cc.bat b/cc.bat new file mode 100644 index 0000000..9ce6fd7 --- /dev/null +++ b/cc.bat @@ -0,0 +1,9 @@ +mv build\_deps . +rm -rf build\ +mkdir build +mv _deps build\ + +cmake -B build -G "Visual Studio 17 2022" + +start build\CommandCenter.sln + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c5f7b1..4bfca7e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,6 +21,7 @@ set(BOT_SOURCES BuildingPlacer.h CCBot.cpp CCBot.h + CMakeLists.txt CombatCommander.cpp CombatCommander.h Common.h @@ -72,6 +73,8 @@ set(BOT_SOURCES WorkerManager.cpp WorkerManager.h main.cpp + ${PROJECT_SOURCE_DIR}/CMakelists.txt + ${PROJECT_SOURCE_DIR}/README.md ) add_executable(CommandCenter ${BOT_SOURCES}) @@ -79,6 +82,22 @@ 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 "$" + VS_DEBUGGER_COMMAND "$" + VS_DEBUGGER_COMMAND_ARGUMENTS "Ladder2019Season3/AcropolisLE.SC2Map" + ) + + # Get Readme and CMakelists to show up in Solution Explorer + set(OTHER + ${PROJECT_SOURCE_DIR}/CMakelists.txt + #${PROJECT_SOURCE_DIR}/src/CMakelists.txt + CMakeLists.txt + ${PROJECT_SOURCE_DIR}/README.md + ) + source_group("Other" FILES ${OTHER}) + else () target_compile_options(CommandCenter PRIVATE -Wall -Wextra) endif ()