Skip to content

Commit 29f87a6

Browse files
committed
Reverting back to state at commit 548fd82
Subsequent changes caused problems for development, and will need to be merged in more carefully from develop
1 parent 880a42b commit 29f87a6

423 files changed

Lines changed: 26968 additions & 30278 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 42 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# C M A K E L I S T S . T X T
1+
# C M A K E L I S T S . T X T F O R S T E P C O D E
22
#
33
# This file is Copyright (c) 2010 United States Government as
44
# represented by the U.S. Army Research Laboratory.
@@ -40,124 +40,45 @@
4040

4141
project(SC)
4242

43-
# Minimum required version of CMake
44-
cmake_minimum_required(VERSION 3.12)
45-
if (POLICY CMP0077)
46-
cmake_policy(SET CMP0077 OLD)
47-
endif (POLICY CMP0077)
48-
4943
# SC version
5044
set(SC_VERSION_MAJOR 0)
51-
set(SC_VERSION_MINOR 9)
52-
set(SC_VERSION_PATCH 1)
53-
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR}.${SC_VERSION_PATCH})
45+
set(SC_VERSION_MINOR 8-dev)
46+
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
5447

55-
# Set language standards
56-
set(CMAKE_C_EXTENSIONS OFF)
57-
set(CMAKE_C_STANDARD 11)
58-
set(CMAKE_C_STANDARD_REQUIRED ON)
59-
set(CMAKE_CXX_EXTENSIONS OFF)
60-
set(CMAKE_CXX_STANDARD 11)
61-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
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)
52+
53+
# Minimum required version of CMake
54+
cmake_minimum_required(VERSION 3.6.3)
55+
cmake_policy(SET CMP0003 NEW)
56+
cmake_policy(SET CMP0026 NEW)
57+
cmake_policy(SET CMP0057 NEW)
6258

6359
# CMake derives much of its functionality from modules, typically
6460
# stored in one directory - let CMake know where to find them.
6561
set(SC_CMAKE_DIR "${SC_SOURCE_DIR}/cmake")
66-
list(APPEND CMAKE_MODULE_PATH "${SC_CMAKE_DIR}")
67-
68-
# OpenBSD has its own naming conventions. Set a platform variable based on
69-
# the OS name so we can test for it succinctly.
70-
if ("${CMAKE_SYSTEM}" MATCHES ".*OpenBSD.*")
71-
set(OPENBSD ON)
72-
endif ("${CMAKE_SYSTEM}" MATCHES ".*OpenBSD.*")
73-
74-
#---------------------------------------------------------------------
75-
# Set up various relative path variables and build output directories
76-
include(Path_Setup)
77-
78-
#---------------------------------------------------------------------
79-
# The following logic is what allows binaries to run successfully in
80-
# the build directory AND install directory. Thanks to plplot for
81-
# identifying the necessity of setting CMAKE_INSTALL_NAME_DIR on OSX.
82-
# Documentation of these options is available at
83-
# http://www.cmake.org/Wiki/CMake_RPATH_handling
84-
85-
# use, i.e. don't skip the full RPATH for the build tree
86-
if(NOT DEFINED CMAKE_SKIP_BUILD_RPATH)
87-
set(CMAKE_SKIP_BUILD_RPATH FALSE)
88-
endif()
89-
90-
# when building, don't use the install RPATH already
91-
# (but later on when installing)
92-
if(NOT DEFINED CMAKE_BUILD_WITH_INSTALL_RPATH)
93-
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
94-
endif()
95-
96-
# the RPATH/INSTALL_NAME_DIR to be used when installing
97-
if (NOT APPLE)
98-
if(NOT DEFINED CMAKE_INSTALL_RPATH)
99-
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN/../lib")
100-
endif()
101-
endif(NOT APPLE)
102-
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH
103-
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
104-
if(NOT DEFINED CMAKE_INSTALL_NAME_DIR)
105-
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
106-
endif()
107-
108-
# add the automatically determined parts of the RPATH which point to
109-
# directories outside the build tree to the install RPATH
110-
if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
111-
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
112-
endif()
113-
114-
115-
#---------------------------------------------------------------------
116-
# Build options
117-
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
118-
option(BUILD_STATIC_LIBS "Build static libraries" OFF)
119-
120-
option(SC_PYTHON_GENERATOR "Compile exp2python" ON)
121-
option(SC_CPP_GENERATOR "Compile exp2cxx" ON)
122-
123-
option(SC_MEMMGR_ENABLE_CHECKS "Enable sc_memmgr's memory leak detection" OFF)
124-
option(SC_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in exp2cxx may be located" OFF)
125-
126-
option(SC_ENABLE_COVERAGE "Enable code coverage test" OFF)
127-
if (SC_ENABLE_COVERAGE AND ${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
128-
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
129-
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
130-
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage" CACHE STRING "Extra linker flags required by code coverage" FORCE)
131-
endif (SC_ENABLE_COVERAGE AND ${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
132-
133-
option(SC_ENABLE_TESTING "Enable unittesting framework" OFF)
134-
if(SC_ENABLE_TESTING)
135-
if(NOT DEFINED SC_BUILD_SCHEMAS)
136-
set(SC_BUILD_SCHEMAS "ALL") #test all schemas, unless otherwise specified
137-
endif()
138-
include(CTest)
139-
endif(SC_ENABLE_TESTING)
62+
if(NOT SC_IS_SUBBUILD)
63+
set(CMAKE_MODULE_PATH "${SC_CMAKE_DIR};${CMAKE_MODULE_PATH}")
64+
else(NOT SC_IS_SUBBUILD)
65+
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SC_CMAKE_DIR}")
66+
endif(NOT SC_IS_SUBBUILD)
14067

141-
# TODO - BRL-CAD is the only known user of this option, and it will be
142-
# transitioning to a new setup that won't need it - once that's done,
143-
# we should just remove this option.
144-
option(SC_SKIP_EXEC_INSTALL "Skip installing executables" OFF)
145-
mark_as_advanced(SC_SKIP_EXEC_INSTALL)
68+
# testing and compilation options, build output dirs, install dirs, uninstall, package creation, etc
69+
include(${SC_CMAKE_DIR}/SC_Build_opts.cmake)
14670

14771
# SC_ADDEXEC and SC_ADDLIB macros, dllimport/export, etc
148-
include(SC_Targets)
72+
include(${SC_CMAKE_DIR}/SC_Targets.cmake)
14973

15074
# Macros related to paths
151-
include(SC_Paths)
75+
include(${SC_CMAKE_DIR}/SC_Paths.cmake)
15276

15377
# locale stuff
154-
include(SC_Locale)
78+
include(${SC_CMAKE_DIR}/SC_Locale.cmake)
15579

15680
# logic related to regenerating the lexer and parser source code
157-
include(SC_Regenerate)
158-
159-
# create config headers sc_cf.h and sc_version_string.h
160-
include(SC_Config_Headers)
81+
include(${SC_CMAKE_DIR}/SC_Regenerate.cmake)
16182

16283
if(NOT DEFINED SC_SDAI_ADDITIONAL_EXES_SRCS)
16384
set(SC_SDAI_ADDITIONAL_EXES_SRCS "" CACHE STRING "Source files for additional executables to be linked with SDAI libs")
@@ -167,8 +88,8 @@ if(NOT DEFINED SC_BUILD_SCHEMAS)
16788
list(APPEND CONFIG_END_MESSAGES
16889
"** CMake variable SC_BUILD_SCHEMAS was not set. Defaults to building ALL schemas, which will take a"
16990
" while; see http://stepcode.org/mw/index.php?title=STEPcode_CMake_variables#SC_BUILD_SCHEMAS")
170-
#this makes SC_BUILD_SCHEMAS show up in cmake-gui
171-
set(SC_BUILD_SCHEMAS "ALL" CACHE STRING "Semicolon-separated list of paths to EXPRESS schemas to be built")
91+
#this makes SC_BUILD_SCHEMAS show up in cmake-gui
92+
set(SC_BUILD_SCHEMAS "ALL" CACHE string "Semicolon-separated list of paths to EXPRESS schemas to be built")
17293
endif(NOT DEFINED SC_BUILD_SCHEMAS)
17394

17495
if(NOT SC_IS_SUBBUILD)
@@ -178,18 +99,23 @@ if(NOT SC_IS_SUBBUILD)
17899
".. Generating step can take a while if you are building several schemas.")
179100
endif(NOT SC_IS_SUBBUILD)
180101

181-
# create config headers sc_cf.h
182-
include(SC_Config_Headers)
102+
# create config headers sc_cf.h and sc_version_string.h
103+
include(${SC_CMAKE_DIR}/SC_Config_Headers.cmake)
183104

184105

185106
################
186107

108+
set(CMAKE_C_STANDARD 11)
109+
set(CMAKE_CXX_STANDARD 11)
110+
187111
if(MSVC)
188112
# Disable warning for preferred usage of secure functions (example strcpy should be strcpy_s, ...)
189113
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
190-
endif()
191-
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
114+
else()
192115
add_definitions(-pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long)
116+
if(HAVE_NULLPTR)
117+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
118+
endif(HAVE_NULLPTR)
193119
endif()
194120

195121
include_directories(
@@ -214,19 +140,13 @@ if(SC_ENABLE_TESTING)
214140
endif(SC_ENABLE_TESTING)
215141
add_subdirectory(doc)
216142

217-
if(NOT SC_IS_SUBBUILD)
218-
#-----------------------------------------------------------------------------
219-
# SC Packaging
220-
# $make package
221-
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "STEPcode")
222-
set(CPACK_SET_DESTDIR "ON")
223-
set(CPACK_PACKAGE_VERSION_MAJOR ${SC_VERSION_MAJOR})
224-
set(CPACK_PACKAGE_VERSION_MINOR ${SC_VERSION_MINOR})
225-
set(CPACK_PACKAGE_NAME SC)
226-
set(CPACK_PACKAGE_CONTACT "SC Developers <scl-dev@googlegroups.com>")
227-
include(CPack)
228-
endif(NOT SC_IS_SUBBUILD)
229-
143+
# 'make core' builds everything that isn't generated. for devs.
144+
add_custom_target(core)
145+
if($CACHE{SC_BUILD_SHARED_LIBS})
146+
add_dependencies(core stepdai stepeditor exp2cxx check-express)
147+
else()
148+
add_dependencies(core stepdai-static stepeditor-static exp2cxx check-express)
149+
endif()
230150

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

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Linux, OSX (LLVM) | Windows (MSVC)
44
[![Build Status](https://travis-ci.org/stepcode/stepcode.svg?branch=master)](https://travis-ci.org/stepcode/stepcode) | [![Build status](https://ci.appveyor.com/api/projects/status/3fbr9t9gfa812oqu?svg=true)](https://ci.appveyor.com/project/mpictor/stepcode)
55

66
***********************************************************************
7-
STEPcode v0.9 -- stepcode.org, github.com/stepcode/stepcode
7+
STEPcode v0.8 -- stepcode.org, github.com/stepcode/stepcode
88

99
* What is STEPcode? SC reads ISO10303-11 EXPRESS schemas and generates
1010
C++ source code that can read and write Part 21 files conforming
@@ -36,16 +36,14 @@ CODING STANDARDS
3636
SC's source has been reformatted with astyle. When making changes, try
3737
to match the current formatting. The main points are:
3838

39-
- K&R (Kernighan & Ritchie) brackets:
39+
- compact (java-style) brackets:
4040
```C
41-
int Foo(bool isBar)
42-
{
43-
if (isBar) {
44-
bar();
45-
return 1;
46-
} else
47-
return 0;
48-
}
41+
if( a == 3 ) {
42+
c = 5;
43+
function( a, b );
44+
} else {
45+
somefunc( );
46+
}
4947
```
5048
- indents are 4 spaces
5149
- no tab characters

SC_VERSION.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.8

cmake/FindLEMON.cmake

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
1212
#
13-
# Copyright (c) 2010-2020 United States Government as represented by
13+
# Copyright (c) 2010-2016 United States Government as represented by
1414
# the U.S. Army Research Laboratory.
1515
# Copyright 2009 Kitware, Inc.
1616
# Copyright 2006 Tristan Carel
@@ -44,35 +44,9 @@
4444
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4545
#=============================================================================
4646

47-
set(_LEMON_SEARCHES)
48-
49-
# Search LEMON_ROOT first if it is set.
50-
if(LEMON_ROOT)
51-
set(_LEMON_SEARCH_ROOT PATHS ${LEMON_ROOT} NO_DEFAULT_PATH)
52-
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_ROOT)
53-
endif()
54-
55-
# Normal search.
56-
set(_LEMON_x86 "(x86)")
57-
set(_LEMON_SEARCH_NORMAL
58-
PATHS "$ENV{ProgramFiles}/lemon"
59-
"$ENV{ProgramFiles${_LEMON_x86}}/lemon")
60-
unset(_LEMON_x86)
61-
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_NORMAL)
62-
63-
set(LEMON_NAMES lemon)
64-
65-
# Try each search configuration.
66-
foreach(search ${_LEMON_SEARCHES})
67-
find_program(LEMON_EXECUTABLE lemon ${${search}} PATH_SUFFIXES bin)
68-
endforeach()
47+
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
6948
mark_as_advanced(LEMON_EXECUTABLE)
7049

71-
foreach(search ${_LEMON_SEARCHES})
72-
find_file(LEMON_TEMPLATE lempar.c ${${search}} PATH_SUFFIXES ${DATA_DIR} ${DATA_DIR}/lemon)
73-
endforeach()
74-
mark_as_advanced(LEMON_TEMPLATE)
75-
7650
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
7751
# look for the template in share
7852
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
@@ -139,10 +113,6 @@ if(NOT COMMAND LEMON_TARGET)
139113
CMAKE_PARSE_ARGUMENTS(${LVAR_PREFIX} "" "OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR;EXTRA_ARGS" "" ${ARGN})
140114
endif(${ARGC} GREATER 3)
141115

142-
if (TARGET perplex_stage)
143-
set(DEPS_TARGET perplex_stage)
144-
endif (TARGET perplex_stage)
145-
146116
# Need a working directory
147117
if("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
148118
set(${LVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${LVAR_PREFIX}")
@@ -191,7 +161,7 @@ if(NOT COMMAND LEMON_TARGET)
191161
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
192162
COMMAND ${CMAKE_COMMAND} -E copy ${lemon_in_file} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}
193163
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME} ${${LVAR_PREFIX}__EXTRA_ARGS}
194-
DEPENDS ${Input} ${LEMON_EXECUTABLE_TARGET} ${DEPS_TARGET}
164+
DEPENDS ${Input} ${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_TARGET}
195165
WORKING_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR}
196166
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
197167
)
@@ -201,15 +171,15 @@ if(NOT COMMAND LEMON_TARGET)
201171
add_custom_command(
202172
OUTPUT ${${LVAR_PREFIX}_OUT_SRC_FILE}
203173
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${${LVAR_PREFIX}_OUT_SRC_FILE}
204-
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE} ${DEPS_TARGET}
174+
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
205175
)
206176
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_SRC_FILE} ${LEMON_${Name}_OUTPUTS})
207177
endif(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
208178
if(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
209179
add_custom_command(
210180
OUTPUT ${${LVAR_PREFIX}_OUT_HDR_FILE}
211181
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${${LVAR_PREFIX}_OUT_HDR_FILE}
212-
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER} ${DEPS_TARGET}
182+
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
213183
)
214184
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_HDR_FILE} ${LEMON_${Name}_OUTPUTS})
215185
endif(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")

0 commit comments

Comments
 (0)