Fix building makehrtf and sofa-info on Windows

This commit is contained in:
Chris Robinson 2019-01-22 13:14:11 -08:00
parent ecafa19bcf
commit 5c0dcd1f24
3 changed files with 26 additions and 9 deletions

View File

@ -1523,18 +1523,14 @@ IF(ALSOFT_UTILS)
endif()
add_executable(makehrtf ${MAKEHRTF_SRCS})
target_compile_definitions(makehrtf PRIVATE ${CPP_DEFS})
target_include_directories(makehrtf PRIVATE ${MYSOFA_INCLUDE_DIRS})
target_compile_options(makehrtf PRIVATE ${C_FLAGS})
if(HAVE_LIBM)
target_link_libraries(makehrtf PRIVATE ${LINKER_FLAGS} ${MYSOFA_LIBRARIES} m)
endif()
target_link_libraries(makehrtf PRIVATE ${LINKER_FLAGS} MySOFA::MySOFA)
set(SOFAINFO_SRCS utils/sofa-info.cpp)
add_executable(sofa-info ${SOFAINFO_SRCS})
target_compile_definitions(sofa-info PRIVATE ${CPP_DEFS})
target_include_directories(sofa-info PRIVATE ${MYSOFA_INCLUDE_DIRS})
target_compile_options(sofa-info PRIVATE ${C_FLAGS})
target_link_libraries(sofa-info PRIVATE ${LINKER_FLAGS} ${MYSOFA_LIBRARIES})
target_link_libraries(sofa-info PRIVATE ${LINKER_FLAGS} MySOFA::MySOFA)
endif()
IF(ALSOFT_INSTALL)

View File

@ -39,6 +39,8 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
find_package(ZLIB)
find_path(MYSOFA_INCLUDE_DIR NAMES mysofa.h
DOC "The MySOFA include directory"
)
@ -47,14 +49,33 @@ find_library(MYSOFA_LIBRARY NAMES mysofa
DOC "The MySOFA library"
)
find_library(MYSOFA_M_LIBRARY NAMES m
DOC "The math library for MySOFA"
)
# handle the QUIETLY and REQUIRED arguments and set MYSOFA_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MYSOFA REQUIRED_VARS MYSOFA_LIBRARY MYSOFA_INCLUDE_DIR)
find_package_handle_standard_args(MYSOFA REQUIRED_VARS MYSOFA_LIBRARY MYSOFA_INCLUDE_DIR ZLIB_FOUND)
if(MYSOFA_FOUND)
set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARY})
set(MYSOFA_INCLUDE_DIRS ${MYSOFA_INCLUDE_DIR})
set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARY})
set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARIES} ZLIB::ZLIB)
if(MYSOFA_M_LIBRARY)
set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARIES} ${MYSOFA_M_LIBRARY})
endif()
add_library(MySOFA::MySOFA UNKNOWN IMPORTED)
set_property(TARGET MySOFA::MySOFA PROPERTY
IMPORTED_LOCATION ${MYSOFA_LIBRARY})
set_target_properties(MySOFA::MySOFA PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${MYSOFA_INCLUDE_DIRS}
INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
if(MYSOFA_M_LIBRARY)
set_property(TARGET MySOFA::MySOFA APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${MYSOFA_M_LIBRARY})
endif()
endif()
mark_as_advanced(MYSOFA_INCLUDE_DIR MYSOFA_LIBRARY)

View File

@ -366,7 +366,7 @@ static void SofaInfo(const char *filename)
mysofa_free(sofa.hrtf);
}
int main(const int argc, const char *argv[])
int main(int argc, char *argv[])
{
GET_UNICODE_ARGS(&argc, &argv);