ref: 3d3d6a2179f8c84fd01c8ae02e3e7161e2b39953
parent: 33254c87dd5032b854442c1cf41e5fc52a3e56b8
author: Clownacy <Clownacy@users.noreply.github.com>
date: Fri Apr 19 21:09:53 EDT 2019
Make CMake output executables to the build_en/build_jp folders MSVC copies SDL2.dll across too
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -223,9 +223,11 @@
# Handle options
if (JAPANESE)
+ set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build_jp")
list(APPEND RESOURCES "BITMAP/PIXEL_JP.bmp")
target_compile_definitions(CSE2 PRIVATE JAPANESE)
else()
+ set(BUILD_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build_en")
list(APPEND RESOURCES "BITMAP/PIXEL.bmp")
endif()
@@ -339,3 +341,22 @@
target_include_directories(CSE2 PRIVATE ${SDL2_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS})
target_compile_options(CSE2 PRIVATE ${SDL2_CFLAGS_OTHER} ${FREETYPE_CFLAGS_OTHER})
target_link_libraries(CSE2 ${SDL2_LIBRARIES} ${FREETYPE_LIBRARIES})
+
+set_target_properties(CSE2 PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY_RELEASE ${BUILD_DIRECTORY}
+ RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${BUILD_DIRECTORY}
+ RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${BUILD_DIRECTORY}
+ RUNTIME_OUTPUT_DIRECTORY_DEBUG ${BUILD_DIRECTORY}
+)
+
+if (MSVC)
+ if (CMAKE_CL_64)
+ set(SDL2_DLL_ARCH "x64")
+ else()
+ set(SDL2_DLL_ARCH "x86")
+ endif()
+
+ add_custom_command(TARGET CSE2 POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/msvc/SDL2/lib/${SDL2_DLL_ARCH}/SDL2.dll" "${BUILD_DIRECTORY}/"
+ )
+endif()
\ No newline at end of file