Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
Added HAVE_NETWORKING back in for both scons and cmake (Fixes #6). Mo…
Browse files Browse the repository at this point in the history
…ve lz4 build info to its directory. Fixed references to old util directory.
  • Loading branch information
juvinious committed Apr 9, 2018
1 parent 059cc86 commit 9b57efc
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 13 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 9 additions & 4 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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'])
Expand All @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion include/r-tech1/network/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <stdint.h>
#ifdef HAVE_NETWORKING
#include "hawknl/nl.h"
#include "hawknl/hawknl/nl.h"
#endif
#include <string>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion misc/r-tech1.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion src/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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')
5 changes: 5 additions & 0 deletions src/libs/7z/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 3 additions & 0 deletions src/libs/dumb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

5 changes: 5 additions & 0 deletions src/libs/gme/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions src/libs/hawknl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/libs/hawknl/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 16 additions & 0 deletions src/libs/lz4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 10 additions & 0 deletions src/libs/lz4/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Import('env')

source = Split("""
lz4.c
""")

x = []
for s in source:
x.append(env.Object(s))
Return('x')
4 changes: 4 additions & 0 deletions src/libs/pcre/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 5 additions & 0 deletions src/libs/sfl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)


4 changes: 4 additions & 0 deletions src/libs/zip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 9b57efc

Please sign in to comment.