-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
47 lines (38 loc) · 1.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION 3.14)
project(pyTGM)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
set(MODULES
"hk512:encrypt/hk512"
"b64:encrypt/b64"
"rect:rect"
"clear:terminal/clear"
"color:terminal/color"
"geky:terminal/geky"
"pos:terminal/pos"
"sound:sound"
)
foreach(entry ${MODULES})
string(REPLACE ":" ";" entry_list ${entry})
list(GET entry_list 0 mod_name)
list(GET entry_list 1 mod_dir)
set(module_cpp "./../${mod_dir}/${mod_name}.cpp")
if(EXISTS "${module_cpp}")
add_library(${mod_name} SHARED "${module_cpp}")
target_include_directories(${mod_name} PRIVATE ${Python3_INCLUDE_DIRS})
target_link_libraries(${mod_name} PRIVATE ${Python3_LIBRARIES})
set_target_properties(${mod_name} PROPERTIES
PREFIX ""
SUFFIX ".so"
)
else()
message(WARNING "Source file for module '${mod_name}' not found: ${module_cpp}")
endif()
endforeach()
message(STATUS "C++ modules being built:")
foreach(entry ${MODULES})
string(REPLACE ":" ";" entry_list ${entry})
list(GET entry_list 0 mod_name)
message(STATUS " ${mod_name}")
endforeach()