forked from mirror/openmw-tes3mp
Merge pull request #1435 from AnyOldName3/cmake-vs-debugging-dir
If CMake supports it, sets the debugger working directory for Visual …
This commit is contained in:
commit
bd667c3847
12 changed files with 76 additions and 44 deletions
|
@ -1,3 +1,40 @@
|
|||
# Apps and tools
|
||||
option(BUILD_OPENMW "build OpenMW" ON)
|
||||
option(BUILD_BSATOOL "build BSA extractor" ON)
|
||||
option(BUILD_ESMTOOL "build ESM inspector" ON)
|
||||
option(BUILD_LAUNCHER "build Launcher" ON)
|
||||
option(BUILD_MWINIIMPORTER "build MWiniImporter" ON)
|
||||
option(BUILD_ESSIMPORTER "build ESS (Morrowind save game) importer" ON)
|
||||
option(BUILD_OPENCS "build OpenMW Construction Set" ON)
|
||||
option(BUILD_WIZARD "build Installation Wizard" ON)
|
||||
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
||||
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
|
||||
option(BUILD_NIFTEST "build nif file tester" OFF)
|
||||
option(BUILD_MYGUI_PLUGIN "build MyGUI plugin for OpenMW resources, to use with MyGUI tools" ON)
|
||||
option(BUILD_DOCS "build documentation." OFF )
|
||||
|
||||
if (NOT BUILD_LAUNCHER AND NOT BUILD_OPENCS AND NOT BUILD_WIZARD)
|
||||
set(USE_QT FALSE)
|
||||
else()
|
||||
set(USE_QT TRUE)
|
||||
endif()
|
||||
|
||||
if (USE_QT)
|
||||
set(DESIRED_QT_VERSION 4 CACHE STRING "The QT version OpenMW should use (4 or 5)")
|
||||
set_property(CACHE DESIRED_QT_VERSION PROPERTY STRINGS 4 5)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
# OS X build process relies on this fix: https://github.com/Kitware/CMake/commit/3df5147043d83aa09acd5c9ce31d5c602efb99db
|
||||
cmake_minimum_required(VERSION 3.1.0)
|
||||
elseif (USE_QT AND DESIRED_QT_VERSION MATCHES 5)
|
||||
# 2.8.11+ is required to make Qt5 happy and allow linking QtMain on Windows.
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
else()
|
||||
# We probably support older versions than this.
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
endif()
|
||||
|
||||
project(OpenMW)
|
||||
|
||||
# If the user doesn't supply a CMAKE_BUILD_TYPE via command line, choose one for them.
|
||||
|
@ -59,21 +96,6 @@ option(QT_STATIC "Link static build of QT into the binaries" FALSE)
|
|||
|
||||
option(OPENMW_UNITY_BUILD "Use fewer compilation units to speed up compile time" FALSE)
|
||||
|
||||
# Apps and tools
|
||||
option(BUILD_OPENMW "build OpenMW" ON)
|
||||
option(BUILD_BSATOOL "build BSA extractor" ON)
|
||||
option(BUILD_ESMTOOL "build ESM inspector" ON)
|
||||
option(BUILD_LAUNCHER "build Launcher" ON)
|
||||
option(BUILD_MWINIIMPORTER "build MWiniImporter" ON)
|
||||
option(BUILD_ESSIMPORTER "build ESS (Morrowind save game) importer" ON)
|
||||
option(BUILD_OPENCS "build OpenMW Construction Set" ON)
|
||||
option(BUILD_WIZARD "build Installation Wizard" ON)
|
||||
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
||||
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
|
||||
option(BUILD_NIFTEST "build nif file tester" OFF)
|
||||
option(BUILD_MYGUI_PLUGIN "build MyGUI plugin for OpenMW resources, to use with MyGUI tools" ON)
|
||||
option(BUILD_DOCS "build documentation." OFF )
|
||||
|
||||
# what is necessary to build documentation
|
||||
IF( BUILD_DOCS )
|
||||
# Builds the documentation.
|
||||
|
@ -120,16 +142,8 @@ if (WIN32)
|
|||
option(USE_DEBUG_CONSOLE "whether a debug console should be enabled for debug builds, if false debug output is redirected to Visual Studio output" ON)
|
||||
endif()
|
||||
|
||||
if (NOT BUILD_LAUNCHER AND NOT BUILD_OPENCS AND NOT BUILD_WIZARD)
|
||||
set(USE_QT FALSE)
|
||||
else()
|
||||
set(USE_QT TRUE)
|
||||
endif()
|
||||
|
||||
# Dependencies
|
||||
if (USE_QT)
|
||||
set(DESIRED_QT_VERSION 4 CACHE STRING "The QT version OpenMW should use (4 or 5)")
|
||||
set_property(CACHE DESIRED_QT_VERSION PROPERTY STRINGS 4 5)
|
||||
message(STATUS "Using Qt${DESIRED_QT_VERSION}")
|
||||
|
||||
if (DESIRED_QT_VERSION MATCHES 4)
|
||||
|
@ -144,17 +158,6 @@ if (USE_QT)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
# OS X build process relies on this fix: https://github.com/Kitware/CMake/commit/3df5147043d83aa09acd5c9ce31d5c602efb99db
|
||||
cmake_minimum_required(VERSION 3.1.0)
|
||||
elseif (USE_QT AND DESIRED_QT_VERSION MATCHES 5)
|
||||
# 2.8.11+ is required to make Qt5 happy and allow linking QtMain on Windows.
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
else()
|
||||
# We probably support older versions than this.
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
endif()
|
||||
|
||||
# Sound setup
|
||||
find_package(FFmpeg REQUIRED COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE SWRESAMPLE)
|
||||
# Required for building the FFmpeg headers
|
||||
|
|
|
@ -4,7 +4,7 @@ set(BSATOOL
|
|||
source_group(apps\\bsatool FILES ${BSATOOL})
|
||||
|
||||
# Main executable
|
||||
add_executable(bsatool
|
||||
openmw_add_executable(bsatool
|
||||
${BSATOOL}
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ set(ESMTOOL
|
|||
source_group(apps\\esmtool FILES ${ESMTOOL})
|
||||
|
||||
# Main executable
|
||||
add_executable(esmtool
|
||||
openmw_add_executable(esmtool
|
||||
${ESMTOOL}
|
||||
)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ set(ESSIMPORTER_FILES
|
|||
convertplayer.cpp
|
||||
)
|
||||
|
||||
add_executable(openmw-essimporter
|
||||
openmw_add_executable(openmw-essimporter
|
||||
${ESSIMPORTER_FILES}
|
||||
)
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ if(NOT WIN32)
|
|||
endif(NOT WIN32)
|
||||
|
||||
# Main executable
|
||||
add_executable(openmw-launcher
|
||||
openmw_add_executable(openmw-launcher
|
||||
${GUI_TYPE}
|
||||
${LAUNCHER}
|
||||
${LAUNCHER_HEADER}
|
||||
|
|
|
@ -9,7 +9,7 @@ set(MWINIIMPORT_HEADER
|
|||
|
||||
source_group(launcher FILES ${MWINIIMPORT} ${MWINIIMPORT_HEADER})
|
||||
|
||||
add_executable(openmw-iniimporter
|
||||
openmw_add_executable(openmw-iniimporter
|
||||
${MWINIIMPORT}
|
||||
)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ set(NIFTEST
|
|||
source_group(components\\nif\\tests FILES ${NIFTEST})
|
||||
|
||||
# Main executable
|
||||
add_executable(niftest
|
||||
openmw_add_executable(niftest
|
||||
${NIFTEST}
|
||||
)
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ else()
|
|||
set (OPENCS_OPENMW_CFG "")
|
||||
endif(APPLE)
|
||||
|
||||
add_executable(openmw-cs
|
||||
openmw_add_executable(openmw-cs
|
||||
MACOSX_BUNDLE
|
||||
${OPENCS_SRC}
|
||||
${OPENCS_UI_HDR}
|
||||
|
|
|
@ -99,7 +99,7 @@ add_openmw_dir (mwbase
|
|||
# Main executable
|
||||
|
||||
if (NOT ANDROID)
|
||||
add_executable(openmw
|
||||
openmw_add_executable(openmw
|
||||
${OPENMW_FILES}
|
||||
${GAME} ${GAME_HEADER}
|
||||
${APPLE_BUNDLE_RESOURCES}
|
||||
|
|
|
@ -17,7 +17,7 @@ if (GTEST_FOUND)
|
|||
|
||||
source_group(apps\\openmw_test_suite FILES openmw_test_suite.cpp ${UNITTEST_SRC_FILES})
|
||||
|
||||
add_executable(openmw_test_suite openmw_test_suite.cpp ${UNITTEST_SRC_FILES})
|
||||
openmw_add_executable(openmw_test_suite openmw_test_suite.cpp ${UNITTEST_SRC_FILES})
|
||||
|
||||
target_link_libraries(openmw_test_suite ${GTEST_BOTH_LIBRARIES} components)
|
||||
# Fix for not visible pthreads functions for linker with glibc 2.15
|
||||
|
|
|
@ -96,7 +96,7 @@ if (OPENMW_USE_UNSHIELD)
|
|||
include_directories(${LIBUNSHIELD_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
add_executable(openmw-wizard
|
||||
openmw_add_executable(openmw-wizard
|
||||
${GUI_TYPE}
|
||||
${WIZARD}
|
||||
${WIZARD_HEADER}
|
||||
|
|
|
@ -142,3 +142,32 @@ foreach (u ${ARGN})
|
|||
add_hdr (OPENCS ${dir} ${u})
|
||||
endforeach (u)
|
||||
endmacro (opencs_hdrs_noqt)
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
macro (openmw_add_executable target)
|
||||
set(OMW_ADD_EXE_OPTIONS WIN32 MACOSX_BUNDLE EXCLUDE_FROM_ALL)
|
||||
set(OMW_ADD_EXE_VALUES)
|
||||
set(OMW_ADD_EXE_MULTI_VALUES)
|
||||
cmake_parse_arguments(OMW_ADD_EXE "${OMW_ADD_EXE_OPTIONS}" "${OMW_ADD_EXE_VALUES}" "${OMW_ADD_EXE_MULTI_VALUES}" ${ARGN})
|
||||
|
||||
if (OMW_ADD_EXE_WIN32)
|
||||
set(OMW_ADD_EXE_WIN32_VALUE WIN32)
|
||||
endif (OMW_ADD_EXE_WIN32)
|
||||
|
||||
if (OMW_ADD_EXE_MACOSX_BUNDLE)
|
||||
set(OMW_ADD_EXE_MACOSX_BUNDLE_VALUE MACOSX_BUNDLE)
|
||||
endif (OMW_ADD_EXE_MACOSX_BUNDLE)
|
||||
|
||||
if (OMW_ADD_EXE_EXCLUDE_FROM_ALL)
|
||||
set(OMW_ADD_EXE_EXCLUDE_FROM_ALL_VALUE EXCLUDE_FROM_ALL)
|
||||
endif (OMW_ADD_EXE_EXCLUDE_FROM_ALL)
|
||||
|
||||
add_executable(${target} ${OMW_ADD_EXE_WIN32_VALUE} ${OMW_ADD_EXE_MACOSX_BUNDLE_VALUE} ${OMW_ADD_EXE_EXCLUDE_FROM_ALL_VALUE} ${OMW_ADD_EXE_UNPARSED_ARGUMENTS})
|
||||
|
||||
if (MSVC)
|
||||
if (CMAKE_VERSION VERSION_GREATER 3.8 OR CMAKE_VERSION VERSION_EQUAL 3.8)
|
||||
set_target_properties(${target} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(TargetDir)")
|
||||
endif (CMAKE_VERSION VERSION_GREATER 3.8 OR CMAKE_VERSION VERSION_EQUAL 3.8)
|
||||
endif (MSVC)
|
||||
endmacro (openmw_add_executable)
|
||||
|
|
Loading…
Reference in a new issue