Skip to content

Commit

Permalink
Compile the Texture Font Generator with cmake.
Browse files Browse the repository at this point in the history
This program is not built by default. Enable one of the following options to utilize it:

* WITH_FULL_RELEASE
* WITH_TEXTURE_GENERATOR

It is heavily advised to make sure the MFC library is installed for Visual Studio and the computer is restarted afterwards.

As a bonus, `zlib1.dll` can go away now.

The old visual studio projects are still in play in case others still struggle with the code fixes.
  • Loading branch information
wolfman2000 committed Oct 27, 2015
1 parent cf5656a commit e0290fc
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -82,6 +82,8 @@ PBProject/Hardware.plist
*.exp
*.ilk
*.map
*.aps
*.res

# Windows General Files
Thumbs.db
Expand Down
3 changes: 3 additions & 0 deletions CMake/DefineOptions.cmake
Expand Up @@ -43,6 +43,9 @@ if(NOT MSVC)
option(WITH_FFMPEG "Build with FFMPEG." ON)
# Change this number to utilize a different number of jobs for building FFMPEG.
option(WITH_FFMPEG_JOBS "Build FFMPEG with this many jobs." 2)
else()
# Turn this option on to enable using the Texture Font Generator.
option(WITH_TEXTURE_GENERATOR "Build with the Texture Font Generator. Ensure the MFC library is installed." OFF)
endif()

if(WIN32)
Expand Down
Binary file removed Program/Texture Font Generator.exe
Binary file not shown.
Binary file removed Program/zlib1.dll
Binary file not shown.
5 changes: 3 additions & 2 deletions src/CMakeLists.txt
Expand Up @@ -6,6 +6,9 @@ if(MSVC)
if (WITH_IRC_POST_HOOK)
include("CMakeProject-irc.cmake")
endif()
if (WITH_TEXTURE_GENERATOR OR WITH_FULL_RELEASE)
include("CMakeProject-texture.cmake")
endif()
endif()

# Keep the module path local for easier grabbing.
Expand Down Expand Up @@ -154,7 +157,6 @@ list(APPEND SM_WINDOWS_PROGRAM_DLLS
"${SM_PROGRAM_DIR}/avutil-52.dll"
"${SM_PROGRAM_DIR}/parallel_lights_io.dll"
"${SM_PROGRAM_DIR}/swscale-2.dll"
"${SM_PROGRAM_DIR}/zlib1.dll"
)

if(WIN32)
Expand Down Expand Up @@ -616,7 +618,6 @@ if(NOT APPLE)
install(FILES "${SM_PROGRAM_DIR}/avutil-52.dll" DESTINATION "${SM_FULL_INSTALLATION_PATH}")
install(FILES "${SM_PROGRAM_DIR}/parallel_lights_io.dll" DESTINATION "${SM_FULL_INSTALLATION_PATH}")
install(FILES "${SM_PROGRAM_DIR}/swscale-2.dll" DESTINATION "${SM_FULL_INSTALLATION_PATH}")
install(FILES "${SM_PROGRAM_DIR}/zlib1.dll" DESTINATION "${SM_FULL_INSTALLATION_PATH}")
install(FILES "${SM_PROGRAM_DIR}/StepMania.vdi" DESTINATION "${SM_FULL_INSTALLATION_PATH}")

# foreach(SM_WINDOW_DLL "${SM_WINDOWS_PROGRAM_DLLS}")
Expand Down
71 changes: 71 additions & 0 deletions src/CMakeProject-texture.cmake
@@ -0,0 +1,71 @@
if (NOT MSVC)
return()
endif()

set(TEXTURE_DIR "${SM_SRC_DIR}/Texture Font Generator")

list(APPEND TEXTURE_SRC
"${TEXTURE_DIR}/stdafx.cpp"
"${TEXTURE_DIR}/Texture Font Generator.cpp"
"${TEXTURE_DIR}/Texture Font GeneratorDlg.cpp"
"${TEXTURE_DIR}/TextureFont.cpp"
"${TEXTURE_DIR}/Utils.cpp"
)

list(APPEND TEXTURE_HPP
"${TEXTURE_DIR}/Resource.h"
"${TEXTURE_DIR}/stdafx.h"
"${TEXTURE_DIR}/Texture Font Generator.h"
"${TEXTURE_DIR}/Texture Font GeneratorDlg.h"
"${TEXTURE_DIR}/TextureFont.h"
"${TEXTURE_DIR}/Utils.h"
)

list(APPEND TEXTURE_DAT
"${TEXTURE_DIR}/res/Texture Font Generator.ico"
"${TEXTURE_DIR}/Texture Font Generator.rc"
"${TEXTURE_DIR}/res/Texture Font Generator.rc2"
)

source_group("Source Files" FILES ${TEXTURE_SRC} ${TEXTURE_HPP})
source_group("Resource Files" FILES ${TEXTURE_DAT})
set(CMAKE_MFC_FLAG 2)
add_executable("TextureFontGenerator" WIN32 ${TEXTURE_SRC} ${TEXTURE_HPP} ${TEXTURE_DAT})
unset(CMAKE_MFC_FLAG)
set_property(TARGET "TextureFontGenerator" PROPERTY FOLDER "Internal Libraries")

disable_project_warnings("TextureFontGenerator")

sm_add_compile_definition("TextureFontGenerator" _AFXDLL)

list(APPEND TEXTURE_LINK_LIB
"zlib"
"png"
)

target_link_libraries("TextureFontGenerator" ${TEXTURE_LINK_LIB})

list(APPEND TEXTURE_INCLUDE_DIRS
"${TEXTURE_DIR}"
"${TEXTURE_DIR}/res"
"${SM_EXTERN_DIR}/zlib"
"${SM_EXTERN_DIR}/libpng/include"
)

target_include_directories("TextureFontGenerator" PUBLIC ${TEXTURE_INCLUDE_DIRS})

set_target_properties("TextureFontGenerator" PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${SM_PROGRAM_DIR}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${SM_PROGRAM_DIR}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${SM_PROGRAM_DIR}"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${SM_PROGRAM_DIR}"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${SM_PROGRAM_DIR}"
)

set_target_properties("TextureFontGenerator" PROPERTIES
OUTPUT_NAME "Texture Font Generator"
RELEASE_OUTPUT_NAME "Texture Font Generator"
DEBUG_OUTPUT_NAME "Texture Font Generator"
MINSIZEREL_OUTPUT_NAME "Texture Font Generator"
RELWITHDEBINFO_OUTPUT_NAME "Texture Font Generator"
)
1 change: 0 additions & 1 deletion src/Texture Font Generator/Utils.cpp
Expand Up @@ -103,7 +103,6 @@ void GetBounds( const Surface *pSurf, RECT *out )
#pragma include_alias( "zlib/zlib.h", "../zlib/zlib.h" )
#include "png.h"
#if defined(_MSC_VER)
# pragma comment(lib, "libpng.lib")
#pragma warning(disable: 4611) /* interaction between '_setjmp' and C++ object destruction is non-portable */
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/Texture Font Generator/stdafx.h
Expand Up @@ -15,11 +15,11 @@ using namespace std;
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif

#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif

#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
Expand Down

0 comments on commit e0290fc

Please sign in to comment.