Compare commits

...

3 commits

Author SHA1 Message Date
310e1a8ed4 [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
2024-03-24 18:30:00 -07:00
90ac8e2561 Normalize external includes to lowercase filenames
Also remove leading case of resource.h in the vcproj, since it's all lowercase
on the filesystem, and everything else refers to it like that.
2024-03-24 18:26:11 -07:00
a21ae4e276 Correct definition of extern variables 2024-03-24 18:25:30 -07:00
10 changed files with 312 additions and 10 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "Keygender32/libxmp"]
path = Keygender32/libxmp
url = https://github.com/libxmp/libxmp

View file

@ -5,6 +5,8 @@
#include <xmp.h>
#include "Debug.h"
char *MusicStartFailReason;
static DWORD WINAPI MusicThreadProc(LPVOID);
struct _BgmState {
@ -382,4 +384,4 @@ EndMusic(BgmState state)
HeapFree(GetProcessHeap(), 0, state);
return;
}
}

View file

@ -17,4 +17,4 @@ void EndMusic(BgmState);
// current state on success: 0 is playing, 1 is paused.
int TogglePlayPause(BgmState state);
char *MusicStartFailReason;
extern char *MusicStartFailReason;

295
Keygender32/CMakeLists.txt Normal file
View file

@ -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)

View file

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "Random.h"
#include "Generator.h"
#include <Time.h>
#include <time.h>
static const TCHAR szBaseChars[] = _T("BCDFGHJKMPQRTVWXY346789");
static const BYTE base = (sizeof(szBaseChars) / sizeof(TCHAR)) - 1;
@ -113,4 +113,4 @@ GenerateKey(LPCTSTR szInput,
*szPtr = 0;
return TRUE;
}
}

View file

@ -460,7 +460,7 @@
>
</File>
<File
RelativePath=".\Resource.h"
RelativePath=".\resource.h"
>
</File>
<File

View file

@ -5,6 +5,7 @@
#include <math.h>
#include <time.h>
UINT WMU_FRAMERATE;
#define WMU_FRAMERATE_NAME _T("SetFramerate_{6CFC2304-CE89-40c4-881C-988D36FBB978}")
#define DENSITY 3
#define LAYERS 5
@ -305,4 +306,4 @@ void
DeinitStarfieldControl(HINSTANCE hInst)
{
UnregisterClass(STARFIELD_CLASS, hInst);
}
}

View file

@ -11,4 +11,4 @@ void DeinitStarfieldControl(HINSTANCE);
// Defined by InitStarFieldControl. Send this message to define the
// rough framerate the control tries to render at.
UINT WMU_FRAMERATE;
extern UINT WMU_FRAMERATE;

1
Keygender32/libxmp Submodule

@ -0,0 +1 @@
Subproject commit 8201d26cf933688a8be64292457c429fd8e654ab

View file

@ -25,11 +25,11 @@
// Windows Header Files:
#include <windows.h>
#include <CommCtrl.h>
#include <Shlwapi.h>
#include <commctrl.h>
#include <shlwapi.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <tchar.h>