diff --git a/CMakeLists.txt b/CMakeLists.txt index 492b5de6..ba9d680f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,8 +97,8 @@ else(DEBUG) set(CMAKE_C_FLAGS "-O2 -Wall -Wno-unused-variable -Wno-unused-function -funroll-loops -fexpensive-optimizations") endif(DEBUG) -# Disabled for now -# add_definitions(-DHAVE_NETWORKING) +# Networking +add_definitions(-DHAVE_NETWORKING) add_definitions(-DHAVE_CXX11 -DDUMB_DECLARE_DEPRECATED) @@ -193,7 +193,7 @@ endif(APPLE) # ------------------------------------------------------- # Include directory # ------------------------------------------------------- -include_directories(src src/libs/hawknl src/libs/dumb/include include ${GRAPHICS_INCLUDES} ${FREETYPE_INCLUDE_DIR} ${OGG_INCLUDES} ${MP3_INCLUDES}) +include_directories(src src/libs src/libs/hawknl src/libs/dumb/include include ${GRAPHICS_INCLUDES} ${FREETYPE_INCLUDE_DIR} ${OGG_INCLUDES} ${MP3_INCLUDES}) # ------------------------------------------------------- # Put the linked libraries together @@ -228,8 +228,11 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/src/libs/gme) # PCRE add_subdirectory(${CMAKE_SOURCE_DIR}/src/libs/pcre) +# LZ4 +add_subdirectory(${CMAKE_SOURCE_DIR}/src/libs/lz4) + # Create r-tech1 library -add_library(r-tech1 ${SFL_SRC} ${UTIL_SRC} ${PCRE_SRC} ${x7Z_SRC} ${DUMB_SRC} ${MINIZIP_SRC} ${HAWKNL_SRC} ${GME_SRC}) +add_library(r-tech1 ${SFL_SRC} ${UTIL_SRC} ${PCRE_SRC} ${x7Z_SRC} ${DUMB_SRC} ${MINIZIP_SRC} ${HAWKNL_SRC} ${GME_SRC} ${LZ4_SRC}) # Init test add_executable(init-test tests/init/main.cpp) diff --git a/SConscript b/SConscript index f6196a40..341454b0 100644 --- a/SConscript +++ b/SConscript @@ -44,7 +44,7 @@ if scons_rtech1.checks.debug(): env.Append(CXXFLAGS = ['-g3','-ggdb']) build_dir = '%s/%s' % (build_dir_root, build_type if not scons_rtech1.checks.debug() else 'debug') -options = {'networking': False, +options = {'networking': True, 'allegro5': True } @@ -57,7 +57,7 @@ def getLibName(): libname = getLibName() -env.Append(CPPPATH = [Dir('include', Dir('.').rel_path(Dir('#' + root)))]) +env.Append(CPPPATH = [Dir('include', Dir('.').rel_path(Dir('#' + root))), Dir('src/libs')]) env.VariantDir(build_dir, 'src') libs = env.SConscript('src/SConscript', variant_dir=build_dir, exports=['env', 'options', 'root']) @@ -81,8 +81,13 @@ if os.access(env.installPrefix, os.W_OK): for root, dirs, files in os.walk(include_dir): for file in files: installEnv.Install(header_prefix + root[len(include_dir):], os.path.join(root, file)) - - installEnv.Install(os.path.join(header_prefix, 'lz4'), 'src/libs/lz4/lz4.h') + + libs_dir = 'src/libs' + for root, dirs, files in os.walk(libs_dir): + for file in files: + if file.endswith('.h'): + # print os.path.dirname(os.path.join(root, file)[len('src'):]) + installEnv.Install(header_prefix + os.path.dirname(os.path.join(root, file)[len('src'):]), os.path.join(root, file)) # pkg-config file create pc_mod, pc_install = scons_rtech1.utils.pc_install(installEnv, build_dir, scons_rtech1.checks.debug()) diff --git a/include/r-tech1/network/network.h b/include/r-tech1/network/network.h index 9e2a60d8..b8acfbf0 100644 --- a/include/r-tech1/network/network.h +++ b/include/r-tech1/network/network.h @@ -3,7 +3,7 @@ #include #ifdef HAVE_NETWORKING -#include "hawknl/nl.h" +#include "hawknl/hawknl/nl.h" #endif #include #include diff --git a/misc/r-tech1.pc.in b/misc/r-tech1.pc.in index 0c1371ae..d43d6dea 100644 --- a/misc/r-tech1.pc.in +++ b/misc/r-tech1.pc.in @@ -10,5 +10,5 @@ Name: ${lib} Description: R-Tech1 Library Wrapper Utility Version: ${version} Libs: -L${libdir} -l${lib} -Cflags: -I${includedir} -I${includedir}/r-tech1 +Cflags: -I${includedir} -I${includedir}/r-tech1 -I${includedir}/r-tech1/libs Requires: ${libs} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d54616ed..a894a938 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,7 +49,6 @@ ${CMAKE_CURRENT_SOURCE_DIR}/input/allegro5/joystick.cpp ${CMAKE_CURRENT_SOURCE_DIR}/input/touch.cpp ${CMAKE_CURRENT_SOURCE_DIR}/input/allegro5/touch.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xenon/xenon.cpp -${CMAKE_CURRENT_SOURCE_DIR}/libs/lz4/lz4.c ${CMAKE_CURRENT_SOURCE_DIR}/system.cpp ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp ${CMAKE_CURRENT_SOURCE_DIR}/compress.cpp diff --git a/src/SConscript b/src/SConscript index 24500af4..77d4b9ac 100644 --- a/src/SConscript +++ b/src/SConscript @@ -61,12 +61,19 @@ def hawknlLibrary(env): # if isOSX(): # env.Append(CPPDEFINES = 'MACOSX') return env.SConscript('libs/hawknl/SConscript', exports = ['env']) + +def lz4Library(env): + lz4Env = env.Clone() + env = lz4Env + return env.SConscript('libs/lz4/SConscript', exports = ['env']) env.Append(CPPPATH = Dir('src', Dir(Dir('.').rel_path(Dir('#%s' % root)))).abspath) -all = [utilLibrary(env), minizipLibrary(env), gmeLibrary(env), lzmaLibrary7z(env), sflLibrary(env), pcreLibrary(env), dumbLibrary(env)] +all = [utilLibrary(env), minizipLibrary(env), gmeLibrary(env), lzmaLibrary7z(env), sflLibrary(env), pcreLibrary(env), dumbLibrary(env), lz4Library(env)] if useNetwork(options): + # Have networking + env.Append(CPPDEFINES = ['HAVE_NETWORKING']) all.append(hawknlLibrary(env)) Return('all') diff --git a/src/libs/7z/CMakeLists.txt b/src/libs/7z/CMakeLists.txt index c6db7f5a..eb336066 100644 --- a/src/libs/7z/CMakeLists.txt +++ b/src/libs/7z/CMakeLists.txt @@ -36,3 +36,8 @@ PARENT_SCOPE) # module # ------------------------------------------------------- #add_library (x7z_module ${x7Z_SRC}) + + +# Install +file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +INSTALL(FILES ${files} DESTINATION include/r-tech1/libs/7z) diff --git a/src/libs/dumb/CMakeLists.txt b/src/libs/dumb/CMakeLists.txt index 2763cd97..c8435eb9 100644 --- a/src/libs/dumb/CMakeLists.txt +++ b/src/libs/dumb/CMakeLists.txt @@ -94,3 +94,6 @@ include_directories(include include/internal) # ------------------------------------------------------- #add_library (dumb_module ${DUMB_SRC}) +# Install +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include DESTINATION include/r-tech1/libs/dumb) + diff --git a/src/libs/gme/CMakeLists.txt b/src/libs/gme/CMakeLists.txt index 9b6f8c4a..25044805 100644 --- a/src/libs/gme/CMakeLists.txt +++ b/src/libs/gme/CMakeLists.txt @@ -61,3 +61,8 @@ PARENT_SCOPE) # module # ------------------------------------------------------- #add_library (gme_module ${GME_SRC}) + + +# Install +file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +INSTALL(FILES ${files} DESTINATION include/r-tech1/libs/gme) diff --git a/src/libs/hawknl/CMakeLists.txt b/src/libs/hawknl/CMakeLists.txt index a05fc114..d3c84d0b 100644 --- a/src/libs/hawknl/CMakeLists.txt +++ b/src/libs/hawknl/CMakeLists.txt @@ -44,3 +44,5 @@ PARENT_SCOPE) # ------------------------------------------------------- #add_library (hawknl_module ${HAWKNL_SRC}) +# Install +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hawknl DESTINATION include/r-tech1/libs/hawknl) diff --git a/src/libs/hawknl/SConscript b/src/libs/hawknl/SConscript index b12903c3..b24f7d24 100644 --- a/src/libs/hawknl/SConscript +++ b/src/libs/hawknl/SConscript @@ -19,7 +19,7 @@ src/sock.cpp # src/htcondition.cpp # src/htmutex.cpp -# env.Append(CPPPATH = 'hawknl') +env.Append(CPPPATH = ['.', 'hawknl']) x = [] for s in source: diff --git a/src/libs/lz4/CMakeLists.txt b/src/libs/lz4/CMakeLists.txt new file mode 100644 index 00000000..6d92fd54 --- /dev/null +++ b/src/libs/lz4/CMakeLists.txt @@ -0,0 +1,16 @@ +# ------------------------------------------------------- +# lz4 cmake build script for r-tech1. +# ------------------------------------------------------- + +project (lz4 C CXX) + +# ------------------------------------------------------- +# Source directories containing all the necessary .c files +# ------------------------------------------------------- +set(LZ4_SRC +${CMAKE_CURRENT_SOURCE_DIR}/lz4.c +PARENT_SCOPE) + +# Install +file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +INSTALL(FILES ${files} DESTINATION include/r-tech1/libs/lz4) diff --git a/src/libs/lz4/SConscript b/src/libs/lz4/SConscript new file mode 100644 index 00000000..32711a38 --- /dev/null +++ b/src/libs/lz4/SConscript @@ -0,0 +1,10 @@ +Import('env') + +source = Split(""" +lz4.c +""") + +x = [] +for s in source: + x.append(env.Object(s)) +Return('x') diff --git a/src/libs/pcre/CMakeLists.txt b/src/libs/pcre/CMakeLists.txt index 376e350b..96a05928 100644 --- a/src/libs/pcre/CMakeLists.txt +++ b/src/libs/pcre/CMakeLists.txt @@ -36,3 +36,7 @@ PARENT_SCOPE) # module # ------------------------------------------------------- #add_library (pcre_module ${PCRE_SRC}) + +# Install +file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +INSTALL(FILES ${files} DESTINATION include/r-tech1/libs/pcre) diff --git a/src/libs/sfl/CMakeLists.txt b/src/libs/sfl/CMakeLists.txt index d2a53101..c253f28b 100644 --- a/src/libs/sfl/CMakeLists.txt +++ b/src/libs/sfl/CMakeLists.txt @@ -73,3 +73,8 @@ include_directories(include ./) # ------------------------------------------------------- #add_library (sfl_module ${SFL_SRC}) +# Install +file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +INSTALL(FILES ${files} DESTINATION include/r-tech1/libs/sfl) + + diff --git a/src/libs/zip/CMakeLists.txt b/src/libs/zip/CMakeLists.txt index d0445c5e..6ce67bc3 100644 --- a/src/libs/zip/CMakeLists.txt +++ b/src/libs/zip/CMakeLists.txt @@ -14,3 +14,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/zip.c PARENT_SCOPE) # module # ------------------------------------------------------- #add_library (minizip_module ${MINIZIP_SRC}) + +# Install +file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +INSTALL(FILES ${files} DESTINATION include/r-tech1/libs/zip)