Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Arxcis

Pages: [1]
1
General / Re: CMake in SFML 2.5
« on: June 08, 2018, 11:49:04 am »
So far I have tried using add_subdirectory() to generate the SFMLCmake.config file, and then using find_package(). (This looks very hacky to me...)

add_subdirectory(${SRCDIR}/lib/SFML-2.5.0)
set(SFML_DIR ${BINDIR}/lib/SFML-2.5.0)
find_package (SFML 2.5 REQUIRED window graphics system)
 

Cmake runs fine and SFML builds, but i still get linker errors:

<me> in ~/Desktop/tutorial-sfmlcmake/build
$ make
BINDIR/Users/<me>/Desktop/tutorial-sfmlcmake/build
SRCDIR/Users/<me>/Desktop/tutorial-sfmlcmake
-- Found SFML 2.5.0 in /Users/<me>/Desktop/tutorial-sfmlcmake/build/lib/SFML-2.5.0
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/<me>/Desktop/tutorial-sfmlcmake/build
[ 13%] Built target sfml-system
[ 46%] Built target sfml-window
[ 72%] Built target sfml-graphics
[ 73%] Linking CXX executable tutorialsfml
Undefined symbols for architecture x86_64:
  "sf::String::String(char const*, std::locale const&)", referenced from:
      _main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [tutorialsfml] Error 1
make[1]: *** [CMakeFiles/tutorialsfml.dir/all] Error 2
make: *** [all] Error 2

 

2
General / Re: CMake in SFML 2.5
« on: June 08, 2018, 11:33:42 am »
When I turn off static build, building SFML works, but it is still a two step process. Like OP I want to be able to build SFML as part of my project in a single make call

Reiterating what OP said:
 "...my current workflow is to call CMake twice - once for SFML, and once for my project. I would like to be able to set up my project such that SFML appears as part of the resultant solution/etc."

3
General / Re: CMake in SFML 2.5
« on: June 08, 2018, 10:16:29 am »
I think I have a similar issue. I am trying to build SFML 2.5 statically on macOs in a single step,
together with the rest of my project.

This is how i want it to work.
git clone <myrepo>
mkdir build
cd build
cmake ..
make
./tutorialsfml
 


Here is the current output from my cmake ..
$ cmake ..
BINDIR /Users/<me>/Desktop/tutorial-sfmlcmake/build
SRCDIR /Users/<me>/Desktop/tutorial-sfmlcmake
CMake Error at build/lib/SFML-2.5.0/SFMLConfig.cmake:139 (message):
  Requested SFML configuration (Static) was not found
Call Stack (most recent call first):
  CMakeLists.txt:38 (find_package)


CMake Error at CMakeLists.txt:38 (find_package):
  Found package configuration file:

    /Users/<me>/Desktop/tutorial-sfmlcmake/build/lib/SFML-2.5.0/SFMLConfig.cmake

  but it set SFML_FOUND to FALSE so package "SFML" is considered to be NOT
  FOUND.


-- Configuring incomplete, errors occurred!
See also "/Users/<me>/Desktop/tutorial-sfmlcmake/build/CMakeFiles/CMakeOutput.log".
 

Here is my project CmakeLists.txt
#
# Relevant command line options
# Passed like this: "cmake .. -D<key1>=<value1> -D<key2>=<value2> ..."
#
# Key                 Value
# --------------------------------
# CMAKE_BUILD_TYPE    Debug | RelWithDebInfo | Release
# CMAKE_CXX_COMPILER  <path to compiler>
# CMAKE_CXX_STDLIB    <path to standardlib>
#
project(tutorialsfml)
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)

set(SRCDIR ${CMAKE_SOURCE_DIR})
set(BINDIR ${CMAKE_BINARY_DIR})

link_directories(${CMAKE_CXX_STDLIB}) # For clang 6.0 on macOs

message("BINDIR" ${BINDIR})
message("SRCDIR" ${SRCDIR})

#
# SFML
#
add_subdirectory(${SRCDIR}/lib/SFML-2.5.0)
set(SFML_DIR ${BINDIR}/lib/SFML-2.5.0)
set(CMAKE_FIND_FRAMEWORK "NEVER") # for macOs
set(SFML_STATIC_LIBRARIES TRUE)
find_package (SFML 2.5 REQUIRED graphics window system)

# Create target executeable
add_executable(tutorialsfml ${SRCDIR}/src/main.cpp)
target_link_libraries(
    tutorialsfml
    PRIVATE sfml-graphics sfml-window sfml-system)

 

Pages: [1]
anything