From 40669d7a637c7b4ac0b9c1a0c89875b7d76d65af Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Fri, 20 Jul 2018 13:29:18 -0500 Subject: [PATCH] Change CMakeSettings.json to use Ninja. Add DFHACK_INCLUDE_CORE option for easier development. --- CMakeLists.txt | 39 +++++++++++++++++++ CMakeSettings.json | 95 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 109 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3237dabdd..e05e5cf2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -493,6 +493,45 @@ endif() set(CPACK_PACKAGE_FILE_NAME "dfhack-${DFHACK_VERSION}-${DFHACK_BUILD_ID_PACKAGE}${DFHACK_PACKAGE_PLATFORM_NAME}-${DFHACK_BUILD_ARCH}${DFHACK_PACKAGE_SUFFIX}") INCLUDE(CPack) +OPTION(DFHACK_INCLUDE_CORE "Download and include Dwarf Fortress core files in DFHack. Useful for local testing, but should not be used in releases." OFF) +IF(DFHACK_INCLUDE_CORE) + STRING(REPLACE "." "_" DF_CORE_FILENAME "${DF_VERSION}") + STRING(REGEX REPLACE "^0_" "df_" DF_CORE_FILENAME "${DF_CORE_FILENAME}") + IF(UNIX) + IF(APPLE) + STRING(APPEND DF_CORE_FILENAME "_osx") + ELSE() + STRING(APPEND DF_CORE_FILENAME "_linux") + ENDIF() + IF(DFHACK_BUILD_32) + STRING(APPEND DF_CORE_FILENAME "32") + ENDIF() + STRING(APPEND DF_CORE_FILENAME ".tar.bz2") + ELSE() + STRING(APPEND DF_CORE_FILENAME "_win") + IF(DFHACK_BUILD_32) + STRING(APPEND DF_CORE_FILENAME "32") + ENDIF() + STRING(APPEND DF_CORE_FILENAME ".zip") + ENDIF() + SET(DF_CORE_URL "http://bay12games.com/dwarves/${DF_CORE_FILENAME}") + IF (NOT EXISTS "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}") + FILE(DOWNLOAD "${DF_CORE_URL}" "${CMAKE_BINARY_DIR}/${DF_CORE_FILENAME}" SHOW_PROGRESS) + ENDIF() + FILE(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/df-core") + FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/df-core") + IF(UNIX) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xjf "../${DF_CORE_FILENAME}" --strip-components=1 + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core") + ELSE() + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "../${DF_CORE_FILENAME}" --format=zip + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/df-core") + FILE(REMOVE "${CMAKE_BINARY_DIR}/df-core/SDL.dll") + ENDIF() + INSTALL(DIRECTORY "${CMAKE_BINARY_DIR}/df-core/" + DESTINATION .) +ENDIF() + #INCLUDE(FindSphinx.cmake) # Store old build arch diff --git a/CMakeSettings.json b/CMakeSettings.json index eef8fdb2e..db45456ee 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -1,11 +1,36 @@ { - // See https://go.microsoft.com//fwlink/?linkid=834763 for more information about this file. + "environments": [ + { + "environment": "msvc_2015_x86", + "PATH": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64_x86;${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64;${env.ProgramFiles(x86)}\\Windows Kits\\10\\bin\\x86;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\bin\\x86;${env.PATH}", + "VS140COMNTOOLS": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\Common7\\Tools\\", + "VCINSTALLDIR": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\", + "WindowsSdkDir": "${env.ProgramFiles(x86)}\\Windows Kits\\10\\", + "UCRTVersion": "10.0.10240.0", + "UniversalCRTSdkDir": "${env.ProgramFiles(x86)}\\Windows Kits\\10\\", + "LIB": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\LIB;${env.ProgramFiles(x86)}\\Windows Kits\\10\\lib\\10.0.10240.0\\ucrt\\x86;${env.ProgramFiles(x86)}\\Windows Kits\\10\\lib\\um\\x86;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\x86", + "INCLUDE": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\INCLUDE;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\shared;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\um;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\winrt;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Include\\um;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Include\\shared", + "LIBPATH": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\LIB" + }, + { + "environment": "msvc_2015_x64", + "PATH": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64;${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN;${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\BIN\\1033;${env.ProgramFiles(x86)}\\Windows Kits\\bin\\x64;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\bin\\x64;${env.PATH}", + "VS140COMNTOOLS": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\Common7\\Tools\\", + "VCINSTALLDIR": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\", + "WindowsSdkDir": "${env.ProgramFiles(x86)}\\Windows Kits\\10\\", + "UCRTVersion": "10.0.10240.0", + "UniversalCRTSdkDir": "${env.ProgramFiles(x86)}\\Windows Kits\\10\\", + "LIB": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\LIB\\amd64;${env.ProgramFiles(x86)}\\Windows Kits\\10\\lib\\10.0.10240.0\\ucrt\\x64;${env.ProgramFiles(x86)}\\Windows Kits\\10\\lib\\um\\x64;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Lib\\winv6.3\\um\\x64", + "INCLUDE": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\INCLUDE;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\shared;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\um;${env.ProgramFiles(x86)}\\Windows Kits\\10\\include\\winrt;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Include\\um;${env.ProgramFiles(x86)}\\Windows Kits\\8.1\\Include\\shared", + "LIBPATH": "${env.ProgramFiles(x86)}\\Microsoft Visual Studio 14.0\\VC\\LIB\\amd64" + } + ], "configurations": [ { "name": "MSVC 32 Debug", - "generator": "Visual Studio 14 2015", + "generator": "Ninja", "configurationType": "RelWithDebInfo", - "intelliSenseMode": "windows-msvc-x86", + "inheritEnvironments": [ "msvc_2015_x86" ], "variables": [ { "name": "DFHACK_BUILD_ARCH", @@ -18,15 +43,18 @@ { "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", "value": "0" + }, + { + "name": "DFHACK_INCLUDE_CORE", + "value": "1" } - ], - "installRoot": "${thisFileDir}/build/win32/DF" + ] }, { "name": "MSVC 32 Release", - "generator": "Visual Studio 14 2015", + "generator": "Ninja", "configurationType": "Release", - "intelliSenseMode": "windows-msvc-x86", + "inheritEnvironments": [ "msvc_2015_x86" ], "variables": [ { "name": "DFHACK_BUILD_ARCH", @@ -36,14 +64,13 @@ "name": "BUILD_STONESENSE", "value": "1" } - ], - "installRoot": "${thisFileDir}/build/win32/DF" + ] }, { "name": "MSVC 64 Debug", - "generator": "Visual Studio 14 2015 Win64", + "generator": "Ninja", "configurationType": "RelWithDebInfo", - "intelliSenseMode": "windows-msvc-x64", + "inheritEnvironments": [ "msvc_2015_x64" ], "variables": [ { "name": "DFHACK_BUILD_ARCH", @@ -56,15 +83,18 @@ { "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", "value": "0" + }, + { + "name": "DFHACK_INCLUDE_CORE", + "value": "1" } - ], - "installRoot": "${thisFileDir}/build/win64/DF" + ] }, { "name": "MSVC 64 Release", - "generator": "Visual Studio 14 2015 Win64", + "generator": "Ninja", "configurationType": "Release", - "intelliSenseMode": "windows-msvc-x64", + "inheritEnvironments": [ "msvc_2015_x64" ], "variables": [ { "name": "DFHACK_BUILD_ARCH", @@ -74,8 +104,7 @@ "name": "BUILD_STONESENSE", "value": "1" } - ], - "installRoot": "${thisFileDir}/build/win64/DF" + ] }, { "name": "GCC 32 Debug", @@ -85,7 +114,7 @@ "rsyncCommandArgs": "--exclude=build --include=.git", "remoteCopySources": true, "cmakeExecutable": "$(which cmake)/..", - "generator": "Unix Makefiles", + "generator": "Ninja", "configurationType": "RelWithDebInfo", "intelliSenseMode": "linux-gcc-x86", "variables": [ @@ -100,6 +129,10 @@ { "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", "value": "0" + }, + { + "name": "DFHACK_INCLUDE_CORE", + "value": "1" } ] }, @@ -111,7 +144,7 @@ "rsyncCommandArgs": "--exclude=build --include=.git", "remoteCopySources": true, "cmakeExecutable": "$(which cmake)/..", - "generator": "Unix Makefiles", + "generator": "Ninja", "configurationType": "Release", "intelliSenseMode": "linux-gcc-x86", "variables": [ @@ -133,7 +166,7 @@ "rsyncCommandArgs": "--exclude=build --include=.git", "remoteCopySources": true, "cmakeExecutable": "$(which cmake)/..", - "generator": "Unix Makefiles", + "generator": "Ninja", "configurationType": "RelWithDebInfo", "intelliSenseMode": "linux-gcc-x64", "variables": [ @@ -148,6 +181,10 @@ { "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", "value": "0" + }, + { + "name": "DFHACK_INCLUDE_CORE", + "value": "1" } ] }, @@ -159,7 +196,7 @@ "rsyncCommandArgs": "--exclude=build --include=.git", "remoteCopySources": true, "cmakeExecutable": "$(which cmake)/..", - "generator": "Unix Makefiles", + "generator": "Ninja", "configurationType": "Release", "intelliSenseMode": "linux-gcc-x64", "variables": [ @@ -181,7 +218,7 @@ "rsyncCommandArgs": "--exclude=build --include=.git", "remoteCopySources": true, "cmakeExecutable": "$(which cmake)/..", - "generator": "Unix Makefiles", + "generator": "Ninja", "configurationType": "RelWithDebInfo", "intelliSenseMode": "linux-gcc-x86", "variables": [ @@ -204,6 +241,10 @@ { "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", "value": "0" + }, + { + "name": "DFHACK_INCLUDE_CORE", + "value": "1" } ] }, @@ -215,7 +256,7 @@ "rsyncCommandArgs": "--exclude=build --include=.git", "remoteCopySources": true, "cmakeExecutable": "$(which cmake)/..", - "generator": "Unix Makefiles", + "generator": "Ninja", "configurationType": "Release", "intelliSenseMode": "linux-gcc-x86", "variables": [ @@ -245,7 +286,7 @@ "rsyncCommandArgs": "--exclude=build --include=.git", "remoteCopySources": true, "cmakeExecutable": "$(which cmake)/..", - "generator": "Unix Makefiles", + "generator": "Ninja", "configurationType": "RelWithDebInfo", "intelliSenseMode": "linux-gcc-x64", "variables": [ @@ -268,6 +309,10 @@ { "name": "REMOVE_SYMBOLS_FROM_DF_STUBS", "value": "0" + }, + { + "name": "DFHACK_INCLUDE_CORE", + "value": "1" } ] }, @@ -279,7 +324,7 @@ "rsyncCommandArgs": "--exclude=build --include=.git", "remoteCopySources": true, "cmakeExecutable": "$(which cmake)/..", - "generator": "Unix Makefiles", + "generator": "Ninja", "configurationType": "Release", "intelliSenseMode": "linux-gcc-x64", "variables": [