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.
4040
4141project (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
5044set (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.
6561set (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
16283if (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" )
17293endif (NOT DEFINED SC_BUILD_SCHEMAS )
17394
17495if (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." )
179100endif (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+
187111if (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 )
193119endif ()
194120
195121include_directories (
@@ -214,19 +140,13 @@ if(SC_ENABLE_TESTING)
214140endif (SC_ENABLE_TESTING )
215141add_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.
0 commit comments