Skip to content

Commit

Permalink
feat: link re2
Browse files Browse the repository at this point in the history
also removed unneeded submodules as I can lmao
  • Loading branch information
djpiper28 committed Jul 27, 2023
1 parent e6c7b42 commit 4200f25
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 19 deletions.
9 changes: 3 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
[submodule "testing_h"]
path = testing_h
url = https://github.com/djpiper28/testing.h
[submodule "jansson"]
path = jansson
url = https://github.com/akheron/jansson
[submodule "curl"]
path = curl
url = https://github.com/curl/curl
[submodule "strptime"]
path = strptime
url = https://github.com/djpiper28/strptime
Expand All @@ -19,3 +13,6 @@
[submodule "re2"]
path = re2
url = https://github.com/google/re2
[submodule "abseil-cpp"]
path = abseil-cpp
url = https://github.com/abseil/abseil-cpp.git
50 changes: 40 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.9)
project(
mtg-search-engine
VERSION 1.0
LANGUAGES C)
LANGUAGES C CXX)

set(REPO_URL "https://github.com/djpiper28/mtg-search-engine")

Expand Down Expand Up @@ -40,9 +40,6 @@ add_definitions("-DMSE_PROJECT_VERSION=\"${CMAKE_PROJECT_VERSION}\"")
add_definitions("-DMSE_PROJECT_NAME=\"${CMAKE_PROJECT_NAME}\"")
add_definitions("-DMSE_BINARY_VERSION=1")

# Packages
find_package(CURL)

# __FILENAME__
string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE)
add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}")
Expand All @@ -65,10 +62,49 @@ add_custom_command(
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/generate_char_map.py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

# Packages
find_package(CURL)

# Jansson find_package is broken On non-unix systems you need to provide your
# own pthreads implementation Have a look at win32 pthreads for example

# These set statements are magical and from
# https://github.com/google/re2/issues/436
set(ABSL_PROPAGATE_CXX_STD ON)
set(ABSL_ENABLE_INSTALL ON)
add_subdirectory(./abseil-cpp)
set(ABSL_LIBS
absl::base
absl::core_headers
absl::fixed_array
absl::flags
absl::flat_hash_map
absl::flat_hash_set
absl::inlined_vector
absl::optional
absl::span
absl::str_format
absl::strings)

add_subdirectory(./re2)

# Parser generators
find_package(BISON)
find_package(FLEX)

option(USE_JEMALLOC OFF)
set(LIBS
jansson
CURL::libcurl
pthread
m
c
${ABSL_LIBS}
re2)
if(USE_JEMALLOC)
set(LIBS ${LIBS} jemalloc)
endif()

if(WIN32)
set(ADDITIONAL_FLEX_FLAGS "--wincompat")
else()
Expand Down Expand Up @@ -215,12 +251,6 @@ if(UNIX)
${GCOVR_EXCLUDE})
endif()

option(USE_JEMALLOC OFF)
set(LIBS jansson CURL::libcurl pthread m c)
if(USE_JEMALLOC)
set(LIBS ${LIBS} jemalloc)
endif()

# Add library and cli execs
add_library(mtg-search-engine OBJECT ${SRC})
target_link_libraries(mtg-search-engine PRIVATE ${LIBS})
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ and sets. It has a syntax that is similar to Scryfall but it can be embedded any
[![codecov](https://codecov.io/gh/MonarchDevelopment/mtg-search-engine/branch/main/graph/badge.svg?token=FK7LTBC9AC)](https://codecov.io/gh/MonarchDevelopment/mtg-search-engine)

## Requirements
- openssl
- cmake
- openssl
- cURL
- jansson
- c compiler *(i.e: gcc)*
- c++ compiler *(i.e: g++)*
- <!--nerf-->bison
- flex
- pthread *(see win32 pthread)*
- python3
- `pip install -r requirements.txt`

Expand Down
1 change: 1 addition & 0 deletions abseil-cpp
Submodule abseil-cpp added at 4ff696
1 change: 0 additions & 1 deletion curl
Submodule curl deleted from f2aac0
1 change: 0 additions & 1 deletion jansson
Submodule jansson deleted from 60097f

0 comments on commit 4200f25

Please sign in to comment.