From 310e1a8ed4572f49696f95033cb310a774e8ce33 Mon Sep 17 00:00:00 2001 From: Will Springer Date: Sun, 24 Mar 2024 18:30:00 -0700 Subject: [PATCH] [WIP] Slap together some cmake nonsense Used vcproj2cmake[1] (github mirror[2]) as a starting point, and then added libxmp as a submodule and hacked up the CMakeLists until it was able to successfully cross-compile on Linux via mingw. (Side note, I was using the master branch of vcproj2cmake, but apparently there are several more recent branches, including experimental_unverified which has more than 1000(!) additional commits...) Could definitely stand to get rid of more cruft in the recipe, esp since we almost certainly won't be autogenerating the cmake stuff from the vcproj going forward. Could even rewrite it from scratch instead, if someone wanted to. As such, this is definitely not in a state where it's ready to stand on its own, lmao [1]: https://sourceforge.net/projects/vcproj2cmake/ [2]: https://github.com/p/vcproj2cmake --- .gitmodules | 3 + Keygender32/CMakeLists.txt | 295 +++++++++++++++++++++++++++++++++++++ Keygender32/libxmp | 1 + 3 files changed, 299 insertions(+) create mode 100644 .gitmodules create mode 100644 Keygender32/CMakeLists.txt create mode 160000 Keygender32/libxmp diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..cd4129b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Keygender32/libxmp"] + path = Keygender32/libxmp + url = https://github.com/libxmp/libxmp diff --git a/Keygender32/CMakeLists.txt b/Keygender32/CMakeLists.txt new file mode 100644 index 0000000..7e7d056 --- /dev/null +++ b/Keygender32/CMakeLists.txt @@ -0,0 +1,295 @@ +# +# TEMPORARY Build file, AUTO-GENERATED by http://vcproj2cmake.sf.net +# DO NOT CHECK INTO VERSION CONTROL OR APPLY "PERMANENT" MODIFICATIONS!! +# + +# >= 2.6 due to crucial set_property(... COMPILE_DEFINITIONS_* ...) +cmake_minimum_required(VERSION 2.6) +if(COMMAND cmake_policy) + if(POLICY CMP0005) + cmake_policy(SET CMP0005 NEW) # automatic quoting of brackets + endif(POLICY CMP0005) + + if(POLICY CMP0011) + # we do want the includer to be affected by our updates, + # since it might define project-global settings. + cmake_policy(SET CMP0011 OLD) + endif(POLICY CMP0011) + if(POLICY CMP0015) + # .vcproj contains relative paths to additional library directories, thus we need to be able to cope with that + cmake_policy(SET CMP0015 NEW) + endif(POLICY CMP0015) +endif(COMMAND cmake_policy) + +set(V2C_BASE "/home/skirmisher/buildzone/vcproj2cmake") + +set(CMAKE_MODULE_PATH "${V2C_BASE}/cmake/Modules" ${CMAKE_MODULE_PATH}) + +set(V2C_CONFIG_DIR_LOCAL "${V2C_BASE}/cmake/vcproj2cmake") + +# include the main file for pre-defined vcproj2cmake helper functions +include(vcproj2cmake_func) + +# include the main file for pre-defined vcproj2cmake definitions +include(vcproj2cmake_defs) + +include(${V2C_CONFIG_DIR_LOCAL}/hook_pre.txt OPTIONAL) + +project( Keygender32 ) + +if(CMAKE_BUILD_TYPE STREQUAL "Release_ANSI") + set(libxmp_CMAKE_BUILD_TYPE "Release" CACHE INTERNAL "" FORCE) +endif(CMAKE_BUILD_TYPE STREQUAL "Release_ANSI") +if(CMAKE_BUILD_TYPE STREQUAL "Debug_ANSI") + set(libxmp_CMAKE_BUILD_TYPE "Debug" CACHE INTERNAL "" FORCE) +endif(CMAKE_BUILD_TYPE STREQUAL "Debug_ANSI") + +set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "" FORCE) +set(BUILD_SHARED OFF CACHE INTERNAL "" FORCE) +set(BUILD_STATIC ON CACHE INTERNAL "" FORCE) +set(LIBXMP_DISABLE_DEPACKERS ON CACHE INTERNAL "" FORCE) +set(LIBXMP_DISABLE_PROWIZARD ON CACHE INTERNAL "" FORCE) +set(LIBXMP_DOCS OFF CACHE INTERNAL "" FORCE) +add_subdirectory(libxmp) +include_directories(libxmp/include) + +# this part is for including a file which contains +# _globally_ applicable settings for all sub projects of a master project +# (compiler flags, path settings, platform stuff, ...) +# e.g. have vcproj2cmake-specific MasterProjectDefaults_vcproj2cmake +# which then _also_ includes a global MasterProjectDefaults module +# for _all_ CMakeLists.txt. This needs to sit post-project() +# since e.g. compiler info is dependent on a valid project. +# MasterProjectDefaults_vcproj2cmake is supposed to define +# generic settings (such as V2C_HOOK_PROJECT, defined as e.g. +# ./cmake/vcproj2cmake/hook_project.txt, and other hook include variables below). +# NOTE: it usually should also reset variables V2C_LIBS, V2C_SOURCES etc. +# as used below since they should contain directory-specific contents only, not accumulate! +include(MasterProjectDefaults_vcproj2cmake OPTIONAL) +# hook e.g. for invoking Find scripts as expected by +# the _LIBRARIES / _INCLUDE_DIRS mappings created +# by your include/dependency map files. +include(${V2C_HOOK_PROJECT} OPTIONAL) + + set(SOURCES_files_Source_Files + BGM.c + Debug.c + Dialog.c + Generator.c + Keygender32.c + Nfo.c + Random.c + Starfield.c + stdafx.c + ) + source_group("Source Files" FILES ${SOURCES_files_Source_Files}) + + set(SOURCES_Source_Files + ${SOURCES_files_Source_Files} + ) + + set(SOURCES_files_Header_Files + BGM.h + Debug.h + Dialog.h + Generator.h + Keygender32.h + Nfo.h + Random.h + resource.h + Starfield.h + stdafx.h + ) + source_group("Header Files" FILES ${SOURCES_files_Header_Files}) + + set(SOURCES_Header_Files + ${SOURCES_files_Header_Files} + ) + + set(SOURCES_files_Resource_Files + Keygender32.rc + ) + source_group("Resource Files" FILES ${SOURCES_files_Resource_Files}) + + set(SOURCES_Resource_Files + ${SOURCES_files_Resource_Files} + ) + + set(SOURCES_files_ + ../keygendr.for.win32.HL.NFO + space_debris.mod + ) + + set(SOURCES_ + ${SOURCES_Source_Files} + ${SOURCES_Header_Files} + ${SOURCES_Resource_Files} + ${SOURCES_files_} + ) + +include_directories(BEFORE ${PROJECT_SOURCE_DIR}) + +include(${V2C_HOOK_POST_SOURCES} OPTIONAL) + +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + + # hook include after all definitions have been made + # (but _before_ target is created using the source list!) + include(${V2C_HOOK_POST_DEFINITIONS} OPTIONAL) + + set(SOURCES + ${SOURCES_} + ${V2C_SOURCES} + ) + + link_directories( + ${V2C_LIB_DIRS} + ) + + add_executable( Keygender32 WIN32 ${SOURCES} ) + + target_link_libraries(Keygender32 + xmp_static + shlwapi + msimg32 + winmm + comctl32 + ${V2C_LIBS} + ) + + # e.g. to be used for tweaking target properties etc. + include(${V2C_HOOK_POST_TARGET} OPTIONAL) +endif(CMAKE_BUILD_TYPE STREQUAL "Debug") +if(TARGET Keygender32) + + set_property(TARGET Keygender32 APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG + LIBXMP_STATIC + WIN32 + _DEBUG + _WINDOWS + ) +endif(TARGET Keygender32) + +if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "Release") + + # hook include after all definitions have been made + # (but _before_ target is created using the source list!) + include(${V2C_HOOK_POST_DEFINITIONS} OPTIONAL) + + set(SOURCES + ${SOURCES_} + ${V2C_SOURCES} + ) + + link_directories( + ${V2C_LIB_DIRS} + ) + + add_executable( Keygender32 WIN32 ${SOURCES} ) + + target_link_libraries(Keygender32 + xmp_static + shlwapi + msimg32 + winmm + comctl32 + ${V2C_LIBS} + ) + + # e.g. to be used for tweaking target properties etc. + include(${V2C_HOOK_POST_TARGET} OPTIONAL) +endif(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "Release") +if(TARGET Keygender32) + + set_property(TARGET Keygender32 APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE + LIBXMP_STATIC + NDEBUG + WIN32 + _WINDOWS + ) +endif(TARGET Keygender32) + +if(CMAKE_BUILD_TYPE STREQUAL "Release_ANSI") + + # hook include after all definitions have been made + # (but _before_ target is created using the source list!) + include(${V2C_HOOK_POST_DEFINITIONS} OPTIONAL) + + set(SOURCES + ${SOURCES_} + ${V2C_SOURCES} + ) + + link_directories( + ${V2C_LIB_DIRS} + ) + + add_executable( Keygender32 WIN32 ${SOURCES} ) + + target_link_libraries(Keygender32 + xmp_static + shlwapi + msimg32 + winmm + comctl32 + ${V2C_LIBS} + ) + + # e.g. to be used for tweaking target properties etc. + include(${V2C_HOOK_POST_TARGET} OPTIONAL) +endif(CMAKE_BUILD_TYPE STREQUAL "Release_ANSI") +if(TARGET Keygender32) + + set_property(TARGET Keygender32 APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE_ANSI + LIBXMP_STATIC + NDEBUG + WIN32 + _WINDOWS + ) +endif(TARGET Keygender32) + +if(CMAKE_BUILD_TYPE STREQUAL "Debug_ANSI") + + # hook include after all definitions have been made + # (but _before_ target is created using the source list!) + include(${V2C_HOOK_POST_DEFINITIONS} OPTIONAL) + + set(SOURCES + ${SOURCES_} + ${V2C_SOURCES} + ) + + link_directories( + ${V2C_LIB_DIRS} + ) + + add_executable( Keygender32 WIN32 ${SOURCES} ) + + target_link_libraries(Keygender32 + xmp_static + shlwapi + msimg32 + winmm + comctl32 + ${V2C_LIBS} + ) + + # e.g. to be used for tweaking target properties etc. + include(${V2C_HOOK_POST_TARGET} OPTIONAL) +endif(CMAKE_BUILD_TYPE STREQUAL "Debug_ANSI") +if(TARGET Keygender32) + + set_property(TARGET Keygender32 APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG_ANSI + LIBXMP_STATIC + WIN32 + _DEBUG + _WINDOWS + ) +endif(TARGET Keygender32) + +set_property(TARGET Keygender32 PROPERTY PROJECT_LABEL "Keygender32") +set_property(TARGET Keygender32 PROPERTY VS_KEYWORD "Win32Proj") + +#v2c_rebuild_on_update(Keygender32 "${CMAKE_CURRENT_SOURCE_DIR}/Keygender32.vcproj" ${CMAKE_CURRENT_LIST_FILE} "/home/skirmisher/buildzone/vcproj2cmake/scripts/vcproj2cmake.rb" ".") + +include(${V2C_HOOK_POST} OPTIONAL) diff --git a/Keygender32/libxmp b/Keygender32/libxmp new file mode 160000 index 0000000..8201d26 --- /dev/null +++ b/Keygender32/libxmp @@ -0,0 +1 @@ +Subproject commit 8201d26cf933688a8be64292457c429fd8e654ab