Skip to content

Commit e617808

Browse files
committed
simplify SC_VERSION and library versioning
1 parent 97de8f9 commit e617808

File tree

20 files changed

+34
-174
lines changed

20 files changed

+34
-174
lines changed

CMakeLists.txt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,10 @@ project(SC)
4242

4343
# SC version
4444
set(SC_VERSION_MAJOR 0)
45-
set(SC_VERSION_MINOR 8-dev)
46-
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
45+
set(SC_VERSION_MINOR 9)
46+
set(SC_VERSION_PATCH 1)
47+
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR}.${SC_VERSION_PATCH})
4748

48-
# SC ABI version. SC_ABI_SOVERSION should be incremented
49-
# for each release introducing API incompatibilities
50-
set(SC_ABI_SOVERSION 2)
51-
set(SC_ABI_VERSION ${SC_ABI_SOVERSION}.0.0)
5249

5350
# Minimum required version of CMake
5451
cmake_minimum_required(VERSION 3.6.3)
@@ -99,8 +96,8 @@ if(NOT SC_IS_SUBBUILD)
9996
".. Generating step can take a while if you are building several schemas.")
10097
endif(NOT SC_IS_SUBBUILD)
10198

102-
# create config headers sc_cf.h and sc_version_string.h
10399
include(${SC_CMAKE_DIR}/SC_Config_Headers.cmake)
100+
# create config headers sc_cf.h
104101

105102

106103
################
@@ -144,6 +141,19 @@ if($CACHE{SC_BUILD_SHARED_LIBS})
144141
else()
145142
add_dependencies(core stepdai-static stepeditor-static exp2cxx check-express)
146143
endif()
144+
if(NOT SC_IS_SUBBUILD)
145+
#-----------------------------------------------------------------------------
146+
# SC Packaging
147+
# $make package
148+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "STEPcode")
149+
set(CPACK_SET_DESTDIR "ON")
150+
set(CPACK_PACKAGE_VERSION_MAJOR ${SC_VERSION_MAJOR})
151+
set(CPACK_PACKAGE_VERSION_MINOR ${SC_VERSION_MINOR})
152+
set(CPACK_PACKAGE_NAME SC)
153+
set(CPACK_PACKAGE_CONTACT "SC Developers <scl-dev@googlegroups.com>")
154+
include(CPack)
155+
endif(NOT SC_IS_SUBBUILD)
156+
147157

148158
# CONFIG_END_MESSAGES - list of messages to be printed after everything else is done.
149159
# THIS MUST BE LAST to ensure that they are visible to the user without scrolling.

cmake/SC_Build_opts.cmake

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,6 @@ if(NOT SC_IS_SUBBUILD)
144144
PATH "Install prefix prepended to target to create install location")
145145
set(CMAKE_INSTALL_PREFIX ${SC_INSTALL_PREFIX} CACHE INTERNAL "Prefix prepended to install directories if target destination is not absolute, immutable" FORCE)
146146

147-
#-----------------------------------------------------------------------------
148-
# SC Packaging
149-
# $make package
150-
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "STEPcode")
151-
set(CPACK_SET_DESTDIR "ON")
152-
set(CPACK_PACKAGE_VERSION_MAJOR ${SC_VERSION_MAJOR})
153-
set(CPACK_PACKAGE_VERSION_MINOR ${SC_VERSION_MINOR})
154-
set(CPACK_PACKAGE_NAME SC)
155-
set(CPACK_PACKAGE_CONTACT "SC Developers <scl-dev@googlegroups.com>")
156-
include(CPack)
157-
158147
#-----------------------------------------------------------------------------
159148
# Uninstall target
160149
# From http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F

cmake/SC_CXX_schema_macros.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,15 @@ endmacro(P21_TESTS sfile)
2828
macro(SCHEMA_EXES)
2929
RELATIVE_PATH_TO_TOPLEVEL(${CMAKE_CURRENT_SOURCE_DIR} RELATIVE_PATH_COMPONENT)
3030
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc" LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils base TESTABLE)
31-
#add_dependencies(p21read_${PROJECT_NAME} version_string)
3231
if(NOT WIN32)
3332
SC_ADDEXEC(lazy_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc" LINK_LIBRARIES ${PROJECT_NAME} steplazyfile stepdai stepcore stepeditor steputils base TESTABLE)
34-
#add_dependencies(lazy_${PROJECT_NAME} version_string)
3533
endif(NOT WIN32)
3634

3735
#add user-defined executables
3836
foreach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
3937
get_filename_component(name ${src} NAME_WE)
4038
get_filename_component(path ${src} ABSOLUTE)
4139
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils base TESTABLE)
42-
add_dependencies(${name}_${PROJECT_NAME} version_string)
4340
#set_target_properties(${name}_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${${PROJECT_NAME}_COMPILE_FLAGS} -I${path}")
4441
endforeach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
4542
ENDMACRO(SCHEMA_EXES)

cmake/SC_Config_Headers.cmake

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# create sc_cf.h and sc_version_string.h
21

32
# Take the sc config file template as the starting point for
43
# sc_cf.h.in - scripts may need to append to the template, so
@@ -18,6 +17,7 @@ if(NOT COMMAND CONFIG_H_APPEND)
1817
endif(NOT COMMAND CONFIG_H_APPEND)
1918
file(READ ${SC_SOURCE_DIR}/include/sc_cf_cmake.h.in CONFIG_H_FILE_CONTENTS)
2019
CONFIG_H_APPEND(SC "${CONFIG_H_FILE_CONTENTS}")
20+
# create sc_cf.h
2121

