[brlcad-commits] SF.net SVN: brlcad:[51566] brlcad/trunk/src/other/step
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <n_...@us...> - 2012-07-17 19:25:10
|
Revision: 51566 http://brlcad.svn.sourceforge.net/brlcad/?rev=51566&view=rev Author: n_reed Date: 2012-07-17 19:25:03 +0000 (Tue, 17 Jul 2012) Log Message: ----------- update dll export macros and remove local definitions; SCL git 7be54f3 Modified Paths: -------------- brlcad/trunk/src/other/step/cmake/SCL_Utils.cmake brlcad/trunk/src/other/step/data/CMakeLists.txt brlcad/trunk/src/other/step/src/cldai/CMakeLists.txt brlcad/trunk/src/other/step/src/cleditor/CMakeLists.txt brlcad/trunk/src/other/step/src/clstepcore/CMakeLists.txt brlcad/trunk/src/other/step/src/clutils/CMakeLists.txt brlcad/trunk/src/other/step/src/exppp/CMakeLists.txt brlcad/trunk/src/other/step/src/fedex_plus/CMakeLists.txt brlcad/trunk/src/other/step/src/fedex_python/CMakeLists.txt Modified: brlcad/trunk/src/other/step/cmake/SCL_Utils.cmake =================================================================== --- brlcad/trunk/src/other/step/cmake/SCL_Utils.cmake 2012-07-17 18:58:45 UTC (rev 51565) +++ brlcad/trunk/src/other/step/cmake/SCL_Utils.cmake 2012-07-17 19:25:03 UTC (rev 51566) @@ -1,70 +1,137 @@ -# 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() +# set compile definitions for dll exports on windows +MACRO(DEFINE_DLL_EXPORTS libname) + IF( MSVC OR BORLAND ) + if( ${libname} MATCHES "sdai_.*" ) + set( export "SCL_SCHEMA_DLL_EXPORTS" ) + else() + STRING(REGEX REPLACE "lib" "" shortname "${libname}") + STRING(REGEX REPLACE "step" "" LOWERCORE "${shortname}") + STRING(TOUPPER ${LOWERCORE} UPPER_CORE) + set( export "SCL_${UPPER_CORE}_DLL_EXPORTS" ) + endif() + get_target_property(defs ${libname} COMPILE_DEFINITIONS ) + if( defs ) #if no properties, ${defs} will be defs-NOTFOUND which CMake interprets as false + set( defs "${defs};${export}") + else( defs ) + set( defs "${export}") + endif( defs ) + set_target_properties(${libname} PROPERTIES COMPILE_DEFINITIONS "${defs}" ) + ENDIF( MSVC OR BORLAND ) +ENDMACRO(DEFINE_DLL_EXPORTS libname) +# set compile definitions for dll imports on windows +MACRO( DEFINE_DLL_IMPORTS tgt libs ) + IF( MSVC OR BORLAND ) + get_target_property(defs ${tgt} COMPILE_DEFINITIONS ) + if( NOT defs ) #if no properties, ${defs} will be defs-NOTFOUND which CMake interprets as false + set( defs "") + endif( NOT defs ) + foreach( lib ${libs} ) + STRING(REGEX REPLACE "lib" "" shortname "${lib}") + STRING(REGEX REPLACE "step" "" LOWERCORE "${shortname}") + STRING(TOUPPER ${LOWERCORE} UPPER_CORE) + list( APPEND defs "SCL_${UPPER_CORE}_DLL_IMPORTS" ) + endforeach( lib ${libs} ) + if( DEFINED defs ) + if( defs ) + set_target_properties( ${tgt} PROPERTIES COMPILE_DEFINITIONS "${defs}" ) + endif( defs ) + endif( DEFINED defs ) + ENDIF( MSVC OR BORLAND ) +ENDMACRO( DEFINE_DLL_IMPORTS tgt libs ) -MACRO(SCL_ADDEXEC execname srcslist libslist) - add_executable(${execname} ${srcslist}) - target_link_libraries(${execname} ${libslist} ${STDCXX_LIBRARIES}) - 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 SCL-ENABLE_STRICT) - SET(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}") - ENDIF(${extraarg} MATCHES "STRICT" AND SCL-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 srcslist libslist) +#EXCLUDE_OR_INSTALL(target destination ARGV3) +# installs ${target} in ${destination} unless testing is enabled AND ${arg_3} == "TESTABLE", +# in which case the EXCLUDE_FROM_ALL property is set for testing. +# EXCLUDE_FROM_ALL cannot be set on targets that are to be installed, +# so either test the target or install it - but not both +MACRO(EXCLUDE_OR_INSTALL target dest arg_3 ) + if( NOT ( ( SCL_ENABLE_TESTING ) AND ( "${arg_3}" STREQUAL "TESTABLE" ) ) ) + INSTALL(TARGETS ${target} DESTINATION ${dest}) + else( NOT ( ( SCL_ENABLE_TESTING ) AND ( "${arg_3}" STREQUAL "TESTABLE" ) ) ) + set_target_properties( ${target} PROPERTIES EXCLUDE_FROM_ALL ON ) + endif( NOT ( ( SCL_ENABLE_TESTING ) AND ( "${arg_3}" STREQUAL "TESTABLE" ) ) ) +ENDMACRO(EXCLUDE_OR_INSTALL target dest arg_3 ) -MACRO(SCL_ADDLIB libname srcslist libslist) - DLL_DEFINE(${libname}) +#SCL_ADDEXEC( execname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...]) +# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro +# optional args can also be used by MSVC-specific code, but it looks like these two uses +# will not conflict because the MSVC args must contain "STRICT" +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}) + DEFINE_DLL_IMPORTS(${execname} "${libslist}") #add import definitions for all libs that the executable is linked to + EXCLUDE_OR_INSTALL( ${execname} "bin" "${ARGV3}" ) + # Enable extra compiler flags if local executables and/or global options dictate + SET(LOCAL_COMPILE_FLAGS "") + FOREACH(extraarg ${ARGN}) + IF(${extraarg} MATCHES "STRICT" AND SCL-ENABLE_STRICT) + SET(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}") + ENDIF(${extraarg} MATCHES "STRICT" AND SCL-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) + +#SCL_ADDLIB( libname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...]) +# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro +# optional args can also be used by MSVC-specific code, but it looks like these two uses +# will not conflict because the MSVC args must contain "STRICT" +MACRO(SCL_ADDLIB libname srcs libs) + STRING(REGEX REPLACE " " ";" srcslist "${srcs}") + STRING(REGEX REPLACE " " ";" libslist1 "${libs}") + STRING(REGEX REPLACE "-framework;" "-framework " libslist "${libslist1}") IF(SCL_BUILD_SHARED_LIBS) - add_library(${libname} SHARED ${srcslist}) - if(NOT "${libslist}" MATCHES "NONE") - target_link_libraries(${libname} ${libslist}) - endif(NOT "${libslist}" MATCHES "NONE") - SET_TARGET_PROPERTIES(${libname} PROPERTIES VERSION ${SCL_ABI_VERSION} SOVERSION ${SCL_ABI_SOVERSION} ) - INSTALL(TARGETS ${libname} DESTINATION lib) + add_library(${libname} SHARED ${srcslist}) + DEFINE_DLL_EXPORTS(${libname}) + if(NOT ${libs} MATCHES "NONE") + target_link_libraries(${libname} ${libslist}) + DEFINE_DLL_IMPORTS(${libname} "${libslist}" ) + endif(NOT ${libs} MATCHES "NONE") + SET_TARGET_PROPERTIES(${libname} PROPERTIES VERSION ${SCL_ABI_VERSION} SOVERSION ${SCL_ABI_SOVERSION} ) + EXCLUDE_OR_INSTALL( ${libname} "lib" "${ARGV3}" ) + if(APPLE) + set_target_properties(${libname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress") + endif(APPLE) ENDIF(SCL_BUILD_SHARED_LIBS) IF(SCL_BUILD_STATIC_LIBS AND NOT MSVC) - add_library(${libname}-static STATIC ${srcslist}) - if(NOT "${libslist}" MATCHES "NONE") - target_link_libraries(${libname}-static ${libslist}) - endif(NOT "${libslist}" 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) + add_library(${libname}-static STATIC ${srcslist}) + DEFINE_DLL_EXPORTS(${libname}-static) + if(NOT ${libs} MATCHES "NONE") + target_link_libraries(${libname}-static "${libslist}") + DEFINE_DLL_IMPORTS(${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) + EXCLUDE_OR_INSTALL( ${libname}-static "lib" "${ARGV3}" ) + if(APPLE) + set_target_properties(${libname}-static PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress") + endif(APPLE) ENDIF(SCL_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 SCL-ENABLE_STRICT) - SET(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}") - ENDIF(${extraarg} MATCHES "STRICT" AND SCL-ENABLE_STRICT) + IF(${extraarg} MATCHES "STRICT" AND SCL-ENABLE_STRICT) + SET(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}") + ENDIF(${extraarg} MATCHES "STRICT" AND SCL-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) + 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 srcslist libslist) +ENDMACRO(SCL_ADDLIB libname srcs libs) Modified: brlcad/trunk/src/other/step/data/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/data/CMakeLists.txt 2012-07-17 18:58:45 UTC (rev 51565) +++ brlcad/trunk/src/other/step/data/CMakeLists.txt 2012-07-17 19:25:03 UTC (rev 51566) @@ -63,23 +63,11 @@ WORKING_DIRECTORY ${SCHEMA_OUTPUT_DIR} COMMENT "Running fedex_plus for ${SCHEMA_SHORT_NAME}..." VERBATIM ) - if(MSVC OR BORLAND) - add_definitions( -DSCL_SCHEMA_DLL_EXPORTS ) - add_definitions( -DSCL_BASE_DLL_IMPORTS ) - add_definitions( -DSCL_EXPRESS_DLL_IMPORTS ) - add_definitions( -DSCL_UTILS_DLL_IMPORTS ) - add_definitions( -DSCL_DAI_DLL_IMPORTS ) - add_definitions( -DSCL_CORE_DLL_IMPORTS ) - add_definitions( -DSCL_EDITOR_DLL_IMPORTS ) - endif() add_library( ${PROJECT_NAME} SHARED ${FEDEX_OUT} ) target_link_libraries(${PROJECT_NAME} stepdai stepcore express stepeditor steputils base ) add_dependencies( ${PROJECT_NAME} generate_cpp_${SCHEMA_SHORT_NAME} ) set_target_properties( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS ${${PROJECT_NAME}_COMPILE_FLAGS} ) - if(APPLE) - set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress") - endif(APPLE) TESTABLE_TARGET( ${PROJECT_NAME} ) add_test( NAME generate_cpp_${SCHEMA_SHORT_NAME} Modified: brlcad/trunk/src/other/step/src/cldai/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/src/cldai/CMakeLists.txt 2012-07-17 18:58:45 UTC (rev 51565) +++ brlcad/trunk/src/other/step/src/cldai/CMakeLists.txt 2012-07-17 19:25:03 UTC (rev 51566) @@ -27,12 +27,6 @@ sdaiString.h ) -IF(MSVC OR BORLAND) -add_definitions( -DSCL_DAI_DLL_EXPORTS ) -add_definitions( -DSCL_BASE_DLL_IMPORTS ) -add_definitions( -DSCL_UTILS_DLL_IMPORTS ) -ENDIF() - include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${SCL_SOURCE_DIR}/src/base Modified: brlcad/trunk/src/other/step/src/cleditor/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/src/cleditor/CMakeLists.txt 2012-07-17 18:58:45 UTC (rev 51565) +++ brlcad/trunk/src/other/step/src/cleditor/CMakeLists.txt 2012-07-17 19:25:03 UTC (rev 51566) @@ -41,12 +41,4 @@ ${SCL_SOURCE_DIR}/src/clutils ) -if(MSVC OR BORLAND) -add_definitions( -DSCL_EDITOR_DLL_EXPORTS ) -add_definitions( -DSCL_BASE_DLL_IMPORTS ) -add_definitions( -DSCL_CORE_DLL_IMPORTS ) -add_definitions( -DSCL_DAI_DLL_IMPORTS ) -add_definitions( -DSCL_UTILS_DLL_IMPORTS ) -endif() - SCL_ADDLIB(stepeditor "${LIBSTEPEDITOR_SRCS}" "stepcore;stepdai;steputils;base") Modified: brlcad/trunk/src/other/step/src/clstepcore/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/src/clstepcore/CMakeLists.txt 2012-07-17 18:58:45 UTC (rev 51565) +++ brlcad/trunk/src/other/step/src/clstepcore/CMakeLists.txt 2012-07-17 19:25:03 UTC (rev 51566) @@ -26,13 +26,6 @@ trynext.cc print.cc ) -if(MSVC OR BORLAND) - add_definitions( -DSCL_CORE_DLL_EXPORTS ) - add_definitions( -DSCL_BASE_DLL_IMPORTS ) - add_definitions( -DSCL_EXPRESS_DLL_IMPORTS ) - add_definitions( -DSCL_UTILS_DLL_IMPORTS ) - add_definitions( -DSCL_DAI_DLL_IMPORTS ) -endif() SET(LIBSTEPCORE_PRIVATE_HDRS baseType.h @@ -61,6 +54,3 @@ ) SCL_ADDLIB(stepcore "${LIBSTEPCORE_SRCS}" "express;steputils;stepdai;base") -if(APPLE) - set_target_properties(stepcore PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress") -endif(APPLE) Modified: brlcad/trunk/src/other/step/src/clutils/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/src/clutils/CMakeLists.txt 2012-07-17 18:58:45 UTC (rev 51565) +++ brlcad/trunk/src/other/step/src/clutils/CMakeLists.txt 2012-07-17 19:25:03 UTC (rev 51566) @@ -25,11 +25,6 @@ ${CMAKE_CURRENT_SOURCE_DIR} ) -if (MSVC OR BORLAND) -add_definitions( -DSCL_BASE_DLL_IMPORTS ) -add_definitions( -DSCL_UTILS_DLL_EXPORTS ) -endif() - SCL_ADDLIB(steputils "${LIBSTEPUTILS_SRCS}" "base") IF(MINGW OR MSVC OR BORLAND) Modified: brlcad/trunk/src/other/step/src/exppp/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/src/exppp/CMakeLists.txt 2012-07-17 18:58:45 UTC (rev 51565) +++ brlcad/trunk/src/other/step/src/exppp/CMakeLists.txt 2012-07-17 19:25:03 UTC (rev 51566) @@ -13,14 +13,8 @@ ${SCL_SOURCE_DIR}/src/base ) -if(MSVC OR BORLAND) -add_definitions( -DSCL_EXPPP_DLL_EXPORTS ) -add_definitions( -DSCL_EXPRESS_DLL_IMPORTS ) -add_definitions( -DSCL_BASE_DLL_IMPORTS ) -endif() - if(BORLAND) -add_definitions( -D__STDC__ ) + add_definitions( -D__STDC__ ) endif() SCL_ADDLIB(libexppp "${LIBEXPPP_SOURCES}" "express;base") Modified: brlcad/trunk/src/other/step/src/fedex_plus/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/src/fedex_plus/CMakeLists.txt 2012-07-17 18:58:45 UTC (rev 51565) +++ brlcad/trunk/src/other/step/src/fedex_plus/CMakeLists.txt 2012-07-17 19:25:03 UTC (rev 51566) @@ -30,12 +30,7 @@ ${SCL_SOURCE_DIR}/include/express ${SCL_SOURCE_DIR}/src/base ) -IF(MSVC OR BORLAND) -add_definitions( -DSCL_EXPRESS_DLL_IMPORTS ) -add_definitions( -DSCL_EXPPP_DLL_IMPORTS ) -add_definitions( -DSCL_BASE_DLL_IMPORTS ) -ENDIF() -SCL_ADDEXEC(fedex_plus "${fedex_plus_SOURCES};${fedex_plus_EXTRA_SOURCES}" "libexppp;express;base") +SCL_ADDEXEC(fedex_plus "${fedex_plus_SOURCES}" "libexppp;express;base") add_dependencies( fedex_plus version_string ) Modified: brlcad/trunk/src/other/step/src/fedex_python/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/src/fedex_python/CMakeLists.txt 2012-07-17 18:58:45 UTC (rev 51565) +++ brlcad/trunk/src/other/step/src/fedex_python/CMakeLists.txt 2012-07-17 19:25:03 UTC (rev 51566) @@ -10,12 +10,6 @@ add_definitions( -DHAVE_CONFIG_H ) -IF(MSVC) -add_definitions( -DSCL_BASE_DLL_IMPORTS ) -add_definitions( -DSCL_EXPRESS_DLL_IMPORTS ) -add_definitions( -DSCL_EXPPP_DLL_IMPORTS ) -ENDIF(MSVC) - set(fedex_python_SOURCES src/classes_misc_python.c ../express/fedex.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |