Commit 6acf8cb1 authored by Thomas Debesse's avatar Thomas Debesse

make crunch build optional and disabled by default

parent f715e5f6
......@@ -3,6 +3,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
project(NetRadiant C CXX)
option(BUILD_RADIANT "Build the GUI" ON)
option(BUILD_CRUNCH "Build Crunch image support" OFF)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/install" CACHE PATH "..." FORCE)
......
add_subdirectory(cmdlib)
add_subdirectory(container)
add_subdirectory(crnrgba)
if (BUILD_CRUNCH)
add_subdirectory(crnrgba)
endif ()
add_subdirectory(ddslib)
add_subdirectory(debugging)
add_subdirectory(etclib)
......
......@@ -17,6 +17,11 @@ add_subdirectory(archivewad)
add_subdirectory(archivezip)
add_subdirectory(entity)
add_subdirectory(image)
if(BUILD_CRUNCH)
add_subdirectory(imagecrn)
endif()
add_subdirectory(imagehl)
add_subdirectory(imagepng)
add_subdirectory(imageq2)
......
......@@ -6,10 +6,9 @@ radiant_plugin(image
ktx.cpp ktx.h
pcx.cpp pcx.h
tga.cpp tga.h
crn.cpp crn.h
)
find_package(JPEG REQUIRED)
target_include_directories(image PRIVATE ${JPEG_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libs/crnrgba)
target_link_libraries(image PRIVATE crnrgba ddslib etclib ${JPEG_LIBRARIES})
target_include_directories(image PRIVATE ${JPEG_INCLUDE_DIR})
target_link_libraries(image PRIVATE ddslib etclib ${JPEG_LIBRARIES})
target_compile_options(image PRIVATE -fexceptions)
......@@ -28,7 +28,6 @@
#include "pcx.h"
#include "dds.h"
#include "ktx.h"
#include "crn.h"
#include "modulesystem/singletonmodule.h"
......@@ -174,29 +173,6 @@ typedef SingletonModule<ImageKTXAPI, ImageDependencies> ImageKTXModule;
ImageKTXModule g_ImageKTXModule;
class ImageCRNAPI {
_QERPlugImageTable m_imagecrn;
public:
typedef _QERPlugImageTable Type;
STRING_CONSTANT(Name, "crn");
ImageCRNAPI()
{
m_imagecrn.loadImage = LoadCRN;
}
_QERPlugImageTable *getTable()
{
return &m_imagecrn;
}
};
typedef SingletonModule<ImageCRNAPI, ImageDependencies> ImageCRNModule;
ImageCRNModule g_ImageCRNModule;
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer &server)
{
initialiseModule(server);
......@@ -207,5 +183,4 @@ extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer &server)
g_ImagePCXModule.selfRegister();
g_ImageDDSModule.selfRegister();
g_ImageKTXModule.selfRegister();
g_ImageCRNModule.selfRegister();
}
radiant_plugin(imagecrn
imagecrn.cpp
crn.cpp crn.h
)
target_include_directories(imagecrn PRIVATE ${CMAKE_SOURCE_DIR}/libs/crnrgba)
target_link_libraries(imagecrn PRIVATE crnrgba)
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "ifilesystem.h"
#include "iimage.h"
#include "crn.h"
#include "modulesystem/singletonmodule.h"
class ImageDependencies : public GlobalFileSystemModuleRef {
};
class ImageCRNAPI {
_QERPlugImageTable m_imagecrn;
public:
typedef _QERPlugImageTable Type;
STRING_CONSTANT(Name, "crn");
ImageCRNAPI()
{
m_imagecrn.loadImage = LoadCRN;
}
_QERPlugImageTable *getTable()
{
return &m_imagecrn;
}
};
typedef SingletonModule<ImageCRNAPI, ImageDependencies> ImageCRNModule;
ImageCRNModule g_ImageCRNModule;
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer &server)
{
initialiseModule(server);
g_ImageCRNModule.selfRegister();
}
; imagepng.def : Declares the module parameters for the DLL.
LIBRARY "IMAGECRN"
EXPORTS
; Explicit exports can go here
Radiant_RegisterModules @1
......@@ -121,6 +121,16 @@ radiant_tool(q3map2
q3map2/writebsp.c
)
if (BUILD_CRUNCH)
set(OPTIONAL_IMAGE_LIBRARIES crnrgba)
set(OPTIONAL_IMAGE_DEFINES BUILD_CRUNCH=1)
endif ()
target_compile_definitions(q3map2
PRIVATE
${OPTIONAL_IMAGE_DEFINES}
)
target_link_libraries(q3map2
${GLIB_LIBRARIES}
${JPEG_LIBRARIES}
......@@ -128,7 +138,7 @@ target_link_libraries(q3map2
${LIBXML2_LIBRARIES}
${Minizip_LIBRARIES}
${ZLIB_LIBRARIES}
crnrgba
${OPTIONAL_IMAGE_LIBRARIES}
ddslib
etclib
filematch
......
......@@ -86,6 +86,7 @@ static void LoadDDSBuffer( byte *buffer, int size, byte **pixels, int *width, in
DDSDecompress( (ddsBuffer_t*) buffer, *pixels );
}
#ifdef BUILD_CRUNCH
/*
LoadCRNBuffer
loads a crn image into a valid rgba image
......@@ -106,6 +107,7 @@ void LoadCRNBuffer( byte *buffer, int size, byte **pixels, int *width, int *heig
return;
}
}
#endif // BUILD_CRUNCH
/*
......@@ -457,6 +459,7 @@ image_t *ImageLoad( const char *filename ){
if ( size > 0 ) {
LoadKTXBufferFirstImage( buffer, size, &image->pixels, &image->width, &image->height );
}
#ifdef BUILD_CRUNCH
else
{
/* attempt to load crn */
......@@ -467,6 +470,7 @@ image_t *ImageLoad( const char *filename ){
LoadCRNBuffer( buffer, size, &image->pixels, &image->width, &image->height );
}
}
#endif // BUILD_CRUNCH
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment