commit c99e51bf37bd9290adb04326338cec1c05c25f0d
parent 41046ab9f62215b2bf40b38dd6de0bd75c64d462
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 19 Feb 2021 18:01:27 +0100
Re-organise the htrdr commands
Transform the "htrdr-atmosphere" project in library and shared it
between the htrdr-atmosphere and "htrdr atmosphere" commands.
Diffstat:
21 files changed, 285 insertions(+), 177 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -31,6 +31,7 @@ set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
################################################################################
add_subdirectory(core)
add_subdirectory(atmosphere)
+add_subdirectory(commands)
#add_subdirectory(doc)
################################################################################
diff --git a/cmake/atmosphere/CMakeLists.txt b/cmake/atmosphere/CMakeLists.txt
@@ -80,7 +80,7 @@ rcmake_prepend_path(HTRDR_ATMOSPHERE_FILES_INC ${HTRDR_SOURCE_DIR}/atmosphere)
rcmake_prepend_path(HTRDR_ATMOSPHERE_FILES_INC2 ${HTRDR_BUILD_DIR}/atmosphere)
# Atmosphere library
-add_executable(htrdr-atmosphere
+add_library(htrdr-atmosphere SHARED
${HTRDR_ATMOSPHERE_FILES_SRC}
${HTRDR_ATMOSPHERE_FILES_INC}
${HTRDR_ATMOSPHERE_FILES_INC2})
@@ -90,6 +90,11 @@ if(CMAKE_COMPILER_IS_GNUCC)
target_link_libraries(htrdr-atmosphere m)
endif()
+set_target_properties(htrdr-atmosphere PROPERTIES
+ DEFINE_SYMBOL HTRDR_SHARED_BUILD
+ VERSION ${VERSION}
+ SOVERSION ${VERSION_MAJOR})
+
################################################################################
# Define output & install directories
################################################################################
diff --git a/cmake/commands/CMakeLists.txt b/cmake/commands/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com)
+# Copyright (C) 2018, 2019, 2021 CNRS
+# Copyright (C) 2018, 2019 Université Paul Sabatier
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+cmake_minimum_required(VERSION 3.1)
+project(htrdr-commands C)
+
+include_directories(${HTRDR_BUILD_DIR} ${HTRDR_SOURCE_DIR})
+
+################################################################################
+# Check dependencies
+################################################################################
+find_package(RSys 0.11 REQUIRED)
+include_directories(${RSys_INCLUDE_DIR})
+
+################################################################################
+# Configure and define targets
+################################################################################
+add_executable(htrdr_cmd ${HTRDR_SOURCE_DIR}/commands/htrdr_cmd.c)
+target_link_libraries(htrdr_cmd htrdr-atmosphere)
+set_target_properties(htrdr_cmd PROPERTIES
+ OUTPUT_NAME htrdr)
+
+add_executable(htrdr_atmosphere_cmd
+ ${HTRDR_SOURCE_DIR}/commands/htrdr_atmosphere_cmd.c)
+target_link_libraries(htrdr_atmosphere_cmd htrdr-atmosphere)
+set_target_properties(htrdr_atmosphere_cmd PROPERTIES
+ OUTPUT_NAME htrdr-atmosphere)
+
+################################################################################
+# Define output & install directories
+################################################################################
+install(TARGETS htrdr_cmd htrdr_atmosphere_cmd
+ ARCHIVE DESTINATION bin
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin)
+
diff --git a/cmake/core/CMakeLists.txt b/cmake/core/CMakeLists.txt
@@ -125,17 +125,14 @@ endif()
set_target_properties(htrdr-core PROPERTIES
COMPILE_FLAGS "${OpenMP_C_FLAGS}"
- DEFINE_SYMBOL HTRDR_SHARED_BUILD
+ DEFINE_SYMBOL HTRDR_CORE_SHARED_BUILD
VERSION ${VERSION}
SOVERSION ${VERSION_MAJOR})
-# Main command
-add_executable(htrdr ${HTRDR_SOURCE_DIR}/core/htrdr_main.c)
-
################################################################################
# Define output & install directories
################################################################################
-install(TARGETS htrdr htrdr-core
+install(TARGETS htrdr-core
ARCHIVE DESTINATION bin
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
diff --git a/src/atmosphere/htrdr_atmosphere.h b/src/atmosphere/htrdr_atmosphere.h
@@ -18,6 +18,7 @@
#ifndef HTRDR_ATMOSPHERE_H
#define HTRDR_ATMOSPHERE_H
+#include "core/htrdr.h"
#include <rsys/rsys.h>
/* Forward declarations */
@@ -25,23 +26,32 @@ struct htrdr;
struct htrdr_atmosphere;
struct htrdr_atmosphere_args;
-extern LOCAL_SYM res_T
+BEGIN_DECLS
+
+HTRDR_API res_T
htrdr_atmosphere_create
(struct htrdr* htrdr,
const struct htrdr_atmosphere_args* args,
struct htrdr_atmosphere** cmd);
-extern LOCAL_SYM void
+HTRDR_API void
htrdr_atmosphere_ref_get
(struct htrdr_atmosphere* cmd);
-extern LOCAL_SYM void
+HTRDR_API void
htrdr_atmosphere_ref_put
(struct htrdr_atmosphere* cmd);
-extern LOCAL_SYM res_T
+HTRDR_API res_T
htrdr_atmosphere_run
(struct htrdr_atmosphere* cmd);
+HTRDR_API int
+htrdr_atmosphere_main
+ (int argc,
+ char** argv);
+
+END_DECLS
+
#endif /* HTRDR_ATMOSPHERE_H */
diff --git a/src/atmosphere/htrdr_atmosphere_main.c b/src/atmosphere/htrdr_atmosphere_main.c
@@ -23,18 +23,24 @@
#include <rsys/mem_allocator.h>
int
-main(int argc, char** argv)
+htrdr_atmosphere_main(int argc, char** argv)
{
+ char cmd_name[] = "htrdr-atmosphere";
struct htrdr_args htrdr_args = HTRDR_ARGS_DEFAULT;
struct htrdr_atmosphere_args cmd_args = HTRDR_ATMOSPHERE_ARGS_DEFAULT;
struct htrdr* htrdr = NULL;
struct htrdr_atmosphere* cmd = NULL;
size_t memsz;
+ int is_mpi_init = 0;
int err = 0;
res_T res = RES_OK;
+ /* Overwrite command name */
+ argv[0] = cmd_name;
+
res = htrdr_mpi_init(argc, argv);
if(res != RES_OK) goto error;
+ is_mpi_init = 1;
res = htrdr_atmosphere_args_init(&cmd_args, argc, argv);
if(res != RES_OK) goto error;
@@ -57,8 +63,8 @@ main(int argc, char** argv)
if(res != RES_OK) goto error;
exit:
- htrdr_mpi_finalize();
htrdr_atmosphere_args_release(&cmd_args);
+ if(is_mpi_init) htrdr_mpi_finalize();
if(htrdr) htrdr_ref_put(htrdr);
if(cmd) htrdr_atmosphere_ref_put(cmd);
@@ -69,6 +75,7 @@ exit:
}
return err;
error:
- err = - 1;
+ err = -1;
goto exit;
}
+
diff --git a/src/commands/htrdr_atmosphere_cmd.c b/src/commands/htrdr_atmosphere_cmd.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com)
+ * Copyright (C) 2018, 2019, 2021 CNRS
+ * Copyright (C) 2018, 2019 Université Paul Sabatier
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "atmosphere/htrdr_atmosphere.h"
+
+int
+main(int argc, char** argv)
+{
+ return htrdr_atmosphere_main(argc, argv);
+}
diff --git a/src/commands/htrdr_cmd.c b/src/commands/htrdr_cmd.c
@@ -0,0 +1,108 @@
+/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com)
+ * Copyright (C) 2018, 2019, 2021 CNRS
+ * Copyright (C) 2018, 2019 Université Paul Sabatier
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "atmosphere/htrdr_atmosphere.h"
+#include "core/htrdr_version.h"
+
+#include <string.h>
+
+/*******************************************************************************
+ * Helper functions
+ ******************************************************************************/
+static void
+print_usage(const char* cmd)
+{
+ ASSERT(cmd);
+ printf("Usage: %s [--version] [--help] <mode> [<args>]\n", cmd);
+}
+
+static void
+print_help(const char* cmd)
+{
+ ASSERT(cmd);
+
+ print_usage(cmd);
+ printf("\n");
+
+ printf(
+" --version display version information and exit.\n");
+ printf(
+" --help display this help and exit.\n");
+ printf("\n");
+
+ printf("These are %s available modes:\n", cmd);
+ printf("\n");
+ printf(
+" atmosphere Radiative transfer computations in a cloudy atmosphere.\n");
+ printf(
+" combustion Radiative transfer computations in a combustion medium.\n");
+ printf("\n");
+
+ htrdr_fprint_license(cmd, stdout);
+}
+
+/*******************************************************************************
+ * Program
+ ******************************************************************************/
+int
+main(int argc, char** argv)
+{
+ int err = 0;
+
+ if(argc < 2) {
+ print_usage(argv[0]);
+ err = -1;
+ goto error;
+ }
+
+ /* Atmosphere mode */
+ if(!strcmp(argv[1], "atmosphere")) {
+ err = htrdr_atmosphere_main(argc-1, argv+1);
+ if(err) goto error;
+
+ /* Combustion mode */
+ } else if(!strcmp(argv[1], "combustion")) {
+ /* TODO */
+
+ /* Version */
+ } else if(!strcmp(argv[1], "--version")) {
+ printf("%s version %d.%d.%d\n",
+ argv[0],
+ HTRDR_VERSION_MAJOR,
+ HTRDR_VERSION_MINOR,
+ HTRDR_VERSION_PATCH);
+ goto exit;
+
+ /* Help */
+ } else if(!strcmp(argv[1], "--help")) {
+ print_help(argv[0]);
+ goto exit;
+
+ /* Fallback */
+ } else {
+ fprintf(stderr, "Unknown option: %s\n", argv[1]);
+ print_usage(argv[0]);
+ err = -1;
+ goto error;
+ }
+
+exit:
+ return err;
+error:
+ goto exit;
+}
+
diff --git a/src/core/htrdr.h b/src/core/htrdr.h
@@ -22,6 +22,14 @@
#include <stdio.h>
/* Library symbol management */
+#if defined(HTRDR_CORE_SHARED_BUILD) /* Build shared library */
+ #define HTRDR_CORE_API extern EXPORT_SYM
+#elif defined(HTRDR_CORE_STATIC) /* Use/build static library */
+ #define HTRDR_CORE_API extern LOCAL_SYM
+#else /* Use shared library */
+ #define HTRDR_CORE_API extern IMPORT_SYM
+#endif
+
#if defined(HTRDR_SHARED_BUILD) /* Build shared library */
#define HTRDR_API extern EXPORT_SYM
#elif defined(HTRDR_STATIC) /* Use/build static library */
@@ -78,69 +86,69 @@ BEGIN_DECLS
/* Initialize the MPI execution environment. Must be called priorly to any MPI
* invocation, e.g. at the beginning of the main function */
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_mpi_init
(int argc,
char** argv);
/* Terminate the MPI execution environment */
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_mpi_finalize
(void);
/*******************************************************************************
* HTRDR api
******************************************************************************/
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_create
(struct mem_allocator* allocator,
const struct htrdr_args* args,
struct htrdr** htrdr);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_ref_get
(struct htrdr* htrdr);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_ref_put
(struct htrdr* htrdr);
/* Return the number of threads used by the process */
-HTRDR_API size_t
+HTRDR_CORE_API size_t
htrdr_get_threads_count
(const struct htrdr* htrdr);
/* Return the number of running processes for the current htrdr instance */
-HTRDR_API size_t
+HTRDR_CORE_API size_t
htrdr_get_procs_count
(const struct htrdr* htrdr);
-HTRDR_API int
+HTRDR_CORE_API int
htrdr_get_mpi_rank
(const struct htrdr* htrdr);
-HTRDR_API struct mem_allocator*
+HTRDR_CORE_API struct mem_allocator*
htrdr_get_allocator
(struct htrdr* htrdr);
-HTRDR_API struct mem_allocator*
+HTRDR_CORE_API struct mem_allocator*
htrdr_get_thread_allocator
(struct htrdr* htrdr,
const size_t ithread);
-HTRDR_API struct logger*
+HTRDR_CORE_API struct logger*
htrdr_get_logger
(struct htrdr* htrdr);
-HTRDR_API int
+HTRDR_CORE_API int
htrdr_get_verbosity_level
(const struct htrdr* htrdr);
-HTRDR_API struct s3d_device*
+HTRDR_CORE_API struct s3d_device*
htrdr_get_s3d
(struct htrdr* htrdr);
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_open_output_stream
(struct htrdr* htrdr,
const char* filename,
@@ -149,13 +157,13 @@ htrdr_open_output_stream
FILE** out_fp);
/* TODO do not expose publicly this function(?) */
-HTRDR_API const char*
+HTRDR_CORE_API const char*
htrdr_mpi_error_string
(struct htrdr* htrdr,
const int mpi_err);
/* TODO replace them by regular log message */
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_fprintf
(struct htrdr* htrdr,
FILE* stream,
@@ -167,7 +175,7 @@ htrdr_fprintf
;
/* TODO remove this */
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_fflush
(struct htrdr* htrdr,
FILE* stream);
diff --git a/src/core/htrdr_args.h.in b/src/core/htrdr_args.h.in
@@ -84,24 +84,28 @@ static const struct htrdr_args_spectral HTRDR_ARGS_SPECTRAL_DEFAULT =
/*******************************************************************************
* Exported functions
******************************************************************************/
-HTRDR_API res_T
+BEGIN_DECLS
+
+HTRDR_CORE_API res_T
htrdr_args_camera_parse
(struct htrdr_args_camera* cam,
const char* str);
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_args_rectangle_parse
(struct htrdr_args_rectangle* rect,
const char* str);
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_args_image_parse
(struct htrdr_args_image* img,
const char* str);
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_args_spectral_parse
(struct htrdr_args_spectral* spectral,
const char* str);
+END_DECLS
+
#endif /* HTRDR_ARGS_H */
diff --git a/src/core/htrdr_buffer.h b/src/core/htrdr_buffer.h
@@ -42,7 +42,7 @@ struct htrdr_buffer;
BEGIN_DECLS
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_buffer_create
(struct htrdr* htrdr,
const size_t width,
@@ -52,24 +52,24 @@ htrdr_buffer_create
const size_t alignment, /* Alignement of the buffer */
struct htrdr_buffer** buf);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_buffer_ref_get
(struct htrdr_buffer* buf);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_buffer_ref_put
(struct htrdr_buffer* buf);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_buffer_get_layout
(const struct htrdr_buffer* buf,
struct htrdr_buffer_layout* layout);
-HTRDR_API void*
+HTRDR_CORE_API void*
htrdr_buffer_get_data
(struct htrdr_buffer* buf);
-HTRDR_API void*
+HTRDR_CORE_API void*
htrdr_buffer_at
(struct htrdr_buffer* buf,
const size_t x,
diff --git a/src/core/htrdr_camera.h b/src/core/htrdr_camera.h
@@ -27,7 +27,7 @@ struct htrdr_camera;
BEGIN_DECLS
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_camera_create
(struct htrdr* htrdr,
const double position[3],
@@ -37,15 +37,15 @@ htrdr_camera_create
const double fov, /* In radian */
struct htrdr_camera** cam);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_camera_ref_get
(struct htrdr_camera* cam);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_camera_ref_put
(struct htrdr_camera* cam);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_camera_ray
(const struct htrdr_camera* cam,
const double sample[2], /* In [0, 1[ */
diff --git a/src/core/htrdr_cie_xyz.h b/src/core/htrdr_cie_xyz.h
@@ -30,37 +30,37 @@ struct htrdr_cie_xyz;
BEGIN_DECLS
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_cie_xyz_create
(struct htrdr* htrdr,
const double range[2], /* Must be included in [380, 780] nanometers */
const size_t nbands, /* # bands used to discretisze the CIE tristimulus s*/
struct htrdr_cie_xyz** cie);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_cie_xyz_ref_get
(struct htrdr_cie_xyz* cie);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_cie_xyz_ref_put
(struct htrdr_cie_xyz* cie);
/* Return a wavelength in nanometer */
-HTRDR_API double
+HTRDR_CORE_API double
htrdr_cie_xyz_sample_X
(struct htrdr_cie_xyz* cie,
const double r0, const double r1, /* Canonical numbers in [0, 1[ */
double* pdf); /* In nm^-1. May be NULL */
/* Return a wavelength in nanometer */
-HTRDR_API double
+HTRDR_CORE_API double
htrdr_cie_xyz_sample_Y
(struct htrdr_cie_xyz* cie,
const double r0, const double r1, /* Canonical number in [0, 1[ */
double* pdf); /* In nm^-1. May be NULL */
/* Return a wavelength in nanometer */
-HTRDR_API double
+HTRDR_CORE_API double
htrdr_cie_xyz_sample_Z
(struct htrdr_cie_xyz* cie,
const double r0, const double r1, /* Canonical number in [0, 1[ */
diff --git a/src/core/htrdr_draw_map.h b/src/core/htrdr_draw_map.h
@@ -82,7 +82,7 @@ htrdr_draw_pixel_args_check(const struct htrdr_draw_pixel_args* args)
******************************************************************************/
BEGIN_DECLS
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_draw_map
(struct htrdr* htrdr,
const struct htrdr_draw_map_args* args,
diff --git a/src/core/htrdr_log.h b/src/core/htrdr_log.h
@@ -29,7 +29,7 @@ struct htrdr;
BEGIN_DECLS
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_log
(struct htrdr* htrdr,
const char* msg,
@@ -39,7 +39,7 @@ htrdr_log
#endif
;
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_log_err
(struct htrdr* htrdr,
const char* msg,
@@ -49,7 +49,7 @@ htrdr_log_err
#endif
;
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_log_warn
(struct htrdr* htrdr,
const char* msg,
diff --git a/src/core/htrdr_main.c b/src/core/htrdr_main.c
@@ -1,106 +0,0 @@
-/* Copyright (C) 2018, 2019, 2020, 2021 |Meso|Star> (contact@meso-star.com)
- * Copyright (C) 2018, 2019, 2021 CNRS
- * Copyright (C) 2018, 2019 Université Paul Sabatier
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "core/htrdr.h"
-#include "core/htrdr_version.h"
-
-#include <string.h>
-
-/*******************************************************************************
- * Helper functions
- ******************************************************************************/
-static void
-print_usage(const char* cmd)
-{
- ASSERT(cmd);
- printf("Usage: %s [--version] [--help] <mode> [<args>]\n", cmd);
-}
-
-static void
-print_help(const char* cmd)
-{
- ASSERT(cmd);
-
- print_usage(cmd);
- printf("\n");
-
- printf(
-" --version display version information and exit.\n");
- printf(
-" --help display this help and exit.\n");
- printf("\n");
-
- printf("These are %s available modes:\n", cmd);
- printf("\n");
- printf(
-" atmosphere Radiative transfer computations in a cloudy atmosphere.\n");
- printf(
-" combustion Radiative transfer computations in a combustion medium.\n");
- printf("\n");
-
- htrdr_fprint_license(cmd, stdout);
-}
-
-/*******************************************************************************
- * Program
- ******************************************************************************/
-int
-main(int argc, char** argv)
-{
- int err = 0;
-
- if(argc < 2) {
- print_usage(argv[0]);
- goto error;
- }
-
- /* Atmosphere mode */
- if(!strcmp(argv[1], "atmosphere")) {
- /* TODO */
-
- /* Combustion mode */
- } else if(!strcmp(argv[1], "combustion")) {
- /* TODO */
-
- /* Version */
- } else if(!strcmp(argv[1], "--version")) {
- printf("%s version %d.%d.%d\n",
- argv[0],
- HTRDR_VERSION_MAJOR,
- HTRDR_VERSION_MINOR,
- HTRDR_VERSION_PATCH);
- goto exit;
-
- /* Help */
- } else if(!strcmp(argv[1], "--help")) {
- print_help(argv[0]);
- goto exit;
-
- /* Fallback */
- } else {
- fprintf(stderr, "Unknown option: %s\n", argv[1]);
- print_usage(argv[0]);
- goto error;
- }
-
-exit:
- return err;
-error:
- err = -1;
- goto exit;
-}
-
diff --git a/src/core/htrdr_materials.h b/src/core/htrdr_materials.h
@@ -38,28 +38,28 @@ static const struct htrdr_mtl HTRDR_MTL_NULL = HTRDR_MTL_NULL__;
BEGIN_DECLS
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_materials_create
(struct htrdr* htrdr,
const char* filename,
struct htrdr_materials** mats);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_materials_ref_get
(struct htrdr_materials* mats);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_materials_ref_put
(struct htrdr_materials* mats);
/* Return 1 if the material exist and 0 otherwise */
-HTRDR_API int
+HTRDR_CORE_API int
htrdr_materials_find_mtl
(struct htrdr_materials* mats,
const char* mtl_name,
struct htrdr_mtl* mtl);
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_mtl_create_bsdf
(struct htrdr* htrdr,
const struct htrdr_mtl* mtl,
diff --git a/src/core/htrdr_ran_wlen.h b/src/core/htrdr_ran_wlen.h
@@ -29,7 +29,7 @@ struct htrdr_ran_wlen;
BEGIN_DECLS
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_ran_wlen_create
(struct htrdr* htrdr,
const double range[2],
@@ -39,16 +39,16 @@ htrdr_ran_wlen_create
const double ref_temperature, /* Reference temperature */
struct htrdr_ran_wlen** wlen_ran);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_ran_wlen_ref_get
(struct htrdr_ran_wlen* wlen_ran);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_ran_wlen_ref_put
(struct htrdr_ran_wlen* wlen_ran);
/* Return a wavelength in nanometer */
-HTRDR_API double
+HTRDR_CORE_API double
htrdr_ran_wlen_sample
(const struct htrdr_ran_wlen* wlen_ran,
const double r0, /* Canonical number in [0, 1[ */
diff --git a/src/core/htrdr_rectangle.h b/src/core/htrdr_rectangle.h
@@ -27,7 +27,7 @@ struct htrdr_rectangle; /* 2D rectangle transformed in 3D */
BEGIN_DECLS
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_rectangle_create
(struct htrdr* htrdr,
const double sz[2], /* Size of the rectangle along its local X and Y axis */
@@ -36,21 +36,21 @@ htrdr_rectangle_create
const double up[3], /* vector orthogonal to the rectangle X axis */
struct htrdr_rectangle** rect);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_rectangle_ref_get
(struct htrdr_rectangle* rect);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_rectangle_ref_put
(struct htrdr_rectangle* rect);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_rectangle_sample_pos
(const struct htrdr_rectangle* rect,
const double sample[2], /* In [0, 1[ */
double pos[3]);
-HTRDR_API void
+HTRDR_CORE_API void
htrdr_rectangle_get_normal
(const struct htrdr_rectangle* rect,
double normal[3]);
diff --git a/src/core/htrdr_slab.h b/src/core/htrdr_slab.h
@@ -35,7 +35,7 @@ typedef res_T
BEGIN_DECLS
/* Trace a ray into a slab composed of a cell infinitely repeated in X and Y */
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_slab_trace_ray
(struct htrdr* htrdr,
const double org[3],
diff --git a/src/core/htrdr_spectral.h b/src/core/htrdr_spectral.h
@@ -143,7 +143,7 @@ htrdr_planck
BEGIN_DECLS
-HTRDR_API res_T
+HTRDR_CORE_API res_T
htrdr_brightness_temperature
(struct htrdr* htrdr,
const double lambda_min, /* In meters */
@@ -152,7 +152,7 @@ htrdr_brightness_temperature
const double radiance,
double* temperature);
-HTRDR_API double
+HTRDR_CORE_API double
htrdr_radiance_temperature
(struct htrdr* htrdr,
const double lambda_min, /* In meters */