Fixes for Windows/MSYS2
parent
75ab2beb06
commit
518d50d2e6
|
@ -139,10 +139,6 @@ IF (WIN32)
|
||||||
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
OPTION (ASSIMP_BUILD_ASSIMP_VIEW
|
|
||||||
"If the Assimp view tool is built. (requires DirectX)"
|
|
||||||
OFF )
|
|
||||||
|
|
||||||
OPTION( ASSIMP_INSTALL_PDB
|
OPTION( ASSIMP_INSTALL_PDB
|
||||||
"Install MSVC debug files."
|
"Install MSVC debug files."
|
||||||
ON )
|
ON )
|
||||||
|
@ -184,6 +180,7 @@ ENDIF()
|
||||||
IF(NOT BUILD_SHARED_LIBS)
|
IF(NOT BUILD_SHARED_LIBS)
|
||||||
MESSAGE(STATUS "Shared libraries disabled")
|
MESSAGE(STATUS "Shared libraries disabled")
|
||||||
SET(LINK_SEARCH_START_STATIC TRUE)
|
SET(LINK_SEARCH_START_STATIC TRUE)
|
||||||
|
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(STATUS "Shared libraries enabled")
|
MESSAGE(STATUS "Shared libraries enabled")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -231,16 +228,6 @@ IF(ASSIMP_DOUBLE_PRECISION)
|
||||||
ADD_DEFINITIONS(-DASSIMP_DOUBLE_PRECISION)
|
ADD_DEFINITIONS(-DASSIMP_DOUBLE_PRECISION)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
CONFIGURE_FILE(
|
|
||||||
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/revision.h
|
|
||||||
)
|
|
||||||
|
|
||||||
CONFIGURE_FILE(
|
|
||||||
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h
|
|
||||||
)
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES( BEFORE
|
INCLUDE_DIRECTORIES( BEFORE
|
||||||
./
|
./
|
||||||
code/
|
code/
|
||||||
|
@ -710,7 +697,8 @@ ADD_SUBDIRECTORY( code/ )
|
||||||
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
||||||
# The viewer for windows only
|
# The viewer for windows only
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" OFF )
|
FIND_PACKAGE(DirectX)
|
||||||
|
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} )
|
||||||
IF ( ASSIMP_BUILD_ASSIMP_VIEW )
|
IF ( ASSIMP_BUILD_ASSIMP_VIEW )
|
||||||
ADD_SUBDIRECTORY( tools/assimp_view/ )
|
ADD_SUBDIRECTORY( tools/assimp_view/ )
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
@ -735,12 +723,22 @@ IF ( ASSIMP_BUILD_TESTS )
|
||||||
ADD_SUBDIRECTORY( test/ )
|
ADD_SUBDIRECTORY( test/ )
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
# Generate a pkg-config .pc for the Assimp library.
|
# Generate a pkg-config .pc, revision.h, and config.h for the Assimp library.
|
||||||
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY )
|
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY )
|
||||||
IF ( ASSIMP_INSTALL )
|
IF ( ASSIMP_INSTALL )
|
||||||
INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT})
|
INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
CONFIGURE_FILE(
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/revision.h
|
||||||
|
)
|
||||||
|
|
||||||
|
CONFIGURE_FILE(
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h
|
||||||
|
)
|
||||||
|
|
||||||
IF ( ASSIMP_INSTALL )
|
IF ( ASSIMP_INSTALL )
|
||||||
IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
|
IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
|
||||||
# Packing information
|
# Packing information
|
||||||
|
|
|
@ -55,7 +55,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
|
||||||
endif(CMAKE_CL_64)
|
endif(CMAKE_CL_64)
|
||||||
find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||||
find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||||
find_library(DirectX_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
find_library(DirectX_DXERR_LIBRARY NAMES DxErr DxErr9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||||
find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1053,7 +1053,9 @@ ENDIF()
|
||||||
# Check dependencies for glTF importer with Open3DGC-compression.
|
# Check dependencies for glTF importer with Open3DGC-compression.
|
||||||
# RT-extensions is used in "contrib/Open3DGC/o3dgcTimer.h" for collecting statistics. Pointed file
|
# RT-extensions is used in "contrib/Open3DGC/o3dgcTimer.h" for collecting statistics. Pointed file
|
||||||
# has implementation for different platforms: WIN32, __MACH__ and other ("else" block).
|
# has implementation for different platforms: WIN32, __MACH__ and other ("else" block).
|
||||||
FIND_PACKAGE(RT QUIET)
|
IF (NOT WIN32)
|
||||||
|
FIND_PACKAGE(RT QUIET)
|
||||||
|
ENDIF ()
|
||||||
IF (NOT ASSIMP_HUNTER_ENABLED AND (RT_FOUND OR WIN32))
|
IF (NOT ASSIMP_HUNTER_ENABLED AND (RT_FOUND OR WIN32))
|
||||||
SET( ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC 1 )
|
SET( ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC 1 )
|
||||||
ADD_DEFINITIONS( -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 )
|
ADD_DEFINITIONS( -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 )
|
||||||
|
@ -1274,10 +1276,17 @@ SET_TARGET_PROPERTIES( assimp PROPERTIES
|
||||||
OUTPUT_NAME assimp${LIBRARY_SUFFIX}
|
OUTPUT_NAME assimp${LIBRARY_SUFFIX}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32 AND CMAKE_COMPILER_IS_GNUCXX AND BUILD_SHARED_LIBS)
|
if (MINGW)
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
set_target_properties(assimp PROPERTIES
|
set_target_properties(assimp PROPERTIES
|
||||||
SUFFIX "-${ASSIMP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
SUFFIX "-${ASSIMP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||||
)
|
)
|
||||||
|
if (NOT DEFINED ${LIBRARY_SUFFIX}) #Added as a guard for subsequent runs, but seems to not work when cache is outdated
|
||||||
|
set(LIBRARY_SUFFIX "-${ASSIMP_SOVERSION}" CACHE STRING "the suffix for the assimp MinGW shared library")
|
||||||
|
endif()
|
||||||
|
else ()
|
||||||
|
TARGET_LINK_LIBRARIES ( assimp -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lwinpthread ) # winpthread is for libminizip.
|
||||||
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
|
|
@ -63,7 +63,7 @@ inline int select_fseek(FILE *file, int64_t offset, int origin) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
#if defined _WIN64 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
||||||
template <>
|
template <>
|
||||||
inline size_t select_ftell<8>(FILE *file) {
|
inline size_t select_ftell<8>(FILE *file) {
|
||||||
return (size_t)::_ftelli64(file);
|
return (size_t)::_ftelli64(file);
|
||||||
|
@ -149,7 +149,7 @@ size_t DefaultIOStream::FileSize() const {
|
||||||
//
|
//
|
||||||
// See here for details:
|
// See here for details:
|
||||||
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
|
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
|
||||||
#if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
#if defined _WIN64 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
|
||||||
struct __stat64 fileStat;
|
struct __stat64 fileStat;
|
||||||
//using fileno + fstat avoids having to handle the filename
|
//using fileno + fstat avoids having to handle the filename
|
||||||
int err = _fstat64(_fileno(mFile), &fileStat);
|
int err = _fstat64(_fileno(mFile), &fileStat);
|
||||||
|
|
|
@ -18,11 +18,12 @@
|
||||||
#else
|
#else
|
||||||
#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) " (Commit @GIT_COMMIT_HASH@)"
|
#define VER_FILEVERSION_STR STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD) " (Commit @GIT_COMMIT_HASH@)"
|
||||||
#endif
|
#endif
|
||||||
|
#define VER_COPYRIGHT_STR "\xA9 2006-2022"
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define VER_ORIGINAL_FILENAME_STR "assimp@LIBRARY_SUFFIX@.dll"
|
#define VER_ORIGINAL_FILENAME_STR "@CMAKE_SHARED_LIBRARY_PREFIX@assimp@LIBRARY_SUFFIX@.dll"
|
||||||
#else
|
#else
|
||||||
#define VER_ORIGINAL_FILENAME_STR "assimp@LIBRARY_SUFFIX@@CMAKE_DEBUG_POSTFIX@.dll"
|
#define VER_ORIGINAL_FILENAME_STR "@CMAKE_SHARED_LIBRARY_PREFIX@assimp@LIBRARY_SUFFIX@@CMAKE_DEBUG_POSTFIX@.dll"
|
||||||
#endif // NDEBUG
|
#endif // NDEBUG
|
||||||
|
|
||||||
#endif // ASSIMP_REVISION_H_INC
|
#endif // ASSIMP_REVISION_H_INC
|
||||||
|
|
|
@ -39,8 +39,6 @@
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
cmake_minimum_required( VERSION 3.10 )
|
cmake_minimum_required( VERSION 3.10 )
|
||||||
|
|
||||||
FIND_PACKAGE(DirectX REQUIRED)
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES (
|
INCLUDE_DIRECTORIES (
|
||||||
${Assimp_SOURCE_DIR}/include
|
${Assimp_SOURCE_DIR}/include
|
||||||
${Assimp_SOURCE_DIR}/code
|
${Assimp_SOURCE_DIR}/code
|
||||||
|
|
Loading…
Reference in New Issue