shithub: choc

Download patch

ref: 59a66543a1013dcdd28fb893a921cd232165af7f
parent: 8101009bbacb0feadead89ef36419ba15a33b171
author: Alex Mayfield <[email protected]>
date: Tue May 8 16:43:07 EDT 2018

Get resource file working

Now, Chocolate Doom has an icon.  Neat.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,12 +3,19 @@
 cmake_minimum_required(VERSION 3.7.2)
 project("Chocolate Doom" VERSION 3.0.0 LANGUAGES C)
 
+# Autotools variables
+set(top_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
+
 # AC_INIT variables
 set(PACKAGE_NAME "${PROJECT_NAME}")
 set(PACKAGE_TARNAME "chocolate-doom")
+set(PACKAGE_VERSION "${PROJECT_VERSION}")
 set(PACKAGE_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
+set(PACKAGE_BUGREPORT "[email protected]")
 
 string(REGEX REPLACE " Doom$" "" PACKAGE_SHORTNAME "${PACKAGE_NAME}")
+set(PACKAGE_COPYRIGHT "Copyright (C) 1993-2017")
+set(PACKAGE_LICENSE "GNU General Public License, version 2")
 
 find_package(SDL2 2.0.1)
 find_package(SDL2_mixer 2.0.0)
@@ -18,6 +25,8 @@
 check_function_exists(strcasecmp HAVE_DECL_STRCASECMP)
 check_function_exists(strncasecmp HAVE_DECL_STRNCASECMP)
 
+set(WINDOWS_RC_VERSION "${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, ${PROJECT_VERSION_PATCH}, 0")
+
 # Without a hyphen. This is used for the bash-completion scripts.
 string(TOLOWER "${PACKAGE_SHORTNAME}" PROGRAM_SPREFIX)
 
@@ -24,7 +33,9 @@
 # With a hyphen, used almost everywhere else.
 set(PROGRAM_PREFIX "${PROGRAM_SPREFIX}-")
 
-configure_file(config.cmake.h config.h)
+configure_file(config.h.cin config.h)
+
+configure_file(src/resource.rc.in src/resource.rc)
 
 foreach(SUBDIR textscreen midiproc opl pcsound src)
     add_subdirectory("${SUBDIR}")
--- a/config.cmake.h
+++ /dev/null
@@ -1,7 +1,0 @@
-#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
-#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@"
-#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
-#cmakedefine PROGRAM_PREFIX "@PROGRAM_PREFIX@"
-
-#cmakedefine01 HAVE_DECL_STRCASECMP
-#cmakedefine01 HAVE_DECL_STRNCASECMP
--- /dev/null
+++ b/config.h.cin
@@ -1,0 +1,7 @@
+#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
+#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@"
+#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
+#cmakedefine PROGRAM_PREFIX "@PROGRAM_PREFIX@"
+
+#cmakedefine01 HAVE_DECL_STRCASECMP
+#cmakedefine01 HAVE_DECL_STRNCASECMP
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -107,8 +107,17 @@
 
 set(EXTRA_LIBS textscreen pcsound opl SDL2::SDL2main SDL2::SDL2 SDL2::mixer SDL2::net)
 
-add_executable("${PROGRAM_PREFIX}doom" ${SOURCE_FILES_WITH_DEH})
+if(WIN32)
+    add_executable("${PROGRAM_PREFIX}doom" ${SOURCE_FILES_WITH_DEH} "${CMAKE_CURRENT_BINARY_DIR}/resource.rc")
+else()
+    add_executable("${PROGRAM_PREFIX}doom" ${SOURCE_FILES_WITH_DEH})
+endif()
 
 target_include_directories("${PROGRAM_PREFIX}doom"
                            PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
 target_link_libraries("${PROGRAM_PREFIX}doom" doom ${EXTRA_LIBS})
+
+if(MSVC)
+    set_target_properties("${PROGRAM_PREFIX}doom" PROPERTIES
+                          LINK_FLAGS "/MANIFEST:NO")
+endif()