Migrate muParser to CMake

This adds a CMakeLists.txt inside muParser, so it can be build
with CMake.
This commit is contained in:
ridiculousfish 2017-11-05 13:00:34 -08:00
parent cd47f9b1a2
commit 39ddfa2ad2
3 changed files with 13 additions and 32 deletions

View File

@ -1,28 +0,0 @@
INCLUDE(ExternalProject)
SET(MUPARSER_PREFIX muparser-build)
SET(MUPARSER_SRC ${CMAKE_CURRENT_SOURCE_DIR}/muparser-2.2.5)
SET(MUPARSER_OBJ ${MUPARSER_PREFIX}/obj)
SET(MUPARSER_DST ${MUPARSER_PREFIX}/dst)
# MuParser configure has an obnoxious victory message which we suppress.
EXTERNALPROJECT_ADD(
muparser_project
PREFIX ${MUPARSER_PREFIX}
SOURCE_DIR ${MUPARSER_SRC}
BINARY_DIR ${MUPARSER_OBJ}
INSTALL_DIR ${MUPARSER_DST}
CONFIGURE_COMMAND ${MUPARSER_SRC}/configure
--prefix=${CMAKE_CURRENT_BINARY_DIR}/${MUPARSER_DST}
--quiet --enable-shared=no --enable-samples=no --enable-debug=no > /dev/null
BUILD_COMMAND make -j 3 CPPFLAGS=-D_UNICODE=1\ -Wno-switch lib/libmuparser.a
INSTALL_COMMAND make install
BUILD_BYPRODUCTS ${MUPARSER_DST}/lib/libmuparser.a
EXCLUDE_FROM_ALL
)
ADD_LIBRARY(muparser STATIC IMPORTED)
SET_TARGET_PROPERTIES(muparser PROPERTIES IMPORTED_LOCATION
${CMAKE_CURRENT_BINARY_DIR}/${MUPARSER_DST}/lib/libmuparser.a)
ADD_DEPENDENCIES(muparser muparser_project)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/${MUPARSER_DST}/include/)

View File

@ -76,7 +76,7 @@ ADD_DEFINITIONS(-D_UNICODE=1
INCLUDE(CMakeFiles/PCRE2.cmake)
# Set up muparser.
INCLUDE(CMakeFiles/MuParser.cmake)
INCLUDE(muparser-2.2.5/CMakeLists.txt)
# Set up the docs.
INCLUDE(CMakeFiles/Docs.cmake)
@ -93,9 +93,6 @@ TARGET_LINK_LIBRARIES(fishlib
${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS}
${PCRE2_LIB} muparser)
# builtin_math.cpp needs to see muParser's built header.
ADD_DEPENDENCIES(fishlib muparser)
# Define fish.
ADD_EXECUTABLE(fish src/fish.cpp)
FISH_LINK_DEPS(fish)

12
muparser-2.2.5/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,12 @@
SET(MUPARSER_SRCS
${CMAKE_CURRENT_LIST_DIR}/src/muParser.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserBase.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserBytecode.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserCallback.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserDLL.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserError.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserInt.cpp
${CMAKE_CURRENT_LIST_DIR}/src/muParserTokenReader.cpp)
ADD_LIBRARY(muparser STATIC ${MUPARSER_SRCS})
TARGET_INCLUDE_DIRECTORIES(muparser PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)