2023-06-03 20:29:35 -05:00
################# Initialize Common Variables ###################
2025-10-29 02:15:14 +00:00
if ( NOT DEFINED ENV{VCPKG_ROOT} )
2025-12-20 12:25:06 -06:00
set ( VCPKG_ROOT "${CMAKE_BINARY_DIR}/vcpkg" CACHE PATH "VCPKG Root" )
if ( NOT EXISTS "${VCPKG_ROOT}" )
message ( STATUS "Bootstrapping vcpkg..." )
if ( GIT_IN_USE )
execute_process (
C O M M A N D g i t c l o n e h t t p s : / / g i t h u b . c o m / m i c r o s o f t / v c p k g . g i t " $ { V C P K G _ R O O T } "
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ B I N A R Y _ D I R } " )
else ( )
set ( VCPKG_MANIFEST_MODE OFF CACHE BOOL "Disable vcpkg manifest mode" FORCE )
set ( VCPKG_ZIP_FILE "${CMAKE_BINARY_DIR}/vcpkg.zip" )
set ( VCPKG_EXTRACT_DEST "${CMAKE_BINARY_DIR}/vcpkg-extracted-temp" )
# Use file(DOWNLOAD) to fetch the source archive
if ( NOT EXISTS "${VCPKG_ZIP_FILE}" )
message ( STATUS "Downloading vcpkg source archive..." )
file ( DOWNLOAD "https://github.com/microsoft/vcpkg/archive/refs/heads/master.zip" "${VCPKG_ZIP_FILE}"
S H O W _ P R O G R E S S )
message ( STATUS "Downloading vcpkg source archive... done" )
endif ( )
# Use file(ARCHIVE_EXTRACT) to unzip the source
if ( NOT EXISTS "${VCPKG_EXTRACT_DEST}" )
message ( STATUS "Extracting vcpkg archive..." )
file ( ARCHIVE_EXTRACT INPUT "${VCPKG_ZIP_FILE}" DESTINATION "${VCPKG_EXTRACT_DEST}" )
# Move the extracted content (which is in a directory like vcpkg-master)
# to the desired VCPKG_ROOT path defined in your original script.
file ( GLOB VCPKG_SOURCE_DIR_TMP "${VCPKG_EXTRACT_DEST}/vcpkg-*" )
file ( RENAME "${VCPKG_SOURCE_DIR_TMP}" "${VCPKG_ROOT}" )
message ( STATUS "Extracting vcpkg archive... done" )
endif ( )
endif ( )
if ( WIN32 )
execute_process ( COMMAND "${VCPKG_ROOT}/bootstrap-vcpkg.bat" )
else ( )
execute_process ( COMMAND "${VCPKG_ROOT}/bootstrap-vcpkg.sh" )
endif ( )
2025-10-29 01:40:27 +00:00
endif ( )
2025-10-29 02:15:14 +00:00
else ( )
file ( TO_CMAKE_PATH $ENV{ VCPKG_ROOT } VCPKG_ROOT )
2025-10-29 01:40:27 +00:00
endif ( )
set ( CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file" )
if ( WIN32 )
if ( GIT_CI_BUILD )
set ( VCPKG_TARGET_TRIPLET "x64-windows-mixed-release" CACHE STRING "" )
else ( )
set ( VCPKG_TARGET_TRIPLET "x64-windows-mixed" CACHE STRING "" )
endif ( )
2023-06-03 20:29:35 -05:00
2025-10-29 01:40:27 +00:00
else ( )
if ( APPLE )
if ( GIT_CI_BUILD )
set ( VCPKG_TARGET_TRIPLET "universal-osx-11-release" CACHE STRING "" )
else ( )
set ( VCPKG_TARGET_TRIPLET "universal-osx-11" CACHE STRING "" )
endif ( )
endif ( APPLE )
if ( UNIX AND NOT APPLE )
if ( GIT_CI_BUILD )
set ( VCPKG_TARGET_TRIPLET "x64-linux-mixed-release" CACHE STRING "" )
else ( )
set ( VCPKG_TARGET_TRIPLET "x64-linux-mixed" CACHE STRING "" )
endif ( )
endif ( )
endif ( )
set ( VCPKG_OVERLAY_TRIPLETS "${CMAKE_SOURCE_DIR}/Tools/CMake/vcpkg/triplets" CACHE STRING "" )
set ( VCPKG_OVERLAY_PORTS "${CMAKE_SOURCE_DIR}/Tools/CMake/vcpkg/ports" CACHE STRING "" )
2025-10-29 02:19:03 +00:00
set ( VCPKG_INSTALL_OPTIONS "--clean-after-build" CACHE STRING "" )
2025-10-29 01:40:27 +00:00
set ( ENV{VCPKG_LIB_SOURCE_ROOT} "${CMAKE_SOURCE_DIR}/Engine/lib" )
set ( ENV{VCPKG_KEEP_ENV_VARS} "VCPKG_LIB_SOURCE_ROOT" )
2023-06-03 20:29:35 -05:00
# All include directories to search. Modules should append to this when they want includes to point
# into themselves.
set ( TORQUE_INCLUDE_DIRECTORIES "" )
2025-12-20 12:25:06 -06:00
if ( NOT GIT_IN_USE )
execute_process (
C O M M A N D v c p k g i n s t a l l
- - c l a s s i c
- - t r i p l e t = $ { V C P K G _ T A R G E T _ T R I P L E T }
- - o v e r l a y - p o r t s = $ { V C P K G _ O V E R L A Y _ P O R T S }
- - o v e r l a y - t r i p l e t s = $ { V C P K G _ O V E R L A Y _ T R I P L E T S }
l i b f l a c l i b o g g l i b s n d f i l e [ e x t e r n a l - l i b s ] l i b t h e o r a l i b v o r b i s o p u s
W O R K I N G _ D I R E C T O R Y $ { V C P K G _ R O O T } )
endif ( )
2023-06-03 20:29:35 -05:00
# All library binaries to install. Modules should append to this the path of any library binaries (.so, .dylib, .dll)
# that should be installed next to the executable.
set ( TORQUE_ADDITIONAL_LIBRARY_BINARIES "" )
# All compile definitions. Modules should append to this if there is any special defines needed.
set ( TORQUE_COMPILE_DEFINITIONS ICE_NO_DLL PCRE_STATIC TORQUE_ADVANCED_LIGHTING TORQUE_SHADERGEN
T O R Q U E _ O P C O D E T O R Q U E _ A S S I M P T O R Q U E _ S D L T O R Q U E _ C O L L A D A
T O R Q U E _ U N I C O D E U N I C O D E _ U N I C O D E )
# All link libraries. Modules should append to this the path to specify additional link libraries (.a, .lib, .dylib, .so)
2025-12-31 11:00:07 +00:00
set ( TORQUE_LINK_LIBRARIES png_static tinyxml2 collada squish opcode assimp SDL2 glad pcre convexMath zlib )
2023-06-03 20:29:35 -05:00
2023-07-24 12:38:36 +01:00
if ( TORQUE_TESTING )
set ( TORQUE_LINK_LIBRARIES ${ TORQUE_LINK_LIBRARIES } gtest gmock )
endif ( )
2023-06-04 12:45:55 -05:00
if ( NOT WIN32 )
2023-07-24 12:59:27 +01:00
set ( WIN32 OFF CACHE BOOL "" FORCE )
2023-06-04 12:45:55 -05:00
endif ( )
mark_as_advanced ( WIN32 )
2023-06-03 10:42:04 -05:00
#general
advanced_option ( TORQUE_MULTITHREAD "Multi Threading" ON )
advanced_option ( TORQUE_DISABLE_MEMORY_MANAGER "Disable memory manager" ON )
2023-10-08 23:16:43 +02:00
set ( TORQUE_ENTRY_FUNCTION "" CACHE STRING "Specify a console function to execute instead of looking for a main.tscript file" )
mark_as_advanced ( TORQUE_ENTRY_FUNCTION )
2023-06-03 13:47:36 -05:00
2023-06-03 10:42:04 -05:00
#fileIO
set ( TORQUE_APP_PASSWORD "changeme" CACHE STRING "zip file password" )
advanced_option ( TORQUE_DISABLE_VIRTUAL_MOUNT_SYSTEM "Disable virtual mount system" OFF )
advanced_option ( TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP "Disable reading root path from zip. Zips will be mounted in-place with file name as directory name." ON )
advanced_option ( TORQUE_ZIP_DISK_LAYOUT "All zips must be placed in the executable directory and contain full paths to the files." OFF )
advanced_option ( TORQUE_POSIX_PATH_CASE_INSENSITIVE "POSIX Pathing Case Insensitivity" ON )
advanced_option ( TORQUE_ZIP_PATH_CASE_INSENSITIVE "ZIP Pathing Case Insensitivity" ON )
advanced_option ( TORQUE_USE_ZENITY "use the Zenity backend for NFD" OFF )
2023-06-03 13:47:36 -05:00
advanced_option ( TORQUE_SECURE_VFS "Secure VFS configuration. Arbitrary script access to file system will be heavily restricted." OFF )
#sfx
2023-06-03 10:42:04 -05:00
advanced_option ( TORQUE_SFX_VORBIS "Vorbis Sound" ON )
advanced_option ( TORQUE_THEORA "Theora Video Support" ON )
advanced_option ( TORQUE_SFX_OPENAL "OpenAL Sound" ON )
2023-06-03 13:47:36 -05:00
2023-06-03 10:42:04 -05:00
#gfx
advanced_option ( TORQUE_DEBUG_GFX_MODE "triggers graphics debug mode" OFF )
advanced_option ( TORQUE_ADVANCED_LIGHTING "Advanced Lighting" ON )
advanced_option ( TORQUE_BASIC_LIGHTING "Basic Lighting" ON )
2023-06-03 13:47:36 -05:00
advanced_option ( TORQUE_OPENGL "Allow OpenGL render" ON ) # we need OpenGL to render on Linux/Mac
if ( WIN32 )
advanced_option ( TORQUE_D3D11 "Allow Direct3D 11 render" ON )
addDef ( TORQUE_D3D11 )
endif ( )
2023-06-03 10:42:04 -05:00
#mode
advanced_option ( TORQUE_NO_DSO_GENERATION "skip storing compiled scripts" ON )
advanced_option ( TORQUE_DYNAMIC_LIBRARY "Whether or not to build Torque as a dynamic library." OFF )
advanced_option ( TORQUE_PLAYER "Playback only?" OFF )
advanced_option ( TORQUE_DEBUG "T3D Debug mode" OFF )
#option(DEBUG_SPEW "more debug" OFF)
advanced_option ( TORQUE_SHIPPING "T3D Shipping build?" OFF )
2023-06-03 13:47:36 -05:00
advanced_option ( TORQUE_DEDICATED "Torque dedicated" OFF ) # disables compiling in gfx and sfx frontend functionality
2023-06-03 10:42:04 -05:00
#tools
advanced_option ( TORQUE_DEBUG_NET "debug network" OFF )
advanced_option ( TORQUE_DEBUG_NET_MOVES "debug network moves" OFF )
advanced_option ( TORQUE_ENABLE_ASSERTS "enables or disable asserts" OFF )
advanced_option ( TORQUE_TOOLS "Enable or disable the tools" ON )
2024-09-01 16:55:58 -05:00
advanced_option ( TORQUE_TOOLS_EXT_COMMANDS "Enable or disable some extended functionality like shell commands or free write access" OFF )
2023-06-03 10:42:04 -05:00
advanced_option ( TORQUE_ENABLE_PROFILER "Enable or disable the profiler" OFF )
advanced_option ( TORQUE_SHOW_LEGACY_FILE_FIELDS "If on, shows legacy direct file path fields in the inspector." OFF )
2024-08-01 18:29:38 +01:00
advanced_option ( USE_TEMPLATE_MATRIX "Set to true to use the new templated matrix class(still in beta)." OFF )
2023-07-24 12:38:36 +01:00
#testing
advanced_option ( TORQUE_TESTING "Unit test build" OFF )
2023-06-03 10:42:04 -05:00
setupVersionNumbers ( )