skaarj1989 / SupernovaEngine

An experimental game engine.
MIT License
135 stars 6 forks source link

Target "FileSystem" links to: minizip::minizip but the target was not found. #6

Closed Martinfx closed 2 weeks ago

Martinfx commented 2 weeks ago

Hi i have problem with cmake files. I ported your engine to FreeBSD. I found minizip pkg_check_modules(minizip minizip REQUIRED) but problem is about linking library


maxfx@hades ~/D/SupernovaEngine (master)> ls /usr/local/include/minizip
.  ..  crypt.h  ioapi.h  mztools.h  unzip.h  zip.h
maxfx@hades ~/D/SupernovaEngine (master)> ls /usr/local/lib/libminizip.a 
/usr/local/lib/libminizip.a

maxfx@hades ~/D/SupernovaEngine (master)> cmake -S . -B build
-- TOOLCHAIN: 
-- The C compiler identification is Clang 17.0.6
-- The CXX compiler identification is Clang 17.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found nlohmann_json: /usr/local/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.11.3")
Parsing public/common/TracyVersion.hpp file
VERSION 0.10.0
-- TRACY_ENABLE: ON
-- TRACY_ON_DEMAND: ON
-- TRACY_CALLSTACK: OFF
-- TRACY_NO_CALLSTACK: OFF
-- TRACY_NO_CALLSTACK_INLINES: OFF
-- TRACY_ONLY_LOCALHOST: OFF
-- TRACY_NO_BROADCAST: OFF
-- TRACY_ONLY_IPV4: OFF
-- TRACY_NO_CODE_TRANSFER: OFF
-- TRACY_NO_CONTEXT_SWITCH: OFF
-- TRACY_NO_EXIT: OFF
-- TRACY_NO_SAMPLING: OFF
-- TRACY_NO_VERIFY: OFF
-- TRACY_NO_VSYNC_CAPTURE: OFF
-- TRACY_NO_FRAME_IMAGE: OFF
-- TRACY_NO_SYSTEM_TRACING: OFF
-- TRACY_PATCHABLE_NOPSLEDS: OFF
-- TRACY_DELAYED_INIT: OFF
-- TRACY_MANUAL_LIFETIME: OFF
-- TRACY_FIBERS: OFF
-- TRACY_NO_CRASH_HANDLER: OFF
-- TRACY_TIMER_FALLBACK: OFF
-- Found ZLIB: /usr/lib/libz.so (found version "1.3.1")
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.2.0")
-- Checking for module 'minizip'
--   Found minizip, version 1.3.1
-- Found Freetype: /usr/local/lib/libfreetype.so (found version "2.13.2")
-- Found Freetype::Freetype - Freetype font engine enabled
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Vulkan: /usr/local/lib/libvulkan.so (found version "1.3.289") found components: glslc glslangValidator
-- VMA_BUILD_SAMPLE = OFF
-- VMA_BUILD_SAMPLE_SHADERS = OFF
-- VMA_STATIC_VULKAN_FUNCTIONS = ON
-- VMA_DYNAMIC_VULKAN_FUNCTIONS = OFF
-- VMA_DEBUG_ALWAYS_DEDICATED_MEMORY = OFF
-- VMA_DEBUG_INITIALIZE_ALLOCATIONS = OFF
-- VMA_DEBUG_GLOBAL_MUTEX = OFF
-- VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT = OFF
-- Performing Test W_IGNORED_ATTRIBUTES
-- Performing Test W_IGNORED_ATTRIBUTES - Success
-- Performing Test W_98_COMPAT_PEDANTIC
-- Performing Test W_98_COMPAT_PEDANTIC - Success
-- Performing Test W_UNUSED_RESULT
-- Performing Test W_UNUSED_RESULT - Success
-- Performing Test W_NULL_DEREFERENCE
-- Performing Test W_NULL_DEREFERENCE - Success
-- Performing Test W_PRAGMA_PACK
-- Performing Test W_PRAGMA_PACK - Success
-- ---------------------------------------------------------
-- Default build type is: 
-- The following compilation flags will be used:
CMAKE_CXX_FLAGS 
CMAKE_C_FLAGS 
CMAKE_CXX_FLAGS_DEBUG -g -D_DEBUG
CMAKE_C_FLAGS_DEBUG -g
CMAKE_CXX_FLAGS_MINSIZEREL -Os -DNDEBUG
CMAKE_C_FLAGS_MINSIZEREL -Os -DNDEBUG
CMAKE_CXX_FLAGS_RELWITHDEBINFO -O2 -g -DNDEBUG
CMAKE_C_FLAGS_RELWITHDEBINFO -O2 -g -DNDEBUG
CMAKE_CXX_FLAGS_RELEASE -O3 -DNDEBUG
CMAKE_C_FLAGS_RELEASE -O3 -DNDEBUG
-- ---------------------------------------------------------
-- Directory Compile Options:
-- -Wall
-- -Werror
-- -Wno-ignored-attributes
-- -Wno-c++98-compat-pedantic
-- ---------------------------------------------------------
-- Directory Compile Definitions:
-- ---------------------------------------------------------
Optional program clang-format not found.
-- ---------------------------------------------------------
-- Selected options:
-- - BUILD_SHARED_LIBS: OFF
-- - ozz_build_tools: OFF
-- - ozz_build_fbx: OFF
-- - ozz_build_gltf: OFF
-- - ozz_build_data: OFF
-- - ozz_build_samples: OFF
-- - ozz_build_howtos: OFF
-- - ozz_build_tests: OFF
-- - ozz_build_simd_ref: OFF
-- - ozz_build_msvc_rt_dll: OFF
-- - ozz_build_postfix: ON
-- Found Lua: /usr/local/lib/liblua-5.1.so;/usr/lib/libm.so (found suitable exact version "5.1.5")
5.1.5 /usr/local/include/lua51 /usr/local/lib/liblua-5.1.so/usr/lib/libm.so
-- Shared libraries disabled
-- Looking for ZLIB...
-- Checking for module 'zzip-zlib-config'
--   Package 'zzip-zlib-config' not found
-- Found ZLIB: optimized;/usr/lib/libz.a;debug;/usr/lib/libz.a
-- Checking for module 'minizip'
--   Found minizip, version 1.3.1
-- tinyusdz disabled
-- Enabled importer formats: AMF 3DS AC ASE ASSBIN B3D BVH COLLADA DXF CSM HMP IRRMESH IQM IRR LWO LWS M3D MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD
-- Disabled importer formats: USD
-- Enabled exporter formats:
-- Disabled exporter formats: OBJ OPENGEX PLY 3DS ASSBIN ASSXML M3D COLLADA FBX STL X X3D GLTF 3MF PBRT ASSJSON STEP
-- Found Boost: /usr/local/include (found version "1.84.0") found components: graph
-- Configuring done (107.0s)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/home/maxfx/Documents/SupernovaEngine/modules/ImageLoader/stb/STB_INCLUDE_DIRS
   used as include directory in directory /home/maxfx/Documents/SupernovaEngine/modules/ImageLoader/stb

