forked from Segs/Segs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Add preliminary SE sdk download helpers (Segs#906)
* MSVC2017/2019 SE Sdk download helpers * Update ACE to 6.5.7 + a test of including the editor_engine reference in the build. * editor executable driver.
- Loading branch information
Showing
11 changed files
with
173 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# the following code is based on BSF's HelperMethods.cmake | ||
|
||
set(SE_BINARY_DEP_WEBSITE "https://segs.dev/sdk") | ||
|
||
function(update_binary_deps DEP_PREFIX DEP_NAME DEP_FOLDER DEP_VERSION) | ||
if(NOT WIN32) | ||
return() | ||
endif() | ||
set(DEP_TYPE VS2017) | ||
# Clean and create a temporary folder | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_SOURCE_DIR}/Temp) | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/Temp) | ||
|
||
set(BINARY_DEPENDENCIES_URL ${SE_BINARY_DEP_WEBSITE}/${DEP_PREFIX}_${DEP_TYPE}_${DEP_VERSION}.7z) | ||
file(DOWNLOAD ${BINARY_DEPENDENCIES_URL} ${PROJECT_SOURCE_DIR}/Temp/Dependencies.7z | ||
SHOW_PROGRESS | ||
STATUS DOWNLOAD_STATUS) | ||
|
||
list(GET DOWNLOAD_STATUS 0 STATUS_CODE) | ||
if(NOT STATUS_CODE EQUAL 0) | ||
message(FATAL_ERROR "Binary dependencies failed to download from URL: ${BINARY_DEPENDENCIES_URL}") | ||
endif() | ||
|
||
message(STATUS "Extracting files. Please wait...") | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/Temp/unpack) | ||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/Temp/Dependencies.7z | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Temp/unpack | ||
) | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${DEP_FOLDER}) | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${DEP_FOLDER}) | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/Temp/unpack ${DEP_FOLDER}) | ||
# execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_SOURCE_DIR}/Temp) | ||
|
||
endfunction() | ||
|
||
function(check_and_update_binary_deps DEP_PREFIX DEP_NAME DEP_FOLDER DEP_VERSION) | ||
set(BUILTIN_DEP_VERSION_FILE ${DEP_FOLDER}/.version) | ||
if(NOT EXISTS ${BUILTIN_DEP_VERSION_FILE}) | ||
message(STATUS "Binary dependencies for '${DEP_PREFIX}' are missing. Downloading package...") | ||
update_binary_deps(${DEP_PREFIX} ${DEP_NAME} ${DEP_FOLDER} ${DEP_VERSION}) | ||
else() | ||
file (STRINGS ${BUILTIN_DEP_VERSION_FILE} CURRENT_DEP_VERSION) | ||
if(${DEP_VERSION} VERSION_GREATER ${CURRENT_DEP_VERSION}) | ||
message(STATUS "Your precomiled dependencies package for '${DEP_PREFIX}' is out of date. Downloading latest package...") | ||
update_binary_deps(${DEP_PREFIX} ${DEP_NAME} ${DEP_FOLDER} ${DEP_VERSION}) | ||
endif() | ||
endif() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
if(MSVC) | ||
check_and_update_binary_deps(SegsEngine SegsEngine ${PROJECT_SOURCE_DIR}/3rd_party/prebuilt 4.0.0-alpha) | ||
find_package(SegsEngine REQUIRED) | ||
|
||
set(SOURCES | ||
main.cpp | ||
os_specific/app.rc | ||
) | ||
add_executable(SegsEditor ${SOURCES}) | ||
target_link_libraries(SegsEditor SegsEngine::editor_engine) | ||
|
||
# copy engine dlls and plugins to editor executable directory | ||
add_custom_command( | ||
TARGET SegsEditor POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory | ||
${PROJECT_SOURCE_DIR}/3rd_party/prebuilt/bin | ||
${CMAKE_BINARY_DIR}/out) | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#include <QCoreApplication> | ||
#include <qlogging.h> | ||
|
||
#include "core/version.h" | ||
#include "main/main.h" | ||
#include "core/os/os.h" | ||
#include "EASTL/unique_ptr.h" | ||
|
||
#include <climits> | ||
#include <clocale> | ||
#include <cstdlib> | ||
#include <QDir> | ||
|
||
|
||
#ifdef Q_OS_WIN32 | ||
#include <windows.h> | ||
static HINSTANCE godot_hinstance = nullptr; | ||
#else | ||
static void *godot_hinstance = nullptr; | ||
#endif | ||
|
||
/* NOTE: enable this to set breakpoints on qdebug messages. */ | ||
#define WRAP_QT_MESSAGES | ||
#ifdef WRAP_QT_MESSAGES | ||
static void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &lMessage) | ||
{ | ||
QString text; | ||
switch (type) | ||
{ | ||
case QtDebugMsg: | ||
text = QString("Qt::Debug (%1:%2, %3): %4").arg(context.file).arg(context.line).arg(context.function).arg(lMessage.constData()); | ||
break; | ||
|
||
case QtWarningMsg: | ||
text = QString("Qt::Warning (%1:%2, %3): %4").arg(context.file).arg(context.line).arg(context.function).arg(lMessage.constData()); | ||
break; | ||
|
||
case QtCriticalMsg: | ||
text = QString("Qt::Critical (%1:%2, %3): %4").arg(context.file).arg(context.line).arg(context.function).arg(lMessage.constData()); | ||
break; | ||
|
||
case QtFatalMsg: | ||
text = QString("Qt::Fatal (%1:%2, %3): %4").arg(context.file).arg(context.line).arg(context.function).arg(lMessage.constData()); | ||
abort(); | ||
} | ||
QByteArray az = text.toUtf8(); | ||
printf("%s\n",az.data()); | ||
} | ||
|
||
#endif | ||
|
||
static int mainT(int argc, char *argv[]) { | ||
|
||
#ifdef WRAP_QT_MESSAGES | ||
qInstallMessageHandler(myMessageOutput); | ||
#endif | ||
QCoreApplication app(argc,argv); | ||
QCoreApplication::setApplicationName("SegsEditor"); | ||
QCoreApplication::setApplicationVersion("0.0.1"); | ||
QCoreApplication::setOrganizationName("Segs"); | ||
|
||
eastl::unique_ptr<OS> os(instantiateOS(godot_hinstance)); | ||
setlocale(LC_CTYPE, ""); | ||
|
||
QString cwd = QDir::currentPath(); | ||
|
||
Error err = Main::setup(); | ||
if (err != OK) { | ||
return 255; | ||
} | ||
|
||
if (Main::start()) | ||
os->run(); // it is actually the OS that decides how to run | ||
Main::cleanup(); | ||
|
||
if (!QDir::setCurrent(cwd)) { | ||
ERR_PRINT("Couldn't return to previous working directory."); | ||
} | ||
|
||
return os->get_exit_code(); | ||
} | ||
|
||
int main(int argc, char *argv[]) { | ||
#ifdef CRASH_HANDLER_EXCEPTION | ||
godot_hinstance = GetModuleHandle(nullptr); | ||
__try { | ||
return mainT<OS_Windows>(argc,argv); | ||
} __except (CrashHandlerException(GetExceptionInformation())) { | ||
return 1; | ||
} | ||
#else | ||
return mainT(argc,argv); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
IDR_MAIN_ICON ICON "..\\resources\\segs.ico" |