CMakeLists.txt crea el executable en la arrel del projecte
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
# CMakeLists.txt completo (incluyendo configuraciones anteriores)
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(coffee_crisis_arcade_edition VERSION 0.01)
|
project(coffee_crisis_arcade_edition VERSION 0.01)
|
||||||
|
|
||||||
@@ -30,6 +32,9 @@ link_directories(${SDL2_LIBDIR})
|
|||||||
# Definir las bibliotecas comunes
|
# Definir las bibliotecas comunes
|
||||||
set(LIBS SDL2main SDL2)
|
set(LIBS SDL2main SDL2)
|
||||||
|
|
||||||
|
# Configuración común de salida de ejecutables en el directorio raíz
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||||
|
|
||||||
# Objetivos específicos por plataforma
|
# Objetivos específicos por plataforma
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(LIBS ${LIBS} mingw32 opengl32 gdi32 winmm imm32 ole32 version)
|
set(LIBS ${LIBS} mingw32 opengl32 gdi32 winmm imm32 ole32 version)
|
||||||
@@ -37,19 +42,19 @@ if(WIN32)
|
|||||||
# Windows estándar
|
# Windows estándar
|
||||||
add_executable(${PROJECT_NAME}_windows ${SOURCES})
|
add_executable(${PROJECT_NAME}_windows ${SOURCES})
|
||||||
target_compile_definitions(${PROJECT_NAME}_windows PRIVATE WINDOWS_BUILD)
|
target_compile_definitions(${PROJECT_NAME}_windows PRIVATE WINDOWS_BUILD)
|
||||||
set_target_properties(${PROJECT_NAME}_windows PROPERTIES OUTPUT_NAME "${PROJECT_NAME}")
|
set_target_properties(${PROJECT_NAME}_windows PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_windows")
|
||||||
target_link_libraries(${PROJECT_NAME}_windows ${LIBS})
|
target_link_libraries(${PROJECT_NAME}_windows ${LIBS})
|
||||||
|
|
||||||
# Windows Debug
|
# Windows Debug
|
||||||
add_executable(${PROJECT_NAME}_windows_debug ${SOURCES})
|
add_executable(${PROJECT_NAME}_windows_debug ${SOURCES})
|
||||||
target_compile_definitions(${PROJECT_NAME}_windows_debug PRIVATE WINDOWS_BUILD DEBUG VERBOSE)
|
target_compile_definitions(${PROJECT_NAME}_windows_debug PRIVATE WINDOWS_BUILD DEBUG VERBOSE)
|
||||||
set_target_properties(${PROJECT_NAME}_windows_debug PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_debug")
|
set_target_properties(${PROJECT_NAME}_windows_debug PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_windows_debug")
|
||||||
target_link_libraries(${PROJECT_NAME}_windows_debug ${LIBS})
|
target_link_libraries(${PROJECT_NAME}_windows_debug ${LIBS})
|
||||||
|
|
||||||
# Windows Release
|
# Windows Release
|
||||||
add_executable(${PROJECT_NAME}_windows_release ${SOURCES})
|
add_executable(${PROJECT_NAME}_windows_release ${SOURCES})
|
||||||
target_compile_definitions(${PROJECT_NAME}_windows_release PRIVATE WINDOWS_BUILD)
|
target_compile_definitions(${PROJECT_NAME}_windows_release PRIVATE WINDOWS_BUILD)
|
||||||
set_target_properties(${PROJECT_NAME}_windows_release PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_release")
|
set_target_properties(${PROJECT_NAME}_windows_release PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_windows_release")
|
||||||
target_link_libraries(${PROJECT_NAME}_windows_release ${LIBS})
|
target_link_libraries(${PROJECT_NAME}_windows_release ${LIBS})
|
||||||
|
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
@@ -58,19 +63,19 @@ elseif(APPLE)
|
|||||||
# macOS estándar
|
# macOS estándar
|
||||||
add_executable(${PROJECT_NAME}_macos ${SOURCES})
|
add_executable(${PROJECT_NAME}_macos ${SOURCES})
|
||||||
target_compile_definitions(${PROJECT_NAME}_macos PRIVATE MACOS_BUILD)
|
target_compile_definitions(${PROJECT_NAME}_macos PRIVATE MACOS_BUILD)
|
||||||
set_target_properties(${PROJECT_NAME}_macos PROPERTIES OUTPUT_NAME "${PROJECT_NAME}")
|
set_target_properties(${PROJECT_NAME}_macos PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_macos")
|
||||||
target_link_libraries(${PROJECT_NAME}_macos ${LIBS})
|
target_link_libraries(${PROJECT_NAME}_macos ${LIBS})
|
||||||
|
|
||||||
# macOS Debug
|
# macOS Debug
|
||||||
add_executable(${PROJECT_NAME}_macos_debug ${SOURCES})
|
add_executable(${PROJECT_NAME}_macos_debug ${SOURCES})
|
||||||
target_compile_definitions(${PROJECT_NAME}_macos_debug PRIVATE MACOS_BUILD DEBUG VERBOSE)
|
target_compile_definitions(${PROJECT_NAME}_macos_debug PRIVATE MACOS_BUILD DEBUG VERBOSE)
|
||||||
set_target_properties(${PROJECT_NAME}_macos_debug PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_debug")
|
set_target_properties(${PROJECT_NAME}_macos_debug PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_macos_debug")
|
||||||
target_link_libraries(${PROJECT_NAME}_macos_debug ${LIBS})
|
target_link_libraries(${PROJECT_NAME}_macos_debug ${LIBS})
|
||||||
|
|
||||||
# macOS Release
|
# macOS Release
|
||||||
add_executable(${PROJECT_NAME}_macos_release ${SOURCES})
|
add_executable(${PROJECT_NAME}_macos_release ${SOURCES})
|
||||||
target_compile_definitions(${PROJECT_NAME}_macos_release PRIVATE MACOS_BUILD)
|
target_compile_definitions(${PROJECT_NAME}_macos_release PRIVATE MACOS_BUILD)
|
||||||
set_target_properties(${PROJECT_NAME}_macos_release PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_release")
|
set_target_properties(${PROJECT_NAME}_macos_release PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_macos_release")
|
||||||
target_link_libraries(${PROJECT_NAME}_macos_release ${LIBS})
|
target_link_libraries(${PROJECT_NAME}_macos_release ${LIBS})
|
||||||
|
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(UNIX AND NOT APPLE)
|
||||||
@@ -79,23 +84,23 @@ elseif(UNIX AND NOT APPLE)
|
|||||||
# Linux estándar
|
# Linux estándar
|
||||||
add_executable(${PROJECT_NAME}_linux ${SOURCES})
|
add_executable(${PROJECT_NAME}_linux ${SOURCES})
|
||||||
target_compile_definitions(${PROJECT_NAME}_linux PRIVATE LINUX_BUILD)
|
target_compile_definitions(${PROJECT_NAME}_linux PRIVATE LINUX_BUILD)
|
||||||
set_target_properties(${PROJECT_NAME}_linux PROPERTIES OUTPUT_NAME "${PROJECT_NAME}")
|
set_target_properties(${PROJECT_NAME}_linux PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_linux")
|
||||||
target_link_libraries(${PROJECT_NAME}_linux ${LIBS})
|
target_link_libraries(${PROJECT_NAME}_linux ${LIBS})
|
||||||
|
|
||||||
# Linux Debug
|
# Linux Debug
|
||||||
add_executable(${PROJECT_NAME}_linux_debug ${SOURCES})
|
add_executable(${PROJECT_NAME}_linux_debug ${SOURCES})
|
||||||
target_compile_definitions(${PROJECT_NAME}_linux_debug PRIVATE LINUX_BUILD DEBUG VERBOSE)
|
target_compile_definitions(${PROJECT_NAME}_linux_debug PRIVATE LINUX_BUILD DEBUG VERBOSE)
|
||||||
set_target_properties(${PROJECT_NAME}_linux_debug PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_debug")
|
set_target_properties(${PROJECT_NAME}_linux_debug PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_linux_debug")
|
||||||
target_link_libraries(${PROJECT_NAME}_linux_debug ${LIBS})
|
target_link_libraries(${PROJECT_NAME}_linux_debug ${LIBS})
|
||||||
|
|
||||||
# Linux Release
|
# Linux Release
|
||||||
add_executable(${PROJECT_NAME}_linux_release ${SOURCES})
|
add_executable(${PROJECT_NAME}_linux_release ${SOURCES})
|
||||||
target_compile_definitions(${PROJECT_NAME}_linux_release PRIVATE LINUX_BUILD)
|
target_compile_definitions(${PROJECT_NAME}_linux_release PRIVATE LINUX_BUILD)
|
||||||
set_target_properties(${PROJECT_NAME}_linux_release PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_release")
|
set_target_properties(${PROJECT_NAME}_linux_release PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_linux_release")
|
||||||
target_link_libraries(${PROJECT_NAME}_linux_release ${LIBS})
|
target_link_libraries(${PROJECT_NAME}_linux_release ${LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Agregar un custom target para cada tipo de build
|
# Agregar custom targets para invocar objetivos de build específicos
|
||||||
add_custom_target(build_windows_debug DEPENDS ${PROJECT_NAME}_windows_debug)
|
add_custom_target(build_windows_debug DEPENDS ${PROJECT_NAME}_windows_debug)
|
||||||
add_custom_target(build_windows_release DEPENDS ${PROJECT_NAME}_windows_release)
|
add_custom_target(build_windows_release DEPENDS ${PROJECT_NAME}_windows_release)
|
||||||
add_custom_target(build_macos_debug DEPENDS ${PROJECT_NAME}_macos_debug)
|
add_custom_target(build_macos_debug DEPENDS ${PROJECT_NAME}_macos_debug)
|
||||||
|
|||||||
Reference in New Issue
Block a user