Optimized lib type switching
This commit is contained in:
parent
e10e74b8a1
commit
78147d3d10
@ -25,6 +25,9 @@ else() # Standalone project mode, should not be used for release.
|
||||
endif()
|
||||
set(RSP_MODEL_LIB_NAME RSPModel${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR})
|
||||
|
||||
# Compilation option
|
||||
option(RSPMODEL_SHARED "Build shared lib" ON)
|
||||
|
||||
# Push compile infos to source
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/RSPModelLib/src/config.h @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/RSEModel/src/config.h @ONLY)
|
||||
@ -57,7 +60,12 @@ add_subdirectory(RSEModel)
|
||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
||||
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
|
||||
install(TARGETS rse-model rsp-model-lib rsp-model-libstatic
|
||||
if(RSPMODEL_SHARED)
|
||||
set(RSE_MODEL_TARGETS_LIST rse-model rsp-model-lib rsp-model-libstatic)
|
||||
else()
|
||||
set(RSE_MODEL_TARGETS_LIST rse-model rsp-model-libstatic)
|
||||
endif()
|
||||
install(TARGETS ${RSE_MODEL_TARGETS_LIST}
|
||||
RUNTIME DESTINATION ${INSTALL_BIN_DIR}
|
||||
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
|
||||
ARCHIVE DESTINATION ${INSTALL_LIB_DIR}
|
||||
|
@ -29,18 +29,20 @@ endif()
|
||||
|
||||
|
||||
# Declare the shared library instance
|
||||
add_library(rsp-model-lib SHARED ${RSP_MOD_SOURCES})
|
||||
set_property(TARGET rsp-model-lib PROPERTY C_STANDARD 90)
|
||||
if(RSPMODEL_SHARED)
|
||||
add_library(rsp-model-lib SHARED ${RSP_MOD_SOURCES})
|
||||
set_property(TARGET rsp-model-lib PROPERTY C_STANDARD 90)
|
||||
|
||||
target_include_directories(rsp-model-lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_include_directories(rsp-model-lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
set_target_properties(rsp-model-lib PROPERTIES OUTPUT_NAME ${RSP_MODEL_LIB_NAME})
|
||||
set_target_properties(rsp-model-lib PROPERTIES DEFINE_SYMBOL RSPMODEL_DLL)
|
||||
set_target_properties(rsp-model-lib PROPERTIES OUTPUT_NAME ${RSP_MODEL_LIB_NAME})
|
||||
set_target_properties(rsp-model-lib PROPERTIES DEFINE_SYMBOL RSPMODEL_DLL)
|
||||
|
||||
if(MSVC)
|
||||
# msvc does not append 'lib' - do it here to have consistent name
|
||||
set_target_properties(rsp-model-lib PROPERTIES PREFIX "lib")
|
||||
set_target_properties(rsp-model-lib PROPERTIES IMPORT_PREFIX "lib")
|
||||
if(MSVC)
|
||||
# msvc does not append 'lib' - do it here to have consistent name
|
||||
set_target_properties(rsp-model-lib PROPERTIES PREFIX "lib")
|
||||
set_target_properties(rsp-model-lib PROPERTIES IMPORT_PREFIX "lib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -14,25 +14,28 @@
|
||||
#define RSPMODEL_H_
|
||||
|
||||
|
||||
#if defined(RSPMODEL_SHARED) || defined(RSPMODEL_DLL)
|
||||
# if defined(_MSC_VER)
|
||||
# define RSPMODEL_ABI_EXPORT __declspec(dllexport)
|
||||
# define RSPMODEL_ABI_IMPORT __declspec(dllimport)
|
||||
# elif __GNUC__ >= 4
|
||||
# define RSPMODEL_ABI_EXPORT __attribute__ ((visibility("default")))
|
||||
# define RSPMODEL_ABI_IMPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define RSPMODEL_ABI_EXPORT
|
||||
# define RSPMODEL_ABI_IMPORT
|
||||
# endif
|
||||
# if defined(WINDOWS) || defined(WIN32)
|
||||
# ifdef RSPMODEL_DLL
|
||||
#if defined(_MSC_VER)
|
||||
# define RSPMODEL_ABI_EXPORT __declspec(dllexport)
|
||||
# define RSPMODEL_ABI_IMPORT __declspec(dllimport)
|
||||
#elif __GNUC__ >= 4
|
||||
# define RSPMODEL_ABI_EXPORT __attribute__ ((visibility("default")))
|
||||
# define RSPMODEL_ABI_IMPORT __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define RSPMODEL_ABI_EXPORT
|
||||
# define RSPMODEL_ABI_IMPORT
|
||||
#endif
|
||||
|
||||
#if defined(RSPMODEL_DLL)
|
||||
# if defined(WIN32)
|
||||
# if defined(RSPMODEL_DLLBUILD)
|
||||
# define RSPMODEL_EXTERN extern RSPMODEL_ABI_EXPORT
|
||||
# else
|
||||
# define RSPMODEL_EXTERN extern RSPMODEL_ABI_IMPORT
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifndef RSPMODEL_EXTERN
|
||||
# define RSPMODEL_EXTERN extern
|
||||
#endif
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* \file RSPModel.c
|
||||
* \date 11/08/2022
|
||||
* \author JackCarterSmith
|
||||
* \copyright GPL-v3.0
|
||||
* \brief HOB model parser and export to Waveform OBJ format.
|
||||
* @file RSPModel.c
|
||||
* @date 11/08/2022
|
||||
* @author JackCarterSmith
|
||||
* @copyright GPL-v3.0
|
||||
* @brief HOB model parser and export to Waveform OBJ format.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#ifndef OPTIONS_H_
|
||||
#define OPTIONS_H_
|
||||
|
||||
#define RSPMODEL_DLLBUILD
|
||||
|
||||
/// Options structure
|
||||
typedef union u_prog_options {
|
||||
struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user