CMake Error: Cannot determine link language for target "Platform".
CMake Error: CMake can not determine linker language for target: Platform
CMake Error at modules/OS/FileSystem/CMakeLists.txt:35 (target_link_libraries):
  Target "FileSystem" links to:

    minizip::minizip

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

CMake Error at modules/Audio/AudioDevice/modules/VorbisDecoder/CMakeLists.txt:19 (target_link_libraries):
  Target "VorbisDecoder" links to:

    Ogg::ogg

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

My changes in CMakefiles for minizip


find_package(ZLIB REQUIRED)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
        find_package(unofficial-minizip CONFIG REQUIRED)
else()
        include(FindPkgConfig)
        pkg_check_modules(minizip minizip REQUIRED)
endif()

add_library(FileSystem
  "include/os/FileSystem.hpp"
  "src/FileSystem.cpp"

  "include/os/DataStream.hpp"
  "src/MemoryFile.hpp"
  "src/MemoryFile.cpp"
  "src/File.cpp"
  "src/File.hpp"

  "include/os/ZipArchive.hpp"
  "src/ZipArchive.cpp"
  "src/InZipFile.hpp"
  "src/InZipFile.cpp"

  "include/os/Serialization.hpp"
)
target_include_directories(FileSystem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
        target_link_libraries(FileSystem
        PRIVATE unofficial::minizip::minizip
        PUBLIC StringUtility
        )

else()
        target_link_libraries(FileSystem
        PRIVATE minizip::minizip
        PUBLIC StringUtility
        )

endif()

set_target_properties(FileSystem PROPERTIES FOLDER "Framework/OS")
set_warning_level(FileSystem)

enable_profiler(FileSystem PRIVATE)
Martinfx commented 2 weeks ago

i fixed these problem with cmake