cmake: add generation of version.h and gmio.rc (DLL information)

This commit is contained in:
Hugues Delorme 2015-05-27 18:57:00 +02:00
parent 6eb38fcd8b
commit ac0c7e2215
3 changed files with 67 additions and 2 deletions

View File

@ -21,6 +21,11 @@ include(CheckCSourceCompiles)
include(CheckTypeSize)
project(gmio C)
set(GMIO_VERSION_MAJOR 0)
set(GMIO_VERSION_MINOR 1)
set(GMIO_VERSION_PATCH 0)
set(GMIO_VERSION
${GMIO_VERSION_MAJOR}.${GMIO_VERSION_MINOR}.${GMIO_VERSION_PATCH})
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
@ -133,8 +138,9 @@ if(NOT BUILD_STRICT_C90)
endif()
endif() # !BUILD_STRICT_C90
configure_file(src/gmio_core/version.h.cmake version.h @ONLY)
configure_file(src/gmio_core/config.h.cmake config.h @ONLY)
include_directories(${CMAKE_BINARY_DIR}) # For generated "config.h"
include_directories(${CMAKE_BINARY_DIR}) # For generated header files
# Specific flags for GCC
if(CMAKE_COMPILER_IS_GNUCC)
@ -170,15 +176,23 @@ if(MSVC)
# Disable deprecation warnings about "non-secure" CRT functions
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
# Enable "Generate Intrinsic Functions"
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Oi")
endif()
# Enable DLL generation (export symbols)
if(BUILD_SHARED_LIBS)
add_definitions(-DGMIO_LIB_DLL
-DGMIO_LIB_MAKE_DLL)
if(MSVC)
configure_file(src/gmio_core/gmio.rc.cmake gmio.rc @ONLY)
set(ALL_SRC_FILES ${ALL_SRC_FILES} ${CMAKE_BINARY_DIR}/gmio.rc)
endif()
endif()
# Declare installs
install(FILES ${CMAKE_BINARY_DIR}/version.h DESTINATION include/gmio_core)
install(FILES ${CMAKE_BINARY_DIR}/config.h DESTINATION include/gmio_core)
file(GLOB C_CORE_HEADERS src/gmio_core/*.h)
@ -217,7 +231,6 @@ install(TARGETS gmio
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
# Examples:
# cmake ../.. -DCMAKE_INSTALL_PREFIX=../../gcc-linux64 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEBUG_POSTFIX=.debug
# cmake ../.. -DCMAKE_INSTALL_PREFIX=../../gcc-linux64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_RELEASE_POSTFIX=.release

View File

@ -0,0 +1,25 @@
#include <winresrc.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION @GMIO_VERSION_MAJOR@,@GMIO_VERSION_MINOR@,@GMIO_VERSION_PATCH@,0
PRODUCTVERSION @GMIO_VERSION_MAJOR@,@GMIO_VERSION_MINOR@,@GMIO_VERSION_PATCH@,0
FILETYPE VFT_DLL
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "04090000"
BEGIN
VALUE "FileDescription", "GeomIO DLL"
VALUE "FileVersion", "@GMIO_VERSION@"
VALUE "InternalName", "gmio"
VALUE "LegalCopyright", "Licensed under CeCILL-B v1.0"
VALUE "ProductName", "GeomIO library, by Fougue Ltd."
VALUE "ProductVersion", "@GMIO_VERSION@"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@ -0,0 +1,27 @@
/****************************************************************************
** GeomIO Library
** Copyright Fougue (2 Mar. 2015)
** contact@fougsys.fr
**
** This software is a reusable library whose purpose is to provide complete
** I/O support for various CAD file formats (eg. STL)
**
** This software is governed by the CeCILL-B 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-B
** license as circulated by CEA, CNRS and INRIA at the following URL
** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
****************************************************************************/
/* Generated by CMake */
#ifndef GMIO_VERSION_H_CMAKE
#define GMIO_VERSION_H_CMAKE
# define GMIO_VERSION_MAJOR @GMIO_VERSION_MAJOR@
# define GMIO_VERSION_MINOR @GMIO_VERSION_MINOR@
# define GMIO_VERSION_PATCH @GMIO_VERSION_PATCH@
# define GMIO_VERSION_STR "@GMIO_VERSION@"
# define GMIO_VERSION 0x0@GMIO_VERSION_MAJOR@0@GMIO_VERSION_MINOR@0@GMIO_VERSION_PATCH@
#endif /* GMIO_VERSION_H_CMAKE */