From 786b291d9c6b784c7ce6ceef0e38a4ec76ea14db Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 6 Apr 2022 16:32:52 +0200 Subject: Move CMake files to modernized cmake syntax, step 1. Change projects to cmake targetsto get rid of havig to hardcore include directories and link libraries in consumer projects. --- indra/cmake/LLPrimitive.cmake | 66 +++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 37 deletions(-) (limited to 'indra/cmake/LLPrimitive.cmake') diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 4e34951215..799afc77d1 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -4,49 +4,41 @@ include(Prebuilt) include(Boost) +if( TARGET colladadom::colladadom ) + return() +endif() + use_prebuilt_binary(colladadom) use_prebuilt_binary(minizip-ng) # needed for colladadom use_prebuilt_binary(pcre) use_prebuilt_binary(libxml2) -set(LLPRIMITIVE_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/llprimitive - ) +create_target( pcre::pcre ) +set_target_libraries( pcre::pcre pcrecpp pcre ) + +create_target( minizip-ng::minizip-ng ) if (WINDOWS) - set(LLPRIMITIVE_LIBRARIES - debug llprimitive - optimized llprimitive - debug libcollada14dom23-sd - optimized libcollada14dom23-s - libxml2_a - debug pcrecppd - optimized pcrecpp - debug pcred - optimized pcre - debug libminizip - optimized libminizip - ${BOOST_SYSTEM_LIBRARIES} + set_target_libraries( minizip-ng::minizip-ng libminizip ) +else() + set_target_libraries( minizip-ng::minizip-ng minizip ) +endif() + +create_target( libxml::libxml ) +if (WINDOWS) + set_target_libraries( libxml::libxml libxml2_a) +else() + set_target_libraries( libxml::libxml xml2) +endif() + +create_target( colladadom::colladadom ) +set_target_include_dirs( colladadom::colladadom + ${LIBS_PREBUILT_DIR}/include/collada + ${LIBS_PREBUILT_DIR}/include/collada/1.4 ) +if (WINDOWS) + set_target_libraries(colladadom::colladadom libcollada14dom23-s libxml::libxml minizip-ng::minizip-ng ) elseif (DARWIN) - set(LLPRIMITIVE_LIBRARIES - llprimitive - debug collada14dom-d - optimized collada14dom - minizip # for collada libminizip.a - xml2 - pcrecpp - pcre - iconv # Required by libxml2 - ) + set_target_libraries(colladadom::colladadom collada14dom libxml::libxml minizip-ng::minizip-ng) elseif (LINUX) - set(LLPRIMITIVE_LIBRARIES - llprimitive - debug collada14dom-d - optimized collada14dom - minizip - xml2 - pcrecpp - pcre - ) -endif (WINDOWS) - + set_target_libraries(colladadom::colladadom collada14dom libxml::libxml minizip-ng::minizip-ng) +endif() \ No newline at end of file -- cgit v1.2.3 From 241919e7f7986c11586a49bff53cf19c2c0e0ea6 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 13 Apr 2022 19:21:55 +0200 Subject: Rework cmake, the original plan was to maybe be able to use conan targets with the same name (that's why 3ps had names like apr::apr), but it's safer and saner to put the LL 3ps under the ll:: prefix. This also allows means it is possible to get rid of that bad "if( TRAGET ...) return() endif()" pattern and rather use include_guard(). --- indra/cmake/LLPrimitive.cmake | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'indra/cmake/LLPrimitive.cmake') diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 799afc77d1..0f0e2d3bbf 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -4,41 +4,39 @@ include(Prebuilt) include(Boost) -if( TARGET colladadom::colladadom ) - return() -endif() +include_guard() use_prebuilt_binary(colladadom) use_prebuilt_binary(minizip-ng) # needed for colladadom use_prebuilt_binary(pcre) use_prebuilt_binary(libxml2) -create_target( pcre::pcre ) -set_target_libraries( pcre::pcre pcrecpp pcre ) +create_target( ll::pcre ) +set_target_libraries( ll::pcre pcrecpp pcre ) -create_target( minizip-ng::minizip-ng ) +create_target( ll::minizip-ng ) if (WINDOWS) - set_target_libraries( minizip-ng::minizip-ng libminizip ) + set_target_libraries( ll::minizip-ng libminizip ) else() - set_target_libraries( minizip-ng::minizip-ng minizip ) + set_target_libraries( ll::minizip-ng minizip ) endif() -create_target( libxml::libxml ) +create_target( ll::libxml ) if (WINDOWS) - set_target_libraries( libxml::libxml libxml2_a) + set_target_libraries( ll::libxml libxml2_a) else() - set_target_libraries( libxml::libxml xml2) + set_target_libraries( ll::libxml xml2) endif() -create_target( colladadom::colladadom ) -set_target_include_dirs( colladadom::colladadom +create_target( ll::colladadom ) +set_target_include_dirs( ll::colladadom ${LIBS_PREBUILT_DIR}/include/collada ${LIBS_PREBUILT_DIR}/include/collada/1.4 ) if (WINDOWS) - set_target_libraries(colladadom::colladadom libcollada14dom23-s libxml::libxml minizip-ng::minizip-ng ) + set_target_libraries(ll::colladadom libcollada14dom23-s ll::libxml ll::minizip-ng ) elseif (DARWIN) - set_target_libraries(colladadom::colladadom collada14dom libxml::libxml minizip-ng::minizip-ng) + set_target_libraries(ll::colladadom collada14dom ll::libxml ll::minizip-ng) elseif (LINUX) - set_target_libraries(colladadom::colladadom collada14dom libxml::libxml minizip-ng::minizip-ng) + set_target_libraries(ll::colladadom collada14dom ll::libxml ll::minizip-ng) endif() \ No newline at end of file -- cgit v1.2.3 From 6d0bba9c03da0d8aca5e88fcb9289cb2f89f3467 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 17:32:14 +0200 Subject: Switch over to standard target_link_libraries (cmake requirements are high enough now). --- indra/cmake/LLPrimitive.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/cmake/LLPrimitive.cmake') diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 0f0e2d3bbf..adb252b8ee 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -12,20 +12,20 @@ use_prebuilt_binary(pcre) use_prebuilt_binary(libxml2) create_target( ll::pcre ) -set_target_libraries( ll::pcre pcrecpp pcre ) +target_link_libraries( ll::pcre INTERFACE pcrecpp pcre ) create_target( ll::minizip-ng ) if (WINDOWS) - set_target_libraries( ll::minizip-ng libminizip ) + target_link_libraries( ll::minizip-ng INTERFACE libminizip ) else() - set_target_libraries( ll::minizip-ng minizip ) + target_link_libraries( ll::minizip-ng INTERFACE minizip ) endif() create_target( ll::libxml ) if (WINDOWS) - set_target_libraries( ll::libxml libxml2_a) + target_link_libraries( ll::libxml INTERFACE libxml2_a) else() - set_target_libraries( ll::libxml xml2) + target_link_libraries( ll::libxml INTERFACE xml2) endif() create_target( ll::colladadom ) @@ -34,9 +34,9 @@ set_target_include_dirs( ll::colladadom ${LIBS_PREBUILT_DIR}/include/collada/1.4 ) if (WINDOWS) - set_target_libraries(ll::colladadom libcollada14dom23-s ll::libxml ll::minizip-ng ) + target_link_libraries(ll::colladadom INTERFACE libcollada14dom23-s ll::libxml ll::minizip-ng ) elseif (DARWIN) - set_target_libraries(ll::colladadom collada14dom ll::libxml ll::minizip-ng) + target_link_libraries(ll::colladadom INTERFACE collada14dom ll::libxml ll::minizip-ng) elseif (LINUX) - set_target_libraries(ll::colladadom collada14dom ll::libxml ll::minizip-ng) + target_link_libraries(ll::colladadom INTERFACE collada14dom ll::libxml ll::minizip-ng) endif() \ No newline at end of file -- cgit v1.2.3 From e0cf0cdfd49e5a946dcd202a083fb23f01e4f1fe Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 18:04:57 +0200 Subject: Switch to target_include_directories All 3Ps include dirs are treated as SYSTEM, this will stop compilers stop emitting warnings from those files and greatly helps having high warning levels and not being swamped by warnings that come from external libraries. --- indra/cmake/LLPrimitive.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/LLPrimitive.cmake') diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index adb252b8ee..0026f183e6 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -29,7 +29,7 @@ else() endif() create_target( ll::colladadom ) -set_target_include_dirs( ll::colladadom +target_include_directories( ll::colladadom SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/collada ${LIBS_PREBUILT_DIR}/include/collada/1.4 ) -- cgit v1.2.3 From 363f2df4fa22b3eb95ff4603d73b7a042f3fefd1 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 18:28:55 +0200 Subject: Remove function create_target and instead directly use add_library --- indra/cmake/LLPrimitive.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/cmake/LLPrimitive.cmake') diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 0026f183e6..e643243fca 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -11,24 +11,24 @@ use_prebuilt_binary(minizip-ng) # needed for colladadom use_prebuilt_binary(pcre) use_prebuilt_binary(libxml2) -create_target( ll::pcre ) +add_library( ll::pcre INTERFACE IMPORTED ) target_link_libraries( ll::pcre INTERFACE pcrecpp pcre ) -create_target( ll::minizip-ng ) +add_library( ll::minizip-ng INTERFACE IMPORTED ) if (WINDOWS) target_link_libraries( ll::minizip-ng INTERFACE libminizip ) else() target_link_libraries( ll::minizip-ng INTERFACE minizip ) endif() -create_target( ll::libxml ) +add_library( ll::libxml INTERFACE IMPORTED ) if (WINDOWS) target_link_libraries( ll::libxml INTERFACE libxml2_a) else() target_link_libraries( ll::libxml INTERFACE xml2) endif() -create_target( ll::colladadom ) +add_library( ll::colladadom INTERFACE IMPORTED ) target_include_directories( ll::colladadom SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/collada ${LIBS_PREBUILT_DIR}/include/collada/1.4 -- cgit v1.2.3 From 2b151e0aefd54671e1be504269f10318d303dccb Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 18 Apr 2022 18:11:43 +0200 Subject: Round one to support conan for 3P packages, this allows to build the viewer on Linux again. --- indra/cmake/LLPrimitive.cmake | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'indra/cmake/LLPrimitive.cmake') diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index e643243fca..3e5ff4963b 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -6,29 +6,39 @@ include(Boost) include_guard() +add_library( ll::pcre INTERFACE IMPORTED ) +add_library( ll::minizip-ng INTERFACE IMPORTED ) +add_library( ll::libxml INTERFACE IMPORTED ) +add_library( ll::colladadom INTERFACE IMPORTED ) + +# ND, needs fixup in collada conan pkg +if( USE_CONAN ) + target_include_directories( ll::colladadom SYSTEM INTERFACE + "${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/" + "${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/1.4/" ) +endif() + +use_conan_binary( colladadom ) + use_prebuilt_binary(colladadom) use_prebuilt_binary(minizip-ng) # needed for colladadom use_prebuilt_binary(pcre) use_prebuilt_binary(libxml2) -add_library( ll::pcre INTERFACE IMPORTED ) target_link_libraries( ll::pcre INTERFACE pcrecpp pcre ) -add_library( ll::minizip-ng INTERFACE IMPORTED ) if (WINDOWS) target_link_libraries( ll::minizip-ng INTERFACE libminizip ) else() target_link_libraries( ll::minizip-ng INTERFACE minizip ) endif() -add_library( ll::libxml INTERFACE IMPORTED ) if (WINDOWS) target_link_libraries( ll::libxml INTERFACE libxml2_a) else() target_link_libraries( ll::libxml INTERFACE xml2) endif() -add_library( ll::colladadom INTERFACE IMPORTED ) target_include_directories( ll::colladadom SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/collada ${LIBS_PREBUILT_DIR}/include/collada/1.4 @@ -39,4 +49,4 @@ elseif (DARWIN) target_link_libraries(ll::colladadom INTERFACE collada14dom ll::libxml ll::minizip-ng) elseif (LINUX) target_link_libraries(ll::colladadom INTERFACE collada14dom ll::libxml ll::minizip-ng) -endif() \ No newline at end of file +endif() -- cgit v1.2.3 From 3f31d0b5a70af4ebf746d40d478b4e948e904a87 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Jul 2022 17:51:25 +0200 Subject: Be more explicit: Rename use_conan_binary to use_system_binary, this will allow us to reuse the macro for more than just conan. --- indra/cmake/LLPrimitive.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/LLPrimitive.cmake') diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 3e5ff4963b..04afe5e405 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -18,7 +18,7 @@ if( USE_CONAN ) "${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/1.4/" ) endif() -use_conan_binary( colladadom ) +use_system_binary( colladadom ) use_prebuilt_binary(colladadom) use_prebuilt_binary(minizip-ng) # needed for colladadom -- cgit v1.2.3 From c7366f4c55c6442414eb6c5a6736baf90f1a4700 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 17 Sep 2022 02:09:04 +0300 Subject: SL-17238 Fix coding policy build issues --- indra/cmake/LLPrimitive.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/cmake/LLPrimitive.cmake') diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 04afe5e405..3d8499cbc3 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -14,8 +14,8 @@ add_library( ll::colladadom INTERFACE IMPORTED ) # ND, needs fixup in collada conan pkg if( USE_CONAN ) target_include_directories( ll::colladadom SYSTEM INTERFACE - "${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/" - "${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/1.4/" ) + "${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/" + "${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/1.4/" ) endif() use_system_binary( colladadom ) -- cgit v1.2.3