Skip to content
Permalink
Browse files

Some hacks to make cmake files MinGW-friendly (#1885)

  • Loading branch information
fundies committed Feb 13, 2020
1 parent 670a3e2 commit 87aac665e3722d9e871f050ea0dddb26dddb480b
Showing with 25 additions and 7 deletions.
  1. +14 −3 CommandLine/libEGM/CMakeLists.txt
  2. +11 −4 shared/protos/CMakeLists.txt
@@ -53,16 +53,27 @@ endif(MSVC)
find_package(yaml-cpp CONFIG REQUIRED)
target_link_libraries(${LIB} PRIVATE yaml-cpp)

include_directories(. ../ "${ENIGMA_DIR}/shared/" "${ENIGMA_DIR}/shared/protos/.eobjs" "${ENIGMA_DIR}/shared/libpng-util")
include_directories(. ../ "${CMAKE_BINARY_DIR}/Submodules/enigma-dev/CommandLine/libEGM/libProtocols" "${ENIGMA_DIR}/shared/" "${ENIGMA_DIR}/shared/libpng-util")

include(FindProtobuf)
target_link_libraries(${LIB} PRIVATE ${Protobuf_LIBRARY})

#Linux is a turd
if(NOT MSVC)
if(NOT WIN32)
find_library(LIB_FS NAMES stdc++fs)
target_link_libraries(${LIB} PRIVATE ${LIB_FS})
endif(NOT MSVC)
endif()

add_subdirectory(../../shared/protos libProtocols)
add_dependencies(${EXE} "Protocols")
target_link_libraries(${LIB} PRIVATE "Protocols")

find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIR})
target_link_libraries(${LIB} PRIVATE ${PNG_LIBRARY})

find_package(ZLIB)
target_link_libraries(${LIB} PRIVATE ${ZLIB_LIBRARIES})

install(TARGETS ${LIB} DESTINATION "${ENIGMA_DIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${LIB}.dir/Debug/${LIB}.pdb" DESTINATION "${ENIGMA_DIR}" OPTIONAL)
@@ -32,11 +32,18 @@ endforeach()

include_directories(${CMAKE_CURRENT_BINARY_DIR})

if(NOT MSVC)
set(GRPC_EXE "/usr/bin/grpc_cpp_plugin")
else()
# Hack to get msys path
if(WIN32 AND NOT MSVC)
get_filename_component(MINGW_BIN ${CMAKE_C_COMPILER} DIRECTORY)
endif()

if(MSVC)
set(GRPC_EXE "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/grpc/grpc_cpp_plugin.exe")
endif(NOT MSVC)
elseif(WIN32)
set(GRPC_EXE "${MINGW_BIN}/grpc_cpp_plugin.exe")
else()
set(GRPC_EXE "/usr/bin/grpc_cpp_plugin")
endif()

file(GLOB PROTO_FILES *.proto)
include(FindProtobuf)

0 comments on commit 87aac66

Please sign in to comment.
You can’t perform that action at this time.