[Build] Move fex/ to src/core/fex/
* Clean up source set and public headers. * Make the fex library an OBJECT library to speed up build. * Clean up the only fex include to use the full path to the header.
This commit is contained in:
parent
d8a1886ccb
commit
ce12db1e06
|
@ -249,13 +249,17 @@ set(SDL2_TARGETS SDL2::SDL2 ${SDL2_LIBRARY_TEMP})
|
|||
set(
|
||||
VBAMCORE_LIBS
|
||||
vbamcore
|
||||
fex
|
||||
vbam-fex
|
||||
${SDL2_TARGETS}
|
||||
${SFML_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${ZLIB_LIBRARY}
|
||||
)
|
||||
|
||||
# Set up "src" as a global include directory.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src)
|
||||
|
||||
|
||||
if(ENABLE_FFMPEG)
|
||||
if(NOT FFMPEG_LIBRARIES)
|
||||
message(FATAL_ERROR "ENABLE_FFMPEG was specified, but required versions of ffmpeg libraries cannot be found!")
|
||||
|
@ -380,7 +384,7 @@ if(ENABLE_NLS)
|
|||
endif()
|
||||
|
||||
if(NOT TRANSLATIONS_ONLY)
|
||||
add_subdirectory(fex)
|
||||
add_subdirectory(src/core/fex)
|
||||
endif()
|
||||
|
||||
set(
|
||||
|
@ -653,7 +657,6 @@ set(
|
|||
|
||||
include_directories(
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
fex
|
||||
third_party/include
|
||||
third_party/include/stb
|
||||
)
|
||||
|
@ -764,5 +767,3 @@ set(CPACK_PACKAGE_VERSION_MINOR "0")
|
|||
set(CPACK_PACKAGE_VERSION_PATCH "0-Git-${COMMITHASH}")
|
||||
list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/dependencies")
|
||||
include(CPack)
|
||||
|
||||
# vim:sw=4 et tw=0:
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
function(make_path_run_wrapper cmd target)
|
||||
get_filename_component(name "${target}" NAME)
|
||||
get_filename_component(cmd_resolved "${cmd}" REALPATH)
|
||||
get_filename_component(base_name "${cmd_resolved}" NAME)
|
||||
get_filename_component(dir_name "${cmd_resolved}" DIRECTORY)
|
||||
|
||||
set(source "${target}.c")
|
||||
|
||||
configure_file(src/gcc-wrap.c.in "${source}")
|
||||
|
||||
include(HostCompile)
|
||||
host_compile("${source}" "${target}")
|
||||
|
||||
add_custom_target(generate_${name} DEPENDS "${CMAKE_BINARY_DIR}/${name}")
|
||||
add_dependencies(generate generate_${name})
|
||||
endfunction()
|
|
@ -1,44 +0,0 @@
|
|||
#Do not use this file directly. Always use the top level CMakeLists.txt file
|
||||
#File extractors so the user doesn't have to extract the rom before playing it
|
||||
|
||||
# Source files definition
|
||||
SET(SRC_FEX
|
||||
7z_C/7zAlloc.c
|
||||
7z_C/7zBuf.c
|
||||
7z_C/7zCrc.c
|
||||
7z_C/7zCrcOpt.c
|
||||
7z_C/7zDec.c
|
||||
7z_C/7zIn.c
|
||||
7z_C/7zStream.c
|
||||
7z_C/Bcj2.c
|
||||
7z_C/Bra86.c
|
||||
7z_C/Bra.c
|
||||
7z_C/CpuArch.c
|
||||
7z_C/Lzma2Dec.c
|
||||
7z_C/LzmaDec.c
|
||||
7z_C/Ppmd7.c
|
||||
7z_C/Ppmd7Dec.c
|
||||
fex/Binary_Extractor.cpp
|
||||
fex/blargg_common.cpp
|
||||
fex/blargg_errors.cpp
|
||||
fex/Data_Reader.cpp
|
||||
fex/fex.cpp
|
||||
fex/File_Extractor.cpp
|
||||
fex/Gzip_Extractor.cpp
|
||||
fex/Gzip_Reader.cpp
|
||||
fex/Rar_Extractor.cpp
|
||||
fex/Zip7_Extractor.cpp
|
||||
fex/Zip_Extractor.cpp
|
||||
fex/Zlib_Inflater.cpp
|
||||
)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
.
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
ADD_LIBRARY(
|
||||
fex
|
||||
STATIC
|
||||
${SRC_FEX}
|
||||
)
|
|
@ -34,7 +34,7 @@ extern "C" {
|
|||
#include "gba/Globals.h"
|
||||
#include "gba/RTC.h"
|
||||
|
||||
#include "fex/fex.h"
|
||||
#include "core/fex/fex.h"
|
||||
|
||||
extern "C" {
|
||||
#include "common/memgzio.h"
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
# Do not use this file directly. Always use the top level CMakeLists.txt file
|
||||
# File extractors so the user doesn't have to extract the rom before playing it.
|
||||
# This defines the `vbam-fex` target.
|
||||
|
||||
add_library(vbam-fex OBJECT)
|
||||
|
||||
target_sources(vbam-fex
|
||||
PRIVATE
|
||||
7z_C/7z.h
|
||||
7z_C/7zAlloc.c
|
||||
7z_C/7zAlloc.h
|
||||
7z_C/7zBuf.c
|
||||
7z_C/7zBuf.h
|
||||
7z_C/7zCrc.c
|
||||
7z_C/7zCrc.h
|
||||
7z_C/7zCrcOpt.c
|
||||
7z_C/7zDec.c
|
||||
7z_C/7zIn.c
|
||||
7z_C/7zStream.c
|
||||
7z_C/Bcj2.c
|
||||
7z_C/Bcj2.h
|
||||
7z_C/Bra.c
|
||||
7z_C/Bra.h
|
||||
7z_C/Bra86.c
|
||||
7z_C/CpuArch.c
|
||||
7z_C/CpuArch.h
|
||||
7z_C/Lzma2Dec.c
|
||||
7z_C/Lzma2Dec.h
|
||||
7z_C/LzmaDec.c
|
||||
7z_C/LzmaDec.h
|
||||
7z_C/Ppmd.h
|
||||
7z_C/Ppmd7.c
|
||||
7z_C/Ppmd7.h
|
||||
7z_C/Ppmd7Dec.c
|
||||
7z_C/Types.h
|
||||
fex/Binary_Extractor.cpp
|
||||
fex/Binary_Extractor.h
|
||||
fex/blargg_common.cpp
|
||||
fex/blargg_common.h
|
||||
fex/blargg_config.h
|
||||
fex/blargg_endian.h
|
||||
fex/blargg_errors.cpp
|
||||
fex/blargg_errors.h
|
||||
fex/blargg_source.h
|
||||
fex/Data_Reader.cpp
|
||||
fex/Data_Reader.h
|
||||
fex/fex.cpp
|
||||
fex/File_Extractor.cpp
|
||||
fex/File_Extractor.h
|
||||
fex/Gzip_Extractor.cpp
|
||||
fex/Gzip_Extractor.h
|
||||
fex/Gzip_Reader.cpp
|
||||
fex/Gzip_Reader.h
|
||||
fex/Rar_Extractor.cpp
|
||||
fex/Rar_Extractor.h
|
||||
fex/Zip7_Extractor.cpp
|
||||
fex/Zip7_Extractor.h
|
||||
fex/Zip_Extractor.cpp
|
||||
fex/Zip_Extractor.h
|
||||
fex/Zlib_Inflater.cpp
|
||||
fex/Zlib_Inflater.h
|
||||
|
||||
PUBLIC
|
||||
fex.h
|
||||
)
|
||||
|
||||
target_include_directories(vbam-fex
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(vbam-fex
|
||||
PRIVATE ${ZLIB_LIBRARY}
|
||||
)
|
|
@ -654,7 +654,7 @@ void Std_File_Reader::close()
|
|||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
|
||||
#include "zlib.h"
|
||||
#include <zlib.h>
|
||||
|
||||
static const char* get_gzip_eof( const char path [], long* eof )
|
||||
{
|
|
@ -4,9 +4,10 @@
|
|||
#ifndef ZLIB_INFLATER_H
|
||||
#define ZLIB_INFLATER_H
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
#include "Data_Reader.h"
|
||||
#include "blargg_common.h"
|
||||
#include "zlib.h"
|
||||
|
||||
class Zlib_Inflater
|
||||
{
|
|
@ -1,57 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define BUF_SZ 4096
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <process.h>
|
||||
#define PATH_SEP ';'
|
||||
#define setenv(var, val, dummy) _putenv_s(var, val)
|
||||
#define execvp my_execvp
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define PATH_SEP ':'
|
||||
#endif
|
||||
|
||||
char* dir_name = "${dir_name}";
|
||||
char* base_name = "${base_name}";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
size_t dir_len = strlen(dir_name);
|
||||
char* path = getenv("PATH");
|
||||
size_t path_len = strlen(path);
|
||||
char* new_path = malloc(dir_len + path_len + 2);
|
||||
char** new_argv = malloc(sizeof(char*) * argc);
|
||||
char** p;
|
||||
char buf[BUF_SZ];
|
||||
|
||||
strcpy(new_path, dir_name);
|
||||
new_path[dir_len] = PATH_SEP;
|
||||
strcpy(new_path + dir_len + 1, path);
|
||||
|
||||
setenv("PATH", new_path, 1);
|
||||
|
||||
free(new_path);
|
||||
|
||||
p = new_argv;
|
||||
*(p++) = base_name;
|
||||
while (*(++argv)) *(p++) = *argv;
|
||||
*p = NULL;
|
||||
|
||||
execvp(base_name, new_argv);
|
||||
|
||||
// this is only reached if exec failed
|
||||
snprintf(buf, BUF_SZ, "%s: exec failed", argv[0]);
|
||||
perror(buf);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
int my_execvp(char* cmd, char** argv) {
|
||||
int ret = _spawnvp(_P_WAIT, cmd, argv);
|
||||
if (ret == -1) return ret;
|
||||
exit(ret);
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue