Skip to content

Commit

Permalink
build system tweaks (#1275)
Browse files Browse the repository at this point in the history
- use WXWIN environment variable directly so callers do not need to set wxWdgets_PREFIX_DIRECTORY
   when invoking cmake
 - Windows: use the Visual Studio 17 generator by default (so callers do not need to specify it)
 - Remove INDI as an explicit dependency of the phd2 executable CMake target. This will
   speed up the incremental edit-compile-test cycle a little bit, but developers
   will have to build INDI once before building the phd2 target specifically. In Visual Studio
   this means building the whole solution once before building the phd2 project.
  • Loading branch information
agalasso authored Dec 31, 2024
1 parent c10142d commit a671685
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ if(APPLE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
endif()

if(WINDOWS)
set(CMAKE_GENERATOR "Visual Studio 17" CACHE STRING INTERNAL "" FORCE)
endif()

enable_language(C CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -57,7 +61,6 @@ if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()


# root directory of the project
set(PHD_PROJECT_ROOT_DIR ${CMAKE_SOURCE_DIR})
set(phd_src_dir ${PHD_PROJECT_ROOT_DIR}/src)
Expand Down
2 changes: 1 addition & 1 deletion build/build-win
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ mkdir -p tmp
cd tmp

cat >run_cmake.bat <<EOF
"$CMAKE_W" -Wno-dev -G "Visual Studio 17" -A Win32 ${vcpkg_args[@]} "-DwxWidgets_PREFIX_DIRECTORY=%WXWIN%" ..
"$CMAKE_W" -Wno-dev -A Win32 "${vcpkg_args[@]}" ..
EOF
"$CMD" /c run_cmake.bat

Expand Down
1 change: 0 additions & 1 deletion run_cmake-osx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ mkdir -p "$tmp"
cd "$tmp"

cmake -G "Unix Makefiles" \
-DwxWidgets_PREFIX_DIRECTORY="$WXWIN" \
-DCMAKE_OSX_ARCHITECTURES="$APPLE_ARCH" \
-DCMAKE_BUILD_TYPE="$buildtype" \
"${cmake_extra_args[@]}" \
Expand Down
2 changes: 1 addition & 1 deletion run_cmake.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@mkdir tmp
@cd tmp
cmake -Wno-dev -G "Visual Studio 17" -A Win32 "-DwxWidgets_PREFIX_DIRECTORY=%WXWIN%" ..
cmake -Wno-dev -A Win32 ..
@cd ..
7 changes: 6 additions & 1 deletion thirdparty/thirdparty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ endif()
# version >= 3.0, a version of cmake >= 3.0 should be used on Windows
# on Linux/OSX it works properly this way).

set(wxWidgets_PREFIX_DIRECTORY $ENV{WXWIN} CACHE PATH "wxWidgets directory")

if(WIN32)
# wxWidgets
set(wxWidgets_CONFIGURATION msw CACHE STRING "Set wxWidgets configuration")
Expand Down Expand Up @@ -644,7 +646,10 @@ else()
## Define LIBNOVA when building Indi from source.
add_definitions("-DLIBNOVA")
endif()
list(APPEND PHD_EXTERNAL_PROJECT_DEPENDENCIES indi)
# adding indi as a dependency allows a developer to build phd2 in
# the IDE without explicitly building anything else first, but this
# slows down incremental development
# list(APPEND PHD_EXTERNAL_PROJECT_DEPENDENCIES indi)
endif()


Expand Down

0 comments on commit a671685

Please sign in to comment.