2222
include(CheckLibraryExists)
2323
include(CheckIncludeFile)
@@ -101,32 +101,6 @@ get_property(CONFIG_H_FILE_CONTENTS GLOBAL PROPERTY SC_CONFIG_H_CONTENTS)
101101
file(WRITE ${CONFIG_H_FILE} "${CONFIG_H_FILE_CONTENTS}")
102102
configure_file(${CONFIG_H_FILE} ${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_cf.h)
103103

104-
# ------------------------
105-
106-
# create sc_version_string.h, http://stackoverflow.com/questions/3780667
107-
# Using 'ver_string' instead of 'sc_version_string.h' is a trick to force the
108-
# command to always execute when the custom target is built. It works because
109-
# a file by that name never exists.
110-
if(SC_GIT_VERSION)
111-
configure_file(${SC_CMAKE_DIR}/sc_version_string.cmake ${SC_BINARY_DIR}/sc_version_string.cmake @ONLY)
112-
add_custom_target(version_string ALL DEPENDS ver_string)
113-
# creates sc_version_string.h using cmake script
114-
add_custom_command(OUTPUT ver_string
115-
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${SC_SOURCE_DIR} -DBINARY_DIR=${SC_BINARY_DIR} -P ${SC_BINARY_DIR}/sc_version_string.cmake
116-
)
117-
# sc_version_string.h is a generated file
118-
else(SC_GIT_VERSION)
119-
set(VER_HDR "
120-
#ifndef SC_VERSION_STRING
121-
#define SC_VERSION_STRING
122-
static char sc_version[512] = {\"${SC_VERSION}\"};
123-
#endif"
124-
)
125-
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h "${VER_HDR}")
126-
endif(SC_GIT_VERSION)
127-
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
128-
PROPERTIES GENERATED TRUE
129-
HEADER_FILE_ONLY TRUE )
130104

131105
# Local Variables:
132106
# tab-width: 8

cmake/SC_Targets.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ macro(SC_ADDLIB _addlib_target)
4646

4747
if(${_arg_prefix}_SHARED)
4848
add_library(${_addlib_target} SHARED ${${_arg_prefix}_SOURCES})
49-
set_target_properties(${_addlib_target} PROPERTIES VERSION ${SC_ABI_VERSION} SOVERSION ${SC_ABI_SOVERSION})
49+
if(OPENBSD)
50+
set_target_properties(${_addlib_target} PROPERTIES VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
51+
else(OPENBSD)
52+
set_target_properties(${_addlib_target} PROPERTIES VERSION ${SC_VERSION} SOVERSION ${SC_VERSION_MAJOR})
53+
endif(OPENBSD)
5054
if(APPLE)
5155
set_target_properties(${_addlib_target} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
5256
endif(APPLE)

cmake/sc_version_string.cmake

Lines changed: 0 additions & 84 deletions
This file was deleted.

example/ap203min/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ if(NOT DEFINED STEPCODE_ROOT_DIR)
1414
endif(NOT DEFINED STEPCODE_ROOT_DIR)
1515

1616
# STEPCODE_ROOT_DIR is relative or absolute path?
17-
if(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
17+
if(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/src/express/express.c")
1818
set(STEPCODE_ROOT_DIR "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}")
1919
message("** STEPCODE_ROOT_DIR is a relative path; converted to absolute path: ${STEPCODE_ROOT_DIR}.")
2020
else()
21-
if(NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
21+
if(NOT EXISTS "${STEPCODE_ROOT_DIR}/src/express/express.c")
2222
message(FATAL_ERROR "**** Cannot locate STEPCODE_ROOT_DIR - try an absolute path.")
23-
endif(NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
24-
endif(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
23+
endif(NOT EXISTS "${STEPCODE_ROOT_DIR}/src/express/express.c")
24+
endif(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/src/express/express.c")
2525

2626

2727
# Use STEPcode as library, but build from this build process.

include/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ install(FILES ordered_attrs.h
3535
sc_stdbool.h
3636
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode)
3737

38-
install(FILES ${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_cf.h
39-
${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
40-
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode)
38+
install(FILES ${SC_BINARY_DIR}/${INCLUDE_DIR}/sc_cf.h
39+
DESTINATION ${INCLUDE_DIR}/stepcode)
4140

4241
# Local Variables:
4342
# tab-width: 8

src/exp2cxx/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ include_directories(
3939

4040
SC_ADDEXEC(exp2cxx SOURCES ${exp2cxx_SOURCES} LINK_LIBRARIES libexppp express base)
4141

42-
if(NOT SC_IS_SUBBUILD AND SC_GIT_VERSION)
43-
add_dependencies(exp2cxx version_string)
44-
endif(NOT SC_IS_SUBBUILD AND SC_GIT_VERSION)
45-
4642
if(SC_ENABLE_TESTING)
4743
add_subdirectory(test)
4844
endif(SC_ENABLE_TESTING)

src/exp2cxx/classes_misc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "classes.h"
55

66
#include <sc_trace_fprintf.h>
7-
#include "sc_version_string.h"
87
#include "class_strings.h"
98

109
/** \file classes_misc.c
@@ -44,7 +43,7 @@ FILE * FILEcreate( const char * filename ) {
4443
fprintf( file, "#ifndef %s\n", fn );
4544
fprintf( file, "#define %s\n\n", fn );
4645

47-
fprintf( file, "// This file was generated by exp2cxx,\n// %s.\n", sc_version );
46+
fprintf( file, "// This file was generated by exp2cxx,\n// %s.\n", SC_VERSION );
4847
fprintf( file, "// You probably don't want to edit it since your modifications\n" );
4948
fprintf( file, "// will be lost if exp2cxx is used to regenerate it.\n\n" );
5049
return ( file );

0 commit comments

Comments
 (0)