ran cmake-format on CMakeLists.txt
it all being uppercase was insane
This commit is contained in:
parent
a1bcfe5f35
commit
edcefdc58b
@ -1,448 +1,486 @@
|
||||
CMAKE_MINIMUM_REQUIRED (VERSION 3.16)
|
||||
cmake_minimum_required(VERSION 3.27)
|
||||
|
||||
# Find CCache
|
||||
FIND_PROGRAM(CCACHE_PATH ccache)
|
||||
IF (CCACHE_PATH)
|
||||
SET (CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PATH}")
|
||||
SET (CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PATH}")
|
||||
MESSAGE (STATUS "Using CCache")
|
||||
ELSE ()
|
||||
MESSAGE (STATUS "Not using CCache")
|
||||
ENDIF ()
|
||||
find_program(CCACHE_PATH ccache)
|
||||
if(CCACHE_PATH)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PATH}")
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PATH}")
|
||||
message(STATUS "Using CCache")
|
||||
else()
|
||||
message(STATUS "Not using CCache")
|
||||
endif()
|
||||
|
||||
project(starbound)
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake)
|
||||
|
||||
PROJECT (starbound)
|
||||
SET (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake)
|
||||
|
||||
SET (CMAKE_CONFIGURATION_TYPES Debug RelWithAsserts RelWithDebInfo Release)
|
||||
SET (CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
|
||||
SET (CMAKE_EXE_LINKER_FLAGS_RELWITHASSERTS "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug RelWithAsserts RelWithDebInfo Release)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS
|
||||
ON
|
||||
CACHE INTERNAL "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHASSERTS
|
||||
""
|
||||
CACHE STRING "" FORCE)
|
||||
# Update the docstring on CMAKE_BUILD_TYPE to show what options we actually
|
||||
# allow
|
||||
# SET (CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Choose the type of build, options are: Debug RelWithAsserts RelWithDebInfo Release" FORCE)
|
||||
# allow SET (CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Choose the
|
||||
# type of build, options are: Debug RelWithAsserts RelWithDebInfo Release"
|
||||
# FORCE)
|
||||
|
||||
# Discover all the relevant environment / system information and place the
|
||||
# result in STAR_* cmake variables.
|
||||
|
||||
# STAR_SOURCE_IDENTIFIER may be set to any string value
|
||||
IF (NOT DEFINED STAR_SOURCE_IDENTIFIER)
|
||||
INCLUDE (GetGitRevisionDescription)
|
||||
GET_GIT_HEAD_REVISION (STAR_GIT_REFSPEC STAR_GIT_HASHVAR)
|
||||
SET (STAR_SOURCE_IDENTIFIER "${STAR_GIT_HASHVAR}")
|
||||
ENDIF ()
|
||||
if(NOT DEFINED STAR_SOURCE_IDENTIFIER)
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(STAR_GIT_REFSPEC STAR_GIT_HASHVAR)
|
||||
set(STAR_SOURCE_IDENTIFIER "${STAR_GIT_HASHVAR}")
|
||||
endif()
|
||||
|
||||
# Architecture identifier, like i386, x86_64 or ppc
|
||||
IF (NOT DEFINED STAR_ARCHITECTURE)
|
||||
INCLUDE (TargetArch)
|
||||
TARGET_ARCHITECTURE (STAR_ARCHITECTURE)
|
||||
ENDIF ()
|
||||
if(NOT DEFINED STAR_ARCHITECTURE)
|
||||
include(TargetArch)
|
||||
target_architecture(STAR_ARCHITECTURE)
|
||||
endif()
|
||||
|
||||
# Either TRUE or FALSE
|
||||
IF (NOT DEFINED STAR_LITTLE_ENDIAN)
|
||||
INCLUDE (TestBigEndian)
|
||||
TEST_BIG_ENDIAN (BIGENDIAN)
|
||||
IF (NOT BIGENDIAN)
|
||||
SET (STAR_LITTLE_ENDIAN TRUE)
|
||||
ELSE ()
|
||||
SET (STAR_LITTLE_ENDIAN FALSE)
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
if(NOT DEFINED STAR_LITTLE_ENDIAN)
|
||||
include(TestBigEndian)
|
||||
test_big_endian(BIGENDIAN)
|
||||
if(NOT BIGENDIAN)
|
||||
set(STAR_LITTLE_ENDIAN TRUE)
|
||||
else()
|
||||
set(STAR_LITTLE_ENDIAN FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# System name, like windows, macos, linux, freebsd, or (generic) unix
|
||||
IF (NOT DEFINED STAR_SYSTEM)
|
||||
IF (WIN32)
|
||||
SET (STAR_SYSTEM "windows")
|
||||
ELSEIF (APPLE AND ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
SET (STAR_SYSTEM "macos")
|
||||
ELSEIF (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
SET (STAR_SYSTEM "linux")
|
||||
ELSEIF (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
SET (STAR_SYSTEM "freebsd")
|
||||
ELSEIF (UNIX)
|
||||
SET (STAR_SYSTEM "unix")
|
||||
ELSE ()
|
||||
SET (STAR_SYSTEM "unknown")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
if(NOT DEFINED STAR_SYSTEM)
|
||||
if(WIN32)
|
||||
set(STAR_SYSTEM "windows")
|
||||
elseif(APPLE AND ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
set(STAR_SYSTEM "macos")
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(STAR_SYSTEM "linux")
|
||||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
set(STAR_SYSTEM "freebsd")
|
||||
elseif(UNIX)
|
||||
set(STAR_SYSTEM "unix")
|
||||
else()
|
||||
set(STAR_SYSTEM "unknown")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF (NOT DEFINED STAR_SYSTEM_FAMILY)
|
||||
IF (WIN32)
|
||||
SET (STAR_SYSTEM_FAMILY "windows")
|
||||
ELSEIF (UNIX)
|
||||
SET (STAR_SYSTEM_FAMILY "unix")
|
||||
ELSE ()
|
||||
SET (STAR_SYSTEM_FAMILY "unknown")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
if(NOT DEFINED STAR_SYSTEM_FAMILY)
|
||||
if(WIN32)
|
||||
set(STAR_SYSTEM_FAMILY "windows")
|
||||
elseif(UNIX)
|
||||
set(STAR_SYSTEM_FAMILY "unix")
|
||||
else()
|
||||
set(STAR_SYSTEM_FAMILY "unknown")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# C/C++ compiler ID, like clang, gnu, or msvc
|
||||
IF (NOT DEFINED STAR_COMPILER)
|
||||
IF (NOT CMAKE_C_COMPILER_ID STREQUAL CMAKE_CXX_COMPILER_ID)
|
||||
MESSAGE (FATAL_ERROR "C and C++ compiler id do not match, unsupported build configuration")
|
||||
ENDIF ()
|
||||
if(NOT DEFINED STAR_COMPILER)
|
||||
if(NOT CMAKE_C_COMPILER_ID STREQUAL CMAKE_CXX_COMPILER_ID)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"C and C++ compiler id do not match, unsupported build configuration")
|
||||
endif()
|
||||
|
||||
IF (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
SET (STAR_COMPILER "clang")
|
||||
ELSEIF (CMAKE_COMPILER_IS_GNUC)
|
||||
SET (STAR_COMPILER "gnu")
|
||||
ELSEIF (MSVC)
|
||||
SET (STAR_COMPILER "msvc")
|
||||
ELSE ()
|
||||
STRING (TOLOWER "${CMAKE_C_COMPILER_ID}" STAR_COMPILER)
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(STAR_COMPILER "clang")
|
||||
elseif(CMAKE_COMPILER_IS_GNUC)
|
||||
set(STAR_COMPILER "gnu")
|
||||
elseif(MSVC)
|
||||
set(STAR_COMPILER "msvc")
|
||||
else()
|
||||
string(TOLOWER "${CMAKE_C_COMPILER_ID}" STAR_COMPILER)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Enable OPTIONs based on the discovered system / environment...
|
||||
|
||||
IF (STAR_COMPILER STREQUAL "gnu")
|
||||
OPTION (STAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX "Statically link libgcc and libstdc++" OFF)
|
||||
OPTION (STAR_ENABLE_GCC_PROFILING "Enable gcc/g++ profiling via the -pg flag" OFF)
|
||||
OPTION (STAR_ENABLE_GLIBCXX_DEBUG "Enable _GLIBCXX_DEBUG for g++" OFF)
|
||||
ENDIF ()
|
||||
if(STAR_COMPILER STREQUAL "gnu")
|
||||
option(STAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX
|
||||
"Statically link libgcc and libstdc++" OFF)
|
||||
option(STAR_ENABLE_GCC_PROFILING "Enable gcc/g++ profiling via the -pg flag"
|
||||
OFF)
|
||||
option(STAR_ENABLE_GLIBCXX_DEBUG "Enable _GLIBCXX_DEBUG for g++" OFF)
|
||||
endif()
|
||||
|
||||
IF (STAR_COMPILER STREQUAL "msvc")
|
||||
OPTION (STAR_ENABLE_STATIC_MSVC_RUNTIME "Statically link with the CRT" OFF)
|
||||
ENDIF ()
|
||||
if(STAR_COMPILER STREQUAL "msvc")
|
||||
option(STAR_ENABLE_STATIC_MSVC_RUNTIME "Statically link with the CRT" OFF)
|
||||
endif()
|
||||
|
||||
OPTION (STAR_BUILD_GUI "Build GUI utilities and Client" ON)
|
||||
option(STAR_BUILD_GUI "Build GUI utilities and Client" ON)
|
||||
|
||||
IF (STAR_BUILD_GUI)
|
||||
OPTION (STAR_BUILD_QT_TOOLS "Build GUI utilities that require Qt" OFF)
|
||||
OPTION (STAR_ENABLE_STEAM_INTEGRATION "Use Steam platform services" OFF)
|
||||
OPTION (STAR_ENABLE_DISCORD_INTEGRATION "Use Discord platform services" OFF)
|
||||
ENDIF ()
|
||||
if(STAR_BUILD_GUI)
|
||||
option(STAR_BUILD_QT_TOOLS "Build GUI utilities that require Qt" OFF)
|
||||
option(STAR_ENABLE_STEAM_INTEGRATION "Use Steam platform services" OFF)
|
||||
option(STAR_ENABLE_DISCORD_INTEGRATION "Use Discord platform services" OFF)
|
||||
endif()
|
||||
|
||||
OPTION (STAR_LUA_APICHECK "Use lua api checks" OFF)
|
||||
OPTION (STAR_USE_JEMALLOC "Use jemalloc allocators" OFF)
|
||||
option(STAR_LUA_APICHECK "Use lua api checks" OFF)
|
||||
option(STAR_USE_JEMALLOC "Use jemalloc allocators" OFF)
|
||||
|
||||
# Report all the discovered system / environment settings and all options.
|
||||
|
||||
MESSAGE (STATUS "Source ID: ${STAR_SOURCE_IDENTIFIER}")
|
||||
MESSAGE (STATUS "Architecture: ${STAR_ARCHITECTURE}")
|
||||
MESSAGE (STATUS "Little Endian: ${STAR_LITTLE_ENDIAN}")
|
||||
MESSAGE (STATUS "System: ${STAR_SYSTEM}")
|
||||
MESSAGE (STATUS "System family: ${STAR_SYSTEM_FAMILY}")
|
||||
MESSAGE (STATUS "C/C++ compiler: ${STAR_COMPILER}")
|
||||
message(STATUS "Source ID: ${STAR_SOURCE_IDENTIFIER}")
|
||||
message(STATUS "Architecture: ${STAR_ARCHITECTURE}")
|
||||
message(STATUS "Little Endian: ${STAR_LITTLE_ENDIAN}")
|
||||
message(STATUS "System: ${STAR_SYSTEM}")
|
||||
message(STATUS "System family: ${STAR_SYSTEM_FAMILY}")
|
||||
message(STATUS "C/C++ compiler: ${STAR_COMPILER}")
|
||||
|
||||
IF (DEFINED STAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX)
|
||||
MESSAGE (STATUS "Statically linking to libgcc / libstdc++: ${STAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX}")
|
||||
ENDIF ()
|
||||
if(DEFINED STAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX)
|
||||
message(
|
||||
STATUS
|
||||
"Statically linking to libgcc / libstdc++: ${STAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX}"
|
||||
)
|
||||
endif()
|
||||
|
||||
IF (DEFINED STAR_ENABLE_STATIC_MSVC_RUNTIME)
|
||||
MESSAGE (STATUS "Statically linking to CRT: ${STAR_ENABLE_STATIC_MSVC_RUNTIME}")
|
||||
ENDIF ()
|
||||
if(DEFINED STAR_ENABLE_STATIC_MSVC_RUNTIME)
|
||||
message(
|
||||
STATUS "Statically linking to CRT: ${STAR_ENABLE_STATIC_MSVC_RUNTIME}")
|
||||
endif()
|
||||
|
||||
IF (DEFINED STAR_ENABLE_GLIBCXX_DEBUG)
|
||||
MESSAGE (STATUS "Enabling _GLIBCXX_DEBUG: ${STAR_ENABLE_GLIBCXX_DEBUG}")
|
||||
ENDIF ()
|
||||
if(DEFINED STAR_ENABLE_GLIBCXX_DEBUG)
|
||||
message(STATUS "Enabling _GLIBCXX_DEBUG: ${STAR_ENABLE_GLIBCXX_DEBUG}")
|
||||
endif()
|
||||
|
||||
MESSAGE (STATUS "Building GUI: ${STAR_BUILD_GUI}")
|
||||
message(STATUS "Building GUI: ${STAR_BUILD_GUI}")
|
||||
|
||||
IF (DEFINED STAR_BUILD_QT_TOOLS)
|
||||
MESSAGE (STATUS "Building Qt tools: ${STAR_BUILD_QT_TOOLS}")
|
||||
ENDIF ()
|
||||
if(DEFINED STAR_BUILD_QT_TOOLS)
|
||||
message(STATUS "Building Qt tools: ${STAR_BUILD_QT_TOOLS}")
|
||||
endif()
|
||||
|
||||
IF (DEFINED STAR_ENABLE_STEAM_INTEGRATION)
|
||||
MESSAGE (STATUS "Using Steam platform services: ${STAR_ENABLE_STEAM_INTEGRATION}")
|
||||
ENDIF ()
|
||||
if(DEFINED STAR_ENABLE_STEAM_INTEGRATION)
|
||||
message(
|
||||
STATUS "Using Steam platform services: ${STAR_ENABLE_STEAM_INTEGRATION}")
|
||||
endif()
|
||||
|
||||
IF (DEFINED STAR_ENABLE_DISCORD_INTEGRATION)
|
||||
MESSAGE (STATUS "Using Discord platform services: ${STAR_ENABLE_DISCORD_INTEGRATION}")
|
||||
ENDIF ()
|
||||
if(DEFINED STAR_ENABLE_DISCORD_INTEGRATION)
|
||||
message(
|
||||
STATUS "Using Discord platform services: ${STAR_ENABLE_DISCORD_INTEGRATION}"
|
||||
)
|
||||
endif()
|
||||
|
||||
MESSAGE (STATUS "Using Lua API checks: ${STAR_LUA_APICHECK}")
|
||||
MESSAGE (STATUS "Using jemalloc: ${STAR_USE_JEMALLOC}")
|
||||
message(STATUS "Using Lua API checks: ${STAR_LUA_APICHECK}")
|
||||
message(STATUS "Using jemalloc: ${STAR_USE_JEMALLOC}")
|
||||
|
||||
# Set C defines and cmake variables based on the build settings we have now
|
||||
# determined...
|
||||
|
||||
# Set a cmake variable to true and define a corresponding C/C++ definition
|
||||
FUNCTION (SET_FLAG flagValue)
|
||||
SET (${flagValue} TRUE PARENT_SCOPE)
|
||||
ADD_DEFINITIONS (-D${flagValue})
|
||||
ENDFUNCTION ()
|
||||
function(SET_FLAG flagValue)
|
||||
set(${flagValue}
|
||||
TRUE
|
||||
PARENT_SCOPE)
|
||||
add_definitions(-D${flagValue})
|
||||
endfunction()
|
||||
|
||||
IF (STAR_LITTLE_ENDIAN)
|
||||
SET_FLAG (STAR_LITTLE_ENDIAN)
|
||||
ELSEIF ()
|
||||
SET_FLAG (STAR_BIG_ENDIAN)
|
||||
ENDIF ()
|
||||
if(STAR_LITTLE_ENDIAN)
|
||||
set_flag(STAR_LITTLE_ENDIAN)
|
||||
elseif()
|
||||
set_flag(STAR_BIG_ENDIAN)
|
||||
endif()
|
||||
|
||||
IF (STAR_ARCHITECTURE STREQUAL "i386")
|
||||
SET_FLAG (STAR_ARCHITECTURE_I386)
|
||||
ELSEIF (STAR_ARCHITECTURE STREQUAL "x86_64")
|
||||
SET_FLAG (STAR_ARCHITECTURE_X86_64)
|
||||
ENDIF ()
|
||||
if(STAR_ARCHITECTURE STREQUAL "i386")
|
||||
set_flag(STAR_ARCHITECTURE_I386)
|
||||
elseif(STAR_ARCHITECTURE STREQUAL "x86_64")
|
||||
set_flag(STAR_ARCHITECTURE_X86_64)
|
||||
endif()
|
||||
|
||||
IF (STAR_SYSTEM STREQUAL "windows")
|
||||
SET_FLAG (STAR_SYSTEM_WINDOWS)
|
||||
ELSEIF (STAR_SYSTEM STREQUAL "macos")
|
||||
SET_FLAG (STAR_SYSTEM_MACOS)
|
||||
ELSEIF (STAR_SYSTEM STREQUAL "linux")
|
||||
SET_FLAG (STAR_SYSTEM_LINUX)
|
||||
ELSEIF (STAR_SYSTEM STREQUAL "freebsd")
|
||||
SET_FLAG (STAR_SYSTEM_FREEBSD)
|
||||
ENDIF ()
|
||||
if(STAR_SYSTEM STREQUAL "windows")
|
||||
set_flag(STAR_SYSTEM_WINDOWS)
|
||||
elseif(STAR_SYSTEM STREQUAL "macos")
|
||||
set_flag(STAR_SYSTEM_MACOS)
|
||||
elseif(STAR_SYSTEM STREQUAL "linux")
|
||||
set_flag(STAR_SYSTEM_LINUX)
|
||||
elseif(STAR_SYSTEM STREQUAL "freebsd")
|
||||
set_flag(STAR_SYSTEM_FREEBSD)
|
||||
endif()
|
||||
|
||||
IF (STAR_SYSTEM_FAMILY STREQUAL "windows")
|
||||
SET_FLAG (STAR_SYSTEM_FAMILY_WINDOWS)
|
||||
ELSEIF (STAR_SYSTEM_FAMILY STREQUAL "unix")
|
||||
SET_FLAG (STAR_SYSTEM_FAMILY_UNIX)
|
||||
ENDIF ()
|
||||
if(STAR_SYSTEM_FAMILY STREQUAL "windows")
|
||||
set_flag(STAR_SYSTEM_FAMILY_WINDOWS)
|
||||
elseif(STAR_SYSTEM_FAMILY STREQUAL "unix")
|
||||
set_flag(STAR_SYSTEM_FAMILY_UNIX)
|
||||
endif()
|
||||
|
||||
IF (STAR_COMPILER STREQUAL "gnu")
|
||||
SET_FLAG (STAR_COMPILER_GNU)
|
||||
ELSEIF (STAR_COMPILER STREQUAL "clang")
|
||||
SET_FLAG (STAR_COMPILER_CLANG)
|
||||
ELSEIF (STAR_COMPILER STREQUAL "msvc")
|
||||
SET_FLAG (STAR_COMPILER_MSVC)
|
||||
ENDIF ()
|
||||
if(STAR_COMPILER STREQUAL "gnu")
|
||||
set_flag(STAR_COMPILER_GNU)
|
||||
elseif(STAR_COMPILER STREQUAL "clang")
|
||||
set_flag(STAR_COMPILER_CLANG)
|
||||
elseif(STAR_COMPILER STREQUAL "msvc")
|
||||
set_flag(STAR_COMPILER_MSVC)
|
||||
endif()
|
||||
|
||||
IF (STAR_LUA_APICHECK)
|
||||
ADD_DEFINITIONS (-DLUA_USE_APICHECK)
|
||||
ENDIF ()
|
||||
if(STAR_LUA_APICHECK)
|
||||
add_definitions(-DLUA_USE_APICHECK)
|
||||
endif()
|
||||
|
||||
IF (STAR_SYSTEM_WINDOWS)
|
||||
if(STAR_SYSTEM_WINDOWS)
|
||||
# LUA_USE_WINDOWS is automatically defined in luaconf if _WIN32 is defined
|
||||
ELSEIF (STAR_SYSTEM_MACOS)
|
||||
ADD_DEFINITIONS(-DLUA_USE_MACOSX)
|
||||
ELSEIF (STAR_SYSTEM_LINUX)
|
||||
ADD_DEFINITIONS(-DLUA_USE_LINUX)
|
||||
ELSEIF (STAR_SYSTEM_FAMILY_UNIX)
|
||||
ADD_DEFINITIONS(-DLUA_USE_POSIX)
|
||||
ENDIF ()
|
||||
elseif(STAR_SYSTEM_MACOS)
|
||||
add_definitions(-DLUA_USE_MACOSX)
|
||||
elseif(STAR_SYSTEM_LINUX)
|
||||
add_definitions(-DLUA_USE_LINUX)
|
||||
elseif(STAR_SYSTEM_FAMILY_UNIX)
|
||||
add_definitions(-DLUA_USE_POSIX)
|
||||
endif()
|
||||
|
||||
IF (STAR_ENABLE_STEAM_INTEGRATION)
|
||||
ADD_DEFINITIONS (-DSTAR_ENABLE_STEAM_INTEGRATION)
|
||||
ENDIF ()
|
||||
if(STAR_ENABLE_STEAM_INTEGRATION)
|
||||
add_definitions(-DSTAR_ENABLE_STEAM_INTEGRATION)
|
||||
endif()
|
||||
|
||||
IF (STAR_ENABLE_DISCORD_INTEGRATION)
|
||||
ADD_DEFINITIONS (-DSTAR_ENABLE_DISCORD_INTEGRATION)
|
||||
ENDIF ()
|
||||
if(STAR_ENABLE_DISCORD_INTEGRATION)
|
||||
add_definitions(-DSTAR_ENABLE_DISCORD_INTEGRATION)
|
||||
endif()
|
||||
|
||||
IF (STAR_USE_JEMALLOC)
|
||||
ADD_DEFINITIONS (-DSTAR_USE_JEMALLOC)
|
||||
ENDIF ()
|
||||
if(STAR_USE_JEMALLOC)
|
||||
add_definitions(-DSTAR_USE_JEMALLOC)
|
||||
endif()
|
||||
|
||||
# Set C/C++ compiler flags based on build environment...
|
||||
|
||||
IF (STAR_COMPILER_GNU)
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic -Wall -Wextra -Wno-unused -Wno-implicit-fallthrough -no-pie")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -rdynamic -Wall -Wextra -Wno-unused -Wno-implicit-fallthrough -no-pie")
|
||||
if(STAR_COMPILER_GNU)
|
||||
set(CMAKE_C_FLAGS
|
||||
"${CMAKE_C_FLAGS} -rdynamic -Wall -Wextra -Wno-unused -Wno-implicit-fallthrough -no-pie"
|
||||
)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++17 -rdynamic -Wall -Wextra -Wno-unused -Wno-implicit-fallthrough -no-pie"
|
||||
)
|
||||
|
||||
IF (STAR_SYSTEM_FAMILY_WINDOWS)
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthreads")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads")
|
||||
ELSE ()
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -D_REENTRANT")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -D_REENTRANT")
|
||||
ENDIF ()
|
||||
if(STAR_SYSTEM_FAMILY_WINDOWS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthreads")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -D_REENTRANT")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -D_REENTRANT")
|
||||
endif()
|
||||
|
||||
IF (STAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX)
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
||||
ENDIF ()
|
||||
if(STAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
|
||||
IF (STAR_ENABLE_GCC_PROFILING)
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
|
||||
ENDIF ()
|
||||
if(STAR_ENABLE_GCC_PROFILING)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
|
||||
endif()
|
||||
|
||||
SET (CMAKE_C_FLAGS_DEBUG "-g -Og")
|
||||
SET (CMAKE_CXX_FLAGS_DEBUG "-g -Og")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g -Og")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -Og")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast")
|
||||
set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
||||
SET (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
||||
|
||||
ELSEIF (STAR_COMPILER_CLANG)
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Wno-deprecated-declarations")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Wno-deprecated-declarations")
|
||||
elseif(STAR_COMPILER_CLANG)
|
||||
set(CMAKE_C_FLAGS
|
||||
"${CMAKE_C_FLAGS} -Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Wno-deprecated-declarations"
|
||||
)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Wno-deprecated-declarations"
|
||||
)
|
||||
|
||||
IF (STAR_SYSTEM_MACOS)
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export_dynamic")
|
||||
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-export_dynamic")
|
||||
SET (CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17")
|
||||
SET (CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||
ELSEIF ()
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -D_REENTRANT")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -D_REENTRANT")
|
||||
SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export_dynamic")
|
||||
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export_dynamic")
|
||||
ENDIF ()
|
||||
if(STAR_SYSTEM_MACOS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS
|
||||
"${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export_dynamic")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-export_dynamic")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||
elseif()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -D_REENTRANT")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -D_REENTRANT")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS
|
||||
"${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export_dynamic")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export_dynamic")
|
||||
endif()
|
||||
|
||||
SET (CMAKE_C_FLAGS_DEBUG "-g")
|
||||
SET (CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast")
|
||||
set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -Ofast")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -Ofast")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -DNDEBUG -Ofast")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
||||
SET (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Ofast")
|
||||
|
||||
ELSEIF (STAR_COMPILER_MSVC)
|
||||
# /MP - Multi-processor building
|
||||
# /EHsc - Enable normal C++ exception handling
|
||||
# /bigobj - More sections in .obj files (Cannot build in Debug without it)
|
||||
# /MT - Use multi-threaded statically linked C runtime library
|
||||
# /GA - Optimize for windows application
|
||||
# /Ox - Full optimization
|
||||
# /fp:fast - Equivalent to -ffast-math
|
||||
# /GS- - Disable buffers security check
|
||||
# /Zi - Generates debugging information without Edit and Continue
|
||||
# /Gy - Use function-level linking
|
||||
# /wd4996 - Disable warnings about unsafe C functions
|
||||
# /wd4351 - Disable warnings about new behavior of default initialization of
|
||||
# arrays (which is the correct behavior anyway)
|
||||
elseif(STAR_COMPILER_MSVC)
|
||||
# /MP - Multi-processor building /EHsc - Enable normal C++ exception
|
||||
# handling /bigobj - More sections in .obj files (Cannot build in Debug
|
||||
# without it) /MT - Use multi-threaded statically linked C runtime
|
||||
# library /GA - Optimize for windows application /Ox - Full
|
||||
# optimization /fp:fast - Equivalent to -ffast-math /GS- - Disable buffers
|
||||
# security check /Zi - Generates debugging information without Edit and
|
||||
# Continue /Gy - Use function-level linking /wd4996 - Disable warnings
|
||||
# about unsafe C functions /wd4351 - Disable warnings about new behavior of
|
||||
# default initialization of arrays (which is the correct behavior anyway)
|
||||
# /wd4800 - Disable warnings about using non-bool as true or false (useless
|
||||
# performance warning)
|
||||
# /wd4244 - Disable warnings about type conversion loss of data, it's a nice
|
||||
# warning, but it triggers on lots and lots of harmless things that no
|
||||
# other compiler warns about, like passing an int as a float parameter
|
||||
# /wd4305 - Disable warnings about truncation from double to float
|
||||
# /wd4267 - Disable warnings about 64 - 32 bit truncation
|
||||
# /wd4456 - Disable warnings about hiding previous local declaration
|
||||
# /wd4503 - Silence warnings about MSVC generating a name so long it has to
|
||||
# truncate it
|
||||
# /wd4250 - Silence "XX inherits YY via dominance"
|
||||
# /wd4624 - Silence implicitly deleted destructor warnings that show up when
|
||||
# using unions in interesting ways.
|
||||
# performance warning) /wd4244 - Disable warnings about type conversion loss
|
||||
# of data, it's a nice warning, but it triggers on lots and lots of harmless
|
||||
# things that no other compiler warns about, like passing an int as a float
|
||||
# parameter /wd4305 - Disable warnings about truncation from double to float
|
||||
# /wd4267 - Disable warnings about 64 - 32 bit truncation /wd4456 - Disable
|
||||
# warnings about hiding previous local declaration /wd4503 - Silence warnings
|
||||
# about MSVC generating a name so long it has to truncate it /wd4250 -
|
||||
# Silence "XX inherits YY via dominance" /wd4624 - Silence implicitly deleted
|
||||
# destructor warnings that show up when using unions in interesting ways.
|
||||
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /EHsc /bigobj /wd4996 /wd4351 /wd4800 /wd4244 /wd4305 /wd4267 /wd4456 /wd4503 /wd4250 /wd4624")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /MP /EHsc /bigobj /wd4996 /wd4351 /wd4800 /wd4244 /wd4305 /wd4267 /wd4456 /wd4503 /wd4250 /wd4624")
|
||||
set(CMAKE_C_FLAGS
|
||||
"${CMAKE_C_FLAGS} /MP /EHsc /bigobj /wd4996 /wd4351 /wd4800 /wd4244 /wd4305 /wd4267 /wd4456 /wd4503 /wd4250 /wd4624"
|
||||
)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} /std:c++17 /MP /EHsc /bigobj /wd4996 /wd4351 /wd4800 /wd4244 /wd4305 /wd4267 /wd4456 /wd4503 /wd4250 /wd4624"
|
||||
)
|
||||
|
||||
IF (STAR_ENABLE_STATIC_MSVC_RUNTIME)
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
|
||||
ENDIF ()
|
||||
if(STAR_ENABLE_STATIC_MSVC_RUNTIME)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
|
||||
endif()
|
||||
|
||||
SET (CMAKE_C_FLAGS_DEBUG "/Zi /Od")
|
||||
SET (CMAKE_CXX_FLAGS_DEBUG "/Zi /Od")
|
||||
set(CMAKE_C_FLAGS_DEBUG "/Zi /Od")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "/Zi /Od")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHASSERTS "/Ox /fp:fast /GA /GS- /Zi /Gy")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHASSERTS "/Ox /fp:fast /GA /GS- /Zi /Gy")
|
||||
set(CMAKE_C_FLAGS_RELWITHASSERTS "/Ox /fp:fast /GA /GS- /Zi /Gy")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "/Ox /fp:fast /GA /GS- /Zi /Gy")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "/Ox /fp:fast /GA /GS- /Zi /Gy /DNDEBUG")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Ox /fp:fast /GA /GS- /Zi /Gy /DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Ox /fp:fast /GA /GS- /Zi /Gy /DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Ox /fp:fast /GA /GS- /Zi /Gy /DNDEBUG")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELEASE "/Ox /fp:fast /GA /GS- /Gy /DNDEBUG")
|
||||
SET (CMAKE_CXX_FLAGS_RELEASE "/Ox /fp:fast /GA /GS- /Gy /DNDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE "/Ox /fp:fast /GA /GS- /Gy /DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/Ox /fp:fast /GA /GS- /Gy /DNDEBUG")
|
||||
|
||||
IF (STAR_ARCHITECTURE_I386)
|
||||
if(STAR_ARCHITECTURE_I386)
|
||||
# Assume all 32 bit target cpus support MMX, SSE, and SSE2
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHASSERTS "${CMAKE_C_FLAGS_RELWITHASSERTS} /arch:SSE2")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHASSERTS "${CMAKE_CXX_FLAGS_RELWITHASSERTS} /arch:SSE2")
|
||||
set(CMAKE_C_FLAGS_RELWITHASSERTS
|
||||
"${CMAKE_C_FLAGS_RELWITHASSERTS} /arch:SSE2")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHASSERTS
|
||||
"${CMAKE_CXX_FLAGS_RELWITHASSERTS} /arch:SSE2")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /arch:SSE2")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /arch:SSE2")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
"${CMAKE_C_FLAGS_RELWITHDEBINFO} /arch:SSE2")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /arch:SSE2")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /arch:SSE2")
|
||||
SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE2")
|
||||
ENDIF ()
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /arch:SSE2")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE2")
|
||||
endif()
|
||||
|
||||
ADD_DEFINITIONS (/DUNICODE)
|
||||
ADD_DEFINITIONS (/D_UNICODE)
|
||||
ADD_DEFINITIONS (/DNOMINMAX)
|
||||
add_definitions(/DUNICODE)
|
||||
add_definitions(/D_UNICODE)
|
||||
add_definitions(/DNOMINMAX)
|
||||
|
||||
ELSE ()
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pthread -D_REENTRANT")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -pthread -D_REENTRANT")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pthread -D_REENTRANT")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++17 -Wall -pthread -D_REENTRANT")
|
||||
|
||||
SET (CMAKE_C_FLAGS_DEBUG "-g")
|
||||
SET (CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHASSERTS "-g -O2")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -O2")
|
||||
set(CMAKE_C_FLAGS_RELWITHASSERTS "-g -O2")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHASSERTS "-g -O2")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG -g -O2")
|
||||
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -g -O2")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG -g -O2")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -g -O2")
|
||||
|
||||
SET (CMAKE_C_FLAGS_RELEASE "$-DNDEBUG -O2")
|
||||
SET (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2")
|
||||
set(CMAKE_C_FLAGS_RELEASE "$-DNDEBUG -O2")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2")
|
||||
|
||||
ENDIF ()
|
||||
endif()
|
||||
|
||||
# Set other global build settings based on environment...
|
||||
|
||||
IF (STAR_SYSTEM_MACOS)
|
||||
SET (CMAKE_MODULE_LINKER_FLAGS "-flat_namespace -undefined suppress")
|
||||
ELSEIF (STAR_SYSTEM_WINDOWS)
|
||||
SET (CMAKE_RC_COMPILER_INIT windres)
|
||||
if(STAR_SYSTEM_MACOS)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "-flat_namespace -undefined suppress")
|
||||
elseif(STAR_SYSTEM_WINDOWS)
|
||||
set(CMAKE_RC_COMPILER_INIT windres)
|
||||
|
||||
ENABLE_LANGUAGE (RC)
|
||||
IF (STAR_COMPILER STREQUAL "msvc")
|
||||
SET (CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> /fo <OBJECT> <SOURCE>")
|
||||
ELSE ()
|
||||
SET (CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
||||
ENDIF()
|
||||
ENDIF ()
|
||||
enable_language(RC)
|
||||
if(STAR_COMPILER STREQUAL "msvc")
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> /fo <OBJECT> <SOURCE>")
|
||||
else()
|
||||
set(CMAKE_RC_COMPILE_OBJECT
|
||||
"<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF (STAR_COMPILER STREQUAL "msvc")
|
||||
# /largeaddressaware - Make 32 bit build able to use 3GB addresses
|
||||
# /OPT:REF - Eliminates functions and data that are never referenced
|
||||
# /OPT:ICF - Performs identical COMDAT folding
|
||||
# /PDBCompress - Hint to windows that it should compress the resulting PDB files
|
||||
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /largeaddressaware /OPT:REF /OPT:ICF /PDBCompress")
|
||||
if(STAR_COMPILER STREQUAL "msvc")
|
||||
# /largeaddressaware - Make 32 bit build able to use 3GB addresses /OPT:REF -
|
||||
# Eliminates functions and data that are never referenced /OPT:ICF - Performs
|
||||
# identical COMDAT folding /PDBCompress - Hint to windows that it should
|
||||
# compress the resulting PDB files
|
||||
set(CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} /largeaddressaware /OPT:REF /OPT:ICF /PDBCompress"
|
||||
)
|
||||
|
||||
# Make sure RelWithAsserts has debugging enabled
|
||||
SET (CMAKE_EXE_LINKER_FLAGS_RELWITHASSERTS "${CMAKE_EXE_LINKER_FLAGS_RELWITHASSERTS} /DEBUG")
|
||||
ENDIF ()
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHASSERTS
|
||||
"${CMAKE_EXE_LINKER_FLAGS_RELWITHASSERTS} /DEBUG")
|
||||
endif()
|
||||
|
||||
IF (STAR_SYSTEM_WINDOWS)
|
||||
SET (CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} ws2_32.lib iphlpapi.lib shlwapi.lib dbghelp.lib")
|
||||
SET (CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} ws2_32.lib iphlpapi.lib shlwapi.lib dbghelp.lib")
|
||||
if(STAR_SYSTEM_WINDOWS)
|
||||
set(CMAKE_C_STANDARD_LIBRARIES
|
||||
"${CMAKE_C_STANDARD_LIBRARIES} ws2_32.lib iphlpapi.lib shlwapi.lib dbghelp.lib"
|
||||
)
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES
|
||||
"${CMAKE_CXX_STANDARD_LIBRARIES} ws2_32.lib iphlpapi.lib shlwapi.lib dbghelp.lib"
|
||||
)
|
||||
|
||||
ELSEIF (STAR_SYSTEM_LINUX)
|
||||
SET (CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -ldl -lrt")
|
||||
SET (CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -ldl -lrt")
|
||||
elseif(STAR_SYSTEM_LINUX)
|
||||
set(CMAKE_C_STANDARD_LIBRARIES
|
||||
"${CMAKE_C_STANDARD_LIBRARIES} -lpthread -ldl -lrt")
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES
|
||||
"${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -ldl -lrt")
|
||||
|
||||
ELSEIF (STAR_SYSTEM_FREEBSD)
|
||||
SET (CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -lrt")
|
||||
SET (CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -lrt")
|
||||
elseif(STAR_SYSTEM_FREEBSD)
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -lrt")
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES
|
||||
"${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -lrt")
|
||||
|
||||
ENDIF ()
|
||||
endif()
|
||||
|
||||
# Find all required external libraries, based on build settings...
|
||||
|
||||
IF (STAR_USE_JEMALLOC)
|
||||
if(STAR_USE_JEMALLOC)
|
||||
# Assumes jemalloc was configured with a "je_" function prefix
|
||||
FIND_PACKAGE (JeMalloc REQUIRED)
|
||||
find_package(JeMalloc REQUIRED)
|
||||
|
||||
INCLUDE_DIRECTORIES (SYSTEM ${JEMALLOC_INCLUDE_DIR})
|
||||
SET (STAR_EXT_LIBS ${JEMALLOC_LIBRARY})
|
||||
ENDIF ()
|
||||
include_directories(SYSTEM ${JEMALLOC_INCLUDE_DIR})
|
||||
set(STAR_EXT_LIBS ${JEMALLOC_LIBRARY})
|
||||
endif()
|
||||
|
||||
FIND_PACKAGE (ZLIB REQUIRED)
|
||||
FIND_PACKAGE (PNG REQUIRED)
|
||||
FIND_PACKAGE (Freetype REQUIRED)
|
||||
FIND_PACKAGE (OggVorbis REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(Freetype REQUIRED)
|
||||
find_package(OggVorbis REQUIRED)
|
||||
|
||||
INCLUDE_DIRECTORIES (SYSTEM
|
||||
${FREETYPE_INCLUDE_DIRS}
|
||||
${OGGVORBIS_INCLUDE_DIR}
|
||||
)
|
||||
include_directories(SYSTEM ${FREETYPE_INCLUDE_DIRS} ${OGGVORBIS_INCLUDE_DIR})
|
||||
|
||||
IF (TARGET freetype AND NOT TARGET Freetype::Freetype)
|
||||
if(TARGET freetype AND NOT TARGET Freetype::Freetype)
|
||||
add_library(Freetype::Freetype ALIAS freetype)
|
||||
MESSAGE(STATUS "Freetype target name is freetype")
|
||||
ELSEIF (TARGET Freetype::Freetype AND NOT TARGET freetype)
|
||||
message(STATUS "Freetype target name is freetype")
|
||||
elseif(TARGET Freetype::Freetype AND NOT TARGET freetype)
|
||||
add_library(freetype ALIAS Freetype::Freetype)
|
||||
MESSAGE(STATUS "Freetype target name is Freetype::Freetype")
|
||||
ELSE ()
|
||||
MESSAGE (FATAL_ERROR "Could not find Freetype")
|
||||
ENDIF ()
|
||||
message(STATUS "Freetype target name is Freetype::Freetype")
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find Freetype")
|
||||
endif()
|
||||
|
||||
SET (STAR_EXT_LIBS ${STAR_EXT_LIBS}
|
||||
set(STAR_EXT_LIBS
|
||||
${STAR_EXT_LIBS}
|
||||
ZLIB::ZLIB
|
||||
PNG::PNG
|
||||
Freetype::Freetype
|
||||
@ -450,116 +488,113 @@ SET (STAR_EXT_LIBS ${STAR_EXT_LIBS}
|
||||
${VORBIS_LIBRARY}
|
||||
${OGG_LIBRARY}
|
||||
opus # Currently a submodule from extern
|
||||
)
|
||||
)
|
||||
|
||||
IF (STAR_BUILD_GUI)
|
||||
FIND_PACKAGE (SDL2 REQUIRED)
|
||||
INCLUDE_DIRECTORIES (SYSTEM ${SDL2_INCLUDE_DIR})
|
||||
SET (STAR_EXT_GUI_LIBS ${SDL2_LIBRARY})
|
||||
if(STAR_BUILD_GUI)
|
||||
find_package(SDL2 REQUIRED)
|
||||
include_directories(SYSTEM ${SDL2_INCLUDE_DIR})
|
||||
set(STAR_EXT_GUI_LIBS ${SDL2_LIBRARY})
|
||||
|
||||
FIND_PACKAGE (OpenGL REQUIRED)
|
||||
FIND_PACKAGE (GLEW REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
|
||||
INCLUDE_DIRECTORIES (SYSTEM ${GLEW_INCLUDE_DIR} ${SDL2_INCLUDE_DIR})
|
||||
SET (STAR_EXT_GUI_LIBS ${STAR_EXT_GUI_LIBS} ${OPENGL_LIBRARY} ${GLEW_LIBRARY})
|
||||
include_directories(SYSTEM ${GLEW_INCLUDE_DIR} ${SDL2_INCLUDE_DIR})
|
||||
set(STAR_EXT_GUI_LIBS ${STAR_EXT_GUI_LIBS} ${OPENGL_LIBRARY} ${GLEW_LIBRARY})
|
||||
|
||||
IF (STAR_ENABLE_STEAM_INTEGRATION)
|
||||
FIND_PACKAGE (SteamApi REQUIRED)
|
||||
if(STAR_ENABLE_STEAM_INTEGRATION)
|
||||
find_package(SteamApi REQUIRED)
|
||||
|
||||
INCLUDE_DIRECTORIES (SYSTEM ${STEAM_API_INCLUDE_DIR})
|
||||
SET (STAR_EXT_GUI_LIBS ${STAR_EXT_GUI_LIBS} ${STEAM_API_LIBRARY})
|
||||
ENDIF ()
|
||||
include_directories(SYSTEM ${STEAM_API_INCLUDE_DIR})
|
||||
set(STAR_EXT_GUI_LIBS ${STAR_EXT_GUI_LIBS} ${STEAM_API_LIBRARY})
|
||||
endif()
|
||||
|
||||
IF (STAR_ENABLE_DISCORD_INTEGRATION)
|
||||
FIND_PACKAGE (DiscordApi REQUIRED)
|
||||
if(STAR_ENABLE_DISCORD_INTEGRATION)
|
||||
find_package(DiscordApi REQUIRED)
|
||||
|
||||
INCLUDE_DIRECTORIES (SYSTEM ${DISCORD_API_INCLUDE_DIR})
|
||||
SET (STAR_EXT_GUI_LIBS ${STAR_EXT_GUI_LIBS} ${DISCORD_API_LIBRARY})
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
include_directories(SYSTEM ${DISCORD_API_INCLUDE_DIR})
|
||||
set(STAR_EXT_GUI_LIBS ${STAR_EXT_GUI_LIBS} ${DISCORD_API_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set basic build flags, include all the relevant source directories, based on
|
||||
# build settings...
|
||||
|
||||
SET (BUILD_SHARED_LIBS false)
|
||||
set(BUILD_SHARED_LIBS false)
|
||||
|
||||
# First set output dir for the generic no-config case (e.g. macos / linux)
|
||||
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../dist)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../dist)
|
||||
|
||||
# Second, set output dir for multi-config builds (e.g. msvc)
|
||||
FOREACH (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
|
||||
STRING (TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
|
||||
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${PROJECT_SOURCE_DIR}/../dist)
|
||||
ENDFOREACH (OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
|
||||
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG}
|
||||
${PROJECT_SOURCE_DIR}/../dist)
|
||||
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
|
||||
|
||||
# External code included with starbound source, which core depends on
|
||||
SET (STAR_EXTERN_INCLUDES ${PROJECT_SOURCE_DIR}/extern)
|
||||
ADD_SUBDIRECTORY (extern)
|
||||
set(STAR_EXTERN_INCLUDES ${PROJECT_SOURCE_DIR}/extern)
|
||||
add_subdirectory(extern)
|
||||
|
||||
# Core support code, not specific to starbound.
|
||||
SET (STAR_CORE_INCLUDES ${PROJECT_SOURCE_DIR}/core)
|
||||
ADD_SUBDIRECTORY (core)
|
||||
set(STAR_CORE_INCLUDES ${PROJECT_SOURCE_DIR}/core)
|
||||
add_subdirectory(core)
|
||||
|
||||
# Less general purpose code than core that is available to both the game and
|
||||
# application modules.
|
||||
SET (STAR_BASE_INCLUDES ${PROJECT_SOURCE_DIR}/base)
|
||||
ADD_SUBDIRECTORY (base)
|
||||
set(STAR_BASE_INCLUDES ${PROJECT_SOURCE_DIR}/base)
|
||||
add_subdirectory(base)
|
||||
|
||||
# Platform APIs that are implemented by the application module
|
||||
SET (STAR_PLATFORM_INCLUDES ${PROJECT_SOURCE_DIR}/platform)
|
||||
ADD_SUBDIRECTORY (platform)
|
||||
set(STAR_PLATFORM_INCLUDES ${PROJECT_SOURCE_DIR}/platform)
|
||||
add_subdirectory(platform)
|
||||
|
||||
# Core game logic used by both server and client.
|
||||
SET (STAR_GAME_INCLUDES
|
||||
${PROJECT_SOURCE_DIR}/game
|
||||
${PROJECT_SOURCE_DIR}/game/interfaces
|
||||
${PROJECT_SOURCE_DIR}/game/items
|
||||
${PROJECT_SOURCE_DIR}/game/objects
|
||||
${PROJECT_SOURCE_DIR}/game/scripting
|
||||
${PROJECT_SOURCE_DIR}/game/terrain
|
||||
)
|
||||
ADD_SUBDIRECTORY (game)
|
||||
set(STAR_GAME_INCLUDES
|
||||
${PROJECT_SOURCE_DIR}/game ${PROJECT_SOURCE_DIR}/game/interfaces
|
||||
${PROJECT_SOURCE_DIR}/game/items ${PROJECT_SOURCE_DIR}/game/objects
|
||||
${PROJECT_SOURCE_DIR}/game/scripting ${PROJECT_SOURCE_DIR}/game/terrain)
|
||||
add_subdirectory(game)
|
||||
|
||||
# Googletest based tests
|
||||
OPTION (BUILD_TESTING "Build test projects" OFF)
|
||||
IF (BUILD_TESTING)
|
||||
ENABLE_TESTING()
|
||||
ADD_SUBDIRECTORY (test)
|
||||
ENDIF()
|
||||
option(BUILD_TESTING "Build test projects" OFF)
|
||||
if(BUILD_TESTING)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
# Starbound stand-alone server.
|
||||
ADD_SUBDIRECTORY (server)
|
||||
add_subdirectory(server)
|
||||
|
||||
# cmdline utilities
|
||||
ADD_SUBDIRECTORY (utility)
|
||||
add_subdirectory(utility)
|
||||
|
||||
IF (STAR_BUILD_GUI)
|
||||
if(STAR_BUILD_GUI)
|
||||
# Handles creating windows, keyboard / mouse / joystick input, and the 2d
|
||||
# rendering model.
|
||||
SET (STAR_APPLICATION_INCLUDES ${PROJECT_SOURCE_DIR}/application)
|
||||
ADD_SUBDIRECTORY (application)
|
||||
set(STAR_APPLICATION_INCLUDES ${PROJECT_SOURCE_DIR}/application)
|
||||
add_subdirectory(application)
|
||||
|
||||
# Rendering code not dependent on widget system
|
||||
SET (STAR_RENDERING_INCLUDES ${PROJECT_SOURCE_DIR}/rendering)
|
||||
ADD_SUBDIRECTORY (rendering)
|
||||
set(STAR_RENDERING_INCLUDES ${PROJECT_SOURCE_DIR}/rendering)
|
||||
add_subdirectory(rendering)
|
||||
|
||||
# Panes and Widgets
|
||||
SET (STAR_WINDOWING_INCLUDES ${PROJECT_SOURCE_DIR}/windowing)
|
||||
ADD_SUBDIRECTORY (windowing)
|
||||
set(STAR_WINDOWING_INCLUDES ${PROJECT_SOURCE_DIR}/windowing)
|
||||
add_subdirectory(windowing)
|
||||
|
||||
# Client interface code
|
||||
SET (STAR_FRONTEND_INCLUDES ${PROJECT_SOURCE_DIR}/frontend)
|
||||
ADD_SUBDIRECTORY (frontend)
|
||||
set(STAR_FRONTEND_INCLUDES ${PROJECT_SOURCE_DIR}/frontend)
|
||||
add_subdirectory(frontend)
|
||||
|
||||
# Starbound game / client
|
||||
ADD_SUBDIRECTORY (client)
|
||||
add_subdirectory(client)
|
||||
|
||||
# Qt GUI tools
|
||||
IF (STAR_BUILD_QT_TOOLS)
|
||||
ADD_SUBDIRECTORY (json_tool)
|
||||
if(STAR_BUILD_QT_TOOLS)
|
||||
add_subdirectory(json_tool)
|
||||
|
||||
if (STAR_ENABLE_STEAM_INTEGRATION)
|
||||
ADD_SUBDIRECTORY (mod_uploader)
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
if(STAR_ENABLE_STEAM_INTEGRATION)
|
||||
add_subdirectory(mod_uploader)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user