Merge branch 'portable' of https://github.com/Clownacy/Cave-Story-Engine-2 into portable

This commit is contained in:
Clownacy 2020-04-02 23:18:44 +01:00
commit 2b65c5811a
9 changed files with 22 additions and 9 deletions

View file

@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.12)
option(PKG_CONFIG_STATIC_LIBS "On platforms with pkg-config, static-link the dependencies (good for Windows builds, so you don't need to bundle DLL files)" OFF)
option(MSVC_LINK_STATIC_RUNTIME "Link the static MSVC runtime library (Visual Studio only)" OFF)
option(FORCE_LOCAL_LIBS "Compile the built-in version of GLFW3 instead of using the system-provided one" OFF)
project(DoConfig LANGUAGES C CXX)
@ -40,12 +43,27 @@ target_link_libraries(DoConfig PRIVATE ${CMAKE_DL_LIBS})
target_include_directories(DoConfig PRIVATE "../external/glad/include")
target_compile_definitions(DoConfig PRIVATE IMGUI_IMPL_OPENGL_LOADER_GLAD)
if(PKG_CONFIG_STATIC_LIBS)
target_link_options(DoConfig PRIVATE "-static")
endif()
if(MSVC)
# Disable warnings that normally fire up on MSVC when using "unsafe" functions instead of using MSVC's "safe" _s functions
target_compile_definitions(DoConfig PRIVATE _CRT_SECURE_NO_WARNINGS)
# Use `main` instead of `WinMain`
set_target_properties(DoConfig PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup")
# This is messy as hell, and has been replaced by CMAKE_MSVC_RUNTIME_LIBRARY,
# but that's a very recent CMake addition, so we're still doing it this way for now
if(MSVC_LINK_STATIC_RUNTIME)
# Statically-link the CRT (vcpkg static libs do this)
foreach(flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
endif()
endif()

View file

@ -75,6 +75,8 @@ int main(int argc, char *argv[])
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO &io = ImGui::GetIO();
io.IniFilename = NULL; // Disable `imgui.ini`
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init(glsl_version);

View file

@ -1 +1 @@
102 ICON "1.ico"
GLFW_ICON ICON "1.ico"

View file

@ -66,8 +66,7 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
101 ICON "ICON/0.ico"
102 ICON "ICON/ICON_MINI.ico"
GLFW_ICON ICON "ICON/GLFW_ICON.ico"
#endif // Japanese resources
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

View file

@ -27,11 +27,6 @@ void PlatformBackend_Init(void)
{
SDL_Init(SDL_INIT_EVENTS);
#ifdef _WIN32 // On Windows, we use native icons instead (so we can give the taskbar and window separate icons, like the original EXE does)
SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON, "101");
SDL_SetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL, "102");
#endif
SDL_InitSubSystem(SDL_INIT_VIDEO);
puts("Available SDL2 video drivers:");

View file

@ -273,7 +273,6 @@ int main(int argc, char *argv[])
#endif
// Set up window icon
// TODO - GLFW_ICON
#ifndef _WIN32 // On Windows, we use native icons instead (so we can give the taskbar and window separate icons, like the original EXE does)
size_t window_icon_resource_size;
const unsigned char *window_icon_resource_data = FindResource("ICON_MINI", "ICON", &window_icon_resource_size);