Skip to content

Commit

Permalink
feat: update CMakeLists for Visual Studio
Browse files Browse the repository at this point in the history
?

???

To show up in Solution Explorer, needs to also be in BotSources???
  • Loading branch information
Nickrader committed Dec 12, 2023
1 parent 86322db commit ea0262e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ 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
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)
Expand Down
9 changes: 9 additions & 0 deletions cc.bat
Original file line number Diff line number Diff line change
@@ -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

19 changes: 19 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(BOT_SOURCES
BuildingPlacer.h
CCBot.cpp
CCBot.h
CMakeLists.txt
CombatCommander.cpp
CombatCommander.h
Common.h
Expand Down Expand Up @@ -72,13 +73,31 @@ set(BOT_SOURCES
WorkerManager.cpp
WorkerManager.h
main.cpp
${PROJECT_SOURCE_DIR}/CMakelists.txt
${PROJECT_SOURCE_DIR}/README.md
)

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"
)

# 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 ()
Expand Down

0 comments on commit ea0262e

Please sign in to comment.