Skip to content

Commit ba952bc

Browse files
author
kRHYME7
committed
static build hyprlang so we can redistribute
1 parent 74510a3 commit ba952bc

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

CMakeLists.txt

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
cmake_minimum_required(VERSION 3.10)
2-
project(hyprquery)
1+
cmake_minimum_required(VERSION 3.19)
2+
project(hyprquery VERSION 0.1.0)
33

44
# Set the C++ standard
55
set(CMAKE_CXX_STANDARD 23)
66
set(CMAKE_CXX_STANDARD_REQUIRED True)
77

8-
# Include directories
9-
include_directories(/usr/include)
8+
# Set policy for CMP0048
9+
if(POLICY CMP0048)
10+
cmake_policy(SET CMP0048 NEW)
11+
endif()
12+
13+
# Set policy for CMP0127
14+
if(POLICY CMP0127)
15+
cmake_policy(SET CMP0127 NEW)
16+
endif()
17+
18+
# Suppress developer warnings
19+
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1)
1020

1121
# Add FetchContent module
1222
include(FetchContent)
23+
include(ExternalProject)
1324

1425
# Download and configure nlohmann_json
1526
FetchContent_Declare(
@@ -35,11 +46,25 @@ FetchContent_Declare(
3546
)
3647
FetchContent_MakeAvailable(cli11)
3748

49+
# Download and configure hyprlang
50+
ExternalProject_Add(
51+
hyprlang
52+
GIT_REPOSITORY https://github.com/hyprwm/hyprlang.git
53+
GIT_TAG main
54+
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/hyprlang_install
55+
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target install -j
56+
INSTALL_COMMAND ""
57+
)
58+
3859
# Add the executable
3960
add_executable(hyq src/main.cpp)
4061

62+
# Include hyprlang header
63+
target_include_directories(hyq PRIVATE ${hyprlang_SOURCE_DIR}/include)
64+
4165
# Link the hyprlang library
42-
target_link_libraries(hyq PRIVATE hyprlang)
66+
add_dependencies(hyq hyprlang)
67+
target_link_libraries(hyq PRIVATE ${CMAKE_BINARY_DIR}/hyprlang_install/lib/libhyprlang.so)
4368

4469
# Link nlohmann_json, spdlog, and CLI11 to the executable
4570
target_link_libraries(hyq PRIVATE nlohmann_json::nlohmann_json spdlog::spdlog CLI11::CLI11)

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <string>
1010
#include <vector>
1111

12-
#include <hyprlang.hpp>
12+
#include "../build/hyprlang_install/include/hyprlang.hpp"
1313

1414
static Hyprlang::CConfig *pConfig = nullptr;
1515
static std::string currentPath = "";

0 commit comments

Comments
 (0)