Merge branch 'OpenStarbound:main' into main

This commit is contained in:
JamesTheMaker 2024-03-07 09:44:18 -05:00 committed by GitHub
commit 3c8a8619d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 555 additions and 359 deletions

22
scripts/ci/linux/build.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/sh -e
mkdir -p build
cd build
rm -f CMakeCache.txt
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DSTAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX=ON \
-DSTAR_USE_JEMALLOC=ON \
-DSTAR_ENABLE_STEAM_INTEGRATION=ON \
-DCMAKE_INCLUDE_PATH=../lib/linux/include \
-DCMAKE_LIBRARY_PATH=../lib/linux \
../source
make -j2
cd ..
mv dist linux_binaries
cp lib/linux/*.so linux_binaries/

View File

@ -0,0 +1,5 @@
#!/bin/sh
cd "`dirname \"$0\"`"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:./" ./starbound "$@"

View File

@ -0,0 +1,22 @@
#!/bin/sh
cd "`dirname \"$0\"`"
terms="
x-terminal-emulator
konsole
gnome-terminal.wrapper
xfce4-terminal.wrapper
koi8rxterm
lxterm
uxterm
xterm"
for term in $terms; do
$term -e ./starbound_server $@
if [ $? -eq 0 ]; then
exit 0;
fi
done
exit 1

View File

@ -0,0 +1,9 @@
{
"assetDirectories" : [
"./data/",
"../assets/",
"../mods/"
],
"storageDirectory" : "../storage/"
}

8
scripts/ci/linux/test.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh -e
cd linux_binaries
cp ../scripts/linux/sbinit.config .
./core_tests
./game_tests

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>Starbound</string>
<key>CFBundleExecutable</key>
<string>starbound</string>
<key>CFBundleIdentifier</key>
<string>com.chucklefish</string>
<key>CFBundleName</key>
<string>starbound</string>
<key>CFBundleIconFile</key>
<string>starbound</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSEnvironment</key>
<dict>
<key>MinimumSystemVersion</key>
<string>10.9.0</string>
</dict>
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>
<string>parent</string>
</dict>
</plist>

25
scripts/ci/macos/build.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/sh -e
mkdir -p build
cd build
rm -f CMakeCache.txt
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DSTAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX=ON \
-DSTAR_USE_JEMALLOC=OFF \
-DSTAR_ENABLE_STEAM_INTEGRATION=ON \
-DSTAR_ENABLE_DISCORD_INTEGRATION=ON \
-DCMAKE_INCLUDE_PATH=../lib/osx/include \
-DCMAKE_LIBRARY_PATH=../lib/osx \
-DCMAKE_OSX_SYSROOT=/ \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
../source
make -j2
cd ..
mv dist macos_binaries
cp lib/osx/*.dylib macos_binaries/

View File

@ -0,0 +1,11 @@
#!/bin/sh -e
cd "`dirname \"$0\"`"
osascript <<END
tell application "Terminal"
do script "cd \"`pwd`\";./starbound_server $@;exit"
end tell
END

View File

@ -0,0 +1,9 @@
{
"assetDirectories" : [
"./data/",
"../assets/",
"../mods/"
],
"storageDirectory" : "../storage/"
}

9
scripts/ci/macos/test.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/sh -e
cd macos_binaries
cp ../scripts/osx/sbinit.config .
./core_tests
./game_tests

View File

@ -0,0 +1,32 @@
set QT_PREFIX_PATH="C:\Qt\5.7\msvc2015_64"
set CMAKE_PREFIX_PATH="C:\Program Files\CMake"
set PATH=%PATH%;%CMAKE_PREFIX_PATH%\bin;%QT_PREFIX_PATH%\bin
mkdir build
cd build || exit /b 1
del /f CMakeCache.txt
cmake.exe ^
-G"Visual Studio 17 2022" ^
-T"v143" ^
-DCMAKE_PREFIX_PATH=%QT_PREFIX_PATH% ^
-DSTAR_USE_JEMALLOC=OFF ^
-DSTAR_ENABLE_STEAM_INTEGRATION=ON ^
-DSTAR_ENABLE_DISCORD_INTEGRATION=ON ^
-DSTAR_BUILD_QT_TOOLS=OFF ^
-DCMAKE_INCLUDE_PATH="..\lib\windows\include" ^
-DCMAKE_LIBRARY_PATH="..\lib\windows" ^
..\source || exit /b 1
cmake.exe --build . --config RelWithDebInfo || exit /b 1
cd ..
move dist windows_binaries || exit /b 1
if exist windows_binaries\mod_uploader.exe (
windeployqt.exe windows_binaries\mod_uploader.exe || exit /b 1
)
copy lib\windows\*.dll windows_binaries\ || exit /b 1

View File

@ -0,0 +1,9 @@
{
"assetDirectories" : [
".\\data\\",
"..\\assets\\",
"..\\mods\\"
],
"storageDirectory" : "..\\storage\\"
}

View File

@ -0,0 +1,8 @@
cd windows_binaries
set PATH="%PATH%;..\lib\windows"
copy ..\scripts\windows\sbinit.config .
.\core_tests || exit /b 1
.\game_tests || exit /b 1

View File

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