diff --git a/CMake/CheckCFileRuns.cmake b/CMake/CheckCFileRuns.cmake new file mode 100644 index 00000000..8ed14de0 --- /dev/null +++ b/CMake/CheckCFileRuns.cmake @@ -0,0 +1,84 @@ +# - Check if the given C source code compiles and runs. +# CHECK_C_SOURCE_RUNS( ) +# - source code to try to compile +# - variable to store the result +# (1 for success, empty for failure) +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +MACRO(CHECK_C_FILE_RUNS SOURCE VAR) + IF("${VAR}" MATCHES "^${VAR}$") + SET(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + IF(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + ELSE(CMAKE_REQUIRED_LIBRARIES) + SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) + ENDIF(CMAKE_REQUIRED_LIBRARIES) + IF(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + ELSE(CMAKE_REQUIRED_INCLUDES) + SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) + ENDIF(CMAKE_REQUIRED_INCLUDES) + + MESSAGE(STATUS "Performing Test ${VAR}") + TRY_RUN(${VAR}_EXITCODE ${VAR}_COMPILED + ${CMAKE_BINARY_DIR} + ${SOURCE} + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${FILE_RUN_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} + "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" + COMPILE_OUTPUT_VARIABLE OUTPUT) + # if it did not compile make the return value fail code of 1 + IF(NOT ${VAR}_COMPILED) + SET(${VAR}_EXITCODE 1) + ENDIF(NOT ${VAR}_COMPILED) + # if the return value was 0 then it worked + IF("${${VAR}_EXITCODE}" EQUAL 0) + SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + MESSAGE(STATUS "Performing Test ${VAR} - Success") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}}\n" + "Source file was:\n${SOURCE}\n") + ELSE("${${VAR}_EXITCODE}" EQUAL 0) + IF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + SET(${VAR} "${${VAR}_EXITCODE}") + ELSE(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + SET(${VAR} "" CACHE INTERNAL "Test ${VAR}") + ENDIF(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + + MESSAGE(STATUS "Performing Test ${VAR} - Failed") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}_EXITCODE}\n" + "Source file was:\n${SOURCE}\n") + + ENDIF("${${VAR}_EXITCODE}" EQUAL 0) + ENDIF("${VAR}" MATCHES "^${VAR}$") +ENDMACRO(CHECK_C_FILE_RUNS) + diff --git a/CMake/FindLEX.cmake b/CMake/FindLEX.cmake new file mode 100644 index 00000000..9376922d --- /dev/null +++ b/CMake/FindLEX.cmake @@ -0,0 +1,164 @@ +# - Find lex executable and provides a macro to generate custom build rules +# +# The module defines the following variables: +# LEX_FOUND - true is lex executable is found +# LEX_EXECUTABLE - the path to the lex executable +# LEX_LIBRARIES - The lex libraries +# +# If lex is found on the system, the module provides the macro: +# LEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS ]) +# which creates a custom command to generate the file from +# the file. If COMPILE_FLAGS option is specified, the next +# parameter is added to the lex command line. Name is an alias used to +# get details of this custom command. Indeed the macro defines the +# following variables: +# LEX_${Name}_DEFINED - true is the macro ran successfully +# LEX_${Name}_OUTPUTS - the source file generated by the custom rule, an +# alias for FlexOutput +# LEX_${Name}_INPUT - the lex source file, an alias for ${FlexInput} +# +# Flex scanners oftenly use tokens defined by Yacc: the code generated +# by Flex depends of the header generated by Yacc. This module also +# defines a macro: +# ADD_LEX_YACC_DEPENDENCY(FlexTarget YaccTarget) +# which adds the required dependency between a scanner and a parser +# where and are the first parameters of +# respectively LEX_TARGET and YACC_TARGET macros. +# +# ==================================================================== +# Example: +# +# find_package(YACC) +# find_package(LEX) +# +# YACC_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp +# LEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BIANRY_DIR}/lexer.cpp) +# ADD_LEX_YACC_DEPENDENCY(MyScanner MyParser) +# +# include_directories(${CMAKE_CURRENT_BINARY_DIR}) +# add_executable(Foo +# Foo.cc +# ${YACC_MyParser_OUTPUTS} +# ${LEX_MyScanner_OUTPUTS} +# ) +# ==================================================================== +# +#============================================================================= +# Copyright 2010 United States Government as represented by +# the U.S. Army Research Laboratory. +# Copyright 2009 Kitware, Inc. +# Copyright 2006 Tristan Carel +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +FIND_PROGRAM(LEX_EXECUTABLE flex DOC "path to the lex executable") +IF(NOT LEX_EXECUTABLE) + FIND_PROGRAM(LEX_EXECUTABLE lex DOC "path to the lex executable") +ENDIF(NOT LEX_EXECUTABLE) +MARK_AS_ADVANCED(LEX_EXECUTABLE) + +FIND_LIBRARY(FL_LIBRARY NAMES fl + DOC "path to the fl library") +MARK_AS_ADVANCED(FL_LIBRARY) +SET(LEX_LIBRARIES ${FL_LIBRARY}) + +IF(LEX_EXECUTABLE) + + #============================================================ + # LEX_TARGET (public macro) + #============================================================ + # + MACRO(LEX_TARGET Name Input Output) + SET(LEX_TARGET_usage "LEX_TARGET( [COMPILE_FLAGS ]") + IF(${ARGC} GREATER 3) + IF(${ARGC} EQUAL 5) + IF("${ARGV3}" STREQUAL "COMPILE_FLAGS") + SET(LEX_EXECUTABLE_opts "${ARGV4}") + SEPARATE_ARGUMENTS(LEX_EXECUTABLE_opts) + ELSE() + MESSAGE(SEND_ERROR ${LEX_TARGET_usage}) + ENDIF() + ELSE() + MESSAGE(SEND_ERROR ${LEX_TARGET_usage}) + ENDIF() + ENDIF() + + ADD_CUSTOM_COMMAND(OUTPUT ${Output} + COMMAND ${LEX_EXECUTABLE} + ARGS ${LEX_EXECUTABLE_opts} -o${Output} ${Input} + DEPENDS ${Input} + COMMENT "[LEX][${Name}] Building scanner with ${LEX_EXECUTABLE}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + SET(LEX_${Name}_DEFINED TRUE) + SET(LEX_${Name}_OUTPUTS ${Output}) + SET(LEX_${Name}_INPUT ${Input}) + SET(LEX_${Name}_COMPILE_FLAGS ${LEX_EXECUTABLE_opts}) + ENDMACRO(LEX_TARGET) + #============================================================ + + + #============================================================ + # ADD_LEX_YACC_DEPENDENCY (public macro) + #============================================================ + # + MACRO(ADD_LEX_YACC_DEPENDENCY FlexTarget YaccTarget) + + IF(NOT LEX_${FlexTarget}_OUTPUTS) + MESSAGE(SEND_ERROR "Flex target `${FlexTarget}' does not exists.") + ENDIF() + + IF(NOT YACC_${YaccTarget}_OUTPUT_HEADER) + MESSAGE(SEND_ERROR "Yacc target `${YaccTarget}' does not exists.") + ENDIF() + + SET_SOURCE_FILES_PROPERTIES(${LEX_${FlexTarget}_OUTPUTS} + PROPERTIES OBJECT_DEPENDS ${YACC_${YaccTarget}_OUTPUT_HEADER}) + ENDMACRO(ADD_LEX_YACC_DEPENDENCY) + #============================================================ + + #Need to run a test lex file to determine if YYTEXT_POINTER needs + #to be defined + EXEC_PROGRAM(${LEX_EXECUTABLE} ARGS ${CMAKE_SOURCE_DIR}/misc/CMake/test_srcs/lex_test.l -o ${CMAKE_BINARY_DIR}/CMakeTmp/lex_test.c RETURN_VALUE _retval OUTPUT_VARIABLE _lexOut) + INCLUDE (CheckCFileRuns) + SET(FILE_RUN_DEFINITIONS "-DYYTEXT_POINTER=1") + CHECK_C_FILE_RUNS(${CMAKE_CURRENT_SOURCE_DIR}/CMake/test_srcs/sys_wait_test.c YYTEXT_POINTER) + SET(FILE_RUN_DEFINITIONS) + IF(CONFIG_H_FILE) + FILE(APPEND ${CONFIG_H_FILE} "#cmakedefine YYTEXT_POINTER 1\n") + ENDIF(CONFIG_H_FILE) + + +ENDIF(LEX_EXECUTABLE) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEX DEFAULT_MSG LEX_EXECUTABLE) + +# FindLEX.cmake ends here diff --git a/CMake/FindYACC.cmake b/CMake/FindYACC.cmake new file mode 100644 index 00000000..1869fcbd --- /dev/null +++ b/CMake/FindYACC.cmake @@ -0,0 +1,165 @@ +# - Find yacc executable and provides macros to generate custom build rules +# The module defines the following variables +# +# YACC_EXECUTABLE - path to the yacc program +# YACC_FOUND - true if the program was found +# +# If yacc is found, the module defines the macros: +# YACC_TARGET( [VERBOSE ] +# [COMPILE_FLAGS ]) +# which will create a custom rule to generate a parser. is +# the path to a yacc file. is the name of the source file +# generated by yacc. A header file is also be generated, and contains +# the token list. If COMPILE_FLAGS option is specified, the next +# parameter is added in the yacc command line. if VERBOSE option is +# specified, is created and contains verbose descriptions of the +# grammar and parser. The macro defines a set of variables: +# YACC_${Name}_DEFINED - true is the macro ran successfully +# YACC_${Name}_INPUT - The input source file, an alias for +# YACC_${Name}_OUTPUT_SOURCE - The source file generated by yacc +# YACC_${Name}_OUTPUT_HEADER - The header file generated by yacc +# YACC_${Name}_OUTPUTS - The sources files generated by yacc +# YACC_${Name}_COMPILE_FLAGS - Options used in the yacc command line +# +# ==================================================================== +# Example: +# +# find_package(YACC) +# YACC_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) +# add_executable(Foo main.cpp ${YACC_MyParser_OUTPUTS}) +# ==================================================================== +# +#============================================================================= +# Copyright 2010 United States Government as represented by +# the U.S. Army Research Laboratory. +# Copyright 2009 Kitware, Inc. +# Copyright 2006 Tristan Carel +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * The names of the authors may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + + +FIND_PROGRAM(YACC_EXECUTABLE bison DOC "path to the yacc executable") +IF(NOT YACC_EXECUTABLE) + FIND_PROGRAM(YACC_EXECUTABLE yacc DOC "path to the yacc executable") +ENDIF(NOT YACC_EXECUTABLE) +MARK_AS_ADVANCED(YACC_EXECUTABLE) + +IF(YACC_EXECUTABLE) + # internal macro + MACRO(YACC_TARGET_option_verbose Name YaccOutput filename) + LIST(APPEND YACC_TARGET_cmdopt "--verbose") + GET_FILENAME_COMPONENT(YACC_TARGET_output_path "${YaccOutput}" PATH) + GET_FILENAME_COMPONENT(YACC_TARGET_output_name "${YaccOutput}" NAME_WE) + ADD_CUSTOM_COMMAND(OUTPUT ${filename} + COMMAND ${CMAKE_COMMAND} + ARGS -E copy + "${YACC_TARGET_output_path}/${YACC_TARGET_output_name}.output" + "${filename}" + DEPENDS + "${YACC_TARGET_output_path}/${YACC_TARGET_output_name}.output" + COMMENT "[YACC][${Name}] Copying yacc verbose table to ${filename}" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + SET(YACC_${Name}_VERBOSE_FILE ${filename}) + LIST(APPEND YACC_TARGET_extraoutputs + "${YACC_TARGET_output_path}/${YACC_TARGET_output_name}.output") + ENDMACRO(YACC_TARGET_option_verbose) + + # internal macro + MACRO(YACC_TARGET_option_extraopts Options) + SET(YACC_TARGET_extraopts "${Options}") + SEPARATE_ARGUMENTS(YACC_TARGET_extraopts) + LIST(APPEND YACC_TARGET_cmdopt ${YACC_TARGET_extraopts}) + ENDMACRO(YACC_TARGET_option_extraopts) + + #============================================================ + # YACC_TARGET (public macro) + #============================================================ + # + MACRO(YACC_TARGET Name YaccInput YaccOutput) + SET(YACC_TARGET_output_header "") + SET(YACC_TARGET_command_opt "") + SET(YACC_TARGET_outputs "${YaccOutput}") + IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) + MESSAGE(SEND_ERROR "Usage") + ELSE() + # Parsing parameters + IF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5) + IF("${ARGV3}" STREQUAL "VERBOSE") + YACC_TARGET_option_verbose(${Name} ${YaccOutput} "${ARGV4}") + ENDIF() + IF("${ARGV3}" STREQUAL "COMPILE_FLAGS") + YACC_TARGET_option_extraopts("${ARGV4}") + ENDIF() + ENDIF() + + IF(${ARGC} EQUAL 7) + IF("${ARGV5}" STREQUAL "VERBOSE") + YACC_TARGET_option_verbose(${Name} ${YaccOutput} "${ARGV6}") + ENDIF() + + IF("${ARGV5}" STREQUAL "COMPILE_FLAGS") + YACC_TARGET_option_extraopts("${ARGV6}") + ENDIF() + ENDIF() + + # Header's name generated by yacc (see option -d) + LIST(APPEND YACC_TARGET_cmdopt "-d") + STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}") + STRING(REPLACE "c" "h" _fileext ${_fileext}) + STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" + YACC_${Name}_OUTPUT_HEADER "${ARGV2}") + LIST(APPEND YACC_TARGET_outputs "${YACC_${Name}_OUTPUT_HEADER}") + + ADD_CUSTOM_COMMAND(OUTPUT ${YACC_TARGET_outputs} + ${YACC_TARGET_extraoutputs} + COMMAND ${YACC_EXECUTABLE} + ARGS ${YACC_TARGET_cmdopt} -o ${ARGV2} ${ARGV1} + DEPENDS ${ARGV1} + COMMENT "[YACC][${Name}] Building parser with ${YACC_EXECUTABLE}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + # define target variables + SET(YACC_${Name}_DEFINED TRUE) + SET(YACC_${Name}_INPUT ${ARGV1}) + SET(YACC_${Name}_OUTPUTS ${YACC_TARGET_outputs}) + SET(YACC_${Name}_COMPILE_FLAGS ${YACC_TARGET_cmdopt}) + SET(YACC_${Name}_OUTPUT_SOURCE "${YaccOutput}") + + ENDIF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7) + ENDMACRO(YACC_TARGET) + # + #============================================================ + +ENDIF(YACC_EXECUTABLE) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(YACC DEFAULT_MSG YACC_EXECUTABLE) + +# FindYACC.cmake ends here diff --git a/CMake/SCL_Utils.cmake b/CMake/SCL_Utils.cmake new file mode 100644 index 00000000..0ed97479 --- /dev/null +++ b/CMake/SCL_Utils.cmake @@ -0,0 +1,75 @@ +# Will need windows logic someday, even though it doesn't work yet, so go ahead +# and add the DLL_DEFINE macro + +MACRO(DLL_DEFINE libname) + IF(MSVC) + STRING(REGEX REPLACE "lib" "" LOWERCORE "${libname}") + STRING(TOUPPER ${LOWERCORE} UPPER_CORE) + add_definitions("-D${UPPER_CORE}_EXPORT_DLL") + ENDIF(MSVC) +ENDMACRO() + + +MACRO(SCL_ADDEXEC execname srcs libs) + STRING(REGEX REPLACE " " ";" srcslist "${srcs}") + STRING(REGEX REPLACE " " ";" libslist "${libs}") + add_executable(${execname} ${srcslist}) + target_link_libraries(${execname} ${libslist}) + INSTALL(TARGETS ${execname} DESTINATION bin) + # Enable extra compiler flags if local executables and/or global options dictate + SET(LOCAL_COMPILE_FLAGS "") + FOREACH(extraarg ${ARGN}) + IF(${extraarg} MATCHES "STRICT" AND BRLCAD-ENABLE_STRICT) + SET(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}") + ENDIF(${extraarg} MATCHES "STRICT" AND BRLCAD-ENABLE_STRICT) + ENDFOREACH(extraarg ${ARGN}) + IF(LOCAL_COMPILE_FLAGS) + SET_TARGET_PROPERTIES(${execname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS}) + ENDIF(LOCAL_COMPILE_FLAGS) +ENDMACRO(SCL_ADDEXEC execname srcs libs) + +MACRO(SCL_ADDLIB libname srcs libs) + STRING(REGEX REPLACE " " ";" srcslist "${srcs}") + STRING(REGEX REPLACE " " ";" libslist1 "${libs}") + STRING(REGEX REPLACE "-framework;" "-framework " libslist "${libslist1}") + DLL_DEFINE(${libname}) + IF(BUILD_SHARED_LIBS) + add_library(${libname} SHARED ${srcslist}) + if(NOT ${libs} MATCHES "NONE") + target_link_libraries(${libname} ${libslist}) + endif(NOT ${libs} MATCHES "NONE") + SET_TARGET_PROPERTIES(${libname} PROPERTIES VERSION ${SCL_VERSION_MAJOR}.${SCL_VERSION_MINOR} SOVERSION ${SCL_VERSION_MAJOR} ) + INSTALL(TARGETS ${libname} DESTINATION lib) + ENDIF(BUILD_SHARED_LIBS) + IF(BUILD_STATIC_LIBS AND NOT MSVC) + add_library(${libname}-static STATIC ${srcslist}) + if(NOT ${libs} MATCHES "NONE") + target_link_libraries(${libname}-static ${libslist}) + endif(NOT ${libs} MATCHES "NONE") + IF(NOT WIN32) + SET_TARGET_PROPERTIES(${libname}-static PROPERTIES OUTPUT_NAME "${libname}") + ENDIF(NOT WIN32) + IF(WIN32) + # We need the lib prefix on win32, so add it even if our add_library + # wrapper function has removed it due to the target name - see + # http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F + SET_TARGET_PROPERTIES(${libname}-static PROPERTIES PREFIX "lib") + ENDIF(WIN32) + INSTALL(TARGETS ${libname}-static DESTINATION lib) + ENDIF(BUILD_STATIC_LIBS AND NOT MSVC) + # Enable extra compiler flags if local libraries and/or global options dictate + SET(LOCAL_COMPILE_FLAGS "") + FOREACH(extraarg ${ARGN}) + IF(${extraarg} MATCHES "STRICT" AND BRLCAD-ENABLE_STRICT) + SET(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}") + ENDIF(${extraarg} MATCHES "STRICT" AND BRLCAD-ENABLE_STRICT) + ENDFOREACH(extraarg ${ARGN}) + IF(LOCAL_COMPILE_FLAGS) + IF(BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(${libname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS}) + ENDIF(BUILD_SHARED_LIBS) + IF(BUILD_STATIC_LIBS AND NOT MSVC) + SET_TARGET_PROPERTIES(${libname}-static PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS}) + ENDIF(BUILD_STATIC_LIBS AND NOT MSVC) + ENDIF(LOCAL_COMPILE_FLAGS) +ENDMACRO(SCL_ADDLIB libname srcs libs) diff --git a/CMake/test_srcs/sys_wait_test.c b/CMake/test_srcs/sys_wait_test.c new file mode 100644 index 00000000..db1c19b8 --- /dev/null +++ b/CMake/test_srcs/sys_wait_test.c @@ -0,0 +1,19 @@ +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +int +main () +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..cabc54e8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,222 @@ +# C M A K E L I S T S . T X T +# SCL +# +# Copyright (c) 2010 United States Government as represented by +# the U.S. Army Research Laboratory. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# ******************************************************************* +# *** BRL-CAD's CMakeLists.txt *** +# ******************************************************************* + +# This file contains the top level CMakeLists.txt logic for the +# BRL-CAD software package. + +# Minimum required version of CMake +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +IF(COMMAND CMAKE_POLICY) + CMAKE_POLICY(SET CMP0003 NEW) +ENDIF(COMMAND CMAKE_POLICY) + +# set CMake project name +PROJECT(SCL) + +# build shared libs by default +OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON) + +# build static libs by default +OPTION(BUILD_STATIC_LIBS "Build static libraries" ON) + +# Set version +SET(SCL_VERSION_MAJOR "3") +SET(SCL_VERSION_MINOR "2") +SET(SCL_VERSION_PATCH "0") +SET(SCL_VERSION "${SCL_VERSION_MAJOR}.${SCL_VERSION_MINOR}.${SCL_VERSION_PATCH}") + +# CMake derives much of its functionality from modules, typically +# stored in one directory - let CMake know where to find them. +SET(SCL_CMAKE_DIR "${SCL_SOURCE_DIR}/CMake") +SET(CMAKE_MODULE_PATH "${SCL_CMAKE_DIR};${CMAKE_MODULE_PATH}") + +INCLUDE(${SCL_CMAKE_DIR}/SCL_Utils.cmake) + +# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables and set them +# to "C" so things like date output are as expected +SET(_orig_lc_all $ENV{LC_ALL}) +SET(_orig_lc_messages $ENV{LC_MESSAGES}) +SET(_orig_lang $ENV{LANG}) +IF(_orig_lc_all) + SET(ENV{LC_ALL} C) +ENDIF(_orig_lc_all) +IF(_orig_lc_messages) + SET(ENV{LC_MESSAGES} C) +ENDIF(_orig_lc_messages) +IF(_orig_lang) + SET(ENV{LANG} C) +ENDIF(_orig_lang) + +# For NFS volumes, to ensure proper file creation. +IF(NOT WIN32) + IF(NOT UMASK) + EXEC_PROGRAM(umask ARGS 022 OUTPUT_VARIABLE exec_out) + ELSE(NOT UMASK) + EXEC_PROGRAM(umask ARGS ${UMASK} OUTPUT_VARIABLE exec_out) + ENDIF(NOT UMASK) +ENDIF(NOT WIN32) + +#--------------------------------------------------------------------- +# The following logic is what allows binaries to run successfully in +# the build directory AND install directory. Thanks to plplot for +# identifying the necessity of setting CMAKE_INSTALL_NAME_DIR on OSX. + +# use, i.e. don't skip the full RPATH for the build tree +SET(CMAKE_SKIP_BUILD_RPATH FALSE) + +# when building, don't use the install RPATH already +# (but later on when installing) +SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +# the RPATH/INSTALL_NAME_DIR to be used when installing +if (NOT APPLE) + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +endif(NOT APPLE) +SET(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +# add the automatically determined parts of the RPATH which point to +# directories outside the build tree to the install RPATH +SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + +#----------------------------------------------------------------------------- +# Output directories. +IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) + IF(WIN32) + SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.") + ELSE(WIN32) + SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.") + ENDIF(WIN32) +ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) +IF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.") +ENDIF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) +IF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.") +ENDIF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + +FOREACH(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES}) + STRING(TOUPPER "${CFG_TYPE}" CFG_TYPE) + IF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}") + IF(WIN32) + SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.") + ELSE(WIN32) + SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all libraries.") + ENDIF(WIN32) + ENDIF(NOT "CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE}") + IF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}") + SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/lib CACHE INTERNAL "Single output directory for building all archives.") + ENDIF(NOT "CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE}") + IF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}") + SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}" ${SCL_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.") + ENDIF(NOT "CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE}") +ENDFOREACH() + + +#----------------------------------------------------------------------------- +# Configure install locations. + +# The location in which to install BRLCAD. Need a good Debug location +# for Windows. Only do this if CMAKE_INSTALL_PREFIX hasn't been set +# already, to try and allow parent builds (if any) some control. +IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + MESSAGE("HAVE_DEFAULT_PREFIX") + IF(NOT WIN32) + IF ("${CMAKE_BUILD_TYPE}" MATCHES "Release") + SET(CMAKE_INSTALL_PREFIX "/usr") + ELSEIF ("${CMAKE_BUILD_TYPE}" MATCHES "Debug") + MESSAGE("setting debug output dir") + SET(CMAKE_INSTALL_PREFIX "${SCL_SOURCE_DIR}/../scl-install") + ELSE("${CMAKE_BUILD_TYPE}" MATCHES "Release") + SET(CMAKE_INSTALL_PREFIX "/usr/local") + ENDIF ("${CMAKE_BUILD_TYPE}" MATCHES "Release") + ENDIF(NOT WIN32) + SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "SCL install prefix" FORCE) + SET(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0) +ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) +SET(BRLCAD_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "SCL install prefix") + +OPTION(SCL-BUILD_EXPRESS_ONLY "Only build express parser." OFF) +MARK_AS_ADVANCED(SCL-BUILD_EXPRESS_ONLY) + +# Take the scl config file template and copy it to the build directory so CMake +# scripts can append to it if need be +configure_file(${SCL_SOURCE_DIR}/include/scl_cf_cmake.h.in ${SCL_BINARY_DIR}/include/scl_cf.h.in COPYONLY) +SET(CONFIG_H_FILE ${SCL_SOURCE_DIR}/include/scl_cf_cmake.h.in) + +INCLUDE(CheckLibraryExists) +INCLUDE(CheckIncludeFile) +INCLUDE(CheckFunctionExists) +INCLUDE(CheckTypeSize) +INCLUDE(${SCL_CMAKE_DIR}/FindLEX.cmake) +INCLUDE(${SCL_CMAKE_DIR}/FindYACC.cmake) + +CHECK_INCLUDE_FILE(ndir.h HAVE_NDIR_H) +CHECK_INCLUDE_FILE(stdarg.h HAVE_STDARG_H) +CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILE(sysent.h HAVE_SYSENT_H) +CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H) + +CHECK_FUNCTION_EXISTS(abs HAVE_ABS) +CHECK_FUNCTION_EXISTS(memcpy HAVE_MEMCPY) +CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE) + +CHECK_TYPE_SIZE("ssize_t" SSIZE_T) + +# Now that all the tests are done, configure the scl_cf.h file: +configure_file(${SCL_BINARY_DIR}/include/scl_cf.h.in ${SCL_BINARY_DIR}/include/scl_cf.h) + +add_definitions( + -DHAVE_CONFIG_H + ) + +include_directories( + ${SCL_SOURCE_DIR}/include + ${SCL_BINARY_DIR}/include + ) + +ADD_SUBDIRECTORY(src/express) +ADD_SUBDIRECTORY(src/exppp) +ADD_SUBDIRECTORY(src/fedex_plus) +ADD_SUBDIRECTORY(src/clstepcore) +ADD_SUBDIRECTORY(src/cleditor) +ADD_SUBDIRECTORY(src/cldai) +ADD_SUBDIRECTORY(src/clutils) +ADD_SUBDIRECTORY(include) +ADD_SUBDIRECTORY(data) +ADD_SUBDIRECTORY(doc) diff --git a/configure.ac b/configure.ac index ad89fcfc..3d81edbf 100644 --- a/configure.ac +++ b/configure.ac @@ -80,13 +80,10 @@ dnl minimum version of autoconf required. should coincide with dnl setting in autogen.sh script. AC_PREREQ(2.52) -dnl See HACKING for details on how to properly update the version -define([MAJOR_VERSION], [patsubst(esyscmd([cat include/conf/MAJOR]), [ -])]) -define([MINOR_VERSION], [patsubst(esyscmd([cat include/conf/MINOR]), [ -])]) -define([PATCH_VERSION], [patsubst(esyscmd([cat include/conf/PATCH]), [ -])]) +define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl +define([MAJOR_VERSION], [3]) +define([MINOR_VERSION], [2]) +define([PATCH_VERSION], [0]) define([SCL_VERSION], [patsubst([MAJOR_VERSION.MINOR_VERSION.PATCH_VERSION], [ ])]) @@ -187,7 +184,7 @@ BC_SCL_DATA AM_INIT_AUTOMAKE([1.6 dist-zip dist-bzip2]) # write out all of our definitions to this header -AM_CONFIG_HEADER([include/scl_config.h]) +AM_CONFIG_HEADER([include/scl_cf.h]) # automatically enable and load our configure cache file if available BC_CONFIG_CACHE([config.cache.${host_os}.${ac_hostname}]) @@ -788,7 +785,6 @@ AC_CONFIG_FILES([ m4/Makefile misc/Makefile include/Makefile - include/conf/Makefile include/express/Makefile include/exppp/Makefile doc/Makefile diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 00000000..a6f9039f --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,35 @@ +SET(SCL_DATA ${${CMAKE_PROJECT_NAME}_INSTALL_DATA_DIR}) + +SET(ap203_data + ap203/203wseds.exp + ap203/cube1.p21 + ap203/cube2.p21 + ap203/g_r_assembly1.p21 + ap203/gasket1.p21 + ap203/gasket2.p21 + ap203/gasket3.p21 + ap203/hex_prism1.p21 + ap203/rod_aspect1.p21 + ap203/star1.p21 +) +INSTALL(FILES ${ap203_data} DESTINATION ${SCL_DATA}/data/ap203) + +SET(ap227_data + ap227/ap227.exp + ap227/mitre.p21 + ap227/mitre.step.txt +) +INSTALL(FILES ${ap227_data} DESTINATION ${SCL_DATA}/data/ap227) + +SET(step_example_data + example/example.exp +) +INSTALL(FILES ${step_example_data} DESTINATION ${SCL_DATA}/data/example) + + + +SET(step_datafiles + pdmnet.exp + select.exp +) +INSTALL(FILES ${step_datafiles} DESTINATION ${SCL_DATA}/data) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 00000000..392de59e --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,7 @@ +SET(scl_MANS + man/man1/dataprobe.1 + man/man1/fedex.1 + man/man1/fedex_plus.1 + man/man1/mkProbe.1 +) +INSTALL(FILES ${scl_MANS} DESTINATION ${${CMAKE_PROJECT_NAME}_INSTALL_MAN_DIR}/man1) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 00000000..8dfc1fca --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,36 @@ +SET(express_HDRS + express/alg.h + express/basic.h + express/caseitem.h + express/de_end.h + express/decstart.h + express/defstart.h + express/dict.h + express/entity.h + express/error.h + express/expbasic.h + express/expr.h + express/express.h + express/hash.h + express/lexact.h + express/linklist.h + express/memory.h + express/object.h + express/resolve.h + express/schema.h + express/scope.h + express/stmt.h + express/symbol.h + express/type.h + express/variable.h +) +install(FILES ${express_HDRS} DESTINATION include/express) + +SET(exppp_HDRS + exppp/exppp.h +) +install(FILES ${exppp_HDRS} DESTINATION include/exppp) + +SET(SCL_noinst_HEADERS + sclprefixes.h +) diff --git a/include/Makefile.am b/include/Makefile.am index f9b9ef17..48c40aa0 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,6 +1,5 @@ SUBDIRS = \ - conf \ express \ exppp diff --git a/include/conf/MAJOR b/include/conf/MAJOR deleted file mode 100644 index 00750edc..00000000 --- a/include/conf/MAJOR +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/include/conf/MINOR b/include/conf/MINOR deleted file mode 100644 index 0cfbf088..00000000 --- a/include/conf/MINOR +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/include/conf/Makefile.am b/include/conf/Makefile.am deleted file mode 100644 index 0cc8fa46..00000000 --- a/include/conf/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ - -COUNT: DATE HOST PATH USER - test -f $@ && expr `cat COUNT` + 1 > $@ || echo "1" > $@ - -DATE: HOST PATH USER $(top_builddir)/include/scl_config.h - echo "\"`LANG=C date -R 2>/dev/null || date +'%a, %d %b %Y %H:%M:%S %z' 2>/dev/null || date`\"" > $@ - -HOST: $(top_builddir)/include/scl_config.h - echo "\"`hostname`\"" > $@ - -PATH: $(top_builddir)/include/scl_config.h - echo "\"$(DESTDIR)$(prefix)\"" > $@ - -USER: $(top_builddir)/include/scl_config.h - echo "\"`whoami`\"" > $@ - -# updated every time make is invoked for timing the compile -TS: - @echo "\"`LANG=C date -R 2>/dev/null || date +'%a, %d %b %Y %H:%M:%S %z' 2>/dev/null || date`\"" > $@ - @cat TS - -.PHONY: TS - -# this causes them to be dependencies on the 'all' target -BUILT_SOURCES = \ - COUNT \ - DATE \ - HOST \ - PATH \ - TS \ - USER - -EXTRA_DIST = \ - $(BUILT_SOURCES) \ - MAJOR \ - MINOR \ - PATCH - -# remove all except COUNT -CLEANFILES = \ - DATE \ - HOST \ - PATH \ - TS \ - USER - -DISTCLEANFILES = \ - $(CLEANFILES) \ - COUNT \ - TS - -include $(top_srcdir)/misc/Makefile.defs diff --git a/include/conf/PATCH b/include/conf/PATCH deleted file mode 100644 index 573541ac..00000000 --- a/include/conf/PATCH +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/include/scl_cf_cmake.h.in b/include/scl_cf_cmake.h.in new file mode 100644 index 00000000..24e463d9 --- /dev/null +++ b/include/scl_cf_cmake.h.in @@ -0,0 +1,14 @@ +/**** Define statements for CMake ****/ +#cmakedefine HAVE_NDIR_H 1 +#cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_SYS_STAT_H 1 +#cmakedefine HAVE_SYSENT_H 1 +#cmakedefine HAVE_UNISTD_H 1 +#cmakedefine HAVE_ABS 1 +#cmakedefine HAVE_MEMCPY 1 +#cmakedefine HAVE_MEMMOVE 1 +#cmakedefine HAVE_SSIZE_T 1 +#cmakedefine YYTEXT_POINTER 1 +#cmakedefine YYTEXT_POINTER 1 +#cmakedefine YYTEXT_POINTER 1 +#cmakedefine YYTEXT_POINTER 1 diff --git a/src/cldai/CMakeLists.txt b/src/cldai/CMakeLists.txt new file mode 100644 index 00000000..ff8ea9c9 --- /dev/null +++ b/src/cldai/CMakeLists.txt @@ -0,0 +1,39 @@ + +set(LIBSTEPDAI_SRCS + sdaiApplication_instance_set.cc + sdaiSession_instance.cc + sdaiObject.cc + sdaiDaObject.cc + sdaiEntity_extent.cc + sdaiEntity_extent_set.cc + sdaiModel_contents.cc + sdaiModel_contents_list.cc +) + +SET(LIBSTEPDAI_PRIVATE_HDRS + ErrorMap.hh + ErrorRpt.hh + impconv.hh + imptypes.hh + sdaiApplication_instance_set.h + sdaiDaObject.h + sdaiEntity_extent.h + sdaiEntity_extent_set.h + sdaiModel_contents.h + sdaiModel_contents_list.h + sdaiObject.h + sdaiSession_instance.h + StrUtil.hh +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${SCL_SOURCE_DIR}/src/clstepcore + ${SCL_SOURCE_DIR}/src/clutils +) + +add_definitions( + -DHAVE_CONFIG_H +) + +SCL_ADDLIB(stepdai "${LIBSTEPDAI_SRCS}" "steputils stepcore") diff --git a/src/cleditor/CMakeLists.txt b/src/cleditor/CMakeLists.txt new file mode 100644 index 00000000..9d8795cd --- /dev/null +++ b/src/cleditor/CMakeLists.txt @@ -0,0 +1,43 @@ + +set(LIBSTEPEDITOR_SRCS + STEPfile.cc + STEPfile.inline.cc + cmdmgr.cc + dispnode.cc + dispnodelist.cc + instmgr.cc + mgrnode.cc + mgrnodearray.cc + mgrnodelist.cc + needFunc.cc + s_HEADER_SCHEMA.cc + s_HEADER_SCHEMA.init.cc +) + +SET(LIBSTEPEDITOR_PRIVATE_HDRS + STEPfile.h + cmdmgr.h + dispnode.h + dispnodelist.h + editordefines.h + instmgr.h + mgrnode.h + mgrnodearray.h + mgrnodelist.h + needFunc.h + s_HEADER_SCHEMA.h + seeinfodefault.h +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${SCL_SOURCE_DIR}/src/cldai + ${SCL_SOURCE_DIR}/src/clstepcore + ${SCL_SOURCE_DIR}/src/clutils +) + +add_definitions( + -DHAVE_CONFIG_H +) + +SCL_ADDLIB(stepeditor "${LIBSTEPEDITOR_SRCS}" stepcore) diff --git a/src/cleditor/dispnodelist.cc b/src/cleditor/dispnodelist.cc index 5d5b3c64..7495f949 100644 --- a/src/cleditor/dispnodelist.cc +++ b/src/cleditor/dispnodelist.cc @@ -25,7 +25,7 @@ void DisplayNodeList::Remove(GenericNode *node) { GenNodeList::Remove(node); // DON'T DO THIS ((DisplayNode *)node)->displayState = noMapState; -}; +} // deletes node from its previous list & appends // actually it puts it at the front of the list. diff --git a/src/cleditor/mgrnode.cc b/src/cleditor/mgrnode.cc index 765f5149..f87bc331 100644 --- a/src/cleditor/mgrnode.cc +++ b/src/cleditor/mgrnode.cc @@ -41,7 +41,7 @@ void MgrNode::Remove() // cout << "MgrNode::this : '" << this << "'\n"; GenericNode::Remove(); // DON'T DO THIS!! currState = noStateSE; -}; +} // searches current list for fileId MgrNode *MgrNode::StateFindFileId(int fileId) diff --git a/src/cleditor/mgrnodelist.cc b/src/cleditor/mgrnodelist.cc index 1831cd7d..016e27c9 100644 --- a/src/cleditor/mgrnodelist.cc +++ b/src/cleditor/mgrnodelist.cc @@ -32,7 +32,7 @@ void MgrNodeList::Remove(GenericNode *node) // cout << "MgrNodeList::Remove()\n"; GenNodeList::Remove(node); // DON'T DO THIS ((MgrNode *)node)->currState = noStateSE; -}; +} // deletes node from its previous list & appends... // actually it puts it at the front of the list. diff --git a/src/clstepcore/CMakeLists.txt b/src/clstepcore/CMakeLists.txt new file mode 100644 index 00000000..fedd4715 --- /dev/null +++ b/src/clstepcore/CMakeLists.txt @@ -0,0 +1,70 @@ + +set(LIBSTEPCORE_SRCS + sdaiApplication_instance.cc + STEPcomplex.cc + STEPattribute.cc + STEPattribute.inline.cc + sdai.cc + sdaiEnum.cc + sdaiString.cc + sdaiSelect.cc + sdaiBinary.cc + STEPaggregate.cc + STEPundefined.cc + STEPattributeList.cc + SingleLinkList.cc + SingleLinkList.inline.cc + Registry.inline.cc + ExpDict.cc + ExpDict.inline.cc + read_func.cc + collect.cc + complexlist.cc + entlist.cc + multlist.cc + orlist.cc + entnode.cc + non-ors.cc + match-ors.cc + trynext.cc + print.cc +) + +SET(LIBSTEPCORE_PRIVATE_HDRS + baseType.h + complexSupport.h + dictdefs.h + ExpDict.h + read_func.h + Registry.h + scl_osschema.h + sdaiApplication_instance.h + sdaiBinary.h + sdaiEnum.h + sdai.h + sdaiSelect.h + sdaiString.h + Select.h + SingleLinkList.h + STEPaggregate.h + STEPattribute.h + STEPattributeList.h + STEPcomplex.h + STEPundefined.h +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${SCL_SOURCE_DIR}/src/cldai + ${SCL_SOURCE_DIR}/src/cleditor + ${SCL_SOURCE_DIR}/src/clutils +) + +add_definitions( + -DHAVE_CONFIG_H +) + +SCL_ADDLIB(stepcore "${LIBSTEPCORE_SRCS}" "express steputils") +if(APPLE) + set_target_properties(stepcore PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress") +endif(APPLE) diff --git a/src/clstepcore/ExpDict.cc b/src/clstepcore/ExpDict.cc index 0c4499cf..57d98800 100644 --- a/src/clstepcore/ExpDict.cc +++ b/src/clstepcore/ExpDict.cc @@ -11,6 +11,10 @@ */ /* $Id: ExpDict.cc,v 3.0.1.7 1998/02/17 19:19:15 sauderd DP3.1 $ */ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include diff --git a/src/clstepcore/STEPaggregate.cc b/src/clstepcore/STEPaggregate.cc index 829f6110..4f1d2656 100644 --- a/src/clstepcore/STEPaggregate.cc +++ b/src/clstepcore/STEPaggregate.cc @@ -483,12 +483,12 @@ GenericAggregate::ShallowCopy (const STEPaggregate& a) GenericAggrNode::GenericAggrNode (const char *str) { value = str; -}; +} GenericAggrNode::GenericAggrNode (GenericAggrNode& gan) { value = gan.value; -}; +} GenericAggrNode::GenericAggrNode() { diff --git a/src/clstepcore/sdai.h b/src/clstepcore/sdai.h index cea743b9..2887502d 100644 --- a/src/clstepcore/sdai.h +++ b/src/clstepcore/sdai.h @@ -20,6 +20,10 @@ /* $Id: sdai.h,v 3.0.1.12 1997/11/05 22:52:58 sauderd DP3.1 $ */ +#ifdef HAVE_CONFIG_H +# include +#endif + extern const char *SCLversion; #include diff --git a/src/clutils/CMakeLists.txt b/src/clutils/CMakeLists.txt new file mode 100644 index 00000000..67dcc94c --- /dev/null +++ b/src/clutils/CMakeLists.txt @@ -0,0 +1,38 @@ + +set(LIBSTEPUTILS_SRCS + Str.cc + dirobj.cc + gennode.cc + gennodelist.cc + gennodearray.cc + scl_hash.cc + errordesc.cc + scl_string.cc + scl_char_str_list.cc +) + +SET(LIBSTEPUTILS_PRIVATE_HDRS + dirobj.h + errordesc.h + gennodearray.h + gennode.h + gennodelist.h + scl_char_str_list.h + scldir.h + scl_hash.h + scl_string.h + stat.h + Str.h + str_list.h +) + +include_directories( + ${SCL_BINARY_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_definitions( + -DHAVE_CONFIG_H +) + +SCL_ADDLIB(steputils "${LIBSTEPUTILS_SRCS}" "") diff --git a/src/clutils/dirobj.cc b/src/clutils/dirobj.cc index cb92a1be..d5dd8209 100644 --- a/src/clutils/dirobj.cc +++ b/src/clutils/dirobj.cc @@ -43,7 +43,7 @@ #include #ifdef HAVE_CONFIG_H -# include +# include #endif /* for getuid() */ diff --git a/src/clutils/gennodearray.cc b/src/clutils/gennodearray.cc index 3ebd670c..b35ad1ed 100644 --- a/src/clutils/gennodearray.cc +++ b/src/clutils/gennodearray.cc @@ -12,6 +12,10 @@ /* $Id: gennodearray.cc,v 3.0.1.4 1997/11/05 22:33:48 sauderd DP3.1 $ */ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include diff --git a/src/clutils/gennodelist.cc b/src/clutils/gennodelist.cc index 6e0b00f6..23e7da53 100644 --- a/src/clutils/gennodelist.cc +++ b/src/clutils/gennodelist.cc @@ -54,8 +54,7 @@ GenNodeList::Remove(GenericNode *node) node->next = 0; node->prev = 0; } -}; - +} void GenNodeList::ClearEntries() { // if(debug_level >= PrintFunctionTrace) diff --git a/src/clutils/scl_char_str_list.cc b/src/clutils/scl_char_str_list.cc index 7ae81955..f4455aae 100644 --- a/src/clutils/scl_char_str_list.cc +++ b/src/clutils/scl_char_str_list.cc @@ -1,5 +1,8 @@ /////////////////////////////////////////////////////////////////////////////// +#ifdef HAVE_CONFIG_H +# include +#endif #include #include diff --git a/src/exppp/CMakeLists.txt b/src/exppp/CMakeLists.txt new file mode 100644 index 00000000..44e3ab86 --- /dev/null +++ b/src/exppp/CMakeLists.txt @@ -0,0 +1,23 @@ +set(LIBEXPPP_SOURCES + exppp.c +) + +SET(EXPPP_SOURCES + ${SCL_SOURCE_DIR}/src/express/fedex.c + exppp-main.c +) + +include_directories( + ${SCL_SOURCE_DIR}/include + ${SCL_SOURCE_DIR}/include/exppp +) + +add_definitions( + -DHAVE_CONFIG_H +) + +SCL_ADDLIB(libexppp "${LIBEXPPP_SOURCES}" express) +set_target_properties(libexppp PROPERTIES PREFIX "") + +SCL_ADDEXEC(exppp "${EXPPP_SOURCES}" "libexppp express") + diff --git a/src/express/CMakeLists.txt b/src/express/CMakeLists.txt new file mode 100644 index 00000000..1fbf5620 --- /dev/null +++ b/src/express/CMakeLists.txt @@ -0,0 +1,59 @@ +YACC_TARGET(ExpParser expparse.y ${CMAKE_CURRENT_BINARY_DIR}/expparse.c) +LEX_TARGET(ExpScanner expscan.l ${CMAKE_CURRENT_BINARY_DIR}/expscan.c COMPILE_FLAGS "-l") +ADD_LEX_YACC_DEPENDENCY(ExpScanner ExpParser) + +set(EXPRESS_SOURCES + ${YACC_ExpParser_OUTPUTS} + ${LEX_ExpScanner_OUTPUTS} + symbol.c + type.c + variable.c + expr.c + entity.c + caseitem.c + stmt.c + alg.c + scope.c + schema.c + resolve.c + lexact.c + linklist.c + error.c + dict.c + hash.c + memory.c + object.c + inithook.c + yyvars.c + express.c +) + +SET(FEDEX_SOURCES + fedex.c +) + +SET(SYMLINK_SOURCES + fedex.c + symlink.c +) + +SET(EXPRESS_PRIVATE_HDRS + conf.h + exptoks.h + stack.h +) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_definitions( + -DHAVE_CONFIG_H +) + +SCL_ADDLIB(express "${EXPRESS_SOURCES}" "") + +SCL_ADDEXEC(fedex "${FEDEX_SOURCES}" express) + +SCL_ADDEXEC(symlink "${SYMLINK_SOURCES}" express) diff --git a/src/fedex_plus/CMakeLists.txt b/src/fedex_plus/CMakeLists.txt new file mode 100644 index 00000000..a495d6e2 --- /dev/null +++ b/src/fedex_plus/CMakeLists.txt @@ -0,0 +1,52 @@ +set(FEDEX_COMMON_SRCS + classes_misc.c + ${SCL_SOURCE_DIR}/src/express/fedex.c +) + +set(fedex_os_SOURCES + ${FEDEX_COMMON_SRCS} + fedex_os.c +) + +set(fedex_idl_SOURCES + ${FEDEX_COMMON_SRCS} + fedex_idl.c +) + +set(fedex_plus_SOURCES + ${FEDEX_COMMON_SRCS} + fedex_main.c + classes_wrapper.cc + classes.c + selects.c + multpass.c + collect.cc + complexlist.cc + entlist.cc + multlist.cc + orlist.cc + entnode.cc + expressbuild.cc + non-ors.cc + match-ors.cc + trynext.cc + write.cc + print.cc +) + +include_directories( + ${SCL_SOURCE_DIR}/include + ${SCL_SOURCE_DIR}/include/exppp + ${SCL_SOURCE_DIR}/include/express +) + +add_definitions( + -DHAVE_CONFIG_H +) + +SCL_ADDEXEC(fedex_os "${fedex_os_SOURCES}" "libexppp express") + +SCL_ADDEXEC(fedex_idl "${fedex_idl_SOURCES}" "libexppp express") + +SCL_ADDEXEC(fedex_plus "${fedex_plus_SOURCES}" "libexppp express") +