commit 2c01501475a15af6162b33c35abe5aa08c256e43
parent d9d2dcf73685c32b1a6346e5153e8cbf8426622f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 9 Mar 2015 11:19:14 +0100
Setup the CMake script
Currently only a dummy library is built
Diffstat:
3 files changed, 137 insertions(+), 2 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -0,0 +1,96 @@
+# Copyright (C) |Meso|Star> 2015 (contact@meso-star.com)
+#
+# This software is a computer program whose purpose is to generate files used
+# to build the Star-3D library.
+#
+# This software is governed by the CeCILL license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/or redistribute the software under the terms of the CeCILL
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# "http://www.cecill.info".
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# In this respect, the user's attention is drawn to the risks associated
+# with loading, using, modifying and/or developing or reproducing the
+# software by the user in light of its specific status of free software,
+# that may mean that it is complicated to manipulate, and that also
+# therefore means that it is reserved for developers and experienced
+# professionals having in-depth computer knowledge. Users are therefore
+# encouraged to load and test the software's suitability as regards their
+# requirements in conditions enabling the security of their systems and/or
+# data to be ensured and, more generally, to use and operate it in the
+# same conditions as regards security.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL license and that you accept its terms.
+
+cmake_minimum_required(VERSION 2.6)
+project(s3d CXX)
+cmake_policy(SET CMP0011 NEW)
+enable_testing()
+
+set(S3D_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src)
+option(NO_TEST "Disable the test" OFF)
+
+################################################################################
+# Check dependencies
+################################################################################
+find_package(RCMake 0.1 REQUIRED)
+find_package(RSys 0.1 REQUIRED)
+set(CMAKE_MODULE_PATH ${RCMAKE_SOURCE_DIR})
+include(rcmake)
+include_directories(${RSys_INCLUDE_DIR})
+
+################################################################################
+# Configure and define targets
+################################################################################
+set(VERSION_MAJOR 0)
+set(VERSION_MINOR 0)
+set(VERSION_PATCH 0)
+set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
+
+set(S3D_FILES_SRC s3d.cpp)
+set(S3D_FILES_INC s3d.h)
+
+# Prepend each file in the `S3D_FILES_<SRC|INC>' list by `S3D_SOURCE_DIR'
+rcmake_prepend_path(S3D_FILES_SRC ${S3D_SOURCE_DIR})
+rcmake_prepend_path(S3D_FILES_INC ${S3D_SOURCE_DIR})
+
+add_library(s3d SHARED ${S3D_FILES_SRC} ${S3D_FILES_INC})
+set_target_properties(s3d PROPERTIES
+ DEFINE_SYMBOL S3D_SHARED_BUILD
+ VERSION ${VERSION}
+ SOVERSION ${VERSION_MAJOR})
+
+rcmake_setup_devel(s3d s3d ${VERSION} se/s3d_version.h)
+
+################################################################################
+# Add tests
+################################################################################
+if(NOT NO_TEST)
+ function(new_test _name)
+ add_executable(${_name} ${RSYS_SOURCE_DIR}/${_name}.c)
+ set(_libraries ${ARGN})
+ foreach(_lib ${_libraries})
+ target_link_libraries(${_name} ${_lib})
+ endforeach(_lib)
+ add_test(${_name} ${_name})
+ endfunction(new_test)
+
+ # Declare tests here
+endif(NOT NO_TEST)
+
+################################################################################
+# Define output & install directories
+################################################################################
+install(TARGETS s3d
+ ARCHIVE DESTINATION bin
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin)
+install(FILES ${S3D_FILES_INC} DESTINATION include/se)
+
diff --git a/src/s3d.cpp b/src/s3d.cpp
@@ -0,0 +1,35 @@
+/* Copyright (C) |Meso|Star> 2015 (contact@meso-star.com)
+ *
+ * This software is a computer program whose purpose is to describe a
+ * virtual 3D environment that can be ray-traced and sampled both robustly
+ * and efficiently.
+ *
+ * This software is governed by the CeCILL license under French law and
+ * abiding by the rules of distribution of free software. You can use,
+ * modify and/or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty and the software's author, the holder of the
+ * economic rights, and the successive licensors have only limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading, using, modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean that it is complicated to manipulate, and that also
+ * therefore means that it is reserved for developers and experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and, more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms. */
+
+#include "s3d.h"
+
+/* Dummy file */
diff --git a/src/s3d.h b/src/s3d.h
@@ -33,6 +33,9 @@
#ifndef S3D_H
#define S3D_H
+#include <rsys/rsys.h>
+#include <float.h>
+
/* Library symbol management */
#if defined(S3D_SHARED_BUILD)
#define S3D_API extern EXPORT_SYM
@@ -94,7 +97,8 @@ struct s3d_hit {
};
/* Constant defining a NULL intersection. Should be used to initialize a hit */
-static const struct S3D_HIT_NULL = {NULL, 0, {0.f,0.f,0.f}, {0.f,0.f}, FLT_MAX};
+static const struct s3d_hit S3D_HIT_NULL =
+{NULL, 0, {0.f,0.f,0.f}, {0.f,0.f}, FLT_MAX};
/* Helper macro that defines whether or not the hit is valid, i.e. the ray
* intersects a shape or not */
@@ -126,7 +130,7 @@ BEGIN_DECLS
******************************************************************************/
S3D_API res_T
s3d_device_create
- (struct logger* logger, /* Maye be NULL <=> use default logger */
+ (struct logger* logger, /* May be NULL <=> use default logger */
struct mem_allocator* allocator, /* May be NULL <=> use default allocator */
struct s3d_device** dev);