Permalink
Browse files

Gettext, PCH++, ozEngine

- all oCore/*.cc and ozDynamics/*.cc include ozCore.hh/ozDynamics.hh, which is
  precompiled via ozCore_pch.hh/ozDynamics_pch.hh
- ozCore
  * JSON::read(), write() removed
  * Gettext class: generalisation of Lingua class, handles gettext .mo files
- ozEngine
  * new comonent to contain generic 3D engine building blocks in the future
- cmake
  * PCHs work from other directories
  • Loading branch information...
ducakar committed Feb 15, 2013
1 parent 8c7ea5a commit fcc71832b350e6cf46d23f074d19e5332b6c5863
Showing with 649 additions and 131 deletions.
  1. +1 −1 autogen.sh
  2. +5 −5 cmake/PCH.cmake
  3. +2 −2 etc/PKGBUILD
  4. +10 −4 etc/openzone.spec
  5. +1 −0 src/CMakeLists.txt
  6. +1 −4 src/ozCore/Alloc.cc
  7. +1 −1 src/ozCore/Buffer.cc
  8. +7 −2 src/ozCore/CMakeLists.txt
  9. +9 −9 src/ozCore/File.cc
  10. +227 −0 src/ozCore/Gettext.cc
  11. +128 −0 src/ozCore/Gettext.hh
  12. +20 −3 src/ozCore/InputStream.hh
  13. +16 −29 src/ozCore/JSON.cc
  14. +0 −13 src/ozCore/JSON.hh
  15. +1 −1 src/ozCore/Log.cc
  16. +1 −1 src/ozCore/Log.hh
  17. +1 −1 src/ozCore/Mat33.cc
  18. +1 −1 src/ozCore/Mat44.cc
  19. +1 −1 src/ozCore/Math.cc
  20. +1 −3 src/ozCore/Mutex.cc
  21. +22 −5 src/ozCore/OutputStream.hh
  22. +1 −1 src/ozCore/Point.cc
  23. +1 −1 src/ozCore/Quat.cc
  24. +1 −3 src/ozCore/Semaphore.cc
  25. +1 −4 src/ozCore/StackTrace.cc
  26. +1 −4 src/ozCore/String.cc
  27. +1 −4 src/ozCore/System.cc
  28. +1 −3 src/ozCore/Thread.cc
  29. +1 −1 src/ozCore/Time.cc
  30. +1 −1 src/ozCore/Vec3.cc
  31. +1 −1 src/ozCore/Vec4.cc
  32. +1 −2 src/ozCore/common.cc
  33. +2 −1 src/ozCore/ozCore.hh
  34. +1 −0 src/ozCore_pch.cc
  35. +1 −0 src/ozCore_pch.hh
  36. +5 −2 src/ozDynamics/CMakeLists.txt
  37. +1 −1 src/ozDynamics/collision/Body.cc
  38. +1 −1 src/ozDynamics/collision/Box.cc
  39. +1 −1 src/ozDynamics/collision/Capsule.cc
  40. +1 −1 src/ozDynamics/collision/Collider.cc
  41. +1 −1 src/ozDynamics/collision/Compound.cc
  42. +1 −1 src/ozDynamics/collision/Mesh.cc
  43. +1 −1 src/ozDynamics/collision/Shape.cc
  44. +1 −1 src/ozDynamics/collision/Space.cc
  45. +1 −1 src/ozDynamics/ozDynamics.hh
  46. +1 −1 src/ozDynamics/physics/DBody.cc
  47. +1 −3 src/ozDynamics/physics/Physics.cc
  48. +1 −0 src/ozDynamics_pch.cc
  49. +1 −0 src/ozDynamics_pch.hh
  50. +25 −0 src/ozEngine/CMakeLists.txt
  51. +27 −0 src/ozEngine/common.cc
  52. +30 −0 src/ozEngine/common.hh
  53. +27 −0 src/ozEngine/config.hh.in
  54. 0 src/ozEngine/dummy.cc
  55. +31 −0 src/ozEngine/ozEngine.hh
  56. +11 −0 src/ozEngine/ozEngine.pc.in
  57. +1 −0 src/ozEngine_pch.cc
  58. +1 −0 src/ozEngine_pch.hh
  59. +3 −0 src/tests/test.cc
  60. +4 −4 src/tools/CMakeLists.txt
View
@@ -10,7 +10,7 @@
#
version=0.3.81
-components=( ozCore ozDynamics common matrix nirvana modules client builder unittest )
+components=( ozCore ozDynamics ozEngine common matrix nirvana modules client builder unittest )
# Generate CMakeLists.txt files.
for component in ${components[@]}; do
View
@@ -55,14 +55,14 @@ else( PCH_DISABLE )
add_library( ${_pchTarget}_trigger STATIC "${_inputModule}" )
# Build PCH and copy original header to the build folder since we include PCH indirectly.
- add_custom_command( OUTPUT "${_inputHeader}.gch"
+ add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_inputHeader}.gch"
DEPENDS ${_pchTarget}_trigger
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/${_inputHeader}"
- "${_inputHeader}"
- COMMAND "${CMAKE_COMMAND}" -E remove -f "${_inputHeader}.gch"
- COMMAND "${CMAKE_CXX_COMPILER}" ${_flags} -o "${_inputHeader}.gch"
+ "${CMAKE_CURRENT_BINARY_DIR}/${_inputHeader}"
+ COMMAND "${CMAKE_COMMAND}" -E remove -f "${CMAKE_CURRENT_BINARY_DIR}/${_inputHeader}.gch"
+ COMMAND "${CMAKE_CXX_COMPILER}" ${_flags} -o "${CMAKE_CURRENT_BINARY_DIR}/${_inputHeader}.gch"
"${CMAKE_CURRENT_SOURCE_DIR}/${_inputHeader}" )
- add_custom_target( ${_pchTarget} DEPENDS "${_inputHeader}.gch" )
+ add_custom_target( ${_pchTarget} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_inputHeader}.gch" )
# Cache header location for later `use_pch()` macros.
set( ${_pchTarget}_output "${CMAKE_CURRENT_BINARY_DIR}/${_inputHeader}" )
View
@@ -19,7 +19,7 @@ function build()
cmake \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=Release \
- -D CMAKE_CXX_FLAGS="${CXXFLAGS/-O2} -msse3 -mfpmath=sse" \
+ -D CMAKE_CXX_FLAGS="${CXXFLAGS/-O2} -msse3 -mfpmath=sse -fPIC" \
-D CMAKE_CXX_FLAGS_RELEASE="-Ofast -flto" \
-D BUILD_SHARED_LIBS=1 \
-D OZ_LUAJIT=1 \
@@ -31,7 +31,7 @@ function build()
function package_liboz()
{
- pkgdesc='OpenZone Core and Dynamics Libraries'
+ pkgdesc='OpenZone Core, Dynamics and Engine Libraries'
license=('ZLIB')
depends=('libpulse' 'physfs')
View
@@ -31,7 +31,7 @@ and front-end that renders it and enables the player to manipulate with the
simulated world.
%package -n liboz
-Summary: OpenZone Core and Dynamics Libraries
+Summary: OpenZone Core, Dynamics and Engine Libraries
Group: System Environment/Libraries
License: zlib
@@ -43,15 +43,18 @@ log writer, JSON file manipulation class, math functions and linear algebra
classes.
OpenZone Dynamics Library is a rigid body physics engine used in OpenZone
engine.
+OpenZone Engine Library contains basic engine building blocks for OpenZone
+game.
%package -n liboz-devel
-Summary: Headers for OpenZone Core and Dynamics Libraries
+Summary: Headers for OpenZone Core, Dynamics and Engine Libraries
Group: Development/Libraries
License: zlib
Requires: liboz = %{version}
%description -n liboz-devel
-This package contains header files for OpenZone Core and Dynamics Libraries.
+This package contains header files for OpenZone Core, Dynamics and Engine
+Libraries.
%package data
Summary: OpenZone game data
@@ -71,7 +74,7 @@ cd build
cmake \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=Release \
- -D CMAKE_CXX_FLAGS="-msse3 -mfpmath=sse" \
+ -D CMAKE_CXX_FLAGS="-msse3 -mfpmath=sse -fPIC" \
-D CMAKE_CXX_FLAGS_RELEASE="-Ofast -flto" \
-D BUILD_SHARED_LIBS=1 \
..
@@ -102,14 +105,17 @@ install -m644 share/openzone/*.zip "$RPM_BUILD_ROOT"%{_datadir}/openzone
%defattr(-, root, root, -)
%{_libdir}/libozCore.so*
%{_libdir}/libozDynamics.so*
+%{_libdir}/libozEngine.so*
%doc src/ozCore/COPYING
%files -n liboz-devel
%defattr(-, root, root, -)
%{_libdir}/pkgconfig/ozCore.pc
%{_libdir}/pkgconfig/ozDynamics.pc
+%{_libdir}/pkgconfig/ozEngine.pc
%{_includedir}/ozCore
%{_includedir}/ozDynamics
+%{_includedir}/ozEngine
%doc src/ozCore/COPYING
%files data
View
@@ -3,6 +3,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
add_subdirectory( ozCore )
add_subdirectory( ozDynamics )
+add_subdirectory( ozEngine )
add_subdirectory( unittest )
add_pch( pch stable.hh stable.cc )
View
@@ -24,10 +24,7 @@
* @file ozCore/Alloc.cc
*/
-#include "Alloc.hh"
-
-#include "System.hh"
-#include "Log.hh"
+#include "ozCore.hh"
#include <cstdlib>
#include <malloc.h>
View
@@ -24,7 +24,7 @@
* @file ozCore/Buffer.cc
*/
-#include "Buffer.hh"
+#include "ozCore.hh"
namespace oz
{
@@ -16,6 +16,7 @@ add_library( ozCore
DChain.hh
Endian.hh
File.hh
+ Gettext.hh
HashMap.hh
HashSet.hh
InputStream.hh
@@ -52,6 +53,7 @@ add_library( ozCore
Buffer.cc
common.cc
File.cc
+ Gettext.cc
JSON.cc
Log.cc
Mat33.cc
@@ -71,8 +73,6 @@ add_library( ozCore
#END SOURCES
)
-set_target_properties( ozCore PROPERTIES VERSION ${OZ_VERSION} SOVERSION 0 )
-
if( EMSCRIPTEN )
# target_link_libraries( ozCore )
elseif( ANDROID )
@@ -88,6 +88,11 @@ else()
target_link_libraries( ozCore ${PHYSFS_LIBRARY} -lpulse-simple -lasound -lrt -lpthread )
endif()
+set_target_properties( ozCore PROPERTIES VERSION ${OZ_VERSION} SOVERSION 0 )
+
+add_pch( ozCore_pch ../ozCore_pch.hh ../ozCore_pch.cc )
+use_pch( ozCore ozCore_pch )
+
install( TARGETS ozCore
RUNTIME DESTINATION bin${OZ_BINARY_SUBDIR}
LIBRARY DESTINATION lib${OZ_BINARY_SUBDIR}
View
@@ -24,7 +24,7 @@
* @file ozCore/File.cc
*/
-#include "File.hh"
+#include "ozCore.hh"
#if defined( __native_client__ )
# include <ppapi/c/pp_file_info.h>
@@ -65,13 +65,6 @@ namespace oz
#ifdef __native_client__
-struct Semaphore
-{
- pthread_mutex_t mutex;
- pthread_cond_t cond;
- volatile int counter;
-};
-
#define SEMAPHORE_POST() \
pthread_mutex_lock( &_fd->semaphore.mutex ); \
++_fd->semaphore.counter; \
@@ -106,6 +99,13 @@ struct Semaphore
struct File::Descriptor
{
+ struct Semaphore
+ {
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ volatile int counter;
+ };
+
// Some Descriptor members are also useful for static functions.
static Descriptor staticDesc;
@@ -665,7 +665,7 @@ bool File::read( OutputStream* ostream ) const
char* buffer = ostream->forward( fileSize );
bool result = read( buffer, &size );
- ostream->seek( buffer + size );
+ ostream->set( buffer + size );
return result;
}
Oops, something went wrong.

0 comments on commit fcc7183

Please sign in to comment.