@@ -117,13 +117,11 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/viewsrc/include)
117
117
include_directories (${CMAKE_CURRENT_SOURCE_DIR} /websockets/include )
118
118
include_directories (${CMAKE_CURRENT_SOURCE_DIR} /include )
119
119
120
- if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR} /bin/paozhu_empty )
121
- file (REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR} /bin/paozhu_empty )
122
- endif ()
123
- #EXECUTE_PROCESS(COMMAND rm ${CMAKE_CURRENT_SOURCE_DIR}/bin/paozhu_empty)
120
+ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR} /bin/paozhu_pre )
121
+ file (REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR} /bin/paozhu_pre )
122
+ endif ()
124
123
set (PAOZHU_PRE paozhu_pre )
125
124
add_executable (${PAOZHU_PRE} ${CMAKE_CURRENT_SOURCE_DIR} /vendor/httpcli/autopickmethod.cpp ${CMAKE_CURRENT_SOURCE_DIR} /vendor/httpserver/src/md5.cpp )
126
- add_executable (paozhu_empty ${CMAKE_CURRENT_SOURCE_DIR} /vendor/httpcli/autoemptymethod.cpp )
127
125
128
126
129
127
@@ -138,6 +136,22 @@ file(GLOB_RECURSE src_list ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
138
136
139
137
foreach (cppfile IN LISTS controller_list )
140
138
string (REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR} /controller/src/" "" cppfilename ${cppfile} )
139
+ string (FIND ${cppfilename} "/" strpos )
140
+ if (${strpos} GREATER_EQUAL "0" )
141
+ string (REGEX MATCHALL "([A-Za-z0-9._-]+)/" npaths ${cppfilename} )
142
+ set (fullpaths "" )
143
+ string (APPEND fullpaths "${CMAKE_CURRENT_SOURCE_DIR} /controller/include/" )
144
+ foreach (onepathname ${npaths} )
145
+ string (REPLACE "/" "" toucpath ${onepathname} )
146
+ string (APPEND fullpaths ${toucpath} )
147
+ if (IS_DIRECTORY "${fullpaths} " )
148
+ else ()
149
+ message ("mkdir ${fullpaths} " )
150
+ file (MAKE_DIRECTORY "${fullpaths} " )
151
+ endif ()
152
+ string (APPEND fullpaths "/" )
153
+ endforeach ()
154
+ endif ()
141
155
string (REGEX REPLACE ".cpp" "" cppbasename ${cppfilename} )
142
156
# message(${cppbasename})
143
157
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR} /controller/include/${cppbasename} .h" )
@@ -175,21 +189,18 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
175
189
176
190
177
191
if (${mode} AND (CMAKE_BUILD_TYPE STREQUAL "Release" ))
178
- add_executable (paozhu ${CMAKE_CURRENT_SOURCE_DIR} /test/testbenchmark .cpp ${common_list} ${viewsrc_list} ${FRAMEWORK_CPP_PATH} ${orm_list} ${reflect_list} ${src_list} ${source_list} ${controller_list} )
192
+ add_executable (paozhu ${CMAKE_CURRENT_SOURCE_DIR} /test/testdaemon .cpp ${common_list} ${viewsrc_list} ${FRAMEWORK_CPP_PATH} ${orm_list} ${reflect_list} ${src_list} ${source_list} ${controller_list} )
179
193
else ()
180
194
add_executable (paozhu ${CMAKE_CURRENT_SOURCE_DIR} /test/test.cpp ${common_list} ${viewsrc_list} ${FRAMEWORK_CPP_PATH} ${orm_list} ${reflect_list} ${src_list} ${source_list} ${controller_list} )
181
195
endif ()
182
196
183
197
if (ENABLE_WIN_VCPKG STREQUAL "ON" )
184
- else ()
198
+ else ()
185
199
add_custom_command (
186
- TARGET paozhu_empty paozhu
187
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR} /bin/paozhu_pre
188
- PRE_BUILD
200
+ TARGET paozhu_pre POST_BUILD
189
201
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} /
190
202
COMMAND echo "-- controls method --"
191
203
COMMAND ${PAOZHU_PRE} ${CMAKE_CURRENT_SOURCE_DIR} /
192
- COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_SOURCE_DIR} /bin/paozhu_empty
193
204
)
194
205
endif ()
195
206
@@ -265,7 +276,7 @@ else ()
265
276
266
277
if (USE_STANDALONE_ASIO )
267
278
if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
268
- set (ASIO_PATH "/usr/local/opt/asio/include" "/usr/local/include" )
279
+ set (ASIO_PATH "/usr/local/opt/asio/include" "/usr/local/include" "/opt/homebrew/opt/asio" ${CMAKE_CURRENT_SOURCE_DIR} /asio )
269
280
else ()
270
281
set (ASIO_PATH ${CMAKE_CURRENT_SOURCE_DIR} /asio "/usr/include" )
271
282
endif ()
@@ -324,19 +335,54 @@ if(ZLIB_FOUND)
324
335
target_link_libraries (paozhu z )
325
336
endif ()
326
337
327
- find_path (MYSQL_ROOT_DIR mysql )
338
+
339
+ if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
340
+ if (IS_DIRECTORY "/usr/local/mysql/include" )
341
+ MESSAGE ( STATUS "/usr/local/mysql" )
342
+ set (MYSQL_INCLUDE_DIR "/usr/local/mysql/include" )
343
+ include_sub_directories_recursively (/usr/local/mysql/include )
344
+ endif ()
345
+
346
+ if (IS_DIRECTORY "/usr/local/opt/mysql-client" )
347
+ MESSAGE ( STATUS "/usr/local/opt/mysql-client" )
348
+ set (MYSQL_INCLUDE_DIR "/usr/local/opt/mysql-client/include" )
349
+ include_sub_directories_recursively (/usr/local/opt/mysql-client/include )
350
+ endif ()
351
+
352
+ if (IS_DIRECTORY "/opt/homebrew/opt/mysql" )
353
+ MESSAGE ( STATUS "/opt/homebrew/opt/mysql" )
354
+ set (MYSQL_INCLUDE_DIR "/opt/homebrew/opt/mysql/include" )
355
+ include_sub_directories_recursively (/opt/homebrew/opt/mysql/include )
356
+ endif ()
357
+
358
+
359
+ if (IS_DIRECTORY "/opt/homebrew/opt/mysql-client" )
360
+ MESSAGE ( STATUS "/opt/homebrew/opt/mysql-client" )
361
+ set (MYSQL_INCLUDE_DIR "/opt/homebrew/opt/mysql-client/include" )
362
+ include_sub_directories_recursively (/opt/homebrew/opt/mysql-client/include )
363
+ endif ()
364
+ MESSAGE ( STATUS "MYSQL_ROOT_DIR = ${MYSQL_ROOT_DIR} " )
365
+ else ()
366
+ find_path (MYSQL_ROOT_DIR mysql )
367
+ endif ()
368
+
369
+
370
+ FIND_PATH (MYSQL_INCLUDE_DIR NAMES mysql.h
371
+ PATHS /usr/local/include/mysql /usr/include/mysql /opt/homebrew/opt/mysql/include /usr/local/opt/mysql-client/include /opt/homebrew/opt/mysql-client/include
372
+ )
373
+
328
374
MESSAGE ( STATUS "MYSQL_ROOT_DIR = ${MYSQL_ROOT_DIR} " )
329
375
find_package_handle_standard_args (mysql REQUIRED_VARS MYSQL_ROOT_DIR )
330
376
331
- FIND_PATH ( MYSQL_INCLUDE_DIR mysql.h
332
- /usr/local/include/mysql
333
- /usr/include/ mysql
334
- /usr/local/mysql/include
335
- )
377
+
378
+ if ( NOT MYSQL_INCLUDE_DIR )
379
+ message ( STATUS "Could not find \" mysql.h \" from searching " )
380
+ endif ()
381
+
336
382
SET (MYSQL_NAMES mysqlclient )
337
383
FIND_LIBRARY (MYSQL_LIBRARY
338
384
NAMES ${MYSQL_NAMES}
339
- PATHS /usr/lib /usr/local/lib /usr/local/mysql/lib
385
+ PATHS /usr/lib /usr/local/lib /usr/local/mysql/lib /usr/local/opt/mysql/lib /opt/homebrew/opt/mysql/lib /opt/homebrew/opt/mysql-client/lib
340
386
PATH_SUFFIXES mysql
341
387
)
342
388
@@ -371,7 +417,17 @@ if(ENABLE_GD STREQUAL "ON")
371
417
message ("---ENABLE_GD-----" )
372
418
373
419
if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
374
- set (GD_ROOT_DIR "/usr/local/opt/gd/lib" )
420
+
421
+ if (IS_DIRECTORY "/usr/local/opt/gd/lib" )
422
+ MESSAGE ( STATUS "/usr/local/opt/gd/lib" )
423
+ set (GD_ROOT_DIR "/usr/local/opt/gd/lib" )
424
+ include_sub_directories_recursively (/usr/local/opt/gd/include )
425
+ endif ()
426
+ if (IS_DIRECTORY "/opt/homebrew/opt/gd/lib" )
427
+ MESSAGE ( STATUS "/opt/homebrew/opt/gd/lib" )
428
+ set (GD_ROOT_DIR "/opt/homebrew/opt/gd/lib" )
429
+ include_sub_directories_recursively (/opt/homebrew/opt/gd/include )
430
+ endif ()
375
431
else ()
376
432
set (GD_ROOT_DIR "${sys_so_path} " )
377
433
endif ()
@@ -393,7 +449,18 @@ endif()
393
449
message (STATUS "GD Graphics Library at: ${GD_LIB_DIR} " )
394
450
395
451
if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
396
- set (QR_ROOT_DIR "/usr/local/opt/qrencode/lib" )
452
+
453
+ if (IS_DIRECTORY "/usr/local/opt/qrencode/lib" )
454
+ MESSAGE ( STATUS "/usr/local/opt/qrencode/lib" )
455
+ set (QR_ROOT_DIR "/usr/local/opt/qrencode/lib" )
456
+ include_sub_directories_recursively (/usr/local/opt/qrencode/include )
457
+ endif ()
458
+ if (IS_DIRECTORY "/opt/homebrew/opt/qrencode/lib" )
459
+ MESSAGE ( STATUS "/opt/homebrew/opt/qrencode/lib" )
460
+ set (QR_ROOT_DIR "/opt/homebrew/opt/qrencode/lib" )
461
+ include_sub_directories_recursively (/opt/homebrew/opt/qrencode/include )
462
+ endif ()
463
+
397
464
else ()
398
465
set (QR_ROOT_DIR "${sys_so_path} " )
399
466
endif ()
@@ -422,7 +489,18 @@ target_link_libraries(paozhu ${GD_LIB_DIR})
422
489
target_link_libraries (paozhu ${QR_LIB_DIR} )
423
490
424
491
if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
425
- set (PNG_ROOT_DIR "/usr/local/opt/libpng/lib" )
492
+
493
+ if (IS_DIRECTORY "/usr/local/opt/libpng/lib" )
494
+ MESSAGE ( STATUS "/usr/local/opt/libpng/lib" )
495
+ set (PNG_ROOT_DIR "/usr/local/opt/libpng/lib" )
496
+ include_sub_directories_recursively (/usr/local/opt/libpng/include )
497
+ endif ()
498
+ if (IS_DIRECTORY "/opt/homebrew/opt/libpng/lib" )
499
+ MESSAGE ( STATUS "/opt/homebrew/opt/libpng/lib" )
500
+ set (PNG_ROOT_DIR "/opt/homebrew/opt/libpng/lib" )
501
+ include_sub_directories_recursively (/opt/homebrew/opt/libpng/include )
502
+ endif ()
503
+
426
504
else ()
427
505
set (PNG_ROOT_DIR "${sys_so_path} " )
428
506
endif ()
@@ -435,7 +513,18 @@ find_library(PNG_LIB_DIR
435
513
target_link_libraries (paozhu ${PNG_LIB_DIR} )
436
514
437
515
if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
438
- set (FREETYPE_ROOT_DIR "/usr/local/opt/freetype/lib" )
516
+
517
+ if (IS_DIRECTORY "/usr/local/opt/freetype/lib" )
518
+ MESSAGE ( STATUS "/usr/local/opt/freetype/lib" )
519
+ set (FREETYPE_ROOT_DIR "/usr/local/opt/freetype/lib" )
520
+ include_sub_directories_recursively (/usr/local/opt/freetype/include )
521
+ endif ()
522
+ if (IS_DIRECTORY "/opt/homebrew/opt/freetype/lib" )
523
+ MESSAGE ( STATUS "/opt/homebrew/opt/freetype/lib" )
524
+ set (FREETYPE_ROOT_DIR "/opt/homebrew/opt/freetype/lib" )
525
+ include_sub_directories_recursively (/opt/homebrew/opt/freetype/include )
526
+ endif ()
527
+
439
528
else ()
440
529
set (FREETYPE_ROOT_DIR "${sys_so_path} " )
441
530
endif ()
@@ -450,7 +539,15 @@ target_link_libraries(paozhu ${FREETYPE_LIB_DIR})
450
539
endif ()
451
540
452
541
if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
453
- set (BROTLI_ROOT_DIR "/usr/local/opt/brotli/lib" )
542
+ if (IS_DIRECTORY "/usr/local/opt/brotli/lib" )
543
+ set (BROTLI_ROOT_DIR "/usr/local/opt/brotli/lib" )
544
+ INCLUDE_DIRECTORIES ("/usr/local/opt/brotli/include" )
545
+ endif ()
546
+ # set(BROTLI_ROOT_DIR "/usr/local/opt/brotli/lib")
547
+ if (IS_DIRECTORY "/opt/homebrew/opt/brotli/lib" )
548
+ set (BROTLI_ROOT_DIR "/opt/homebrew/opt/brotli/lib" )
549
+ INCLUDE_DIRECTORIES ("/opt/homebrew/opt/brotli/include" )
550
+ endif ()
454
551
else ()
455
552
set (BROTLI_ROOT_DIR "${sys_so_path} " )
456
553
endif ()
0 commit comments