2015-12-08 07:31:57 +00:00
|
|
|
include_directories(
|
|
|
|
${CMAKE_SOURCE_DIR}/include
|
|
|
|
${CMAKE_SOURCE_DIR}/3d-viewer
|
2017-03-02 22:53:49 +00:00
|
|
|
)
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2017-03-02 22:53:49 +00:00
|
|
|
set( SG_FILES
|
2015-12-08 07:31:57 +00:00
|
|
|
sg_base.cpp
|
|
|
|
sg_node.cpp
|
|
|
|
sg_helpers.cpp
|
|
|
|
scenegraph.cpp
|
|
|
|
sg_appearance.cpp
|
|
|
|
sg_faceset.cpp
|
|
|
|
sg_shape.cpp
|
|
|
|
sg_colors.cpp
|
|
|
|
sg_coords.cpp
|
|
|
|
sg_normals.cpp
|
|
|
|
sg_index.cpp
|
|
|
|
sg_coordindex.cpp
|
|
|
|
ifsg_node.cpp
|
|
|
|
ifsg_transform.cpp
|
|
|
|
ifsg_appearance.cpp
|
|
|
|
ifsg_index.cpp
|
|
|
|
ifsg_coordindex.cpp
|
|
|
|
ifsg_colors.cpp
|
|
|
|
ifsg_coords.cpp
|
|
|
|
ifsg_faceset.cpp
|
|
|
|
ifsg_normals.cpp
|
|
|
|
ifsg_shape.cpp
|
|
|
|
ifsg_api.cpp
|
|
|
|
)
|
|
|
|
|
2017-03-02 22:53:49 +00:00
|
|
|
if( MINGW )
|
|
|
|
list( APPEND SG_FILES ${CMAKE_SOURCE_DIR}/common/streamwrapper.cpp )
|
|
|
|
endif( MINGW )
|
|
|
|
|
|
|
|
add_library( kicad_3dsg SHARED ${SG_FILES} )
|
|
|
|
|
2016-02-29 23:08:19 +00:00
|
|
|
if( APPLE )
|
|
|
|
# puts library into the main kicad.app bundle in build tree
|
|
|
|
set_target_properties( kicad_3dsg PROPERTIES
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${OSX_BUNDLE_BUILD_LIB_DIR}"
|
|
|
|
INSTALL_NAME_DIR "${OSX_BUNDLE_BUILD_LIB_DIR}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2015-12-14 03:51:28 +00:00
|
|
|
find_file( S3DSG_VERSION_FILE sg_version.h
|
2016-01-29 01:00:03 +00:00
|
|
|
PATHS ${CMAKE_SOURCE_DIR}/include/plugins/3dapi NO_DEFAULT_PATH )
|
2015-12-14 03:51:28 +00:00
|
|
|
|
|
|
|
if( NOT ${S3DSG_VERSION_FILE} STREQUAL "S3DSG_VERSION_FILE-NOTFOUND" )
|
|
|
|
|
2016-02-29 23:08:19 +00:00
|
|
|
# extract the "#define KICADSG_VERSION_*" lines
|
2015-12-14 03:51:28 +00:00
|
|
|
file( STRINGS ${S3DSG_VERSION_FILE} _version
|
2016-02-29 23:08:19 +00:00
|
|
|
REGEX "^[' ','\t']*#define[' ','\t']*KICADSG_VERSION_.*" )
|
2015-12-14 03:51:28 +00:00
|
|
|
|
|
|
|
foreach( SVAR ${_version} )
|
2016-01-29 01:00:03 +00:00
|
|
|
string( REGEX MATCH KICADSG_VERSION_[M,A,J,O,R,I,N,P,T,C,H,E,V]* _VARNAME ${SVAR} )
|
2015-12-14 03:51:28 +00:00
|
|
|
string( REGEX MATCH [0-9]+ _VALUE ${SVAR} )
|
|
|
|
|
|
|
|
if( NOT ${_VARNAME} STREQUAL "" )
|
|
|
|
if( NOT ${_VALUE} STREQUAL "" )
|
|
|
|
set( ${_VARNAME} ${_VALUE} )
|
|
|
|
else()
|
|
|
|
set( ${_VARNAME} 0 )
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endforeach()
|
|
|
|
|
2016-01-29 01:00:03 +00:00
|
|
|
if( NOT KICADSG_VERSION_MAJOR AND NOT ${KICADSG_VERSION_MAJOR} STREQUAL "0" )
|
2015-12-14 03:51:28 +00:00
|
|
|
message( FATAL_ERROR "Cannot determine the S3DSG library version" )
|
|
|
|
endif()
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2015-12-14 03:51:28 +00:00
|
|
|
#ensure that NOT SG_VERSION* will evaluate to '0'
|
2016-01-29 01:00:03 +00:00
|
|
|
if( NOT KICADSG_VERSION_MINOR )
|
|
|
|
set( KICADSG_VERSION_MINOR 0 )
|
2015-12-14 03:51:28 +00:00
|
|
|
endif()
|
|
|
|
|
2016-01-29 01:00:03 +00:00
|
|
|
if( NOT KICADSG_VERSION_PATCH )
|
|
|
|
set( KICADSG_VERSION_PATCH 0 )
|
2015-12-14 03:51:28 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties( kicad_3dsg
|
|
|
|
PROPERTIES SOVERSION
|
2016-01-29 01:00:03 +00:00
|
|
|
${KICADSG_VERSION_MAJOR}.${KICADSG_VERSION_MINOR}.${KICADSG_VERSION_PATCH} )
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2017-03-03 12:38:12 +00:00
|
|
|
message( STATUS "S3DSG version: ${KICADSG_VERSION_MAJOR}.${KICADSG_VERSION_MINOR}.${KICADSG_VERSION_PATCH}" )
|
2015-12-08 07:31:57 +00:00
|
|
|
else()
|
2015-12-14 03:51:28 +00:00
|
|
|
message( FATAL_ERROR "Cannot determine the S3DSG library version" )
|
2015-12-08 07:31:57 +00:00
|
|
|
endif()
|
2015-12-14 03:51:28 +00:00
|
|
|
|
|
|
|
unset( S3DSG_VERSION_FILE CACHE )
|
|
|
|
|
|
|
|
# Define a flag to expose the appropriate EXPORT macro at build time
|
|
|
|
target_compile_definitions( kicad_3dsg PRIVATE -DCOMPILE_SGLIB )
|
|
|
|
|
|
|
|
target_link_libraries( kicad_3dsg ${wxWidgets_LIBRARIES} )
|
|
|
|
|
|
|
|
install( TARGETS
|
|
|
|
kicad_3dsg
|
|
|
|
DESTINATION ${KICAD_LIB}
|
|
|
|
COMPONENT binary
|
|
|
|
)
|