Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@
[submodule "fmt"]
path = fmt
url = https://github.com/fmtlib/fmt.git
[submodule "nlohmann_json"]
path = nlohmann_json
url = https://github.com/nlohmann/json.git
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ both can be installed with `sdkmanager` command line tool.
* `python`: build dep of `opencc`
* `opencc`: for `opencc_dict`
* `gperf`: build dep of `libiconv`
* `rustup`: build dep of `libchewing`

## Libraries

Expand All @@ -40,6 +41,7 @@ both can be installed with `sdkmanager` command line tool.
* yaml-cpp: [jbeder/yaml-cpp](https://github.com/jbeder/yaml-cpp)
* leveldb: [google/leveldb](https://github.com/google/leveldb)
* marisa-trie: [s-yata/marisa-trie](https://github.com/s-yata/marisa-trie)
* nlohmann_json: [nlohmann/json](https://github.com/nlohmann/json)
* librime: [rime/librime](https://github.com/rime/librime)
* librime-lua: [rime/librime-lua](https://github.com/hchunhui/librime-lua)
* librime-octagram: [rime/librime-octagram](https://github.com/lotem/librime-octagram)
Expand Down
1 change: 1 addition & 0 deletions nlohmann_json
Submodule nlohmann_json added at 55f936
3 changes: 3 additions & 0 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Rules.LibThai
import Rules.LibUV
import Rules.Lua
import Rules.Marisa
import Rules.NlohmannJSON
import Rules.OpenCC
import Rules.RustToolchain
import Rules.YAMLCpp
Expand Down Expand Up @@ -68,6 +69,7 @@ main = do
marisaSourceRule
hostMarisaRule
marisaRule
nlohmannJSONRule
librimeRule
libhangulRule
libchewingRule
Expand All @@ -94,6 +96,7 @@ main = do
"yaml-cpp",
"leveldb",
"marisa",
"nlohmann_json",
"librime",
"libhangul",
"chewing-dict",
Expand Down
36 changes: 36 additions & 0 deletions src/Rules/NlohmannJSON.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE TypeFamilies #-}

module Rules.NlohmannJSON (nlohmannJSONRule) where

import Base
import CMakeBuilder

data NlohmannJSON = NlohmannJSON
deriving stock (Eq, Show, Typeable, Generic)
deriving anyclass (Hashable, Binary, NFData)

type instance RuleResult NlohmannJSON = ()

nlohmannJSONRule :: Rules ()
nlohmannJSONRule = do
buildNlohmannJSON <-
useCMake
(cmakeBuilder "nlohmann_json")
{ cmakeFlags =
const
[ "-DBUILD_TESTING=OFF",
"-DJSON_BuildTests=OFF",
-- install boost headers to parent directory, symlink it afterwards
"-DCMAKE_INSTALL_INCLUDEDIR=" <> "../include"
],
-- symlink headers for each abi to reduce size
postBuildEachABI = BuildActionABI $ \_ env ->
liftIO $ do
let includePath = buildEnvOutPrefix env </> "include"
whenM (doesPathExist includePath) $ removePathForcibly includePath
createDirectoryLink (".." </> "include") includePath
}
"nlohmann_json" ~> buildWithAndroidEnv buildNlohmannJSON NlohmannJSON